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

// ************* All the directives ***********************
#define bk back()              // back function for vector
#define co cout <<             // std output
#define ci cin >>              // std input
#define ft front()             // front function for vector
#define gl getline             // string input
#define mp make_pair           // function to get a pair
#define pb push_back           // push_back function for vector
#define ss stringstream        // use string as a stream instead of std input/output
#define wt while(t--)          // while loop for t test-cases

// ************* All the typedefs *************************
typedef pair<int, string> pis     ;    // pair of integer-string
typedef pair<int, int> pii        ;    // pair of integer-integer
typedef map<string, int> msi      ;    // map of string-int
typedef map<int, string> mis      ;    // map of int-string
typedef multimap<int, string> mmis;    // multimap of int-string
typedef list<int> li              ;    // list of integers
typedef queue<int, li> qul        ;    // queue of integers
typedef queue<int> qu             ;    // queue of integers (with deque underlying)
typedef vector<int> vi            ;    // vector of integers
typedef vector<pii> vpii          ;    // vector of pairs(int-int)
typedef vi::iterator itvi         ;    // iterator to vector of integers
typedef msi::iterator itmsi       ;    // iterator to map of string-int
typedef vector<char> vc           ;    // vector of chars
typedef long long ll              ;    // long long
typedef vector<ll> vll            ;    // vector of long long
// ************** Insert code here ************************

int main(void){

    ll a, b;

    cin >> a >> b;

    ll x = (a+b)/2;

    if (abs(x-a) == abs(x-b)){
        cout << x;
    }
    else{
        cout << "IMPOSSIBLE";
    }
    return 0;
}


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

int main() {
  string x, y;
  cin >> x >> y;
  if (x > y) {
    cout << ">" << endl;
  }
  else if (x < y) {
    cout << "<" << endl;
  }
  else {
    cout << "=" << endl;
  }
  return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

#define PI acos(-1)

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  double x, y, theta, omega;
  cin >> x >> y >> theta >> omega;
  theta *= PI/180;
  omega *= PI/180;

  double R = sqrt(x*x+y*y);
  double alpha = atan2(y, x), beta = theta;
  if(alpha < 0) alpha += 2*PI;
  if(alpha > beta) swap(alpha, beta);
  double gamma = min(beta-alpha, 2*PI-beta+alpha);
  double fail = 0, pass = R*omega;
  rep(i, 200) {
    double v = (fail+pass)/2;
    double r = v/omega;
    double l = sqrt(R*R-r*r);
    double phi = atan2(l, r);
    if(phi < 0) phi += 2*PI;
    double ds = r*(gamma+phi);
    if(l <= ds) pass = v;
    else fail = v;
  }
  cout << pass << endl;

  return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

int grid[33][33]={};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=0;j<w;j++)grid[i+1][j]=s[j]-'0';
    }
    int ans=0;
    for(int i=1;i<=h;i++){
        for(int j=0;j<w;j++){
            int newGrid[33][33]={};
            for(int l=1;l<=h;l++){
                for(int m=0;m<w;m++){
                    newGrid[l][m]=grid[l][m];
                    if(l==i&&m==j)newGrid[l][m]=0;
                }
            }
            int rmCnt=-1,res=0;
            bool update=true;
            while(update){
                update=false;
                rmCnt++;
                for(int l=1;l<=h;l++){
                    for(int m=0;m<w;m++){
                        if(newGrid[l][m]==0){
                            for(int r=l;r>=1;r--)newGrid[r][m]=newGrid[r-1][m];
                        }
                    }
                }
                for(int l=1;l<=h;l++){
                    for(int m=0,prv=newGrid[l][0],len=0;m<=w;m++){
                        if(prv==newGrid[l][m]){
                            len++;
                        }else{
                            if(prv>0&&len>=k){
                                for(int r=m-len;r<=m-1;r++)newGrid[l][r]=0;
                                res+=len*prv*pow(2,rmCnt);
                                update=true;
                            }
                            prv=newGrid[l][m],len=1;
                        }
                    }
                }
            }
            ans=max(ans,res);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace std;
const int N=2e5+5,mod=(int)1e9+7;
string s;
ll tot=0;
void bk(int idx,ll num,ll sum)
{
    if (idx>=(int)s.size())
    {
        if (!num) tot+=sum;
        return;
    }
    bk(idx+1,num*10+(s[idx]-'0'),sum);
    bk(idx+1,0,num*10+(s[idx]-'0')+sum);
}
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    cin>>s;
    bk(0,0,0);
    cout<<tot<<"\n";
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
  ios_base::sync_with_stdio (false);
  cin.tie(NULL);
  ll N, K;
  cin >> N >> K;
  vl logs = vl(N, 0);
  vl cuts = vl(N, 0);

  ll total = 0;
  FOR(i, 0, N){
    ll A; cin >> A;
    total += A;
    logs[i] = A;
  }

  priority_queue<pair<double,ll> > q;
  ll K_Rem = K;
  FOR(i, 0, N){
    ll c = (ll) (((double)logs[i]/(double)total) *( (double) (K+1)));
    c--;
    cuts[i]=c;
    q.push(mp(((double)logs[i]/(double)(c+1)), i));
    K_Rem-=c;
  }

  while(K_Rem > 0){
    ll index = q.top().yy; q.pop();
    cuts[index]++;
    q.push(mp(((double)logs[index]/(double)(cuts[index]+1)), index));
    K_Rem--;
  }

  //cout << K_Rem << endl;
  cout << (ll) ceil(q.top().xx) << endl;

}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    rep(i, tx - sx) {
        cout << "R";
    }
    rep(i, ty - sy) {
        cout << "U";
    }
    rep(i, tx - sx) {
        cout << "L";
    }
    rep(i, ty - sy) {
        cout << "D";
    }

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

    cout << "D";
    rep(i, tx - sx + 1) {
        cout << "R";
    }
    rep(i, ty - sy + 1) {
        cout << "U";
    }
    cout << "LU";
    rep(i, tx - sx + 1) {
        cout << "L";
    }
    rep(i, ty - sy + 1) {
        cout << "D";
    }
    cout << "R" << endl;

    return 0;
}

Measured memory_bytes: 256
L = list(int(input()) for _ in range(5))
ans = 0
for l in L:
  if l%10 != 0:
    ans += (l-(l%10))+10
  else:
    ans += l
m = 0
for l in L:
  cnt = 0
  if (l%10) == 0:
    cnt += 1
  elif m < 10-(l%10):
    m = 10-(l%10)
if cnt == 5:
  m = 0
print(ans-m)

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


void solve(long long N, long long K, std::string S){
    S[K - 1] = tolower(S[K - 1]);
    cout << S << "\n";
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::string S;
    std::cin >> S;
    solve(N, K, S);
    return 0;
}


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

using namespace std;

void solve() {
    int n;
    cin >> n;
    int a[n];
    for (int i=0; i<n; ++i) {
        cin >> a[i];
    }
    sort(a, a+n);
    int cnt = 1, ans = 0;;
    for (int i=0; i<n-1; ++i) {
        if (a[i] == a[i+1]) {
            ++cnt;
        } else {
            ans += cnt & 1;
            cnt = 1;
        }
    }
    ans += cnt & 1;
    cout << ans;
}

int main() {

	solve();
    return 0;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;

vector<int> minseg(524288, INT32_MAX);
vector<int> maxseg(524288, INT32_MIN);
vector<vector<int>> G(200010);
int s, t;

void setting() {
	for (int i = 262143;i > 0;i--) {
		minseg[i] = min(minseg[i * 2], minseg[i * 2 + 1]);
		maxseg[i] = max(maxseg[i * 2], maxseg[i * 2 + 1]);
	}
	return;
}

int RMiQ(int k, int l, int r) {
	if (s <= l && r <= t) {
		return minseg[k];
	}
	if (t < l || r < s)
		return INT32_MAX;

	int vl = RMiQ(k * 2, l, (l + r) / 2);
	int vr = RMiQ(k * 2 + 1, (l + r) / 2 + 1, r);
	return min(vl, vr);
}

int RMaQ(int k, int l, int r) {
	if (s <= l && r <= t) {
		return maxseg[k];
	}
	if (t < l || r < s)
		return INT32_MIN;

	int vl = RMaQ(k * 2, l, (l + r) / 2);
	int vr = RMaQ(k * 2 + 1, (l + r) / 2 + 1, r);
	return max(vl, vr);
}

int main(){
	int N, K;
	cin >> N >> K;
	int A[200010];
	bool sb[200010];
	int sq = 1;
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		minseg[262144 + i] = maxseg[262144 + i] = A[i];
		sb[i] = 0;
		if (i) {
			if (A[i] > A[i - 1]) {
				sq++;
				if (sq >= K)sb[i - K + 1] = 1;
			}
			else {
				sq = 1;
			}
		}
	}
	setting();

	int ans = N - K + 1, cnt = 0;
	
	for (int i = 0;i <= N - K;i++) {
		s = i, t = i + K - 1;
		if (sb[i]) {
			ans--;cnt = 1;
		}else if (RMiQ(1, 0, 262143) == A[i] && RMaQ(1, 0, 262143) < A[t + 1]) {
			ans--;
		}
	}
	cout << ans + cnt << endl;
}

Measured memory_bytes: 9984
// D - Gathering Children
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	string S; cin>>S;
	int N = S.size();
	S += "R";//end LR

	int e = 0, o = 0, l = 0, r = 0;
	int l_pos = -1, r_pos;

	rp(i, 0, N){
		if(i%2) o++; else e++;

		if(S[i]=='R' && S[i+1]=='L'){//RL
			r_pos = i;
			rp(j,l_pos+1, r_pos) cout<<0<<" ";
			l_pos = i + 1;
			if(r_pos%2){ r += o; l += e; }
			else{ r += e; l += o; }
			o = e = 0;
		}

		else if(S[i]=='L' && S[i+1]=='R'){//LR
			if(r_pos%2){ r += o; l += e; }
			else{ r += e; l += o; }
			o = e = 0;
			cout<<r<<" "<<l<<(l_pos+1<N?" ":"\n");
			r = l = 0;
		}

	}

	if(l_pos+1<N) rp(i, l_pos+1, N) cout<<0<<(i+1<N?" ":"\n");
}

Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	const int mod = 1000000007;
	public void Solve(){
		string S = rs();

		if(S.Last<char>() == 's')
		{
			S += "es";
		} 
		else 
		{
			S += "s";
		}

		Console.WriteLine(S);
		Console.ReadLine();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static BigInteger rb(){return BigInteger.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
	static BigInteger[] rba(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>BigInteger.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


Measured memory_bytes: 26280
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int ans = 0;
		// 文字列の入力
		String[] s = sc.next().split("");
        for(String v : s) {
          if (v.equals("1")) {
            ans++;
          }
        }
		// 出力
		System.out.println(ans);
	}
}

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

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}   

int main () {
  int a, b;
  cin >> a >> b;
  (a > b)? cout << gcd(a,b) : cout << gcd(b,a);
  cout << endl;
  return 0;
}

Measured memory_bytes: 1160
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 100100;

    vi v;

    void solve() {
        ll a, b, c;
        cin >> a >> b;
        if(a*b > 0) {
            if(a > 0) cout << "Positive" << endl;
            else {
                cout << ((abs(a) - abs(b) + 1) %2 == 0? "Positive" : "Negative");
            }
        } else cout << "Zero" << endl;

    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
/*     
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
      #endif
*/     
      //te
      solve();
      return 0;
    } 

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

#define ll long long
using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  constexpr char nl = '\n';
  const int mod = 1e9 + 7;

  int N;
  cin >> N;

  // dp[i][j][k]:
  // - Number of ones: i
  // - Number of twos: j
  // - Number of three: k
  int ones = 0;
  int twos = 0;
  int threes = 0;
  for (int i = 0; i < N; ++i) {
    int a = 0;
    cin >> a;
    if (a == 1) {
      ++ones;
    } else if (a == 2) {
      ++twos;
    } else {
      ++threes;
    }
  }

  vector<vector<vector<double>>> dp(N + 1, vector<vector<double>>(N + 1, vector<double>(N + 1, 0.0)));

  for (int k = 0; k <= threes; ++k) {
    for (int j = 0; j <= (threes + twos) - k; ++j) {
      for (int i = 0; i <= N - (k + j); ++i) {
        int nonzeros = i + j + k;
        if (nonzeros == 0) {
          continue;
        }
//        cout << i << " " << j << " " << k << nl;
        dp[i][j][k] += (double) N / nonzeros;
        if (i >= 1) {
          dp[i][j][k] += dp[i - 1][j][k] * i / nonzeros;
        }
        if (j >= 1 && i + 1 <= N) {
          dp[i][j][k] += dp[i + 1][j - 1][k] * j / nonzeros;
        }
        if (k >= 1 && j + 1 <= N) {
          dp[i][j][k] += dp[i][j + 1][k - 1] * k / nonzeros;
        }
      }
    }
  }

  cout << fixed << setprecision(10) << dp[ones][twos][threes] << nl;

  return 0;
}


Measured memory_bytes: 216832
# 人数を入力する
N = int(input())
# 名前を入力する
S = [input() for _ in range(N)]
# 単語をwordとする
word = "MARCH"
# 単語の文字数をsとする
n = len(word)
# 単語の各文字を頭文字とする人数を格納する辞書を初期化する
dic_initial = dict()
for letter in word:
    dic_initial[letter] = 0
# 単語の各文字を頭文字とする人数を調べる
for i in range(N):
    # 頭文字が単語の各文字のいずれかである場合
    if S[i][0] in dic_initial:
        # dic_initial内の人数を更新する
        dic_initial[S[i][0]] += 1
# 人の選び方の組み合わせの数を初期化する
ans = 0
# 3つの文字の組み合わせ全てについて、人の選び方の組み合わせの数を調べる
for p in range(n - 2):
    # 単語の頭からp番目の文字を頭文字とする人の数をnum_pとする
    num_p = dic_initial[word[p]]
    # num_pが0の場合、以降の処理は行わず、次の繰り返しに移る
    if num_p == 0:
        continue
    for q in range(p + 1, n - 1):
        num_q = dic_initial[word[q]]
        if num_q == 0:
            continue
        for r in range(q + 1, n):
            num_r = dic_initial[word[r]]
            ans += num_p * num_q * num_r
# 出力する
print(ans)

Measured memory_bytes: 9776
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
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;}

int N;
vector<int> V,W;
int Q;
vector<int> T,L;

int LIM=10;
const int MAX=1e5;

int divtwo(int x){
  int num=0;
  while(x>=2){
    num++;
    x/=2;
  }
  return num;
}

vector<vector<pair<int,int>>> dp;

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

  cin>>N;
  V.resize(N+1,0);
  W.resize(N+1,0);
  rep(i,N) cin>>V[i+1]>>W[i+1];
  cin>>Q;
  T.resize(Q);
  L.resize(Q);
  rep(i,Q) cin>>T[i]>>L[i];

  vector<int> two(20,0);
  two[0]=1;
  for(int i=1;i<=18;i++) two[i]=two[i-1]*2;

  vector<int> ans(Q,-1);
  rep(q,Q){
    //if(divtwo(T[q])<=8){
    if(T[q]<two[LIM]){
      vector<int> nodes;
      int now=T[q];
      while(now>0){
        nodes.push_back(now);
        now/=2;
      }
      int sz=nodes.size();
      for(int bit=0;bit<(1<<sz);bit++){
        int res=0;
        int w=0;
        rep(j,sz){
          if(bit&(1<<j)){
            w+=W[nodes[j]];
            res+=V[nodes[j]];
          }
        }
        if(w<=L[q]) chmax(ans[q],res);
      }
    }
  }

  /*bool all=true;
  rep(i,Q) if(ans[i]<0) all=false;
  if(all){
    rep(i,Q) cout<<ans[i]<<"\n";
    //return 0;
  }*/

  dp.resize(two[LIM]+10);
  for(int k=two[LIM-1];k<two[LIM];k++){
    int now=k;
    vector<int> nodes;
    while(now>0){
      nodes.push_back(now);
      now/=2;
    }
    int sz=nodes.size();
    for(int bit=0;bit<(1<<sz);bit++){
      int res=0;
      int w=0;
      rep(j,sz){
        if(bit&(1<<j)){
          w+=W[nodes[j]];
          res+=V[nodes[j]];
        }
      }
      if(w<=MAX) dp[k].push_back(mkp(w,res));
    }

    sort(dp[k].begin(),dp[k].end());
    for(int i=1;i<dp[k].size();i++) chmax(dp[k][i].second,dp[k][i-1].second);
  }

  rep(q,Q){
    if(ans[q]>=0) continue;
    int now=T[q];
    vector<int> nodes;
    while(now>=two[LIM]){
      nodes.push_back(now);
      now/=2;
    }
    int sz=nodes.size();
    for(int bit=0;bit<(1<<sz);bit++){
      int res=0;
      int w=0;
      rep(j,sz){
        if(bit&(1<<j)){
          w+=W[nodes[j]];
          res+=V[nodes[j]];
        }
      }
      if(w<=L[q]){
        chmax(ans[q],res);
        int z=upper_bound(dp[now].begin(),dp[now].end(),mkp(L[q]-w+1,-1))-dp[now].begin();
        if(z-1>=0){
          chmax(ans[q],res+dp[now][z-1].second);
        }
      }
    }
  }

  rep(i,Q) cout<<ans[i]<<"\n";

  return 0;
}


Measured memory_bytes: 10568
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
    R int res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
int read(char *s){
    R int len=0;R char ch;while(((ch=getc())>'9'||ch<'0'));
    for(s[++len]=ch;(ch=getc())>='0'&&ch<='9';s[++len]=ch);
    return s[len+1]='\0',len;
}
double readdb()
{
    R double x=0,y=0.1,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(x=ch-'0';(ch=getc())>='0'&&ch<='9';x=x*10+ch-'0');
    for(ch=='.'&&(ch=getc());ch>='0'&&ch<='9';x+=(ch-'0')*y,y*=0.1,ch=getc());
    return x*f;
}
char sr[1<<21],z[20];int C=-1,Z=0;
inline void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(R int x){
    if(C>1<<20)Ot();if(x<0)sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
int main(){
    int x,y,a,b;cin>>x>>y>>a>>b;
    cout<<(x-a)*(y-b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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


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

    int n; cin >> n;
    vector<ll> a(n);
    ll X = 0;
    rep(i, n) {
        cin >> a[i];
        X += a[i];
    }
    ll ans = 1e18;
    ll x = 0;
    rep(i, n) {
        x += a[i];
        if(i + 1 < n) ans = min(ans, abs(X - 2 * x));
    }
    COUT(ans);

}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
using namespace std;

#define bll long long
#define dou double
#define For(i,a,b) for (int i=(a),_##i=(b); i<=_##i; ++i)
#define Rof(i,a,b) for (int i=(a),_##i=(b); i>=_##i; --i)
#define Mem(a,b) memset(a,b,sizeof(a))
#define Cpy(a,b) memcpy(a,b,sizeof(b))

const int maxn=2e7+3e6+10;
const int mod=1e9+7;
int S,f[maxn];

int mul(int a,int k)
{
    long long ret=1,s=a;
    for (; k; k>>=1)
    {
        if (k&1) ret=ret*s % mod;
        s=s*s % mod;
    }
    return ret % mod;
}

inline int calc(int t)
{
    int d=S/t;
    int nd=(mul(10,d)-mul(10,d-1)+mod) % mod;
    return (nd-t+mod) % mod;
}

int main()
{
    f[0]=0;
    For(i,1,maxn-1) f[i]=f[i/10]+1;
    for (; scanf("%d",&S)!=EOF; )
    {
        int ret=0;
        int j=1,sum=f[1];
        For(i,1,1e7-1)
        {
            for (; j+1<maxn && sum<S; sum+=f[++j]);
            if (sum==S) ++ret;
            sum-=f[i];
        }
        int div8=S/8;
        ret+=div8;
        for (int i=1; i*i<=S; ++i)
            if (S%i==0)
            {
                if (i<=div8) ret=(ret+calc(i)) % mod;
                int j=S/i;
                if (i!=j && j<=div8) ret=(ret+calc(j)) % mod;
            }
        printf("%d\n",ret);
    }
    return 0;
}


Measured memory_bytes: 90112
def resolve():
	h, w = map(int, input().split())
	ans = [['#']*(w+2) for _ in range(h+2)]
	for i in range(1, h+1):
		r = input()
		for j in range(1, w+1):
			ans[i][j] = r[j-1]
	for r in ans:
		print("".join(r))
resolve()

Measured memory_bytes: 3064
#include <stdio.h>
#define N 100
#define MAX 100000000

int a[N+1][N+1], b[N+1], n, size[N+1];

void kansu(int p, int t){
  int i;
  b[p] = t;
  for(i=1;i<=size[p];i++) if(t + 1 < b[a[p][i]]) kansu(a[p][i], t + 1);
}

int main(){
  int i, j, u;
  scanf("%d", &n);
  for(i=1;i<=n;i++){
    b[i] = MAX;
    scanf("%d", &u);
    scanf("%d", &size[u]);
    for(j=1;j<=size[u];j++) scanf("%d", &a[u][j]);
  }
  kansu(1, 0);
  for(i=1;i<=n;i++) printf("%d %d\n", i, (b[i] == MAX) ? -1 : b[i]);
  return 0;
}



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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

vvb graph;
vb used;
int n, m;

void dfs(int pos)
{
    used[pos] = true;
    rep(i, n) {
        if (pos == i) continue;
        if (graph[pos][i] && !used[i]) {
            dfs(i);
        }
    }
}

int solve() 
{
    used = vb(n, false);
    dfs(0);
    rep(i, n) {
        if (!used[i]) {
            return 1;
        }
    }
    return 0;
}


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

    cin >> n >> m;

    graph = vvb(n, vb(n, false));

    rep(i, m) {
        int2(a, b);
        graph[a-1][b-1] = true;
        graph[b-1][a-1] = true;
    }

    int ans = 0;
    rep(i, n) {
        for (int j = 0; j < i; j++) {
            if (graph[i][j]) {
                graph[i][j] = false;
                graph[j][i] = false;
                ans += solve();
                graph[i][j] = true;
                graph[j][i] = true;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# 約数生成
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
l = lr()
l.sort()
ans = 0
for i in range(n-2):
    a = l[i]
    for j in range(i+1, n-1):
        b = l[j]
        for k in range(j+1, n):
            c = l[k]
            if a != b and b != c and c != a and c < a+b:
                ans+=1
print(ans)


Measured memory_bytes: 73188
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        String y = sc.next();
        sc.close();

        // 主処理
        int compare = x.compareTo(y);
        String result;
        if (0 < compare) {
            result = ">";
        } else if (compare < 0) {
            result = "<";
        } else {
            result = "=";
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 if(n>1000)
 {
     if(n%1000!=0)
      n=n%1000;
      else
      {
          cout<<0;
          return 0;
      }

 }
 int c=1000-n;
 cout<<c;
    return 0;
}




Measured memory_bytes: 3624
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> P;

bool compare(const P &l, const P &r){
  return l.second < r.second;
}

int main(){
  ll n,m;
  cin >> n >> m;
  vector<P> st;
  REP(i,m){
    ll a,b;
    cin >> a >> b;
    st.push_back(P(a,b));
  }
  sort(st.begin(),st.end(),compare);
  ll ans = 0;
  ll end = -1;
  REP(i,m){
    if(st[i].first>=end||i==0){
      ans++;
      end = st[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
# include <bits/stdc++.h>
# define  long          long long
# define  all(vc)       vc.begin(),vc.end()
# define  allr(vc)      vc.rbegin(),vc.rend()
# define  pb            push_back
# define  fi            first 
# define  se            second
# define  pi            pair <long, long>  
# define  lcm(a, b)     (a * b) / __gcd(a, b)  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        using namespace std;
void read(){freopen("input.txt" , "r" , stdin );freopen("output.txt", "w" , stdout );}
void solve(){
	long n;
	cin >> n;
	vector <long> v(n);
	for (int i = 0; i < n; ++i){
		cin >> v[i];
	}
	long ans = 0;
	sort(all(v));
	for (int i = 0; i < n; ++i){
		for (int j = i + 1; j < n; ++j){
			for (int k = j + 1; k < n; ++k){
				if( v[i] != v[j] && v[j] != v[k] ){
					if( v[i] + v[j] > v[k] && 
						v[i] + v[k] > v[j] && 
						v[k] + v[j] > v[i] ){
						ans ++;
					}
				}
			}
		}
	}
	cout << ans;
} 
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
        cout << fixed << setprecision(9);
        long T = 1;
        //cin >> T;
        while( T-- ){
            solve();
            cout<<'\n';
        }
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
} 													


Measured memory_bytes: 3844
#include<stdio.h>
void trace(int a[],int n){
int i;
for(int i=0;i<n;i++){
if(i>0) printf(" ");
printf("%d",a[i]);
}
printf("\n");
}
void insertionsort(int a[],int n){
int j,i,v;
for(int i=1;i<=n-1;i++){
v=a[i];
j=i-1;
while(j>=0&&a[j]>v){
a[j+1]=a[j];
j--;
}
a[j+1]=v;
trace(a,n);
}
}
int main(){
int n,i,j;
int a[105];
scanf("%d",&n);
for (int i=0;i<=n;i++)
scanf("%d",&a[i]);
trace(a,n);
insertionsort(a,n);
return 0;
}

Measured memory_bytes: 2692
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CMaximumVolume solver = new CMaximumVolume();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMaximumVolume {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            double l = Integer.parseInt(in.next());
            out.println(String.format("%.12f", Math.pow(l / 3, 3)));
        }

    }
}



Measured memory_bytes: 19796
#include<iostream>
using namespace std;
int main(){
  int n;
  int a[4]={};
  while(cin >>n){
    string s;
    cin >>s;
    if(s == ",A") a[0]++;
    if(s == ",B") a[1]++;
    if(s == ",AB") a[2]++;
    if(s == ",O") a[3]++;
  }
  for(int i=0; i<4; i++) cout <<a[i]<<endl;
  return 0;
}

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

#define bug(x) cout << #x << " = " << x << endl;
#define fr(a) freopen(a,"r",stdin);
#define fw(a) freopen(a,"w",stdout);
#define tc() int tc;cin >> tc; for (int _tc=1;_tc<=tc;_tc++)
#define up(i,l,r) for (int i=l;i<=r;i++)
#define down(i,r,l) for (int i=r;i>=l;i--)
#define rep(i,l,r) for (int i=l;i<r;i++)
#define pb push_back
#define mp make_pair
#define ins insert
#define fi first
#define se second
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef pair<int,int> ii;

/****************************************************/
void printArr(int a[], int l, int r)
{
    up(i,l,r) {
        cout << a[i] << " ";
    }
    cout << endl;
}

void printMtx(int a[][1010],int n, int m)
{
    up(i,1,n) {
        up(j,1,m) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}
/****************************************************/

ll n, tmp, res;
map<ll,ll> ma;
map<ll,ll> :: iterator it;

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n;
    up(i,1,n) {
        cin >> tmp;
        ma[tmp]++;
    }
    for (it = ma.begin(); it!=ma.end();it++) {
        if ((*it).se > (*it).fi) res += (*it).se - (*it).fi;
        if ((*it).se < (*it).fi) res += (*it).se;
    }
    cout << res << "\n";
}


Measured memory_bytes: 6272
import java.util.*;

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

        String S = sc.next();

        if(S.charAt(0)==S.charAt(1) || S.charAt(1)==S.charAt(2) || S.charAt(2)==S.charAt(3)){
            System.out.println("Bad");
        }
        else{
            System.out.println("Good");
        }
    }
}

Measured memory_bytes: 21844
N, M = map(int, input().split())
A_list = []
for i in range(1, M+1):
    A_list.append("A_" + str(i))
A_list = map(int, input().split())

answer = N - sum(A_list)

if answer >= 0 :
    print(answer)
else:
    print(-1)

Measured memory_bytes: 10492
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<functional>
using namespace std;
#define INF 1e15
#define MOD 1000000007
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define END system("PAUSE");return 0
int a, b, c;
signed main() {
	cin >> a >> b >> c;
	cout << min(c, b / a) << endl;
	END;
}


Measured memory_bytes: 504
def calc(n,k):
	count = 0
	while n < k:
		n *= 2
		count += 1
	return count


n, k = map(int, input().split())

total = 0
basic = 1/n
for i in range(1, n+1):
	temp = basic
	if i < k:
		num = calc(i, k)
		temp *= (0.5)**num
	total += temp

print(total)

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

typedef pair <int, int> pii;
const int MAXM = 1e5 + 1;
const int MAXN = 3e5 + 1;
int n, m, res[MAXM + 1], it[5 * MAXM];
pii range[MAXN];

void down(const int& k) {
	if (it[k]) {
		it[k << 1] += it[k];
		it[(k << 1) + 1] += it[k];
		it[k] = 0;
	}
}

void add(const int& u, const int& v, const int& lef = 1, const int& rig = m, const int& k = 1) {
	if (u == lef && v == rig) {
		++it[k];
		return;
	}
	down(k);
	int mid = (lef + rig) >> 1;
	if (v <= mid)
		add(u, v, lef, mid, k << 1);
	else
		if (u > mid)
			add(u, v, mid + 1, rig, (k << 1) + 1);
		else {
			add(u, mid, lef, mid, k << 1);
			add(mid + 1, v, mid + 1, rig, (k << 1) + 1);
		}
}

int get(const int& pos, const int& lef = 1, const int& rig = m, const int& k = 1) {
	if (lef == rig) 
		return it[k];
	down(k);
	int mid = (lef + rig) >> 1;
	if (pos <= mid)
		return get(pos, lef, mid, k << 1);
	else
		return get(pos, mid + 1, rig, (k << 1) + 1);
}

int main() {
	//freopen("in.txt", "r", stdin);
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; ++i){
		scanf("%d %d", &range[i].first, &range[i].second);
		++res[range[i].second - range[i].first + 1];
	}
	sort(range + 1, range + 1 + n, [](const pii& x, const pii& y)->bool {
		return x.second - x.first < y.second - y.first;
	});

	for (int i = m - 1; i >= 1; --i)
		res[i] += res[i + 1];

	int j = 1;
	for (int i = 1; i <= m; ++i) {
		while (j <= n && range[j].second - range[j].first + 1 < i) {
			add(range[j].first, range[j].second);
			++j;
		}
		for (int j = i; j <= m; j += i)
			res[i] += get(j);
		printf("%d\n", res[i]);
	}

	return 0;
}

Measured memory_bytes: 4736
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

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

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;


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

	cin >> N >> M >> K;
	if (M*K < N || M + K - 1>N) {
		cout << -1 << endl;
		return 0;
	}
	int cnt = 1;
	vector<int>ans;
	for (int i = M; i >= 1; i--)ans.push_back(i);
	cnt = M + 1;
	for (int i = 1; i < K; i++) {
		int box = N - cnt + 1;
		box -= K - i - 1;
		box = min(box, (int)M);
		for (int j = box - 1; j >= 0; j--)ans.push_back(cnt + j);
		cnt += box;
	}
	for (auto i : ans)cout << N - i + 1 << " ";
	cout << endl;
}

Measured memory_bytes: 3568
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>

int main() {
	string s;
	cin >> s;
	int a = s.size();
	int n = a / 2;
	int c = 0;
	rep(i, n) {
		if (s[i] != s[a - 1 - i]){
			++c;
			}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
res = 0
for i in range(61):
  zeros, ones = 0, 0
  for a in A:
    if (a>>i)&1:
      ones += 1
    else:
      zeros += 1
  res += (zeros*ones) * (1<<i)
  res %= mod

print(res)

Measured memory_bytes: 122808
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


struct Edge
{
	int a, b, cost;
	Edge(int a, int b, int cost)
		: a(a), b(b), cost(cost) {}
};
bool operator<(const Edge& a, const Edge& b)
{
	return a.cost < b.cost;
}

//class UnionFind
//{
//private:
//	int parent[128];
//
//public:
//	UnionFind(int n)
//	{
//		for (int i = 0; i < n; ++i)
//			parent[i] = i;
//	}
//	int root(int v)
//	{
//		while (parent[v] != v)
//			v = parent[v];
//		return v;
//	}
//	void unite(int a, int b)
//	{
//		parent[b] = root(a);
//	}
//	bool same(int a, int b)
//	{
//		return root(a) == root(b);
//	}
//};
template <class T>
class UnionFind
{
public:
	UnionFind(int n)
		: n(n)
	{
		parent = new T[n];
		rank = new T[n];
		for (int i = 0; i < n; ++i)
		{
			parent[i] = i;
			rank[i] = 0;
		}
	}

	void unite(T a, T b)
	{
		T root_a = root(a);
		T root_b = root(b);
		if (root_a == root_b)
			return;

		if (rank[root_a] < rank[root_b])
			parent[root_a] = root_b;
		else if (rank[root_a] > rank[root_b])
			parent[root_b] = root_a;
		else
		{
			parent[root_a] = root_b;
			++rank[root_a];
		}
	}

	bool same(T a, T b)
	{
		return root(a) == root(b);
	}

private:
	T* parent;
	T* rank;
	int n;

	T root(T e)
	{
		if (parent[e] == e)
			return e;
		else
			return parent[e] = root(parent[e]);
	}
};
int main()
{
	int n, m;
	while (cin >> n >> m, n)
	{
		vector<Edge> e;
		rep (i, m)
		{
			int a, b, w;
			cin >> a >> b >> w;
			--a, --b;
			e.push_back(Edge(a, b, w));
		}
		sort(all(e));

		const int INF = 1 << 26;
		int res = INF;
		for (int i = 0; i < e.size(); ++i)
		{
			int use = 0;
			UnionFind<int> u(n);
			for (int j = i; j < e.size() && e[j].cost - e[i].cost < res; ++j)
			{
				if (!u.same(e[j].a, e[j].b))
				{
					u.unite(e[j].a, e[j].b);
					if (++use == n - 1)
					{
						res = e[j].cost - e[i].cost;
						break;
					}
				}
			}
		}

		if (res == INF)
			res = -1;
		cout << res << endl;
	}
}

Measured memory_bytes: 11000
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    int s[N];
    int sum = 0;
    rep(i, N) {
        cin >> s[i];
        sum += s[i];
    }
    if(sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }
    else {
        int ans = sum;
        sort(s, s+N);

        rep(i, N) {
            if(s[i] % 10 != 0) {
                ans -= s[i];
                break;
            }
        }

        if(ans == sum) {
            cout << 0; 
        }
        else {
            cout << ans;
        }
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256