akhauriyash/Code-Regression huggingface dataset:
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn dd(a: usize, s: usize) -> usize {
    if (a + s)% 5 == 0 {
        return a + s;
    } else {
        return (5 - (a + s) % 5) + a + s;
    }
}

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
        d: usize,
        e: usize,
    }
    let mut v = Vec::new();
    v.push(a);
    v.push(b);
    v.push(c);
    v.push(d);
    v.push(e);

    let mut min = 644;
    for i in 0..5 {
        let mut sum = 0;
        for j in 0..5 {
            if i == j {
                continue;
            } else {
                sum = sum + v[j];
                while sum % 10 != 0{
                    sum+=1;
                }
            }
        }
        sum+=v[i];
        if min >= sum {
            min = sum;
        }
    }

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

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

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

typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<ll> vec;
  ll total_length = 0;
  FOR(i, 0, n) {
    ll a;
    cin >> a;
    total_length += a;
    vec.push_back(a);
  }
  double center = total_length / 2.0;

  ll near_left = 0;
  ll near_right = 0;

  ll sum = 0;
  FOR(i, 0, n) {
    sum += vec[i];
    if ((double)sum > center) {
      near_left = sum - vec[i];
      near_right = sum;
      break;
    }
  }
  double near = min(center - (double)near_left, (double)near_right - center);
  cout << (ll)(near / 0.5) << endl;
  return 0;
}

Measured memory_bytes: 2420
from collections import deque

n = int(input())
s = input()

open_ = 0  # (
close_ = 0  # )

ans = deque(s)
for c in s:
    if c == '(':
        open_ += 1
    else:
        close_ += 1
        if close_ > open_:
            ans.appendleft('(')
            close_ -= 1
for _ in range(close_ - open_):
    ans.appendleft('(')
for _ in range(open_ - close_):
    ans.append(')')
print(*ans, sep='')


Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://abc076.contest.atcoder.jp/tasks/abc076_d>
問題文============================================================
 2168年、AtCoder 社は成長し、ついに "AtCoder特急" という鉄道を建設することを決めた。
 
 さて、社長の高橋君は、"AtCoder特急" の列車を以下のように運行することを計画した。
 
 列車の走行時間は、(t1+t2+t3+…+tN) 秒である。
 最初の t1 秒間は、列車は速度 v1 m/s 以内で走っていなければならない。
 また、次の t2 秒間は、列車は速度 v2 m/s 以内で走っていなければならない。
 次の t3 秒間、またそれ以降についても同様である。
 
 最後の tN 秒間は、列車は速度 vN m/s 以内で走っていなければならない。
 ただし、列車の性能上、加速度は ±1m⁄s2 以内でなければならない。
 また、走行開始時と走行終了時には列車は止まっていなければならない。
 
 列車が発車してから停車するまでに走れる最大の距離を求めなさい。
=================================================================

解説=============================================================
 区間[l,r] の最大速度が v の集合だと考える
 
 時間 t において
     t <= l であれば
         その時出せる最大速度は v + (l - t)
     t >= r であれば
         その時出せる最大速度は v + (t - r)
     l <= t <= r であれば
         その時出せる最大速度は v
 となるので、
 全区間・時間に関してこれらの最大値を求めて面積を計算していけば良い
 
 t = 0.5刻みで行えば十分
================================================================
*/

// 区間[l,r] の最大 v
struct _f {
    ll v, l, r;
    _f() {}
    _f(ll v, ll l, ll r) :v(v), l(l), r(r) {}
};

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> t(N), v(N);
    for (int i = 0; i < N;i++) cin >> t[i];
    for (int i = 0; i < N;i++) cin >> v[i];
    
    vector<_f> F; F.push_back(_f(0, 0, 0));
    ll t_sum = 0;
    for (int i = 0; i < N;i++) {
        F.push_back(_f(v[i], t_sum, t_sum + t[i]));
        t_sum += t[i];
    }
    F.push_back(_f(0, t_sum, t_sum));
    
    double res = 0.0;
    double pre_v = 0.0;
    for (double T = 0.5; T <= t_sum;T += 0.5) {
        double next_v = INF;
        for (auto _F : F) {
            if (T <= _F.l) { next_v = min(next_v, (double)(_F.v + (_F.l - T))); }
            else if (T >= _F.r) { next_v = min(next_v, (double)(_F.v + (T - _F.r))); }
            else { next_v = min(next_v, (double)_F.v); }
        }
        // 面積計算
        res += (pre_v + next_v)*0.5 / 2.0;
        pre_v = next_v;
    }
    cout << fixed << setprecision(10) << res << endl;
    return 0;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int kaijyo(int x){
	if(x==1) return 1;
	else return  x*kaijyo(x-1);
}

int main() {
	int N;
	cin >> N;
	vector<pair<int,int>> cord;

	int n= kaijyo(N);
	rep(i,N){
		int x;
		int y;
		cin >> x >> y;
		cord.push_back(make_pair(x,y));
	}

	double diswhole=0;
	rep(i,n){
		double len=0;
		rep(j,(N-1)){
			int dx=cord.at(j).first-cord.at(j+1).first;
			int dy=cord.at(j).second-cord.at(j+1).second;
			double dist= pow(pow(dx,2)+pow(dy,2),0.5);
			len +=dist;
		}
		diswhole+=len;
		next_permutation(ALL(cord));
	}
	cout << fixed<<setprecision(10) <<(double)diswhole/n;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <tuple>

int main()
{
	int N, X, T;
	std::cin >> N >> X >> T;
	std::cout << (N + (X - 1)) / X * T << std::endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll x;
    cin >> x;
    ll t = x / 100;
    ll r = x % 100;
    // cout<<t<<endl;
    // cout<<r<<endl;

    if (r > t * 5)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=1;
  rep(i,k) ans*=2;
  ans*=(1900*k+100*(n-k));
  COUT(ans);
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi 1
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

#define MAX_N 100005

LL N, K;
LL A[MAX_N], B[MAX_N];

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

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

  LL ans = 0;
  const LL MAX = 31;
  for (int i = 0; i < MAX; i++) {
    if(!((K >> i) & 1)) {
      continue;
    }
    LL mask = pow(2, MAX) - 1;
    LL mask2 = pow(2, i) - 1;
    mask <<= (i+1);
    LL tmp = 0;
    for (int n = 0; n < N; n++) {
      if(((mask & A[n]) | (mask & K)) == (mask & K) && ((A[n] >> i) & 1) == 0) {
        tmp += B[n];
      }
    }
    //cerr << i << " " << tmp << " " << static_cast<std::bitset<MAX> >(mask) << " " << mask2 << endl;
    ans = max(tmp, ans);
  }

  LL tmp = 0;
  for (int i = 0; i < N; i++) {
    if((A[i] | K) == K){
      tmp += B[i];
    }
  }

  ans = max(ans, tmp);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
def search(tim, d)
    i = 0
    j = d.size - 1
    
    if d[0] > tim
        return 0
    end

    while true
        if tim < d[i]
            return i
        end
        if i >= j
            if i > d.size - 1
                return i
            end
            if tim >= d[i]
                return i + 1
            else
                return i
            end
        end

        k = (i + j).div(2)
        val = d[k]
        if tim == val
            return k + 1
        elsif tim > d[k]
            i = k + 1
        else
            j = k - 1
        end
    end
end

(N, M, K) = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i }
a = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i }
b = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i }

c = []
d = []

tim = 0
for i in a do
    tim += i
    c.push(tim)
end

tim = 0
for i in b do
    tim += i
    d.push(tim)
end

ans = search(K, d)

c.each_with_index do |e, i|
    rest = K - e
    if rest < 0
        break
    end

    z = search(rest, d)
    if ans < i + 1 + z
        ans = i + 1 + z
    end
end

puts ans


Measured memory_bytes: 49556
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;

namespace atcoder
{
    class Solver
    {
        public Solver() { }

        public static int Main()
        {
            new Solver().Solve();
            return 0;
        }

        Scanner cin;

        public void Solve()
        {
            cin = new Scanner();
            string S = cin.next();

            char[] c = S.ToCharArray();

            List<char> l = new List<char>();

            int n = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (l.Count == 0 || c[i] == l[l.Count - 1]) { l.Add(c[i]); }
                else
                {
                    l.RemoveAt(l.Count - 1);
                    n = n + 2;
                }
            }

            Console.Write(n);
        }

    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13920
#include<bits/stdc++.h>
#include <algorithm>
 
using namespace std;
 
int main(){
 string s;
 cin>>s;
  if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
    cout<<"Yes"<<endl;
  }
  else{
  cout<<"No"<<endl;
  }  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,q;
	cin >> a >> b >> q;
	long s[a],t[b];
	for(int i=0;i<a;i++) cin >> s[i];
	for(int i=0;i<b;i++) cin >> t[i];

	while(q--){
		long x;
		cin >> x;
		int index=lower_bound(s,s+a,x)-s;
		long ls=index==0?1e18:x-s[index-1];
		long rs=index>=a?1e18:s[index]-x;
		index=lower_bound(t,t+b,x)-t;
		long lt=index==0?1e18:x-t[index-1];
		long rt=index>=b?1e18:t[index]-x;
		long l=max(lt,ls);
		long r=max(rt,rs);
		long ans=1e18;
		ans=min(l,r);
		if(lt<rs) ans=min(ans,lt*2+rs);
		else ans=min(ans,lt+rs*2);
		if(ls<rt) ans=min(ans,ls*2+rt);
		else ans=min(ans,ls+rt*2);
		cout << ans << endl;
	}
	return 0;
}


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


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

	if (a > b) { cout << "a > b\n"; }
	else if (a < b) { cout << "a < b\n"; }
	else  { cout << "a == b\n"; }

    return 0;
}




Measured memory_bytes: 3080
#include <iostream>
using namespace std;
 
int main(){
  int a,cnt,b,c[5]={500,100,50,10,5};
  while(cin>>a&&a){
    cnt=0;
    b=1000-a;
    for(int i=0;i<5;i++) cnt+=b/c[i],b%=c[i];
    cnt+=b;
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll i,j;
    set<ll> s1;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
            s1.insert(i*j);
    }
    ll N;
    cin>>N;
    if(s1.find(N)!=s1.end()) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using ll = long long; using vi = vector<int>; using vll = vector<ll>;
using vvi = vector<vi>; using vvll = vector<vll>;
const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll INF_MAX = numeric_limits<ll>::max();

int main() {
  int n; cin >> n;
  vvi grid(2, vi(n));
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> grid[i][j];
    }
  }
  int max_candies = 0;
  for (int i = 0; i < n; ++i) {
    int candies = 0;
    for (int j = 0; j < n; ++j) {
      if (j <= i) candies += grid[0][j];
      if (j >= i) candies += grid[1][j];
    }
    max_candies = max(max_candies, candies);
  }
  cout << max_candies << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define ll long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<(int)n;i++)
#define rev(i,n,init) for(int i=(int)n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
// std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// int myRand(int R) {
// 	int val=rng() % R;
//       assert(val>=0);
//       return val;
// }

using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=3e18;
const int32_t LOG=21;
const int32_t MOD=MOD1;



int32_t main()
{ 
      getFaster;
      int tests=1; 
      //cin>>tests;
      rep(ii,0,tests)
      {
            int x,k,d;
            cin>>x>>k>>d;
            x=abs(x);
            if(k<=x/d)
            {
                 int ans=x-k*d;
                 cout<<ans<<endl;
                 return 0;
            }

            int rem=x%d;
            int div=x/d;
            k-=div;
            int ans=rem;
            if(k&1)ans=abs(rem-d);
            cout<<ans<<endl;
      } 
      return 0;                         
}

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

using namespace std;

int main(){
    long long n;
    cin >> n;
    vector<long long>a(n);
    long long count = 0;
    for(long long i = 0; i < a.size(); i++){
        cin >> a[i];
        while(a[i] % 2 == 0){
            a[i] /= 2;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 384
/*
Author : Devil088
*/
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define sep cout<<"\n";
#define Yes cout<<"Yes\n";
#define No cout<<"No\n";
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";

inline string shift(string s){
	int n = s.length();
	string r = "";
	r+=s[n-1];
	for(int i=0;i<n-1;i++)r+=s[i];
	return r;
}

int main(){
	int n;
	cin>>n;
	long A[n];
	long sum = 0;
	for(int i=0;i<n;i++){
		cin>>A[i];
		sum+=A[i];
	}
	cout<<sum-n<<"\n";
}
/*
uday
adyu
7 46
45 6
*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

struct Puzzle {
  int f[9];
  int space;
  string path;

  bool operator < (const Puzzle &p) const {
    rep(i, 9) {
      if (f[i] == p.f[i]) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p) {
  rep(i, 9) {
    if (p.f[i] != i + 1) return false;
  }
  return true;
}

string bfs(Puzzle s) {
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while (!Q.empty()) {
    u = Q.front();
    Q.pop();
    if (isTarget(u)) return u.path;
    int sx = u.space / 3;
    int sy = u.space % 3;
    rep(r, 4) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if (tx < 0 || ty < 0 || tx >= 3 || ty >= 3) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * 3 + ty]);
      v.space = tx * 3 + ty;
      if (!V[v]) {
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }
}

int main() {
  Puzzle in;

  rep(i, 9) {
    cin >> in.f[i];
    if (in.f[i] == 0) {
      in.f[i] = 9;
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  
  return 0;
}


Measured memory_bytes: 30660
import java.util.*;
import java.io.*;
public class Main{
  public static void main(String[] args){
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    int a,b,c,d;
    try{
      a = Integer.parseInt(bf.readLine());
      b = Integer.parseInt(bf.readLine());
      c = Integer.parseInt(bf.readLine());
      d = Integer.parseInt(bf.readLine());
      System.out.println(Math.min(a, b) + Math.min(c, d));
    }catch(Exception e){
      
    }
  }
}

Measured memory_bytes: 21076
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))



def main():
    X,Y,Z,K=mi()
    A,B,C=list(mi()), list(mi()), list(mi())
    
    W = []
    for i in range(X):
        for j in range(Y):
            W.append(A[i]+B[j])

    W.sort(reverse=True)

    ans = []
    for w in W[:K]:
        for c in C:
            ans.append(w+c)
    
    ans.sort(reverse=True)
    print(*ans[:K],sep='\n')


if __name__ == "__main__":
    main()

Measured memory_bytes: 218856
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n;
	cin >> n ;
	int ans = 0 ;
	for(int i = 1 ; i <= n ;++i){
		if(i%3!=0 and i%5!=0 and i%15!=0) ans+=i;
	}
	cout << ans << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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

int main(void)
{
  int a,b,d,r;
  double f;
  cin >> a >> b;

  d = a / b;
  r = a % b;
  f = (double) a / b;
  cout << d << " " << r << " " << fixed << f << endl;

  return 0;
}

Measured memory_bytes: 3260
import itertools

N = int(input())
li = list(map(int,input().split()))

C = list(itertools.combinations(li,3))

for i in range(len(C)):
    C[i] = list(C[i])

count = 0

for j in C:
    if j[0] < j[1] + j[2] and j[0] + j[1] > j[2] and j[0] + j[2] > j[1] :
        if j[0] != j[1] and j[1] != j[2] and j[2] != j[0] :
            count += 1

print(count)

Measured memory_bytes: 93928
// CODE by Kazhybay Askar
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC    optimize("Ofast")
#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define iter   set<int>::iterator
#define f      first
#define s      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define mp     make_pair
#define cont   continue
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define endl   '\n'

typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 1e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

ll a[MAXN],b[MAXN],dp[MAXN];
vector<int>g[MAXN],v;
bool used[MAXN];
ll n,w,k,cnt,sum,ans,mx,mn=INF;
bool y;

void freopen(){
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
}


void solve(){
	cin>>n>>w;
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        for(int j=w;j>=0;j--){
            if(a[i]+j<=w)dp[j+a[i]]=max(dp[j+a[i]],dp[j]+b[i]);
        }
    }
    for(int i=1;i<=w;i++)mx=max(mx,dp[i]);
    cout<<mx;
}

int main(){
	Speed;
	ll T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	r0;
}




Measured memory_bytes: 4480
N, L = map(int, input().split())

sum_N = int(N*((N+1)/2 + L - 1))

if L >= 0 :
  print(sum_N - L)
elif L + N - 1 < 0 :
  print(sum_N - (L + N - 1))
else :
  print(sum_N)


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

using namespace std;

#define int long long

signed main()
{
    int a, b, ans = 0;
    cin >> a >> b;
    int l = a + (4 - a % 4) % 4, r = b - b % 4;
    for (int i = a; i < l; ++i)
        ans ^= i;

    for (int i = r; i <= b; ++i)
        ans ^= i;

    cout << ans;
}

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

char ary[100010];
bool bar[100010],nar[100010];
int main(){
	int N;
	cin>>N>>ary;
	for(int i=0;i<N;i++){
		bar[i]=(ary[i]=='x');
	}
	bar[N]=bar[0];
	bool fla=false;
	for(int i=0;i<2;i++){
		for(int j=0;j<2;j++){
			nar[0]=i;
			nar[1]=j;
			for(int k=1;k<=N;k++){
				nar[k+1]=(nar[k-1]+bar[k]+nar[k])&1;
			}
			if(nar[0]==nar[N]&&nar[1]==nar[N+1]){
				fla=true;
				goto l1;
			}
		}
	}
l1:
	if(fla){
		for(int i=0;i<N;i++){
			if(!nar[i]) cout<<'S';
			else cout<<'W';
		}
		cout<<endl;
	}
	else cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

long long a[2010];

struct stree{
    long long tr[8010];
    void build(int idx, int l, int r) {
        if (l + 1 == r) {
            tr[idx] = a[l];
            return;
        }
        int m = (l + r) / 2;
        build(idx * 2 + 1, l, m);
        build(idx * 2 + 2, m, r);
        tr[idx] = std::min(tr[idx * 2 + 1], tr[idx * 2 + 2]);
        return;
    }
    long long min(int idx, int l, int r, int ll, int rr) {
        if (ll <= l && r <= rr) {
            return tr[idx];
        }
        if (r <= ll || rr <= l) {
            return 1000000000000000000;
        }
        int m = (l + r) / 2;
        long long s1 = min(idx * 2 + 1, l, m, ll, rr);
        long long s2 = min(idx * 2 + 2, m, r, ll, rr);
        return std::min(s1, s2);
    }
};

int main() {
    long long n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    stree tr;
    tr.build(0, 1, n + 1);
    long long ans = 1000000000000000000;
    for (long long i = 0; i < n; ++i) {
        long long sum = i * k;
        for (int j = 1; j <= n; ++j) {
            int l = j - i;
            if (l > 0) {
                sum += tr.min(0, 1, n + 1, l, j + 1);
            } else {
                sum += min(tr.min(0, 1, n + 1, 1, j + 1), tr.min(0, 1, n + 1, n + l, n + 1));
            }
        }
        ans = min(ans, sum);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE
#define ll               long long
#define nl               '\n'                             // NL - sign of new line

#define upc(str, c)      str[c] = toupper(str[c]);         // make single char uppercase
#define lowerc(str, c)   str[c] = tolower(str[c]);         // make single char lowercase

#define ups(str)       	 transform(str.begin(), str.end(), str.begin(), ::toupper); // make entire string uppercase
#define lowers(str)      transform(str.begin(), str.end(), str.begin(), ::tolower); // make entire string lowercase

#define ps(x,y)          fixed << setprecision(y) << x     // usage: t=1.1234; cout << ps(t,4); // it means it will print 4 decimal places.

#define vi               vector <int>                      //create vector of int numbers
#define vs               vector <string>                      //create vector of int numbers
#define eb               emplace_back
#define rev(v)		     reverse(v.begin(), v.end())       // reverse the vector

#define mii			     std::map <int,int>
#define multimii		 std::multimap <int,int>
#define mss			     map <string, string>

#define w(t)             unsigned int t; cin >> t; while(t--)      //  usage: create quickly number of test
mt19937                  rng(chrono::steady_clock::now().time_since_epoch().count());

void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
//==================================6


//==================================
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	c_p_c();
	//--------------------------------


	string s;
	cin >> s;

	cout << s.substr(0, 3);





	return 0;
}

Measured memory_bytes: 3668
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: i32 = read();
    let odd = (1..n + 1).filter(|x| x % 2 == 1).count();
    println!("{}", odd as f64 / n as f64);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
import numpy as np
N,M,K = map(int, input().split())

A = np.array([0] + list(map(int, input().split())))
B = np.array([0] + list(map(int, input().split())))

CA = np.cumsum(A)
CB = np.cumsum(B)

ans = 0
for i in range(N+1):
  if CA[i] > K:
    break
  j = np.searchsorted(CB, K-CA[i], side='right') - 1
  ans = max(ans, i+j)
  #print(ans,i,j)
  
#print(CA)
#print(CB)
print(ans)

Measured memory_bytes: 53388
#include <bits/stdc++.h>
using namespace std;
 
    int main() {
        int64_t N, ans;
        cin >> N;
        if (N>=10) {
            ans = N % 10;
        }
        else 
        { ans = N; }


        if (ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9)
        { cout << "hon" << endl; }
        else if (ans == 0 || ans == 1 || ans == 6 || ans == 8)
        {
            cout << "pon" << endl;
        }
        else
        {
            cout << "bon" << endl;
        }
        
 
    }

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

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

    // K以下の数を貪欲に決める
    ll ans = 0;
    for (int d = 60; d >= -1; d--) { // XがKと上位d桁目より上が一致しているとする d = -1 は X = K の場合
        if (d != -1 && !(K & (1LL << d))) continue; // Kのd桁目が1でない場合はスキップ

        ll tmp = 0;
        for (int e = 60; e >= 0; e--) {
            ll mask = 1LL << e;
            int cnt = 0;
            rep(i, N) if (A[i] & mask) ++cnt; // A[i]のe桁目が立っている数をカウント

            if (e > d) { // dより上位桁はKに合わせて集計
                if (K & mask) tmp += mask * (N - cnt);
                else tmp += mask * cnt;
            } else if (e == d) { // d桁目はKが1なので,Xは0として集計
                tmp += mask * cnt;
            } else { // d桁目未満のbitは自由に決めてよい
                tmp += mask * max(cnt, N - cnt);
            }
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
h, w = input().split()
h = int(h)
w = int(w)
field = []
for _ in range(h):
    field.append(input())
    
ans = True
for i in range(h):
    for j in range(w):
        if field[i][j] == '#':
            temp = 1
            dd = [(1, 0), (-1, 0), (0, 1), (0, -1)]
            for ddd in dd:
                dx, dy = ddd
                nx, ny = i + dx, j + dy
                if nx >= 0 and nx < h and ny >= 0 and ny < w and field[nx][ny] == '#':
                    temp += 1
            if temp == 1:
                ans = False
                break

if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long MOD=(long long)(1e9+7);
vector<int> graph[(int)(1e5+7)];


int main()
{
int n;
cin>>n;
vector<long long> h(n),a(n);
int base=1;
while(base<=n)
base*=2;

for(int i=0;i<n;i++)
{
cin>>h[i];
}
for(int i=0;i<n;i++)
{
cin>>a[i];
}
//sorted heights
vector<long long> tree(2*base);

vector<long long > dp((long long)(2e5+8),0);
//n^2
//optimise to nlogn
int pos;
 long long ans=0;
dp[0]=a[0];
for(int i=0;i<n;i++)
{
long long best=0;
int ind=base+h[i];
//max of dp[i] for i in range (0,h[i]);
while(ind>1)
{
    if(ind%2==1)
    {
        best=max(best,tree[ind-1]);
    }
    ind/=2;
}
dp[h[i]]=best+a[i];
//update dp[i]
for(int j=base+h[i];j>=1;j/=2)
{
    tree[j]=max(tree[j],dp[h[i]]);
}

}


for(int i=0;i<n;i++)
{
    ans=max(ans,dp[h[i]]);
}
cout<<ans<<endl;
}

Measured memory_bytes: 11392
//organize and stay in moment - Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
#define MAXN (int)2e5+5
#define pb push_back
int mod= 998244353;
int arr[MAXN];
int as;
void input(){
  cin>>as;
  f(i,0,as) cin>>arr[i];
}
void q1(){
  string s; cin>>s;
  int a=0,b=0;
  f(i,0,3)
  s[i]=='A'  ? ++a : ++b;
  if(a&&b)
    cout<<"Yes";
  else cout<<"No";
}
void q2(){
  int n,a,b;
  cin>>n>>a>>b;
  int t=a+b;
  int q=n/t;
  int ans=q*a;
  int r=n%t;
  ans+=min(r,a);
  cout<<ans;
}
void q3(){
  int a,b; cin>>a>>b;
  for(int i=1;i<=100000;++i){
    int x=i*8; x/=100;
    int y=i*10; y/=100;
    if(x==a && y==b){
      cout<<i;
      return ;
    }
  }
  cout<<-1;
}
void q4(){
  string s; cin>>s;
  deque<int> q;
  f(i,0,s.size())
  q.push_back(s[i]);
  int Q; cin>>Q;
  int curr=0; 
  //wtf....
  while(Q--){
    int t;
    cin>>t;
    if(t==1){
      curr=1-curr;
    }else{
      int f;char c; cin>>f>>c;
      if(curr==0 && f==1)
        q.push_front(c);
      else if(curr==0 && f==2)
        q.push_back(c);
      else if(curr==1 && f==1)
        q.push_back(c);
      else q.push_front(c);
    }
    //cout<<curr<<" ";
    
  }
  string ret="";
  while(!q.empty()){
    ret+=q.front();
    q.pop_front();
  }
//  cout<<curr<<" ";
  if(curr)
     reverse(ret.begin(),ret.end());
   cout<<ret;
   return ;
}
void q5(){
  int n,p; cin>>n>>p;
  string s; cin>>s;
  int ans=0;
  if(p==2 || p==5){
    f(i,0,n)
    if((s[i]-'0')%p==0)
      ans+=i+1;
  }else {
    int tt=1;
    int curr=0;
     map<int,int> mp;
     mp[0]++;
     for(int i=n-1;i>=0;--i){
        curr+=(s[i]-'0')*tt;
        tt*=10;
        // if curr value if 0 then the above mp[0]++ hnadles it
        //if it is not then it avoides taking i with i again (you cant make i with i if it is not divisible by p)               
        ans+=mp[curr];
        ++mp[curr];
     }
  }
  cout<<ans;
}
int mod2=998244353;
void solve(){
  int n; cin>>n;
  array<int,2> ar[n];
  f(i,0,n) cin>>ar[i][0]>>ar[i][1];
  sort(ar,ar+n);
  int dp[n+1];
  dp[n]=1;
  //there are two ways activate i or do not activate it
  //if we activate it then the number of configurations is same as the highest one say j that is not effected
  // else it is i+1 since it wont be affected.
  //dp[i]=dp[i+1]+dp[j]
  stack<int> id,dis;
  id.push(n); dis.push((int)2e10);
  for(int i=n-1;i>=0;--i){
    while(dis.top()<ar[i][0]+ar[i][1]){
      dis.pop(); id.pop();
    }
    int j=id.top();
    dp[i]=dp[j];dp[i]%=mod2;
    dp[i]+=dp[i+1]; dp[i]%=mod2;
    id.push(i); dis.push(ar[i][0]);
  }
  cout<<dp[0];
  //yay!!
}
int32_t main()
{
  int t; t=1; //cin>>t;
  while(t--) solve();
  return 0;
}


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

int main()
{
	int a,ge,shi,bai,b=7;
	cin >> a;
	ge=a%10;
	shi=a/10%10;
	bai=a/100;
	if(ge==b)
	{
		cout << "Yes";
		return 0;
	}
	else if(shi==b)
	{
		cout << "Yes" ;
		return 0;
	}
	else if(bai==b)
	{
		cout << "Yes" ;
		return 0;
	}
	else
	{
		cout << "No";
		return 0;
	}
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)
#define abs(a,b) (a-b>0 ? a-b : b-a)
 
int main()
{
  long  long a,b,v,w;
long double t;

  cin >> a>>v>>b>>w>>t;

long double tmp=abs(a,b)/t*10;
long long ans=(long long)tmp;
tmp=(long double)ans/10;

if(v-w >= tmp)
 cout << "YES" << endl;
else
 cout <<"NO" << endl;
}
  

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

int main() {

	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	
	int min1 = min(abs(A1 - A2) + abs(A2 - A3), abs(A1 - A3) + abs(A1 - A2));
	int min2 = min(abs(A2 - A1) + abs(A1 - A3), abs(A2 - A3) + abs(A3 - A1));
	int min3 = min(abs(A3 - A1) + abs(A1 - A2), abs(A3 - A2) + abs(A2 - A1));
	min1 = min({ min1,min2,min3 });
	cout << min1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <climits>

using namespace std;

struct unionfind {
  vector<int> dat;

  unionfind(int n) : dat(n, -1) {}

  int find(int x) {
    if (dat[x] < 0) return x;
    return dat[x] = find(dat[x]);
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (dat[x] > dat[y]) swap(x, y);
    dat[x] += dat[y];
    dat[y] = x;
  }

  int size(int x) {
    return -dat[find(x)];
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  vector<pair<int, int>> AB(N + 2);
  for (int i = 0; i < N; i++) {
    cin >> AB[i].first >> AB[i].second;
  }
  AB[N] = make_pair(INT_MIN, 0);
  AB[N + 1] = make_pair(INT_MAX, 0);
  sort(AB.begin(), AB.end());
  vector<int> A(N + 2), B(N + 2);
  for (int i = 0; i < N + 2; i++) {
    A[i] = AB[i].first;
    B[i] = AB[i].second;
  }
  vector<int> d(N + 1);
  for (int i = 0; i < N + 1; i++) {
    d[i] = B[i + 1] ^ B[i];
  }
  vector<vector<int>> G(N + 1);
  vector<int> U(M, -1), V(M, -1);
  unionfind uf(N + 1);
  for (int i = 0; i < M; i++) {
    int L, R; cin >> L >> R;
    int l = lower_bound(A.begin(), A.end(), L) - A.begin();
    int r = (int)(upper_bound(A.begin(), A.end(), R) - A.begin()) - 1;
    if (l <= r) {
      U[i] = l - 1;
      V[i] = r;
      if (uf.find(U[i]) != uf.find(V[i])) {
        G[U[i]].push_back(i);
        G[V[i]].push_back(i);
        uf.unite(U[i], V[i]);
      }
    }
  }
  vector<int> ans(M);
  auto dfs = [&](auto dfs, int u, int p) -> int {
    int x = d[u];
    for (int i : G[u]) {
      int v = U[i] ^ V[i] ^ u;
      if (v == p) continue;
      int y = dfs(dfs, v, u);
      if (y == 1) {
        ans[i] = 1;
      }
      x ^= y;
    }
    return x;
  };
  for (int i = 0; i < N + 1; i++) {
    if (uf.find(i) == i) {
      if (dfs(dfs, i, -1) == 1) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  vector<int> out;
  for (int i = 0; i < M; i++) {
    if (ans[i] == 1) {
      out.push_back(i);
    }
  }
  cout << out.size() << endl;
  for (int i = 0; i < out.size(); i++) {
    cout << out[i] + 1 << " \n"[i == out.size() - 1];
  }
}

Measured memory_bytes: 11132
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

typedef pair<int,int> pii;

vector<pii> P;

string s,t,rev;

const int MAX_N = 1001;

int dp[MAX_N][MAX_N];

void trace(int i,int j){
	if(dp[i][j] == dp[i-1][j] && dp[i][j] == dp[i][j-1]){
		trace(i-1,j-1);	//??????????§????
	}else if(dp[i][j] == dp[i-1][j]){
		trace(i-1,j);	//???????§????
	}else if(dp[i][j] == dp[i][j-1]){
		trace(i,j-1);	//???????§????
	}else{
		rev += s[i-1];
		if(dp[i-1][j-1] == 0){
			return;
		}
		trace(i-1,j-1);	//??????????§????
	}
}
int main()
{
	string com;
	int n;
	cin >> n;
	for(int l=0;l<n;l++){
	cin >> s;
	cin >> t;
	for(int i=0;i<=s.length();i++){
		dp[i][0] = 0;
	}
	for(int i=0;i<=t.length();i++){
		dp[0][i] = 0;
	}
	for(int i=1;i<=s.length();i++){
		for(int j=1;j<=t.length();j++){
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1]+1;
			}else{
				dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
			}
		}
	}
	printf("%d\n",dp[s.length()][t.length()]);
	}
	/*
	trace(s.length(),t.length());
	for(int i=rev.length();i>0;i--){
		com += rev[i-1];
	}
	cout << com << "\n";	//????????±?????¨???????????????????????????
	*/
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    int32 h[n];
    REP(i,n)cin >> h[i];
    int32 ans = 0;
    int32 cnt = 0;
    REP(i,n-1){
        if(h[i] >= h[i+1]){
            cnt++;
            ans = max(ans, cnt);
        }else{
            cnt = 0;
        }
    }
    ANS(ans);
    return 0;
}

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

std::string string_sort(const std::string& str, const bool up){
    std::vector<char> vec(str.begin(), str.end());
    std::sort(vec.begin(), vec.end());
    if(up){
        std::reverse(vec.begin(), vec.end());
    }
    std::string ret(vec.begin(), vec.end());
    return ret;
}

int main(int argc, char **argv)
{
    std::string s, t;
    std::cin >> s;
    std::cin >> t;

    std::string ss = string_sort(s, false);
    std::string tt = string_sort(t, true);

    int len = std::min(ss.size(), tt.size());

    int comp = 0;
    for(int i = 0; i < len; i++){
        if(ss.at(i) < tt.at(i)){
            comp = 1;
            break;
        }else if(ss.at(i) > tt.at(i)){
            comp = -1;
            break;
        }
    }
    if(comp == 0){
        if(ss.size() < tt.size())
            comp = 1;
    }

    if(comp > 0)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long a[100005][2],cnt1[100005],cnt2[100005];
int main()
{
    long long n,c,i,j,l,ans,sum;
    scanf("%lld%lld",&n,&c);
    for(i=0;i<n;i++)
        scanf("%lld%lld",&a[i][0],&a[i][1]);
    ans=0;
    sum=0;
    memset(cnt1,0,sizeof(cnt1));
    memset(cnt2,0,sizeof(cnt2));
    for(i=0;i<n;i++)
    {
        sum+=a[i][1]-a[i][0];
        if(i!=0) cnt1[i]=max(cnt1[i-1],sum);
        else cnt1[0]=sum;
        sum+=a[i][0];
    }
    sum=0;
    for(i=0;i<n;i++)
    {
        sum+=a[n-1-i][1]-c+a[n-1-i][0];
        if(i!=0) cnt2[i]=max(cnt2[i-1],sum);
        else cnt2[0]=sum;
        sum+=c-a[n-1-i][0];
    }
    ans=max(ans,cnt1[n-1]);
    ans=max(ans,cnt2[n-1]);
    sum=0;
    for(i=0;i<n-1;i++)
    {
        sum+=cnt2[n-i-2];
        sum+=a[i][1]-2*a[i][0];
        ans=max(ans,sum);
        sum+=2*a[i][0];
        sum-=cnt2[n-i-2];
    }
    sum=0;
    for(i=0;i<n-1;i++)
    {
        sum+=cnt1[n-i-2];
        sum+=a[n-1-i][1]-2*c+2*a[n-1-i][0];
        ans=max(ans,sum);
        sum+=2*c-2*a[n-1-i][0];
        sum-=cnt1[n-i-2];
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main(void) {
  string w, out = "Yes";
  cin >> w;
  map<char, int> m;
  for (auto s : w) {
    m[s]++;
  }
  for (auto v : m) {
    if (v.second % 2 != 0) {
      out = "No";
      break;
    }
  }
  cout << out << endl;
  return 0;
}

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

int main(){
  string s1,s2;
  int a,b;
  string s3;
  cin>>s1>>s2>>a>>b>>s3;

  if(s3==s1){
    a--;
  }else{
    b--;
  }
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
// ================
// Himanshu Lal
// MNIT Jaipur
// ================
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define TEZ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define INF 1e18
#define vi vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp map<ll,ll>
#define test ll tp; cin>>tp; while(tp--)
#define srt(v) sort(v.begin(),v.end())
double pi=acos(-1);
void OJ(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
}
int main(){
    TEZ;
    ll n,d,c=0;
    cin>>n>>d;
    f(i,0,n){
        ll x,y;
        cin>>x>>y;
        ll dis=(x*x)+(y*y);
        if(sqrt(dis)<=d)
            c++;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 3724
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cctype>
#include <ctime>

int nextch(void)
{
    static char bufdatum[BUFSIZ];
    static char *buf = bufdatum, *endbuf = bufdatum;
    if (endbuf == buf)
    {
        endbuf = (buf = bufdatum) + fread(bufdatum, 1, BUFSIZ, stdin);
        if (endbuf == buf)
            return EOF;
    }
    return *buf++;
}

void legit(void) {}

template<typename Car, typename ...Cdr>
void legit(Car &var, Cdr &...Rest)
{
    int peek;
    while (!isdigit(peek = nextch())
#ifdef LEGIT_NEGI
        && peek != '-'
#endif  // LEGIT_NEGI
        )
        ;
#ifdef LEGIT_NEGI
    bool negi;
    if (peek == '-')
        negi = true;
    else
        negi = false;
#endif  // LEGIT_NEGI
    var = 0;
    do
        var = (((var << 2) + var) << 1) + (peek ^ '0');
    while (isdigit(peek = nextch()));
#ifdef LEGIT_NEGI
    if (negi)
        var = -var;
#endif  // LEGIT_NEGI
    legit(Rest...);
}

void solve(void);

int main(void)
{
#ifdef redirect
    freopen("check/data.in", "r", stdin);
    freopen("check/prog.out", "w", stdout);
    freopen("check/log.out", "w", stderr);
#endif  // redirect
#ifdef chrono
    auto begtm = clock();
#endif  // chrono
    solve();
#ifdef chrono
    auto endtm = clock();
    printf("%f\n", static_cast<float>(endtm - begtm) / CLOCKS_PER_SEC);
#endif  // chrono
    return 0;
}

size_t n;

void solve(void)
{
    legit(n);
    size_t tmp = n;
    size_t sum = 0;
    while (tmp != 0)
    {
        sum += tmp % 10;
        tmp /= 10;
    }
    printf(n % sum == 0 ? "Yes\n" : "No\n");
}



Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inp() for _ in range(n)]
now = 0
s = set()
s.add(0)
cnt = 0
while True:
    nx = a[now] - 1
    cnt += 1
    if nx == 1:
        print(cnt)
        break
    if nx in s:
        print(-1)
        break
    s.add(nx)
    now = nx


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

int main()
{
  int n, k;
  cin >> n >> k;
  if(n >= k + k - 1) {
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256