akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

#define REPI(i, a, n)	for(ll (i)=(a);(i)<(int)(n);(i++))
#define REP(i,n) REPI(i,0,n)
#define REP1(i,n) for(ll (i)=1;(i)<=(n);(i++))
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
 
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;
 
	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
 
/*template<class T>
void VecUniqErs(vector<T> *v) {
	std::sort(ALL(v));
	&v.erase(unique(ALL(&v)), &v.end());
}*/

template<class T, class S>
bool contains(std::vector<T> vec, S number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return true;
	}
	else { // 発見できなかったとき
		return false;
	}
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll fact(ll n) {
	ll m;
	if (n == 0) {
		return 1;
	}
	m = fact(n - 1);
	return n * m;
}
 
ll Combination(unsigned long long n, unsigned long long r) {
	if (r * 2 > n) r = n - r;
	uintmax_t dividend = 1;
	uintmax_t divisor = 1;
	for (unsigned int i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
 
struct vec {
	ll x, y;
 
	bool operator == (const vec &v) const{
		return x == v.x && y == v.y;
	}
 
};
 
namespace std {
	template<>
	class hash<vec> {
	public:
		size_t operator () (const vec& p) const { return p.x%SIZE_MAX; }
	};
}

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, K;
	cin >> N >> K;
	vector<ll> h(110000);
	ll k;
	REP(i, N)
	{
		cin >> h[i];
	}
	vector<ll> dp(110000);
	dp[0] = 0;
	REP1(i,110000){
		dp[i] = INF;
	}
	REP(i, N){
		REP1(l, K){
			if(i-l < 0) break;
			chmin(dp[i], dp[i-l] + abs(h[i] - h[i - l]));
		}
	}

	cout << dp[N-1] << endl;
	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)

int main() {
	int N;
	cin>>N;
	cout<<N/3<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string key = "keyence";
  string s;
  int cnt = 0;
  
  cin >> s;

  for(int i = 0;i < s.size();i++){
	if(s[i] != key[0]){
	  int pos;
	  if((pos = s.rfind(key)) == -1 || pos + key.size() < s.size()){
		cnt = 1;
		break;
	  }
	}else{
	  key.erase(key.begin());
	}
  }
 
  if(cnt < 1) cout << "YES" << endl;
  else        cout << "NO" << endl;
	  
  return 0;
}


Measured memory_bytes: 384
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

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

    string s;
    while (cin >> s) {
        int ans = 0;
        string t = "CODEFESTIVAL2016";
        for (int i = 0; i < 16; i++) {
            ans += t[i] != s[i];
        }
        cout << (ans) << endl;
    }
}

Measured memory_bytes: 764
n = int(input())
lencnt = 1
lencut = 27
for i in range(1,12):
  if n<lencut:
    break
  else:
    lencnt += 1
    lencut = lencut+(26**lencnt)
ans = ""
rem = n
for i in range(lencnt,-1,-1):
  prevlencut = lencut-(26**i)
  quot = (rem-prevlencut)//(26**i)
  ans = ans + chr(quot+96)
  rem = rem-(quot*(26**i))
  lencut = int(prevlencut)
print(ans[1:])

Measured memory_bytes: 9208
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            ArrayList<Integer> sumList;
            int tmp;
            while (true) {
                int n = Integer.parseInt(br.readLine());
                if (n == 0) {
                    System.exit(0);
                }
                tmp = 0;
                sumList = new ArrayList<>();
                sumList.add(0);
                for (int i = 0; i < n; i++) {
                    tmp += Integer.parseInt(br.readLine());
                    sumList.add(tmp);
                }

                int sum;
                int max = -100000 * 5000;
                for (int i = 0; i < sumList.size() - 1; i++) {
                    for (int j = i + 1; j < sumList.size() ; j++) {
                        sum = sumList.get(j) - sumList.get(i);
                        max = sum > max ? sum : max;
                    }
                }
                System.out.println(max);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

Measured memory_bytes: 29852
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
    input_stdin += data;
});

process.on('SIGINT', function(){
    input_stdin_array = input_stdin.split("\n");
    main();
    process.exit();
});

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();    
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////

function main() {
	var s = readLine().split(" ");
	var N = parseInt(s[0]); var X = parseInt(s[1]);
	s = readLine().split(" ");
	var a=[];
	for (var i=0; i < N; i++) 
		a.push(parseInt(s[i]));
	var ans=0;
	for (var i=0; i < N; i++){
		if (a[i] > X) {
			ans += a[i]-X;
			a[i] = X;
		}
	}
	
	for (var i=0; i < N-1; i++){
		if (a[i] + a[i+1] > X){
			ans += a[i] + a[i+1] - X;
			a[i+1] -= a[i] + a[i+1] - X;
		}
	}

	console.log(ans.toString());
}


Measured memory_bytes: 29760
// template version 1.2
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int n;cin>>n;

  if (n==1) {
    cout << "Hello World" << endl;
  }
  else{
    int a,b;cin>>a>>b;
    cout << a+b << endl;
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

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


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 200010

ll N;
ll A[MAX_N] = {};

ll func(ll n) {
    ll res = 0;
    REP(i, N) {
        res += abs(A[i] - n);
    }
    return res;
}

signed main()
{
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        A[i] = A[i] - (i + 1);
    }
    ll ans = LLINF;
    ll lb = -1000000000;
    ll ub = 1000000000;
    while(1) {
        ll mid = lb + (ub - lb) / 2;
        ll cand1 = func(mid+1);
        ll cand2 = func(mid);
        ll cand3 = func(mid-1);
        if(cand2 <= cand1 && cand2 <= cand3) {
            ans = cand2;
            break;
        }
        else if(cand1 <= cand2 && cand1 <= cand3) {
            lb = mid;
        }
        else if(cand3 <= cand2 && cand3 <= cand1) {
            ub = mid;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
package main

import (
        "fmt"
)

func main() {
        D()
}

func D() {
        var h int
        fmt.Scan(&h)
        if h == 1 {
                fmt.Println(1)
                return
        }

        sum := 1
        for h != 1 {
                h /= 2
                sum *= 2
        }
        sum = sum*2 - 1
        fmt.Println(sum)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <unordered_map>

using namespace std;

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a)
    cin >> i;
  unordered_map<int, int> mp;
  ll ans{};
  for (int i = 0; i < n; i++)
  {
    mp[i - a[i]]++;
  }
  for (int i = 0; i < n; i++)
  {
    ans += mp[a[i] + i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 19360
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
bool sortinrev(const pair<pair<string,ll>,ll> &a,
               const pair<pair<string,ll>,ll> &b)
{    if(a.f.f==b.f.f)
            return (a.f.s>b.f.s);
     return (a.f.f<b.f.f);
}
void solve()
{   ll n,m,k,y,x,res=0,l,cnt0=0,z,sum1=0,cnt1=0,h,res1,cnt=0;
    cin>>n;
    string s;
    vector<pair<pair<string,ll>,ll>> v;
    rep(i,0,n)
    {
        cin>>s;
        cin>>x;
        v.pb({{s,x},i+1});
    }
    sort(v.begin(),v.end(),sortinrev);
    rep(i,0,n)
    cout<<v[i].s<<"\n";

}
int main()
{   speed_up
    ll t;
   //cin>>t;
    t=1;
    while(t--)
        solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,x,y;
    cin >> n;
    std::vector<pair<int,int>> vec(n);
    for (int i=0;i<n;i++) {
        cin >> x >> y;
        vec[i] = make_pair(x,y);
    }
    sort(vec.begin(),vec.end());
    for (int j=0;j<vec.size();j++) {
        cout << vec[j].first << " " << vec[j].second << endl;
    }
}



Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

string solve(int n, vector<int>& l) {
  sort(l.begin(), l.end());
  int sum = accumulate(l.begin(), l.end(), 0) - l.back();
  if (l.back() < sum)
    return "Yes";
  return "No";
}

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  REP(i, n) cin >> l[i];
  cout << solve(n, l) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
#define PI  acos(-1)
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string S;cin>>S;
  int res=0,a=0;
  REP(i,0,S.size()){
    if(S.at(i)=='A'){
      a++;
    } else if(S.at(i)=='B') {
      if(i+1<S.size()&&S.at(i+1)=='C'){
        res+=a;
        i++;
      } else{
        a=0;
      }
    }
    else {
      a=0;
    }
  }
  print(res);

}


Measured memory_bytes: 720
#include <iostream>
#include <algorithm>

using namespace std;

int st[100005],dr[100005];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>st[i]>>dr[i];
    sort(st,st+n+1);
    sort(dr,dr+n+1);
    long long sol=0;
    for(int i=0;i<=n;i++)
    {
        if(dr[i]>=st[n-i])
            break;
        sol+=st[n-i]-dr[i];
    }
    cout<<sol*2;


    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
int read()
{
    char ch = getchar();
	int x = 0, f = 1;
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}
int main()
{
 int y,m,d;
 scanf("%d/%d/%d",&y,&m,&d);
int md=y*365+m*30+d*1;
int ans=2019*365+4*30+30;
//cout<<y<<" "<<m<<" "<<d;
if(md<=ans)
printf("Heisei");
else
printf("TBD");
 
}



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

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#define fi first
#define se second
#define pb push_back
#define last(s) (s)[(s).length()-1]
#define all(a) (a).begin(),(a).end()
#define elif else if
#define left asdasd
#define kchay ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

using llong = long long;
using ld = long double;
using ii = pair<int,int>;
using ull = unsigned long long;
using pll = pair<llong, llong>;

const llong over999 = 1e16;
const llong md = 1e9+7;
const ld eps = 1e-9;
const ld Pi = acos(-1);

/*see the sunlight*/

llong n, dp[60];

string s, c;

int32_t main()
{
    kchay;
    
    cin >> n;
    
    cin >> s;
    cin >> c;
    
    if(s[0] == c[0])dp[0] = 3; else dp[0] = 6;
    
    for(int i = 1; i < n; i++)
    {
        if(s[i] == s[i-1] && c[i] == c[i-1])
        {
            dp[i] = dp[i-1];
            continue;
        }
        if(s[i-1] == c[i-1]) 
        {
            dp[i] = (dp[i-1]*2)%md;
        } else {
            if(s[i] != c[i])dp[i] = (dp[i-1]*3)%md; else dp[i] = dp[i-1];
        }
    }
    
    cout << dp[n-1];
    
    
    return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll n, h, max_a = 0;
vector<ll> a, b;

void solve() {
    sort(b.begin(), b.end(), greater<>());
    ll ans = 0;
    each(i, b) {
        if (i >= max_a) {
            h -= i;
            ans++;
            if (h <= 0) break;
        } else {
            break;
        }
    }

    if (h > 0) ans += (h % max_a == 0 ? h / max_a : (h / max_a + 1));
    cout << ans << endl;
}

int main() {
    cin >> n >> h;
    a.resize(n);
    b.resize(n);
    rep(i, n) {
        cin >> a[i] >> b[i];
        max_a = max(a[i], max_a);
    }
    solve();
    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s ; cin >> s ;
	int cnt = 0 ;
	for(int i=0;i<4;i++) if(s.at(i)=='2') cnt++ ;
	cout << cnt << endl ;
}


Measured memory_bytes: 256
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR
#include <iostream>
auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:

private:

};

int solve() {
    Solution solution;
    // handle IO here
    int T, X;
    cin >> T >> X;
    cout << setprecision(8) << double(T) / double(X) << "\n";
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,x;
    long long p=0;
    cin>>n>>k;
    long long a[n];


        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        for(int i=0;i<n-k;i++)
        {
            p=p+a[i];
        }
        cout<<p<<endl;





     return 0;
}


Measured memory_bytes: 1792
n = int(input())
a = input().split()
a_odd = a[1::2]
a_even = a[0::2]

if n % 2 == 0:
    a_odd.reverse()
    ans = a_odd + a_even
else:
    a_even.reverse()
    ans = a_even + a_odd
print(' '.join(ans))

Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 * 2;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	int count = 1;
	int out = 0;
	rep(i, n - 1){
		if(a[i] == a[i + 1]) count++;
		else{
			if(count % 2 == 1) out++;
			count = 1;
		}
	}
	if(count % 2 == 1) out++;
	cout << out << endl;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

bool judge(vector<int> a, vector<int> b) {
    int length = a.size();
    bool ans = true;
    rep(i, length) {
        if (a[i] != b[i])
            ans = false;
    }
    return ans;
}

int main() {
    // source
    int n;
    cin >> n;

    vector<int> p(n), q(n);
    rep(i, n) { cin >> p[i]; }
    rep(i, n) { cin >> q[i]; }

    vector<int> temp(n);
    rep(i, n) { temp[i] = p[i]; }

    sort(temp.begin(), temp.end());
    int num0, num1;

    int counter = 0;
    do {
        if (judge(p, temp)) {
            num0 = counter;
        }
        if (judge(q, temp)) {
            num1 = counter;
        }
        counter++;
    } while (next_permutation(temp.begin(), temp.end()));

    cout << abs(num0 - num1) << endl;

    return 0;
}



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

using namespace std;

#define debug printf("Debug\n");
#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define p_b push_back
#define m_p make_pair

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
vector<ll>v;


int main(){
    _fastio
    ll H,a;
    cin>>H>>a;

    ll s=0;
    for(ll i=1;i<=a;i++){
        ll x;
        cin>>x;
        s+=x;
    }

    if(s>=H) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<stdlib.h>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	long long int a, b, c;
	long long int p, q, r;
	long long int count = 0;

	cin >> a >> b >> c;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		if (a==b&&b==c) {
			count = -1;
			break;
		}
		p = a / 2;
		q = b / 2;
		r = c / 2;
		a = 0;
		b = 0;
		c = 0;
		a += q + r;
		b += p + r;
		c += p + q;
		count++;
		if (count >= 1000000) {
			count = -1;
			break;
		}
	}
	
	if (count == -1) {
		cout << -1 << endl;
	}
	else {
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    set_A = set([])
    for num in A:
        if num in set_A:
            print('NO')
            return
        set_A.add(num)
    print('YES')

if __name__ == "__main__":
    solve()

Measured memory_bytes: 31168
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

char t[1000], s[1000];
int n, ma=0;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	cin>>s;
	cin>>t;

	for(int i=0;i<n;i++){
		int j=i, a=0, c=0;
		while(s[j]==t[a]&&j<n){
			c++;
			j++;
			a++;
		}
		if(j!=n)c=0;
		ma=max(ma, c);
	}
	cout<<2*n -ma;
	return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;
using namespace std;

signed main() {
  string s;
  cin>>s;
  set<char> se;
  rep(i,0,4)
    se.insert(s[i]);
  sort(begin(s), end(s));
  if (se.size() == 2 && s[0] == s[1] && s[2] == s[3])
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    rep(i, 0, 26){
        string t = "";
        t += 'a' + i;
        if(s.find(t) == string::npos){
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
def main():
    A = [[int(i) for i in input().split()] for j in range(3)]
    for i in range(1, 3):
        for j in range(3):
            A[i][j] -= A[0][j]
    if (A[1][0] == A[1][1] == A[1][2]) and (A[2][0] == A[2][1] == A[2][2]):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max()/2;
const int MOD = 1e9+7;

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

    int n,m;cin>>n>>m;
    vector<P> v(m);
    for(int i=0;i<m;i++){
        int x,y;cin>>x>>y;
        v[i]=P(x,y);
    }
    vector<P> w(n+1);
    for(int i=1;i<=n;i++){
        w[i]=P(i,i);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<m;i++){
        int y=v[i].second;
        w[y].second=w[y+1].second;
        w[y+1].first=w[y].first;
    }
    for(int i=1;i<=n;i++){
        int res=w[i].second-w[i].first+1;
        if(i==1) cout<<res;
        else cout<<" "<<res;
    }
    cout<<endl;
}


Measured memory_bytes: 5152
n = int(input())
c = list(input())

l = 0
r = n - 1
count = 0

while True:
    while c[l] == "R" and l < r:
        l += 1
    while c[r] == "W" and l < r:
        r -= 1

    if r == l:
        break

    c[r], c[l] = c[l], c[r]

    count += 1

print(count)


Measured memory_bytes: 77108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    if (S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(2) != S.at(3))
    {
        cout << "Good" << endl;
    }
    else
    {
        cout << "Bad" << endl;
    }
    
    
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
typedef long long int LL;
const int INF=1e9+7;
const int TILL=25;
int t[200005];
bool x[TILL];
int before=0;

bool check(int p){
	for(int i=0;i<TILL;i++){
		if((p&(1<<i)) && x[i])return false;
	}
	return true;
}

void del(){
	for(int i=0;i<TILL;i++){
		if(t[before]&(1<<i))x[i]=false;
	}
	before++;
}

void ins(int p){
	for(int i=0;i<TILL;i++){
		if(p&(1<<i))x[i]=true;
	}
}

int main(){
	int n;
	int i,j,k;
	int a=0,b=0;
	LL s=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>t[i];
	}
	for(i=0;i<n;i++){
		while(!check(t[i])){del();}
		ins(t[i]);
		s+=(i-before+1);
	}
	cout<<s<<endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  vector<int> a(4);
  cin >> a;
  int ans = INF;
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 4; j++) {
      int s = 0, t = 0;
      for (int k = 0; k < 4; k++) {
        if (i == k || j == k)
          s += a[k];
        else
          t += a[k];
      }
      chmin(ans, abs(s - t));
    }
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}



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


int main() {
  int n;
  cin>>n;
  string s,t,u="";
  cin>>s>>t;
  for(int i=0;i<n;i++)
  {
      u=u+s[i]+t[i];
  }
cout<<u<<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int p = stdIn.nextInt();
		int q = stdIn.nextInt();
		int r = stdIn.nextInt();
		
		int a = p+q;
		int b = q+r;
		int c = p+r;
		
		int min = Integer.MAX_VALUE;
		min = Math.min(a, b);
		min = Math.min(min, c);
		
		System.out.println(min);
		
		
		
		
		
	}

}


Measured memory_bytes: 21844
'use strict'
function main(inp) {
  inp = inp.trim().split(' ').map(n => Number(n));
  if (inp[0] < inp[1] * 2) {
    console.log(0)
  } else {
    console.log(inp[0] - inp[1] * 2)
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 22080
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<char> A(3);
    for (int i = 0; i < 3; i++) {
        cin >> A.at(i);
    }
    int C = 0;
    int D = 0;
    for (int i = 0; i < 3; i++) {
        if (A.at(i) == '5') {
            C++;
        }
        else if (A.at(i) == '7') {
            D++;
        }
    }
    if (C == 2 && D == 1) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

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

int main () {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 1; i <= N; i++) {
    int tmp;
    cin >> tmp;
    vec[tmp - 1] = i;
  }
  for (int i = 0; i < vec.size(); i++) {
    cout << vec[i];
    if (vec.size() - 1 != i ) {
      cout << " ";
    } 
  }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=5005,mod=1e9+7;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
int n;
int Fac2[N];
vector <int> e[N],dp[N];
vector <int> Merge(vector <int> a,vector <int> b){
	vector <int> c(a.size()+b.size()-1);
	For(i,0,(int)a.size()-1)
		For(j,0,(int)b.size()-1)
			Add(c[i+j],(LL)a[i]*b[j]%mod);
	return c;
}
void dfs(int x,int pre=0){
	dp[x].resize(2);
	dp[x][0]=0,dp[x][1]=1;
	for (auto y : e[x])
		if (y!=pre){
			dfs(y,x);
			dp[x]=Merge(dp[x],dp[y]);
		}
	assert(dp[x][0]==0);
	for (int i=2;i<(int)dp[x].size();i+=2)
		Del(dp[x][0],(LL)dp[x][i]*Fac2[i/2]%mod);
}
int main(){
	n=read();
	For(i,1,n-1){
		int x=read(),y=read();
		e[x].pb(y),e[y].pb(x);
	}
	Fac2[1]=1;
	For(i,2,n)
		Fac2[i]=(LL)Fac2[i-1]*(i*2-1)%mod;
	dfs(1);
	cout<<Del(-dp[1][0])<<endl;
	return 0;
}

Measured memory_bytes: 36096
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <sstream>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;

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

    int max = 0;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        if (tmp % 2 == 0 && (tmp % 3 != 0 && tmp % 5 != 0))
        {
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  scanf("%d", &n);
  
  vector<int> a;
  SV(n,a);

  llong sum = 0, count = 0, sign = 1;
  llong ans = 0;
  REP(i,n){
    llong tmp;
    if(sign == 1){
      if(sum + a[i] < 0){
        sum += a[i];
      }else{
        tmp = -1 - sum;
        count += abs(tmp - a[i]);
        sum += tmp;
      }
      sign *= -1;
    }else{
      if(sum + a[i] > 0){
        sum += a[i];
      }else{
        tmp = 1 - sum;
        count += abs(tmp - a[i]);
        sum += tmp;
      }
      sign *= -1;
    }
  }

  ans = count;
  sum = 0; count = 0; sign = -1;

  REP(i,n){
    llong tmp;
    if(sign == 1){
      if(sum + a[i] < 0){
        sum += a[i];
      }else{
        tmp = -1 - sum;
        count += abs(tmp - a[i]);
        sum += tmp;
      }
      sign *= -1;
    }else{
      if(sum + a[i] > 0){
        sum += a[i];
      }else{
        tmp = 1 - sum;
        count += abs(tmp - a[i]);
        sum += tmp;
      }
      sign *= -1;
    }
  }

  ans = min(ans, count);
  printf("%lld\n", ans);
  return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Binary Indexed Tree (Sum only)
//-------------------------------------------------
template<typename T>
class BIT
{
private:
    const int n;
    ::std::vector<T> data;
public:
    BIT(int n):n(n),data(n+1){
        for(int i=1; i<=n; i++) data[i] = 0;
    }
    BIT(const ::std::vector<T> &v):n(v.size()),data(v.size()+1){
        for(int i=1; i<=n; i++) data[i] = v[i-1];
        for(int i=1; i<n; i++)
            data[i+(i&-i)] += data[i];
    }
    void add(int k, T x){k++;
        for(int i=k; i<=n; i+=i&-i) data[i] += x;
    }
    T query(int k){
        T ret=0;
        for(int i=k; i>0; i-=i&-i) ret += data[i];
        return ret;
    }
    T query(int a, int b){return query(b)-query(a);}
    void update(int k, T x){
        T upd = x-query(k, k+1);
        add(k, upd);
    }
    T operator[](int k){return query(k, k+1);}
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    auto cmp = [](pi x, pi y){
        int d1 = x.se-x.fi+1;
        int d2 = y.se-y.fi+1;
        return d1<d2;
    };
    using P = tuple<int,int,int>;
    vector<P> lr(n);
    rep(i,n){
        int l,r; cin>>l>>r;
        lr[i] = make_tuple(r-l+1,l,r);
    }
    sort(all(lr));
    BIT<int> bit(m+1);
    int idx=0;
    FOR(i,1,m){
        int ans=0;
        ans += lr.end()-lower_bound(all(lr),make_tuple(i,0,0));
        while(idx<n && get<0>(lr[idx])<i){
            bit.add(get<1>(lr[idx]), 1);
            bit.add(get<2>(lr[idx])+1, -1);
            idx++;
        }
        for(int j=i; j<=m; j+=i){
            ans+=bit.query(j+1);
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 4864
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	while(true) {
	    	long sum=0;
	    	int n = sc.nextInt();
	    	if(n==0) break;
	    	double a[]= new double[n+1];
	    	for(int i=0;i<n;i++) {
	    		a[i]=sc.nextDouble();
	    		sum += a[i];
	    	}
	    	double m = sum/(double)n;
	    	double suma = 0;
	    	for(int i=0;i<n;i++) {
	    		suma += (a[i]-m)*(a[i]-m);
	    	}
	    	double A = Math.sqrt(suma/n);
	    	String str = String.format("%.10f",A);
	    	System.out.println(str);
    	}
    	
    }
}


Measured memory_bytes: 38544
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();

		if(a*b==15) {
			System.out.println("*");
		}
		else if(a+b==15) {
			System.out.println("+");
		}
		else {
			System.out.println("x");
		}
	}
}

Measured memory_bytes: 23764
open Hashtbl
let n = read_int ()
let f g s = let a = String.(Array.init (length s) @@ get s) in Array.(sort g a; String.init (length a) @@ get a)
let ss = Array.init n @@ fun _ -> f compare @@ read_line ()
let h = create n
let _ = Array.iter (fun s -> replace h s @@ try find h s + 1 with _ -> 1) ss; fold (fun _ c a -> a + c * (c - 1) / 2) h 0 |> Printf.printf "%d\n"

Measured memory_bytes: 9984
def simulateBoard(posNums, negNums):
  P, N = len(posNums), len(negNums)
  out_str = ""
  
  if P == 0 and N == 2:
    num1 = max(negNums)
    num2 = min(negNums)
    print(num1 - num2)
    print(num1, ' ', num2)
  elif N==0 and P==2:
    num1, num2 = max(posNums), min(posNums)
    print(num1 - num2)
    print(num1, ' ', num2)
  elif P == 0:
    negNums.sort(reverse=True)
    
    num1 = negNums[0]
    num2 = negNums.pop()
    
    last_pos = num1 - num2
    negNums = negNums[1:]
    print(abs(sum(negNums)) + last_pos)
    print(num1, ' ', num2) 
    last_neg = negNums.pop() 
    
    while len(negNums) != 0:
      cur_neg = negNums.pop()
      cur_diff = last_pos - cur_neg
      print(last_pos, ' ', cur_neg, ' ')
      last_pos = cur_diff
   	
    cur_diff = last_pos - last_neg
    print(last_pos, ' ', last_neg, ' ')
    
  
  elif N == 0:
    posNums.sort()
    
    num1 = posNums[0]
    num2 = posNums.pop()
    
    last_neg = num1 - num2
    posNums = posNums[1:]
    print(abs(last_neg) + sum(posNums))
    print(num1, ' ', num2)
    last_pos = posNums.pop()

    while len(posNums) != 0:
      cur_pos = posNums.pop()
      cur_diff = last_neg - cur_pos
      print(last_neg, ' ', cur_pos, ' ')
      last_neg = cur_diff
   	
    cur_diff = last_pos - last_neg
    print(last_pos, ' ', last_neg, ' ')
    
    
    
  
  #if N == 0:
    #last_neg = negNums.pop()
    
    #while len(negNums) != 0:
      #cur_neg = negNums.pop()
      #cur_diff = last_pos - cur_neg
      #print(last_pos, ' ', cur_neg, ' ')
      #last_pos = cur_diff
    
  
  elif P>=1 and N>=1:
    print(abs(sum(negNums)) + sum(posNums)) 
    
    last_pos = posNums.pop()
    last_neg = negNums.pop()
    
    while len(negNums) != 0:
      cur_neg = negNums.pop()
      cur_diff = last_pos - cur_neg
      print(last_pos, ' ', cur_neg, ' ')
      last_pos = cur_diff
    
    while len(posNums) != 0:
      cur_pos = posNums.pop()
      cur_diff = last_neg - cur_pos
      print(last_neg, ' ', cur_pos, ' ')
      last_neg = cur_diff
   	
    cur_diff = last_pos - last_neg
    print(last_pos, ' ', last_neg, ' ')

N = int(input())
nums = input().split()
#print(nums)
nums = [int(i) for i in nums]
pos_nums = []
neg_nums = []

for num in nums:
  if num >= 0: pos_nums.append(num)
  else: neg_nums.append(num)
    
simulateBoard(pos_nums, neg_nums)




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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

const long long mod = 998244353;

void milkshake() {
  int n, k;
  cin >> n >> k;
  vector<int> l(k), r(k);
  for(int i = 0; i < k; i++) {
    cin >> l[i] >> r[i];
  }
  vector<int> dp(n+1);
  vector<int> dps(n+1);
  dp[1] = dps[1] = 1;
  for(int i = 2; i <= n; i++) {
    for(int j = 0; j < k; j++) {
      int li = i - r[j];
      li = max(li, 1);
      int ri = i - l[j];
      if(ri < 1) continue;
      dp[i] = ((__int64_t)dp[i] + dps[ri] - dps[li-1]) % mod;
    }
    dps[i] = (dps[i-1] + dp[i]) % mod;
  }
  cout << (dp[n] + mod) % mod << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) milkshake();

  return 0;
}


Measured memory_bytes: 4760
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};

int main()
{
    int N, L;
    cin >> N >> L;
    int sum = 0;
    REP(i,0,N){
        sum += L + i;
    }
    int ans = 10000000;
    int idx = 0;

    REP(i, 0, N)
    {
        if(ans>abs(L+i)){
            ans = abs(L + i);
            idx = i;
        }
    }

    cout << sum - L - idx << endl;
}

Measured memory_bytes: 256