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

struct node
{
    int l;int r;
}a[100005];

int cmp(node a,node b)
{
    return a.r<b.r;
}
int main()
{
    int n;
    scanf("%d", &n);
    int a1,b1;
    for(int i=0;i<n;i++)
    {
        cin>>a1>>b1;
        a[i].l=a1-b1;a[i].r=a1+b1;
    }
    sort(a,a+n,cmp);
    int cnt=0;int t=-0x3f3f3f3f;
    for(int i=0;i<n;i++)
    {
        if(t<=a[i].l)
        {
            cnt++;
            t=a[i].r;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main(void)
{
	int N;
	int count = 1;
	cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H.at(i);
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < i; j++) {
			if (H.at(i) < H.at(j)){
				break;
			}
			if (j == i - 1) {
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll K;

ll digit(ll n){
    ll res = 0;
    while(n / 10 != 0){
        res++;
        n /= 10;
    }
    return res;
}

double sunuke(ll n){
    ll N = n;
    ll sum = 0;
    while(n != 0){
        sum += n % 10;
        n /= 10;
    }
    return (double)N/(double)sum;
}

ll f(ll N){
    ll d = digit(N)+3;
    ll m = N;
    rep(i,d+1){
        ll c = pow(10,i+1)*(N/pow(10,i+1)+1)-1;
        if (sunuke(c) < sunuke(m)) m = c;
    }
    return m;
}

int main() {
    cin >> K;
    ll N = 1;
    cout << 1 << endl;
    repi(i,1,K){
        cout << f(N+1) << endl;
        N = f(N+1);
    }
    return 0;
}


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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    map<ll, ll> mp;
    set<ll> st;
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
        st.insert(a[i]);
    }

    ll sum = 0;
    for(ll i :st){
        ll k = mp[i];
        sum += k * (k-1) /2;
    }

    for(int i = 0; i < n; i++){
        ll k = mp[a[i]];
        ll ans = sum - k * (k-1)/2 + (k-1) * (k-2) /2;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007
ll fact[50];
#define eps 1e-9
#define INF 1e18
ll power(ll a,ll b,ll c){
  ll ans=1;
  while(b){
    if(b&1){
      ans=ans*a%c;
    }
    a=a*a%c;
    b=b/2;
  }
  return ans;
}
ll ncr(ll n,ll r){
    if(r>n)return 0;
    if(r==n)return 1;
    ll z=fact[n];
    z=z*power(fact[r],mod-2,mod)%mod;
    z=z*power(fact[n-r],mod-2,mod)%mod;
    return z;
}
ll min(ll a,ll b){return a<b?a:b;}
ll max(ll a,ll b){return a>b?a:b;}
int main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int n; cin>>n;
        vector<int> v[n+1];
        for(int i=2;i<=n;++i){
            int x; cin>>x;
            v[x].push_back(i);
        }
        for(int i=1;i<=n;++i){
            cout<<v[i].size()<<endl;
        }
        
        return 0;
}


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

int main()
{

        ll n;
        cin>>n;
        ll sum=0;
        --n;
        for(ll i=1; i<=n; i++)
            sum+=(n/i);

            cout<<sum<<endl;

    return 0;

}



Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

int main()
{
    int N;
    while(cin>>N){
        map<int,int> m;
        int num;
        int sum=0;
        for(int i=0;i<N;i++){
            cin>>num;
            if(m[num]==0){
                sum++;
                m[num]=1;
            }
            else if(m[num]==1){
                sum--;
                m[num]=0;
            }
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main(){
 
    long long k;
    cin>>k;
    if(k%2 == 0 || k%5 == 0){
        cout<<"-1\n";
    }
    else{
        long long p = 7%k;
        int cnt = 1;
        while(p != 0){
            p = (p*10+7)%k;
            ++cnt;
        }
 
        cout<<cnt<<"\n";
    }
 
}


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

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define rep1(a, b, c)  for(int a = (b); a < (c); ++a)
#define each(a, b)     for(auto& a : b)

#define sz(x)       (int)(x).size()
#define all(a)      (a).begin(),(a).end()

#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define dbg(x) cout << #x << " = " << x << endl;
#define vt vector
#define pii pair<int, int>
#define pll pair<ll, ll>
#define bitcnt(x) __builtin_popcount(x)

using ll = long long;

const int inf = (int)1e9 + 5;
const ll infl = (ll)1e18 + 5;
const int mod = 1e9 + 7;
const int nax = 1e5 + 10;
int link[nax], xt[nax];

int find(int x){
	if(link[x] == x) return x;
	return link[x] = find(link[x]);
}

void join(int a, int b){
	a = find(a);
	b = find(b);
	xt[a] += xt[b];
	link[b] = a;
}



void solve(){
	int n, m; cin >> n >> m;
	rep1(i, 1, n+1) link[i] = i, xt[i] = 1;
	rep(i, m){
		int u, v;
		cin >> u >> v;
		join(u, v);
	}
	set<int> s;
	rep1(i, 1, n+1){
		s.insert(find(i));
	}
	int ans = sz(s); ans -= 1;
	cout << ans << '\n';
}


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

Measured memory_bytes: 8180
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		final int CAKE = 4;
		final int DONUT = 7;

		while (sc.hasNext()) {
			int budget = sc.nextInt();
			boolean flag = false;

			for (int i=0; i*CAKE<=budget; i++) {
				for (int j=0; i*CAKE+j*DONUT<=budget; j++) {
					if (i*CAKE+j*DONUT == budget) {
						flag = true;
					}
				}
			}
			if (flag) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

}


Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)

int main(){
  ll N, Q;
  string S;
  scanf("%lld %lld", &N, &Q);
  cin >> S;
  ll questions[Q][2];
  rep(i, Q) cin >> questions[i][0] >> questions[i][1];

  vector<ll> ac_idx;
  rep(i, N-1) if(S[i] == 'A' && S[i+1] == 'C') ac_idx.push_back(i);
  rep(i, Q){
    vector<ll>::iterator l, r;
    l = lower_bound(ac_idx.begin(), ac_idx.end(), questions[i][0]-1);
    r = lower_bound(ac_idx.begin(), ac_idx.end(), questions[i][1]-1);
    cout << (r - l) << endl;
  }

  return 0;
}


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

int main(){
  int i,j;ll cnt=0;
  ll n;
  ll a[5];
  cin>>n;
  for(i=0;i<5;i++)cin>>a[i];
  ll mi=LLONG_MAX;
  for(i=0;i<5;i++)mi=min(a[i],mi);
  cout<<4+(n+mi-1)/mi;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


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

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int A, B, C;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> A >> B >> C;

  if (A + B >= C) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

struct node {
  bool seen;
  vector<ll> next;
};

void solve(map<pair<ll, ll>, ll> &ans, vector<struct node> &g, ll cur, ll parent) {
  g[cur].seen = true;

  ll c = 0;
  for (auto i : g[cur].next) {
    if (g[i].seen) continue;
    
    c++;
    if (parent == c) c++;

    ans[pair<ll, ll>(cur, i)] = c;
    solve(ans, g, i, c);
  }
}

int main() {
  ll n;
  cin >> n;

  vector<pair<ll, ll>> keys;
  vector<struct node> g(n, node{.seen = false});

  for (ll i = 0; i < n-1; ++i) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].next.push_back(b);
    g[b].next.push_back(a);
    keys.push_back(pair<ll, ll>(a, b));
  }

  map<pair<ll, ll>, ll> ans;
  solve(ans, g, 0, 0);

  ll num = 0;
  for (auto itr = ans.begin(); itr != ans.end(); ++itr) {
    num = max(itr->second, num);
  }

  cout << num << endl;
  for (ll i = 0; i < n-1; ++i) {
    pair<ll, ll> k = keys[i];
    auto itr = ans.find(pair<ll, ll>(k.first, k.second));
    cout << itr->second << endl;
  }

  return 0;
}

Measured memory_bytes: 15088
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<string>
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<queue>
#include<set>
//#define IORD
#define eps 1e-8
#define inf 0x3f3f3f3f
#define mod (1000000007)

using namespace std;
typedef long long LL;
typedef pair<int,int> pp;

int n;

void Sol()
{
    if(n<1200) printf("ABC\n");
    else if(1200<=n && n<2800) printf("ARC\n");
    else printf("AGC\n");
}
int main()
{

    #ifdef IORD
    freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif // IORD

    while(scanf("%d",&n)!=EOF) Sol();
    return 0;
}



Measured memory_bytes: 384
N, M = map(int, input().split())
ans = N*M

# N,Mどちらかが1の時はとりあえず考えない
if N == 1 and M == 1:
  ans = 1
elif N == 1 or M == 1:
  ans -= 2 
else:
  # 四隅,境界線は正なので引く
  ans -= (N*2 + M*2 - 4)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, ss, ee) for (int i = (ss); i < (ee); ++i)

void solve() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  if (a <= k) {
    ans += a;
    k -= a;
  } else {
    ans += k;
    k = 0;
  }
  if (b <= k) {
    k -= b;
  } else {
    k = 0;
  }
  if (c <= k) {
    ans -= c;
    k -= c ;
  } else {
    ans -= k;
    k = 0;
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
    long long n, a[100001];
    cin >> n;
    
    for(long long i = 1; i <= n; i++){
        cin >> a[i];
    }
    a[0] = 0;

    long long distance = 0;


    for(long long i = 0; i <= n; i++){
        if(i == n){
            distance = distance + abs(a[0] - a[i]);
        }
        else{
            distance = distance + abs(a[i+1] - a[i]);
        }
    }

    //printf("distance %lld\n", distance);

    long long cancel[100001];

    for(long long i = 1; i <= n; i++){
        if(i == n){
            cancel[i] = distance - (abs(a[i] - a[i-1]) + abs(a[0] - a[i])) + abs(a[0] - a[i-1]);
        }
        cancel[i] = distance - (abs(a[i] - a[i-1]) + abs(a[i+1] - a[i])) + abs(a[i+1] - a[i-1]);
    }

    for(long long i = 1; i <= n; i++){
        printf("%lld\n", cancel[i]);
    }

    return 0;


}

Measured memory_bytes: 5236
#include <cstdio>
#include <cmath>
#include <iostream>

using namespace std;

int main(){
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    printf("%.8f\n",sqrt((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2)));
    return 0;
}

Measured memory_bytes: 1236
#include <cstdio>
#include<iostream>
#include<cmath>
typedef long long ll;
const ll INF=1e10;

using namespace std;
int main() {
	int n,x;
	cin>>n;
	ll mx=-INF,mn=INF;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(x>mx)	mx=x;
		if(x<mn)	mn=x;
	}
	cout<<mx-mn<<endl;
	return 0;
}





Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

	if (b - a <= 0)cout << "delicious" << endl;
	else if (b - a <= x)cout << "safe" << endl;
	else cout << "dangerous" << endl;

	return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int X, Y, Z, K;
ll A[1005], B[1005], C[1005];
vector <ll> AB, ans;

int main(){
  cin >> X >> Y >> Z >> K;
  for (int i = 0; i < X; i++) cin >> A[i];
  for (int i = 0; i < Y; i++) cin >> B[i];
  for (int i = 0; i < Z; i++) cin >> C[i];

  for (int i = 0; i < X; i++){
    for (int j = 0; j < Y; j++){
      AB.push_back(A[i] + B[j]);
    }
  }
  sort(AB.begin(), AB.end(), greater<ll>());
  int N = AB.size();

  for (int i = 0; i < min(N, K); i++){
    for (int j = 0; j < Z; j++){
      ans.push_back(AB[i] + C[j]);
    }
  }
  sort(ans.begin(), ans.end(), greater<ll>());

  for (int i = 0; i < K; i++) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 44060
#include<iostream>

int main()
{
	int res =0;
	int N;
	std::cin >> N;
	
	for (int i = 1; i <=N; i = i+2)
	{
		int k = 0;
		for (int j = 1; j <= i; j++)
		{
			if (i%j == 0)
				k++;
		}
		if (k == 8)
			res++;
	}
	std::cout << res << std::endl;
	return 0;

}

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

const int maxn = 1e5 + 10;
int tmp, cnt, res = 0, belong[maxn];
vector<int> G[maxn], scc[maxn], one;
bool vis[maxn];
int a [maxn];

void dfs(int u)
{
    vis[u] = true;
    belong[u] = res;
    tmp ++;
    scc[res].push_back(a[u]);
    for(int i = 0; i < G[u].size(); i ++)
        if(!vis[G[u][i]])
            dfs(G[u][i]);
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i ++)
        scanf("%d", &a[i]);
    for(int i = 0; i < m; i ++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
        G[y].push_back(x);
    }

    for(int i = 0; i < n; i ++) {
        if(!vis[i]) {
            tmp = 0;
            res ++;
            dfs(i);
            if(tmp == 1)
                cnt ++, one.push_back(res);
        }
    }

    if(res == 1)
        return !printf("0");
    else {
        LL sum = 0;
        for(int i = 1; i <= res; i ++ )
            sort(scc[i].begin(), scc[i].end());
        vector<int> v;
        v.clear();
        for(int i = 1; i <= res; i ++) {
            sum += (LL) scc[i][0];
            for(int j = 1; j < scc[i].size(); j ++)
                v.push_back(scc[i][j]);
        }
        sort(v.begin(), v.end());
        if(v.size() < res - 2)
            return !printf("Impossible\n");
        for(int i = 0; i < res - 2; i ++)
            sum += (LL) v[i];
        printf("%lld\n", sum);
    }
    return 0;
}


Measured memory_bytes: 10236
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> h(n);
    REP(i, n) {
        cin >> h[i];
    }
    vector<vector<ll>> mat(n, vector<ll>(1,0));
    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        mat[a-1].push_back(h[b-1]);
        mat[b-1].push_back(h[a-1]);
    }

    // REP(i, n) {
    //     REP(j, mat[i].size()) {
    //         cout << mat[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    ll ans = 0;
    REP(i, n) {
        sort(mat[i].rbegin(),mat[i].rend());
        if(h[i] > mat[i][0]){
            ans += 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11704
#include<stdio.h>

int main(){
	int N;
	scanf("%d", &N);
	
	int money, change;
	
	for(int i = money; i * 1000 < N; i++){
		money++;
	}
	
	change = (money * 1000) - N;
	
	printf("%d\n", change);
	return 0;
}

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

int main() {
    int A,B,M;
    cin>>A>>B>>M;
    vector<int> a(A,0);
    vector<int> b(B,0);
    vector<int> c(M,0);
    vector<int> x(M,0);
    vector<int> y(M,0);
    int min_a;
    int min_b;
    int min_mix=INT_MAX;
    for (size_t i = 0; i < A; i++)
    {
        cin>>a[i];
    }
    for (size_t i = 0; i < B; i++)
    {
        cin>>b[i];
    }
    min_a = *std::min_element(a.begin(), a.end());
    min_b = *std::min_element(b.begin(), b.end());
    
    for (size_t i = 0; i < M; i++)
    {
        cin>>x[i]>>y[i]>>c[i];
        min_mix = std::min(min_mix,a[x[i]-1]+b[y[i]-1]-c[i]);
        /* code */
    }
    cout << std::min(min_a+min_b, min_mix)<<endl;
    return 0;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

	int money =0;
	cin>>money;

	int sum = (money/500)*1000;

	sum += ((money%500)/5)*5;

	cout<<sum<<endl;

}


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

using namespace std;

list<int> CreatePrimes(int N) {
  list<int> Numbers(N - 1);
  iota(Numbers.begin(), Numbers.end(), 2);
  list<int> PrimeList;
  auto prime = Numbers.front();
  const int rtn = (int)sqrt(N);
  while (prime <= rtn) {
    PrimeList.push_back(prime);
    Numbers.erase(
        remove_if(Numbers.begin(), Numbers.end(),
                  [=](const auto Number) { return Number % prime == 0; }),
        Numbers.end());
    prime = Numbers.front();
  }
  PrimeList.splice(PrimeList.end(), move(Numbers));
  return PrimeList;
}

int main() {
  int n;
  cin >> n;
  list<int> primes{CreatePrimes(55555)};
  int flag = 0;
  for (auto x : primes) {
    if (x % 5 == 1) {
      cout << x << " ";
      ++flag;
    }
    if (flag == n) {
      break;
    }
  }
}

Measured memory_bytes: 1920
N, T = map(int, input().split())
c = []
t = []
ans = 1000000
for i in range(N):
    c_i, t_i = map(int, input().split())
    c.append(c_i)
    t.append(t_i)
for i in range(N):
    if t[i] <= T:
        if ans > c[i]:
            ans = c[i]

if ans == 1000000:
    print("TLE")
else:
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
int mod = (int)1e9 + 7;
int INF = (int)2e18;


signed main() {
    int H, W;
    cin >> H >> W;
    char S[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S[i][j];
        }
    }
    int ans[H][W];
    for (int i = 0; i < H; i++) {
        int temp = 0;
        vector<int> maxValue;
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') {
                maxValue.push_back(temp);
                temp = 0;
            } else {
                ++temp;
                if (j == W - 1) {
                    maxValue.push_back(temp);
                }
            }
        }
        int address = 0;
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') {
                ++address;
                ans[i][j] = -1;
            } else {
                ans[i][j] = maxValue[address];
            }
        }
    }
    for (int i = 0; i < W; i++) {
        int temp = 0;
        vector<int> maxValue;
        for (int j = 0; j < H; j++) {
            if (S[j][i] == '#') {
                maxValue.push_back(temp);
                temp = 0;
            } else {
                ++temp;
                if (j == H - 1) {
                    maxValue.push_back(temp);
                }
            }
        }
        int address = 0;
        for (int j = 0; j < H; j++) {
            if (S[j][i] == '#') {
                ++address;
                ans[j][i] = -1;
            } else {
                ans[j][i] += maxValue[address];
            }
        }
    }
    int sub = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            sub = max(sub, ans[i][j]);
        }
    }
    cout << sub - 1 << endl;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
    int64_t n, k;
    cin >> n >> k;

    int64_t ans = 0;
    for (auto _ : irange(0L, n)) {
        int64_t h;
        cin >> h;

        if (h >= k) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/* HARDWORK IS THE KEY TO SUCCESS.
   RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll oo =  1e10;
const ll maxs = 1e4 + 3;
const ll MAXS = 1e3 + 3;
ll dp[MAXS][maxs];

pair<ll,ll>a[maxs];
ll n,h;

ll go(ll pos,ll c)
{
    
    if(pos < 0 )
        return oo;
    if(c <= 0)
        return 0;
    
    if(dp[pos][c] != -1)
        return dp[pos][c];
        
    return dp[pos][c] =  min( a[pos].second + go(pos,c-a[pos].first) , go(pos-1,c));
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof dp);
    ll c;
    cin >> c >> n;
    ll i;
    for(i = 0;i < n;++i)
    {
        cin >> a[i].first >> a[i].second;
        
    }
    
    cout << go(n - 1,c);
}
            

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

int main()
{
	ll X, Y;
	cin >> X >> Y;

	ll count = 0;
	while (X <= Y) {
		count += 1;
		X = X * 2;
	}
	cout << count << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll N; cin >> N;
  ll X[N], Y[N], P[N]; rep(i,N) cin >> X[i] >> Y[i] >> P[i];
  ll xmin[1<<N][N], ymin[1<<N][N];
  rep(i,1<<N) rep(j,N) {
    xmin[i][j] = abs(X[j]); rep(k,N) if (i&1<<k) xmin[i][j] = min(xmin[i][j], abs(X[k]-X[j]));
    ymin[i][j] = abs(Y[j]); rep(k,N) if (i&1<<k) ymin[i][j] = min(ymin[i][j], abs(Y[k]-Y[j]));
  }
  // rep(i,N) debug(xmin[i],xmin[i]+(1<<N));

  ll result[N+1]; rep(i,N+1) result[i] = LLINF;
  rep(i,pow(3,N)) {
    ll ti = i, dx = 0, dy = 0, count = 0;
    rep(j,N) {
      if (ti%3==1) { dx += 1<<j; count++; }
      else if (ti%3==2) { dy += 1<<j; count++; }
      ti /= 3;
    }
    ll sum = 0; rep(j,N) sum += min(xmin[dx][j], ymin[dy][j]) * P[j];
    result[count] = min(result[count], sum);
  }
  rep(i,N+1) cout << result[i] << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int X = N;
  int sum  = 0;

  for (int i = 0; i < 8; i++) {
    sum += X % 10;
    X /= 10;
    if ( X == 0 ) {
      break;
    }
  }
  
  if ( N % sum == 0 ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3616
import sys
import math
import copy

s=int(input());
a=math.sqrt(s);
d=copy.copy(a);
a1=copy.copy(a);
d1=copy.copy(a);
if s == 10**18:
    b=0;
    c=0;
else:
    a=int(a)+1;
    d=int(d)+1;
    b=a*d-s;
    while b > 10**9:
        a = a-1;
        d = d+1;
        b = a*d-s;
    if  d > 10**9:
        b = 10**10
        while b > 10**9:
            a1=int(a1)+1;
            d=int(d1);
            a = a1-1;
            b = a*d-s;

    c=1;

print(0, 0, int(a), int(b), int(c), int(d));


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;
const ll inf = 1e18;

template<typename T> struct segtree {
    
    T merge(T x, T y) {
	return max(x,y);
    }
    int n;
    vector<ll> t;
    void init(int n) {
	n += 10;
	this->n = n;
	t.resize(n*4);
    }

    void upd(int v, int tl, int tr, int i, T dx) {
	if (tl == tr) {
	    t[v] = merge(t[v], dx);
	} else {
	    int tm = (tl+tr)/2;
	    if (i<=tm) {
		upd(2*v,tl,tm,i,dx);
	    } else {
		upd(2*v+1,tm+1,tr,i,dx);
	    }
	    t[v] = merge(t[2*v], t[2*v+1]);
	}
    }

    T qry(int v, int tl, int tr, int l, int r) {
	if (l>tr || r<tl) {
	    return -inf;
	}
	if (l <= tl && tr <= r) {
	    return t[v];
	}
	int tm = (tl+tr)/2;
	return merge(qry(2*v,tl,tm,l,r), qry(2*v+1,tm+1,tr,l,r));
    }
};



const int maxn = 6e3;
const int maxm = 222;

int n, m;

ll a[maxn];
ll b[maxn][maxm];

segtree<ll> t[maxm];

ll dp[maxn]; // dp[i]: max value if we end at loc i



ll qry(int l, int r) {
    ll walk = a[r-1]-a[l-1];
    ll res = 0;
    for (int i=1; i<=m; i++) {
	res += t[i].qry(1,1,n,l,r);
    }
    return res - walk;
}


// compute dp[tl],dp[tl+1]...dp[tr], assuming optimal starting loc is in [ql,qr]
void solve(int tl, int tr, int ql, int qr) {
    if (tl>tr) return;
    int tm = (tl+tr)/2;

    int opt = 0;
    ll best = -inf;

    // compute dp[tm]
    for (int i=ql; i<=min(tm, qr); i++) {
	dp[tm] = max(dp[tm], qry(i, tm));
	if (dp[tm] > best) {
	    best = dp[tm];
	    opt = i;
	}
    }

    solve(tl,tm-1,ql,opt);
    solve(tm+1,tr,opt,qr);
}


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


    cin>>n>>m;
    for (int j=1; j<=m; j++) {
	t[j].init(n+10);
    }

    for (int i=1; i<=n-1; i++) {
	cin>>a[i];
	a[i] += a[i-1];
    }

    for (int i=1; i<=n; i++) {
	for (int j=1; j<=m; j++) {
	    cin>>b[i][j];
	    t[j].upd(1,1,n,i,b[i][j]);
	}
    }


    solve(1,n,1,n);
    ll res = 0;
    for (int i=1; i<=n; i++) {
	res = max(res, dp[i]);
    }

    cout<<res<<endl;    
    return 0;
}


Measured memory_bytes: 44136
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

//#include <set>
//#include <unordered_map>
//#include <stack>

using namespace std;

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

#define max_n 100

int H, W, A, B;


int main() {

	cin >> H >> W >> A >> B;
	
	rep(i, H) {
		rep(j, W) {
			bool AB[2];
			if (i < B) AB[0] = true;
			else AB[0] = false;
			
			if (j < A) AB[1] = true;
			else AB[1] = false;

			if (AB[0] == AB[1])cout << 1;
			else cout << 0;
		}
		cout << endl;
	}


	return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
int main(){
    int n,a,b,c,d,i,x;
    char s[200001];
    scanf("%d%d%d%d%d%s",&n,&a,&b,&c,&d,s);
    x=c>d?c:d;
    for(i=a;i<x;i++){
        if(s[i-1]=='#'&&s[i]=='#'){puts("No");return 0;}
    }
    if(d<c){
        for(i=b-1;i<d;i++){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){puts("Yes");return 0;}
        }
        puts("No");
        return 0;
    }
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<int> A(x);
    vector<int> B(y);
    vector<int> C(z);
    rep(i,x)cin >> A[i];
    rep(i,y)cin >> B[i];
    rep(i,z)cin >> C[i];

    SORT(A);
    SORT(B);
    SORT(C);

    priority_queue<int,vector<int>,greater<int> > xy;
    rep(i,x){
        int X = A[x-1-i];
        rep(j,y){
            int Y = B[y-1-j];
            if(xy.size() >= k && X+Y <= xy.top())break;
            xy.push(X+Y);
            if(xy.size() > k)xy.pop();
        }
    }

    vector<int> xy2;
    while(xy.size()){
        xy2.pb(xy.top());
        xy.pop();
    }
    // debug_vec(xy2);

    priority_queue<int,vector<int>,greater<int> > xyz;
    rep(i,z){
        int Z = C[z-1-i];
        rep(j,xy2.size()){
            int XY = xy2[xy2.size()-1-j];
            // cerr << Z << " " << XY << " " << Z+XY << endl;
            if(xyz.size() >= k && XY+Z <= xyz.top())break;
            xyz.push(XY+Z);
            if(xyz.size() > k)xyz.pop();
        }
    }

    vector<int> ans;
    while(xyz.size()){
        ans.pb(xyz.top());
        xyz.pop();
    }
    for(int i = 0;i < ans.size();i++)cout << ans[ans.size()-1-i] << endl;


	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc123.contest.atcoder.jp/tasks/abc123_d

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

// main.cpp

int main() {
  std::int_fast64_t N, M, X;
  std::cin >> N >> M >> X;
  std::vector<std::int_fast64_t> A;
  A.reserve(M);
  std::copy_n(std::istream_iterator<std::int_fast64_t>(std::cin), M, std::back_inserter(A));

  std::vector<std::int_fast64_t> cells(N + 1, 0);
  for (const std::int_fast64_t& A_i : A) {
    cells[A_i] = 1;
  }

  std::vector<std::int_fast64_t> cumsum({0});
  cumsum.reserve(N + 2);
  for (const std::int_fast64_t& cell : cells) {
    cumsum.push_back(cumsum.back() + cell);
  }

  std::cout << std::min(cumsum[X] - cumsum[0], cumsum[N + 1] - cumsum[X + 1]) << std::endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
# map(int,input().split())
v =list(map(int,input().split()))
# [list(map(int,input().split())) for i in range(N)]
v = sorted(v)
sum = v[0]
for i in range(1,N):
    sum  = (sum + v[i])/2

print(sum)


Measured memory_bytes: 2940
// フェルマーの小定理
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	m = 1000000007
)

var (
	fac []int
)

func mpow(x int, n int) int {
	result := 1
	for n != 0 {
		if n&1 == 1 {
			result = result * x % m
		}
		x = x * x % m
		n >>= 1
	}
	return result
}

func mcomb(n int, k int) int {
	if n == 0 && k == 0 {
		return 1
	}
	if n < k || k < 0 {
		return 0
	}
	return (fac[n] * mpow(fac[n-k], m-2) % m) * mpow(fac[k], m-2) % m
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	defer flush()

	N := readInt()
	K := readInt()

	n := max(K, N-K+1)
	fac = make([]int, n+1)
	fac[0] = 1
	for i := 0; i < n; i++ {
		fac[i+1] = fac[i] * (i + 1) % m
	}

	for i := 1; i <= K; i++ {
		println(mcomb(K-1, i-1) * mcomb(N-K+1, i) % m)
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdoutWriter, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 1832
fun main(args: Array<String>) {
    val (T,A,K) = readLine()!!.split(" ").map { it.toLong() }
    if (T+A <= K){
        println("0 0")
    }else {
        if (T < K){
            println("0 ${A-(K-T)}")
        }else{
            println("${T-K} $A")
        }
    }
 
}

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

int main(void){
    std::string s, t;
    std::cin >> s >> t;
    std::vector<std::vector<int>> a(26);
    for(int i = 0; i < s.size(); i++){
        a[s[i] - 'a'].push_back(i);
    }
    int p = -1;
    long long ans = 0;
    for(int i = 0; i < t.size(); i++){
        int cur = t[i] - 'a';
        if(a[cur].size() == 0){
            std::cout << -1 << std::endl;
            return 0;
        }
        while(1){
            auto j = std::upper_bound(a[cur].begin(), a[cur].end(), p);
            if(j != a[cur].end()){
               ans += *j - p;
               p = *j;
               break;
               // std::cout << ans << std::endl;
           }else{
               ans += s.size() - p - 1;
               p = -1;
           }
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 4252
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				int n =sc.nextInt();
				if(n==0) break;
				int w=sc.nextInt();
				int h=sc.nextInt();
				int[][] tree=new int[w+1][h+1];
				for(int i=0; i<n; i++) {
					int x=sc.nextInt();
					int y=sc.nextInt();
					tree[x][y]=1;
				}
				int s=sc.nextInt();
				int t=sc.nextInt();
				int max=0, sum=0;
				for(int i=1; i+s-1<=w; i++) {
					for(int j=1; j+t-1<=h; j++) {
						sum=0;
						for(int ii=i; ii<=i+s-1; ii++) {
							for(int jj=j; jj<=j+t-1; jj++) {
								sum+=tree[ii][jj];
							}
						}
						max=Math.max(sum, max);
					}
				}
				System.out.println(max);
				
			}

		}
	}
}


Measured memory_bytes: 41976
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
 
struct Puddle{
    int start, end, area;
};
 
int main(){
    string str;
    cin >> str;
    int n = str.size(), overall = 0;
    stack<Puddle> S;
    stack<int> slope;
    Puddle temp;

    for(int i = 0; i < n; i++){
        if(str[i] == '\\'){
            slope.push(i);
        } else if(str[i] == '/'){
            if(!slope.empty()){
                temp.start = slope.top();
                slope.pop();
                temp.end = i;
                temp.area = (temp.end - temp.start);
                overall += temp.area;
                while( !S.empty() ){
                    if(temp.start < S.top().start){
                        temp.area += S.top().area;
                        S.pop();
                    } else {
                        break;
                    }
                }
                S.push(temp);
            }
        }
    }
    cout << overall << endl;
    int m = S.size(), A[m];
    cout << m;
    for(int i = 0; i < m; i++){
        A[m - i - 1] = S.top().area;
        S.pop();
    }
    for(int i = 0; i < m; i++)
        cout << " " << A[i];
    cout << endl;
}

Measured memory_bytes: 1312
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

#define x first
#define y second
typedef pair<int,int> pii;
typedef long long ll;
const int MAXN=100005;

int n,m;
int co[MAXN];
bool vis[MAXN];
vector<int> E[MAXN];

bool dfs(int u){
    bool tag=1;
    vis[u]=1;
    for(int i=0;i<(int)E[u].size();i++){
        int v=E[u][i];
        if(vis[v]) tag&=(co[v]!=co[u]);
        else{
            co[v]=co[u]^1;
            tag&=dfs(v);
        }
    }
    return tag;
}

int main(){
    //freopen("squared.in","r",stdin);
    //freopen("squared.out","w",stdout);

    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        E[u].push_back(v);
        E[v].push_back(u);
    }
    int cnt=0,p=0,q=0;
    for(int i=1;i<=n;i++){
        if(vis[i]) continue;
        if(!E[i].size()) cnt++;
        else{
            if(dfs(i)) q++;
            else p++;
        }
    }
    printf("%lld\n",(ll)cnt*cnt+2ll*cnt*(n-cnt)+p*p+2ll*p*q+2ll*q*q);

    fclose(stdin);
    fclose(stdout);
}


Measured memory_bytes: 11008
#include<stdio.h>
int main(void){
    int a,b,x,y,n,i,j;
    while(1){
        int map[17][17]={0};
        int dp[17][17]={0};
        dp[1][1]=1;
        scanf("%d %d",&a,&b);
        if(a==0&&b==0)break;
        scanf("%d",&n);
        for(i=0;i<n;i++){
            scanf("%d %d",&x,&y);
            map[x][y]=-1;
        }
        for(i=1;i<=b;i++){
            for(j=1;j<=a;j++){
                if(map[j][i]==0)dp[j][i]+=dp[j-1][i]+dp[j][i-1];
            }
        }
        printf("%d\n",dp[a][b]);
    }
    return 0;
}

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

#define ll long long int
#define vll vector<ll>
#define vi vector<int>

#define MOD 1000000007

int main() {

    string S;
    cin >> S;

    vector<vll> dp(100005, vll(13, 0));
    dp[0][0] = 1;

    int c;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == '?') c = -1;
        else c = S[i] - '0';
        for (int j = 0; j < 10; j++) {
            if (c != -1 && c != j) continue;
            for (int k = 0; k < 13; k++) {
                dp[i+1][(k*10 + j) % 13] += dp[i][k];
            }
        }
        for (int k = 0; k < 13; k++) {
            dp[i+1][k] %= MOD;
        }
    }

    cout << dp[S.length()][5] << endl;

    return 0;
}


Measured memory_bytes: 13696
a = int(input())
if 400 <= a <= 599:
    print(8)
elif 600 <= a <= 799:
    print(7)
elif 800 <= a <= 999:
    print(6)
elif 1000 <= a <= 1199:
    print(5)
elif 1200 <= a <= 1399:
    print(4)
elif 1400 <= a <= 1599:
    print(3)
elif 1600 <= a <= 1799:
    print(2)
elif 1800 <= a <= 1999:
    print(1)

Measured memory_bytes: 9188
S = input()
N = len(S)

a = [0] * (N + 1)
for i in range(N):
  if S[i] == "<":
    a[i + 1] = a[i] + 1

for i in range(N-1, -1, -1):
  if S[i] == ">":
    a[i] = max(a[i], a[i+1] + 1)

print(sum(a))


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

namespace ConsoleApp5
{
    class Program
    {

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

            Console.WriteLine(R * 2 * 3.1415);


        }


    }
}

Measured memory_bytes: 27460
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=[a[i]-a[i-1] if i!=0 else 0 for i in range(1,m) ]
s.sort()
if n!=1:
    print(sum(s[:-n+1]))
else:
    print(sum(s))



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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

void update(int r, int c, vi& dists, vi& empty, int N) {
    int cur = N*r + c;
    int cd = dists[cur];

    if (r > 0 && dists[N*(r-1) + c] > cd + empty[N*(r-1) + c]) {
        dists[N*(r-1) + c] = cd+ empty[N*(r-1) + c];
        update(r-1, c, dists,empty, N);
    }

    if (r+1<N && dists[N*(r+1) + c] > cd + empty[N*(r+1) + c]) {
        dists[N*(r+1) + c] = cd+ empty[N*(r+1) + c];
        update(r+1, c, dists,empty, N);
    }

    if (c > 0 && dists[N*r + c-1] > cd+ empty[N*r + c-1]) {
        dists[N*r + c-1] = cd+ empty[N*r + c-1];
        update(r, c-1, dists, empty, N);
    }

    if (c+1 < N && dists[N*r+c+1] > cd+ empty[N*r + c+1]) {
        dists[N*r + c+1] = cd+ empty[N*r + c+1];
        update(r, c+1, dists, empty,N);
    }
}

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

    int N;
    cin >> N;
    
    vi P(N*N, 0);
    for (int i=0;i<N*N;i++) cin >> P[i];
    for (int i=0;i<N*N;i++) P[i]--;

    vi dists(N*N, N);
    vi empty(N*N, 1);
    for (int i=0;i<N*N;i++) {
        int r = i/N;
        int c = i%N;
        dists[i] = min(dists[i], c+1);
        dists[i] = min(dists[i], r+1);
        dists[i] = min(dists[i], N-c);
        dists[i] = min(dists[i], N-r);
    }

    int ans = 0;
    for (int i=0;i<N*N;i++) {
        int p = P[i];

        dists[p]--;
        empty[p]=0;
        ans += dists[p];

        update(p/N, p%N, dists, empty, N);
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

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

  int c = x;
  for (int day = 1; day <= d; day++) {
    for (int i = 0; i < a.size(); i++) {
      if (((day - 1) % a[i])) continue;
      c++;
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 256
import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)

Measured memory_bytes: 3064
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
void solve(){
    int n;
    cin>>n;
    set<int>st;
    rep(i,n) {
        int a;
        cin>>a;
        st.insert(a);
    }
    if(sz(st)==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("data.in","r",stdin);
        freopen ("data.out","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 9600
mod = 10**9+7
n = int(input())
slime = [ int(v) for v in input().split() ]
distance = [ slime[i+1] - slime[i] for i in range(n-1) ]

ans = 0
t = 1
for i in range(1, n):
    t *= i
    t %= mod

s = 0
for i in range(n-1):
    s += t * pow(i+1, mod-2, mod)
    s %= mod
    ans += s * distance[i]
    ans %= mod

print(ans)


Measured memory_bytes: 63256
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



signed main()
{
    string O, E;
    cin >> O >> E;

    REP(i,O.length()) {
        cout << O[i];
        if (i < E.length()) cout << E[i];
    }
    cout << endl;
}


Measured memory_bytes: 256