akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
#define MAX 100003
#define NIL -1

struct node {
	int parent, left, right;
};
struct node T[MAX];
int D[MAX];

int getDepth(int u){
	int d = 0;
	while(T[u].parent != NIL){
		u = T[u].parent;
		d++;
	}
	return 0;
}

void setDepth(int u, int p){//cout<<u<<" "<<p<<endl;int t;cin>>t;
	D[u] = p;
	if(T[u].right != NIL){
		setDepth(T[u].right, p);
	}//cout<<"AAA"<<endl;
	if(T[u].left != NIL){
		setDepth(T[u].left,p+1);
	}
}

void printChildren(int u){
	int c = T[u].left, f = 0;
	cout<<"[";
	while(c != NIL){
		if(f++)cout<<", ";
		cout<<c;
		c = T[c].right;
	}
	cout<<"]"<<endl;
}

string foo(int u){
	if(T[u].parent == NIL) return "root";
	if(T[u].left == NIL) return "leaf";
	else return "internal node";
}

int main(){
	int n, id, k, c, c2, root;
	cin>>n;
	for(int i = 0; i < n; i++){
		T[i].parent = T[i].left = T[i].right = NIL;
	}
	
	for(int i = 0; i < n; i++){//cout<<i<<endl;
		cin>>id>>k;
		for(int j = 0; j < k; j++){
			cin>>c;
			T[c].parent = id;
			if(j){
				T[c2].right = c;
			} else T[id].left = c;
			
			c2 = c;
		}
	}
	for(int i = 0; i < n; i++){
		if(T[i].parent == NIL) root = i;
	}
	
	setDepth(root,0);
	
	for(int i = 0; i < n; i++){
		cout<<"node "<<i<<": parent = "<<T[i].parent<<", depth = "<<D[i]<<", "<<foo(i)<<", ";
		printChildren(i);
	}
	
	return 0;
}


Measured memory_bytes: 7764
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main() {
    int N , D;
    cin >> N >> D;
    vector<vector<double>> x(N, vector<double>(D, 0));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < D; j++) {
            cin >> x[i][j];
        }
    }

    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = i+1; j < N; j++) {
            double sum = 0;
            for(int k = 0; k < D; k++) {
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            double d = sqrt(sum);
            if (d == (int)d) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }


int solve()
{
    int N, D;

    cin >> N >> D;

    vector<vector<int>> nums(N, vector<int>(D));

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < D; ++j)
            cin >> nums[i][j];

    int counter = 0;

    for (int i = 0; i < N; ++i)
    {
        for (int j = i + 1; j < N; ++j)
        {
            if (i != j)
            {
                double res = 0;
                for (int k = 0; k < D; ++k)
                {
                    res += (nums[i][k] - nums[j][k]) * (nums[i][k] - nums[j][k]);
                }

                double dist = sqrt(res);
                int intDist = dist;
                if (intDist * intDist == res)
                    ++counter;
            }
        }
    }

    return counter;
}

int main()
{
    std::cout << solve() << std::endl;

    return 0;
}

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

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

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

#define INF INT_MAX/3

#define MAX_N 1000

ll n,x;
int res[311111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>x;
	n=2*n-1;
	ll mid=n/2+1;
	if(x!=1&&x!=n){
		cout<<"Yes"<<endl;
		res[mid-1]=x;
		int l=1;
		repl(i,mid,n){
			if(l==x)l++;
			res[i]=l++;
		}
		rep(i,mid-1){
			if(l==x)l++;
			res[i]=l++;
		}
		rep(i,n)cout<<res[i]<<endl;
	}else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 2304
char S[10101];
st,sz;
N,n;
main(){
  n=read(0,S,10101);
  if(S[1]==10)st=2,N=S[0]-'0';
  else st=3,N=S[0]*10+S[1]-528;
  sz=st;
  for(;sz<n-1;)
  {
    S[sz]+=N;
    if(S[sz]>90)S[sz]-=26;
    sz++;
  }
  write(1,S+st,sz-st);
}

Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int N;
    cin >> N;

    vector<long long> x(N), y(N), h(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> h[i];

    for (int i = 0; i < N; i++) {
        if (h[i] == 0) continue;
        for (long long j = 0; j <= 100; j++) {
            for (long long k = 0; k <= 100; k++) {
                long long H = abs(j - x[i]) + abs(k - y[i]) + h[i];
                if (H <= 0) continue;
                bool good = true;
                for (int l = 0; l < N; l++) if (max(H - abs(j - x[l]) - abs(k - y[l]), 0LL) != h[l]) good = false;
                if (good) {
                    cout << j << " " << k << " " << H << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}











































































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool prime_number(int x){
    if (x < 2) return false;
    else if (x == 2) return true;
    else if (x % 2 == 0) return false;
    
    double sqrtN = sqrt(x);
    for (int i = 3; i <= sqrtN; i += 2){
        if (x % i == 0) return false;
    }
    return true;
}

int main(){
    int Q;
    cin >> Q;
    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++){
        cin >> l.at(i) >> r.at(i);
    }
    vector<int> d(100001, 0);
    int count = 0;
    for (int i = 3; i <= 100000; i++){
        if (prime_number(i) && prime_number((i + 1)/2)) {
            count++;
            //cout << "2017number " << i << endl;
        }
        d.at(i) = count;
    }
    
    for (int i = 0; i < Q; i++){
        cout << d.at(r.at(i)) - d.at(l.at(i) - 1) << endl;
        //cout << d.at(r.at(i)) << " " << d.at(l.at(i) - 1) << endl;
    }
}

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

ll inf=9223372036854775806,ans=0;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int i,a,b,k;
	cin>>a>>b>>k;
	if (b-k+1<=a+k-1){
		for (i=a;i<=b;i++){
			cout<<i<<"\n";
		}
	}
	else {
		for (i=a;i<a+k;i++){
			cout<<i<<"\n";
		}
		for (i=b-k+1;i<=b;i++){
			cout<<i<<"\n";
		}
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    double n;
    cin >> n;
    cout << 2.0 * PI * n << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 3776
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 210000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
// long long C(int a,int b){
// 	if(a<b||b<0)return 0;
// 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
// }
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int main(){
	int a,b;scanf("%d%d",&a,&b);
	int ret=0;
	if(a>b){
		ret+=a;a--;
	}else{
		ret+=b;b--;
	}
	if(a>b){
		ret+=a;a--;
	}else{
		ret+=b;b--;
	}
	
	printf("%d\n",ret);
}

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

typedef long long ll;
int main(){
  ll a,b,k;
  cin >> a >> b >> k;
  if(a >= k){
    a = a - k;
  } else { 
    b = max((ll)0, b - (k - a));
    a = 0;
  }
  
  cout << a << " " << b << endl;
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

bool is_month(int x){
    if (1 <= x && x <= 12){
        return true;
    }else{
        return false;
    }
}

int main(int argc, char**argv){
    int n;
    cin >> n;

    int a = n / 100, b = n % 100;

    if (is_month(a) & is_month(b)){
        cout << "AMBIGUOUS" << endl;
    }else if (is_month(a) & not is_month(b)){
        cout << "MMYY" << endl;
    }else if (not is_month(a) & is_month(b)){
        cout << "YYMM" << endl;
    }else{
        cout << "NA" << endl;
    }

    return 0;
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable PossibleNullReferenceException
// ReSharper disable AssignNullToNotNullAttribute

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            int count = 1;
            for (int i = 0; i < s.Length-1; ++i)
            {
                if (s[i] != s[i + 1]) ++count;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0; i<(N); i++)
typedef long long ll;
const ll mod=1e9+7;

ll M;

int main(){ 

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

cin>>M;

cout<<24+24-M<<endl;


}


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

int main(){
  long long int n,k;
  cin >> n >> k;
  
  if(n==k || k==1){
    cout << 0;
    return 0;
  }
  
  if(n>k){
    n = n % k;
  }
  
  if(n<k){
    if(abs(n-k)<n){
    	n = abs(n-k);
    }
  }
  
  cout << n;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, y;
	cin >> n >> y;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n-i; j++) {
			int money = 10000*i + 5000*j + 1000*(n-i-j);
			if(money == y){
				cout << i << ' ' << j << ' ' << n-i-j << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;

	return 0;
}

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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector < pair < int, int >>ab(M);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		ab[i] = make_pair(a, b);
	}

	sort(ab.begin(), ab.end(), greater < pair < int, int >>());

	int last, ans;
	last = -1;
	ans = 0;

	for (int i = 0; i < M; i++) {
		if (ab[i].first <= last && last < ab[i].second) {
			continue;
		}
		ans++;
		last = ab[i].first;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
'use strict'
 
function Main(input) {
  input = input.split(" ");
  const A = parseInt(input[0], 10);
  let P = parseInt(input[1], 10);
  
  if (A !== 0) {
    const cutA = A*3;
    P = P + cutA;
  }
    
  const result = parseInt(P/2);
  
  console.log(result);
  
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), intScanner()
	fmt.Println(max([]int{a + b, a - b, a * b}))
}


Measured memory_bytes: 1772
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <utility>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
using ll = long long;
constexpr long long INF = 1LL << 62;


int sum[55][55];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N,K,x[50],y[50]; cin >> N >> K;
    set<pair<int, int> > st;
    ll ans = INF;
    REP(i,N) {
        cin >> x[i] >> y[i];
        st.emplace(x[i],y[i]);
    }
    sort(x, x+N); sort(y, y+N);

    for(int i=0; i < N; ++i)
        for(int j=0; j < N; ++j)
            sum[i+1][j+1] = sum[i+1][j] + sum[i][j+1] - sum[i][j] + (st.find(make_pair(x[i], y[j])) != st.end());

    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            if(i > j) continue;
            for(int k = 0; k < N; ++k) { 
                for(int l = 0; l < N; ++l) {
                    if(k > l) continue;
                    // check
                    int cnt = sum[j+1][l+1] - sum[j+1][k] - sum[i][l+1] + sum[i][k];
                    if(cnt < K) continue;
                    ans = min(ans, (x[j] - x[i]) * abs(y[l] - y[k]));
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys

sys.setrecursionlimit(10 ** 5 + 10)


# input = sys.stdin.readline

def resolve():
    N = int(input())
    M = N//9  # Nを変更したくなければ

    # 10進数表記のxをn進数表記にして返す
    def nary_notation(x, n):
        bi = ''
        while x != 0:
            # abs(n)で割った余りをbiに格納
            # nが負の時は不明
            bi += str(x % abs(n))
            if n < 0:
                x = -(-x // n)
            else:
                x = x // n
        # 位取りが逆順になっているため
        cnt = 0
        for j in bi:
            cnt += int(j)
        return cnt

    ans = 10 ** 9
    for i in range(M + 1):
        ans = min(nary_notation(9*i, 9) + nary_notation(N - (9 *i), 6), ans)
    print(ans)


resolve()

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

int main(int argc, char const *argv[])
{
	int a, b; cin >> a >> b;
	int ans = -1;
	rep(i, 10000) {
		if ((int)(i * 0.08) == a and (int)(i * 0.1) == b) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N):
    t[i+1]=t[i] + (1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1]-t[l-1])


Measured memory_bytes: 9668
words = list(map(str, input().strip().split()))
lenAndWords = [0, '']
modeWords = {}
mode = [0, '']

for s in words:
    if len(s) > lenAndWords[0]:
        lenAndWords[0] = len(s)
        lenAndWords[1] = s

    if not s in modeWords:
        d = {s:0}
        modeWords.update(d)
    else:
        modeWords[s] += 1

    if mode[0] < modeWords[s]:
        mode[0] = modeWords[s]
        mode[1] = s

print(mode[1], lenAndWords[1])

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

int alp[26];

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

	for (int i = 0; i < s.size(); i++) {
		alp[s[i] - 'a']++;
	}

	bool flag = true;
	for (int i = 0; i < 26; i++) {
		if (alp[i] % 2) flag = false;
	}

	if (flag)cout << "Yes" << endl;
	else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    int X,Y;
    cin>>X>>Y;
    bool flag=false;
    for(int i=0;i<X+1;i++){
        if(2*i+4*(X-i)==Y){
            flag=true;
        }
    }
    if(flag){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> h(N);
  for(int i=0;i<N;i++)cin >> h[i];
  vector<int> dp(N,10000000);
  dp[0]=0,dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<N;i++){
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
 int a,b,c,d;
 cin>>a>>b>>c;
 if(a>b){
  d=a;
  a=b;
  b=d;
 }
 if(b>c){
  d=b;
  b=c;
  c=d;
 }
 if(a>b){
 d=a;
 a=b;
 b=d;
 }
 cout<<a<<" "<<b<<" "<<c<<endl; 
}

Measured memory_bytes: 1164
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
string str;
int br[2];

int main() {
	getline(cin,str);
	for (int i = 0; i < str.size(); i++) br[str[i] - '0']++;
	printf("%d\n", br[0] + br[1] - (abs(br[0] - br[1])));
}

Measured memory_bytes: 512
using System;
using System.Linq;

namespace ChokudaiScanner
{
     class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            int a = cin.NextInt();
            int ans = a;
            ans += a * a;
            ans += a * a * a;

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

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

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

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

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

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

        public long NextLong()
        {
            return long.Parse(Next());
        }

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

        public double NextDouble()
        {
            return double.Parse(Next());
        }


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



Measured memory_bytes: 27380
#include <cstdio>

int main() {
  int N, n, ans = 0;
  scanf("%d", &N);
  n = N;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  printf(N % ans ? "No\n" : "Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <stack>

using namespace std;
typedef vector<int> VI;

VI graph[100];

int degree[1000] = {};

int main(){
  int v, e;
  cin >> v >> e;
  for(int i = 0; i < e; i++){
    int s, t;
    cin >> s >> t;
    graph[s].push_back(t);
    degree[t]++;
  }

  // Set of vertex which has 0 in-degree
  stack<int> st;

  for(int i = 0; i < v; i++) if(degree[i] == 0) st.push(i);

  // Sorted graph
  VI ans;

  while(st.size() > 0) {
    int i = st.top();
    st.pop();
    ans.push_back(i);
    if(graph[i].size() > 0){
      for(int j: graph[i]){
        degree[j]--;
        if(degree[j] == 0) st.push(j);
      }
    }
  }

  if(ans.size() == v) cout << 0 << endl; // Input graph doesn't have circle
  else cout << 1 << endl; // Input graph has circle

  return 0;
}



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


int main() {
  double w,h; 
  int n;
  cin >> w >> h >> n;
  double x,y;
  int a;
  double max_x, max_y, min_x, min_y;
  max_x = w;
  max_y = h;
  min_x = 0;
  min_y = 0;
  for(int i = 0; i < n; ++i){
    cin >> x >> y >> a;
    if(a == 1 && min_x < x) min_x = x;
    else if(a == 2 && max_x > x) max_x = x;
    else if(a == 3 && min_y < y) min_y = y;
    else if(a == 4 && max_y > y) max_y = y;
  }
  if(max_x - min_x > 0 && max_y - min_y > 0) cout << (max_x - min_x) * (max_y - min_y) << endl;
  else cout << 0 << endl;
}

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

using namespace std;
#define int long long
#define MAX_V 600
#define INF (1<<28)

struct edge{
  int to,cap,rev;
  edge(){}
  edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
};
vector<edge> G[MAX_V];
map<int,int> M[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,int cap){
  M[from][to] = G[from].size();
  M[to][from] = G[to].size();
  G[from].push_back(edge(to,cap,G[to].size()));
  G[to].push_back(edge(from,0,G[from].size()-1));
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int> que;
  level[s] = 0;
  que.push(s);
  while(!que.empty()){
    int v=que.front(); que.pop();
    for(int i=0;i<(int)G[v].size();i++){
      edge &e = G[v][i];
      if(e.cap > 0 && level[e.to]<0){
	level[e.to] = level[v] + 1;
	que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v == t) return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e = G[v][i];
    if(e.cap > 0 && level[v]<level[e.to]){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t,int lim){
  int flow = 0;
  for(;;){
    bfs(s);
    if(level[t]<0||lim==0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,lim))>0){
      flow+=f;
      lim-=f;
    }
  }
}

int max_flow(int s,int t){
  return max_flow(s,t,INF);
}

signed main(){
  int N;
  cin>>N;
  for(int t=0;t<N;t++){
    for(int i=0;i<MAX_V;i++) G[i].clear(),M[i].clear();
    int W,H;
    cin>>W>>H;
    int c[H][W],d[H][W];
    int cnt[2]={},sum=0;
    int S=H*W,T=H*W+1;
    int ay[]={0,1,0,-1};
    int ax[]={1,0,-1,0};
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	cin>>c[i][j];
	d[i][j]=cnt[(i+j)%2]++;
	sum+=c[i][j];
      }
    }
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if((i+j)%2==0){
	  add_edge(S,d[i][j],c[i][j]);
	  for(int k=0;k<4;k++){
	    int ni=i+ay[k],nj=j+ax[k];
	    if(ni<0||H<=ni||nj<0||W<=nj) continue;
	    add_edge(d[i][j],cnt[0]+d[ni][nj],INF);
	  }
	}else{
	  add_edge(cnt[0]+d[i][j],T,c[i][j]);
	}
      }
    }
    if(H*W==1){
      cout<<"Case "<<t+1<<": "<<c[0][0]<<endl;
      continue;
    }
    cout<<"Case "<<t+1<<": "<<sum-max_flow(S,T)<<endl;
  }
  return 0;
}

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

using namespace std;

#define INF 210000000
#define int long long

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
		int n;
		cin >> n;
		if(n < 1200) cout << "ABC" << endl;
		else cout << "ARC" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

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

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

/* do your best */

int main() {
  
  int n; cin >> n;
  vector<int> a(n);
  set<int> st;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    st.insert(a[i]);
  }

  map<int, int> zip;
  int val = 0;
  for (auto x : st) {
    zip[x] = val;
    val++;
  }

  for (int i = 0; i < n; i++) {
    a[i] = zip[a[i]];
  }

  int minus = 0;
  int plus = 0;
  vector<int> ans;
  vector<int> cnt(n + 2, 0);

  for (int k = 0; k < n; k++) {
    cnt[a[k]]++;
    if (cnt[a[k]] == 0) {
      minus--;
    } else if (cnt[a[k]] == 1) {
      plus++;
    }

    cnt[a[n - k - 1]]--;
    if (cnt[a[n - k - 1]] == 0) {
      plus--;
    } else if (cnt[a[n - k - 1]] == -1) {
      minus++;
    }

    if (plus == 0 and minus == 0) {
      ans.push_back(k + 1);
    }
  }

  for (size_t i = 0; i < ans.size(); i++) {
    if (i + 1 == ans.size()) cout << ans[i] << endl;
    else cout << ans[i] << " ";
  }
  
  return 0;
}



Measured memory_bytes: 8372
#include <iostream>

using namespace std;

int main()
{
    int p[200][3];
    int a[101];

    int n; cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> p[i][0] >> p[i][1] >> p[i][2];
    }

    for (int i = 0; i < 3; ++i) {
        for (int j = 1; j <= 100; ++j) a[j] = 0;
        for (int j = 0; j < n; ++j) {
            a[ p[j][i] ] += 1;
        }
        for (int j = 0; j < n; ++j) {
            if (a[ p[j][i] ] != 1) p[j][i] = 0;
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << p[i][0] + p[i][1] + p[i][2] << endl;
    }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <iostream>
using namespace std;

long long N, X;

long long max(long long a, long long b) {
	return a > b ? a : b;
}

long long min(long long a, long long b) {
	return a < b ? a : b;
}

void input() {
	cin >> N >> X;
}
int main() {
	input();
	long long sum(N);
	long long a;
	long long b;
	a = max(X, N - X);
	b = min(X, N - X);
	while (1) {
		if (a % b == 0) {
			sum += a * 2 - b;
			break;
		}
		else {
			sum += (a - a % b) * 2;
			long long tem(a);
			a = b;
			b = tem % b;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
class Heruistics:
    donelist = [0]*26
    resultlist = []
    contestlist = []

    def __init__(self,days):
        self.days = days
        self.clast = list(map(int,input().split()))
        self.allpref = [] #allpref[day][contest]
        for i in range(days):
            self.allpref.append(list(map(int,input().split())))

    def scoring(self,contlist):
        result = 0
        for i in range(self.days):
            cont = contlist[i]
            self.donelist[cont-1] = i+1
            zanen = sum([self.clast[j]*((i+1)-self.donelist[j]) for j in range(26)])

            result += self.allpref[i][cont-1] - zanen
            self.resultlist.append(result)

    def greedy(self):
        for i in range(self.days):
            max = -10**10
            result = 0
            contest = False
            for held in range(26):
                tempdonelist = self.donelist[:]
                tempdonelist[held] = i+1
                zanen = sum([self.clast[j]*((i+1)-tempdonelist[j]) for j in range(26)])
                result = self.allpref[i][held] - zanen
                if result >= max:
                    max = result;contest = held

            self.donelist[contest] = i+1
            self.contestlist.append(contest+1)


greed_heru = Heruistics(int(input()))
greed_heru.greedy()
#greed_heru.scoring(greed_heru.contestlist)
#for result in greed_heru.resultlist:
#    print(result)
for cont in greed_heru.contestlist:
    print(cont)


Measured memory_bytes: 9404
#include <stdio.h>

int main()
{
    int N,R,hasil;

    scanf("%d %d", &N, &R);
    if (N<10){
        hasil += R + 100 * (10 - N);
    }
    else{
        hasil= R;
    }
    printf("%d",hasil);

    return 0;
}

Measured memory_bytes: 1736
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(A,B);
    cout << max(A+B,max(A-B,A*B)) << nn;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<map>
#define sqr(x) (x)*(x)
using namespace std;
map<long long,long long> used;
long long n,x,i,fact[100005],mod=1e9+7,t,l,r,dist;
/*long long c(long long x,long long y)
{
	return ((long long)(double(fact[x])/double(fact[y])/double(fact[x-y])));
}*/
long long qp(long long x,long long p)
{
	if (p==0) return 1LL;
	if (p==1) return x;
	if (p%2==0LL)
	{
		long long y=qp(x,p/2);
		return y*y%mod;
	}
	else
	{
		long long y=qp(x,p/2);
		return y*y%mod*x%mod;
	}
}
long long inv(long long x)
{
	return qp(x,mod-2);
}
long long c(long long n,long long k)
{
	if (k>n) return 0;
	if (k<0) return 0;
	if (k*2>n) k=n-k;
	long long x=fact[n];
	x=x*inv(fact[n-k]);
	x%=mod;
	x*=inv(fact[k]);
	x%=mod;
	return x; 
}
int main()
{
	cin>>n;
	fact[0]=1;
	for (i=1;i<=n+1;i++) fact[i]=fact[i-1]*i%mod;
	for (i=0;i<=n;i++)
	{
		scanf("%d",&x);
		if (used[x])
		{
			dist=i-used[x];
		}
		used[x]=i+1;
	}
	dist=n-1-dist;
//	cout<<dist<<endl;
	for (i=1;i<=n+1;i++)
	{
		long long res=c(n+1,i);
		res-=c(dist,i-1);
		res%=mod;
		res+=mod;
		res%=mod; 
		if (res<0) throw 3;
		printf("%I64d\n",res);
	}
	return 0;
}

Measured memory_bytes: 13568
#include <stdio.h>

int main(void)
{
    int p, i;
    int sum;
    int coin[6] = {500, 100, 50, 10, 5, 1};

    while (1){
        scanf("%d", &p);
        if (p == 0){
            break;
        }
        sum = 0;
        p = 1000 - p;
        for (i = 0; i < 6; i++){
            sum += p / coin[i];
            p %= coin[i];
        }
        printf("%d\n", sum);
    }

    return (0);
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<deque>
#include<queue>

//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)

#define All(a) (a).begin(),(a).end()

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

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

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	int a, b;
	cin >> h >> w >> a >> b;

	REP(i, h) {
		REP(j, w) {
			bool f = false;
			if (j < a)f = !f;
			if (i < b)f = !f;
			if (f) {
				cout << "1";
			}
			else {
				cout << "0";
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1280
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);        
        int N = sc.nextInt();
        int R = sc.nextInt();
        
        if(N>=10){
            System.out.println(R);
        }else{
            System.out.println(R+100*(10-N));
        }
    }
}


Measured memory_bytes: 23252
#include<complex>
#include<cstdio>
#include<cmath>
using namespace std;typedef complex<double> P;class Tr{P a,b,c;double A,B,C;double x,y,z;double F(double a,double b, double c){return acos((b*b+c*c-a*a)/(2*b*c));}public:Tr(P p1, P p2, P p3){a=p1;b=p2;c=p3;B=abs(c-a);A=abs(b-c);C=abs(a-b);x=F(A,B,C);y=F(B,C,A);z=F(C,A,B);}double R(){return A/sin(x)/2.;}double X(){double A=sin(2*x),B=sin(2*y),C=sin(2*z);return(a.real()*A+b.real()*B+c.real()*C)/(A+B+C);}double Y(){double A=sin(2*x),B=sin(2*y),C=sin(2*z);return(a.imag()*A+b.imag()*B+c.imag()*C)/(A+B+C);}};int main(){int n;double d,e,f,g,h,i;scanf("%d",&n);for(;n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);P a(d,g),b(e,h),c(f,i);Tr T(a,b,c);printf("%.3f %.3f %.3f\n",T.X(),T.Y(),T.R());}}

Measured memory_bytes: 0
n,m=map(int,input().split())
check=[False]*n
check[0]=True
ball=[1]*n
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    if check[x]:
        check[y]=True

    ball[y]+=1
    ball[x]-=1
    if ball[x]==0:
        check[x]=False

ans=0

for chk in check:
    if chk:
        ans+=1

print(ans)



Measured memory_bytes: 4596
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  ll sum = 0LL;
  int ind;
  for(int i=1;i<=N;i++){
    sum += i;
    if(sum >= N){
      ind = i;
      break;
    }
  }

  int x = sum - N;
  for(int i=1;i<=ind;i++){
    if(i != x) cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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




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


int n,k;
cin>>n>>k;
string s;
cin>>s;
k--;
s[k]=(char)(s[k]-'A'+'a');
cout<<s;



  
}



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

using namespace std;
using ll = long long;
using ld = long double;

ll gcd(ll a, ll b)
{
    return b != 0 ? gcd(b, a % b) : a;
}

bool isMugen(ll A, ll B, ll C, ll D){
    if(A < B){
        return false;
    }

    if(D < B){
        return false;
    }
    if(C >= B){
        return true;
    }

    ll E = A % B;
    ll F = D % B;

    if(C < E){
        return false;
    }
    if(F == 0){
        return true;
    }

    ll H = gcd(B, F);
    if(B-H>C){
        return false;
    }

    return true;
}

int main() {
    int T;
    cin >> T;
    ll A[300];
    ll B[300];
    ll C[300];
    ll D[300];

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

    for (int i = 0; i < T; ++i) {
        if(isMugen(A[i],B[i],C[i],D[i])){
            cout << "Yes" << endl;
        } else{
            cout << "No" << endl;
        }
    }



    return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

template <typename T>
using vec = vector<T>;

template <typename T>
using vec2 = vector<vector<T>>;

template <typename T>
using vec3 = vector<vector<vector<T>>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

template <typename T>
T Lcm(T a, T b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

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

    Int n, m;
    cin >> n >> m;
    vec<Int> a(n), b(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i] / 2;
    }

    bool isok = true;
    Int div2 = 0;
    for (Int i = a.front(); !(i & 1);) {
        div2++;
        i /= 2;
    }

    for (Int i = 1; i < n; i++) {
        Int tem = 0;
        for (Int j = a[i]; !(j & 1);) {
            tem++;
            j /= 2;
        }

        if (div2 != tem) {
            isok = false;
            break;
        }
    }

    if (isok) {
        Int lcm_b = b[0];
        if (2 <= n) {
            for (Int i = 1; i < n; i++) {
                lcm_b = Lcm(lcm_b, b[i]);
            }
        }

        cout << (m / lcm_b + 1) / 2 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

using namespace std;

const int MOD = 998244353;

int main(){
	int n,s;
	cin >> n >> s;
	vector<long long> dp(s+1);
	dp[0] = 1;
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		for(int j = s; j >= 0; j--){
			dp[j] += dp[j];
			if(j - x >= 0)
			 dp[j] += dp[j-x];
			dp[j]%=MOD;
		}
	}
	cout << dp[s] << "\n";
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int a, b, d;

signed main() {
	cin >> a >> b >> d;
	cout << b / d - (a - 1) / d << endl;
}

Measured memory_bytes: 3616
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl; }
void outl(ll x) { cout << x << endl; }
void outs(string x) { cout << x << endl; }
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
//---------------------------------------------------------------

int main() {
	int r, d, x2000;
	cin >> r >> d >> x2000;

	ll xi = x2000;

	rep(i, 10) {
		xi = r * xi - d;
		cout << xi << endl;
	}


}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
const int mod=998244353;
const int maxn=1000000;
long long fir[maxn+5],inv[maxn+5],ans=0;
long long C(int n,int m)
{
	if(n<m) return 0;
	return fir[n]*inv[m]%mod*inv[n-m]%mod;
}
long long ksm(long long x,long long n)
{
	long long ans=1;
	while(n)
	{
		if(n&1) ans=ans*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return ans;
}
void pre()
{
	fir[0]=fir[1]=1;
	for(int i=2;i<=maxn;i++) fir[i]=fir[i-1]*i%mod;
	inv[maxn]=ksm(fir[maxn],mod-2);
	for(int i=maxn-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
}
int main()
{
	pre();
	int n,k;
	scanf("%d%d",&n,&k);
	if(k<n)
	{
		puts("0");
		return 0;
	}
	for(int R=1;R<=k;R++)
	{
		int B=k-R;
		if(R<B) continue;
		if(R==B) B--;
		ans=(ans+C(R+B,R)-C(R+B,2*R-n+1))%mod;
	}
	ans=(ans%mod+mod)%mod;
	printf("%lld\n",ans);
}

Measured memory_bytes: 19416