akhauriyash/Code-Regression huggingface dataset:
n,m=map(int,input().split())

glaph={}

for i in range(1,n+1):
    glaph[i]=[]

for _ in range(m):
    a,b=map(int,input().split())
    glaph[a].append(b)
    glaph[b].append(a)

#print(glaph)

import itertools
junretsu=[]
for i in range(2,n+1):
    junretsu.append(i)
cnt=0

junretsu=list(itertools.permutations(junretsu))

#print(junretsu)
for item in junretsu:
    i=0
    flag=0
    if item[0] not in glaph[1]:
        flag=1

    while i<n-2:
        #print(item,i)
        if item[i+1] not in glaph[item[i]]:
            flag=1
        i+=1
    if flag==0:
        cnt+=1
        #print(item)
print(cnt)


Measured memory_bytes: 40432
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      if(A <= B*2){
        System.out.println(0);
      }else{
        System.out.println(A-B*2);
      }
    }
}     

Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    ll N, K; cin >> N >> K;
    vector<ll> h;
    REP(i, N){
        ll h_i; cin >> h_i;
        h.PB(h_i);
        }
    vector<ll> dp(N, INF);
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    REP(i, N){
        if (i == 0 || i == 1){
            continue;
        }
        ll min_cd = INF;
        REP(k, K){
            if (i-k == 0){
                break;
            }
            min_cd = min(min_cd, dp[i-k-1] + abs(h[i]-h[i-k-1]));
        }
        dp[i] = min_cd;
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 4948
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
    int a,b,k;
    cin >> a >> b >> k;

    int cnta=0,cntb = 0;
    for(int i=0; i < k; i++){
        if (i % 2 == 0){
            if (a % 2 == 1){
                a -= 1;
            } 
            a = a/2;
            b += a;
        } else {
            if (b % 2 == 1){
                b -= 1;
            }
            b = b/2;
            a += b;
        }
    }

    cout << a <<" " << b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();
    
    int n, W;
    cin >> n >> W;
    VI v(n), w(n);
    FOR(i, 0, n)cin >> v[i] >> w[i];

    vector<VI> dp(n + 1, VI(W + 1, 0));
    FOR(i, 0, n)eFOR(j, 0, W) {
        if (w[i] <= j)chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
        chmax(dp[i + 1][j], dp[i][j]);
    }
    cout << dp[n][W] << "\n";
}



Measured memory_bytes: 6820
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
 
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
 
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }
 
    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
 
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }
 
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};









int main(){
    int N;
    cin >> N;
    vector<int>A(N);
    REP(i, N) cin >> A.at(i);
    map<int,int>a;
    REP(i, N) a[A.at(i)]++;

    int cnt1 = 0, cnt2 = 0;

    for(auto x : a){
        if(x.second % 2 == 1) cnt1++;
        else if(x.second % 2 == 0) cnt2++;
    }
    
    int ans = cnt1 + cnt2;
    if(cnt2 & 1) ans--;
    print(ans);
    return 0; 
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int ans = 0;
		int cout = 0;
		while(ans < x) {
			cout++;
			ans += cout;
		}
		System.out.println(cout);
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>

using namespace std;
typedef long long int ll;

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

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

const int INF = 1 << 30;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i=0;i<N;i++){
        cin >> h[i];
    }

    //Processing
    vector<int> dp;
    for(int i=0;i<N;i++) dp.emplace_back(INF);

    dp[0]=0;

    for(int i=0;i<N;i++){
        for(int j=1;j<=K;j++){
            chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }

    cout << dp[N-1] << endl;

}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

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

    int n;
    cin>>n;
    if(n%10 == 7 or (n/10)%10 == 7 or (n/100)%10 == 7){
        cout << "Yes" << endl;
    }
    else cout  << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(void){
    string S;
    bool F[26]={};
    bool c=0;
    cin >> S;
    REP(i,S.size()){
        F[S[i]-'a']=1;
    }
    REP(i,26){
        if(F[i]==0){
            char a='a'+i;
            cout << a << endl;
            c=1;
            break;
        }
    }
    if(c==0){cout << "None" << endl;}
    return 0;
}


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

typedef long long ll;

int main() {
     
     int t = 1;
 //    cin>>t;

     while(t--){
        ll n, i, j, k, te;

        cin>>n;

        ll count[n+1], a[n];
        memset(count, 0, sizeof(count));

        for(i =0 ;i < n;i++)
         {
             cin>>te;
             a[i] = te;
             count[te]++;
         }
         ll res = 0;
         for(i = 1;i <= n;i++){
             res += count[i]*(count[i]-1)/2;
         }
        // cout<<res<<"\n";
         for(int  k = 0;k < n;k++){
             cout<<res - (count[a[k]])*(count[a[k]]-1)/2 + (count[a[k]]-1)*(count[a[k]]-2)/2<<"\n";
         }


     }
    return 0;
}


Measured memory_bytes: 5760
x, y, z, k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i).sort.reverse
bs = gets.split.map(&:to_i).sort.reverse
cs = gets.split.map(&:to_i).sort.reverse

ss = []
for ai in 0...as.length
  for bi in 0...bs.length
    break if k < (ai+1)*(bi*1)
    for ci in 0...cs.length
      break if k < (ai+1)*(bi+1)*(ci+1)
      ss << as[ai]+bs[bi]+cs[ci]
    end
  end
end
puts ss.sort.reverse[0...k]

Measured memory_bytes: 4600
#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>
using namespace std;
using i64 = int64_t;
int h, w;
vector<string> a;
int main() {
    cin >> h >> w;
    a.resize(h);
    for (int i = 0; i < h; ++i) cin >> a[i];
    vector<string> c[2];
    c[0] = c[1] = a;
    for (int i = 1; i < h - 1; ++i) {
        c[0][i][0] = '#';
        c[1][i][w - 1] = '#';
    }
    for (int i = 1; i < h - 1; ++i) {
        for (int j = 1; j < w - 1; ++j) {
            c[i % 2][i][j] = '#';
        }
    }
    for (int k = 0; k < 2; ++k) {
        for (auto& s : c[k]) cout << s << '\n';
        if (k == 0) cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 1536
def insertion_sort(a, n)
  puts a.join(' ')

  1.upto(n - 1) do |i|
    v = a[i]
    j = i - 1

    while j >= 0 and a[j] > v
      a[j + 1] = a[j]
      j -= 1
    end

    a[j + 1] = v

    puts a.join(' ')
  end
end

N, A = gets.to_i, gets.split.map(&:to_i)

insertion_sort(A, N)

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

struct UnionFind {
    vector<int> par;
    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }
    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
  int N,M;
  cin>>N>>M;
  UnionFind UF(N);
  for(int i=0;i<M;++i){
    int X,Y,Z;
    cin>>X>>Y>>Z;
    UF.unite(X-1,Y-1);
  }

  set<int> comp;
  for(int i=0;i<N;++i){
    comp.insert(UF.root(i));
  }

  cout<<comp.size()<<endl;
}

Measured memory_bytes: 5376
import java.util.*;
import java.io.*;

public class Main
{

public static void main( String[] args ) throws Exception
{
	final Scanner sc = new Scanner( System.in );
	final int N = sc.nextInt();//総ステップ数

	//前のステップのA,B,Cそれぞれに到達する際に取り得る最大スコア
	int maxA = 0;
	int maxB = 0;
	int maxC = 0;

	for( int i = 0; i < N; ++i )
	{
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int tmpMaxA = (maxB + a) > (maxC + a) ? (maxB + a) : (maxC + a);
		int tmpMaxB = (maxA + b) > (maxC + b) ? (maxA + b) : (maxC + b);
		int tmpMaxC = (maxA + c) > (maxB + c) ? (maxA + c) : (maxB + c);

		maxA = tmpMaxA;
		maxB = tmpMaxB;
		maxC = tmpMaxC;
	}

	if( maxA > maxB )
	{
		if( maxA > maxC )
		{
			p( maxA );
		}
		else
		{
			p( maxC );
		}
	}
	else
	{
		if( maxB > maxC )
		{
			p( maxB );
		}
		else
		{
			p( maxC );
		}
	}
}

public static void p( Object o )
{
	System.out.println( o );
}

}

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

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

	string ans = "Yes";
	rep(i, 0, s.size()) {
		if ((i + 1) % 2 == 0&&s[i]=='R') {
			ans = "No";
			break;
		}
		else if ((i + 1) % 2 == 1 && s[i] == 'L') {
			ans = "No";
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

inline void proc_status()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
}

template <typename T> T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int Maxn = 1e5 + 100, Mod = 1e9 + 7;

int N, e, Begin[Maxn], To[Maxn << 1], Next[Maxn << 1];
int Dp[Maxn][3];

inline void add_edge (int x, int y) { To[++e] = y; Next[e] = Begin[x]; Begin[x] = e; }

inline void Add (int &a, int b) { a += b; if (a >= Mod) a -= Mod; }

inline void dfs (int x, int f)
{
	Dp[x][0] = Dp[x][1] = 1;
	for (int i = Begin[x]; i; i = Next[i])
	{
		int y = To[i];
		if (y == f) continue;
		dfs(y, x);
		Dp[x][0] = (LL)(Dp[x][0]) * (Dp[y][1] + Dp[y][0]) % Mod;
		Dp[x][1] = (LL)(Dp[x][1]) * Dp[y][0] % Mod;
	}
}

inline void Solve ()
{
	dfs(1, 0);
	cout<<(Dp[1][0] + Dp[1][1]) % Mod<<endl;
}

inline void Input ()
{
	N = read<int>();
	for (int i = 1; i < N; ++i)
	{
		int x = read<int>(), y = read<int>();
		add_edge (x, y);
		add_edge (y, x);
	}
}

int main()
{
#ifdef hk_cnyali
	freopen("P.in", "r", stdin);
	freopen("P.out", "w", stdout);
#endif
	Input();
	Solve();
	return 0;
}


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

int main() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<int64_t> a(x), b(y), c(z);
  for (int i = 0; i < x; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < y; i++) {
    cin >> b.at(i);
  }
  for (int i = 0; i < z; i++) {
    cin >> c.at(i);
  }
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  sort(c.rbegin(), c.rend());
  priority_queue<tuple<int64_t, int, int, int>> q;
  q.emplace(a.at(0) + b.at(0) + c.at(0), 0, 0, 0);
  vector<tuple<int, int, int>> v;
  for (int i = 0; i < k; i++) {
    auto x = q.top();
    q.pop();
    int64_t p = get<0>(x);
    int s = get<1>(x), t = get<2>(x), u = get<3>(x);
    if (find(v.begin(), v.end(), make_tuple(s, t, u)) != v.end()) {
      i--;
      continue;
    }
    v.emplace_back(s, t, u);
    cout << p << endl;
    if (s + 1 < a.size() && find(v.begin(), v.end(), make_tuple(s + 1, t, u)) == v.end()) {
      q.emplace(a.at(s + 1) + b.at(t) + c.at(u), s + 1, t, u);
    }
    if (t + 1 < b.size() && find(v.begin(), v.end(), make_tuple(s, t + 1, u)) == v.end()) {
      q.emplace(a.at(s) + b.at(t + 1) + c.at(u), s, t + 1, u);
    }
    if (u + 1 < c.size() && find(v.begin(), v.end(), make_tuple(s, t, u + 1)) == v.end()) {
      q.emplace(a.at(s) + b.at(t) + c.at(u + 1), s, t, u + 1);
    }
  }
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];
ll B[100005];
int main()
{
	int N;
	cin >> N;
	REP(i, N)
	{
		cin >> A[i];
		B[i] = A[i];
	}
	sort(A, A + N);
	sort(B, B + N, [](ll a, ll b) {return a > b; });

	int ai = 1, bi = 0;
	ll l = A[0], r = A[0];
	ll ans = 0;
	while (ai + bi < N)
	{
		ll a = A[ai];
		ll b = B[bi];
		ll ad = std::max(abs(l - a), abs(r - a));
		ll bd = std::max(abs(l - b), abs(r - b));
		if (ad > bd)
		{
			if (abs(l - a) < abs(r - a))
			{
				r = a;
			}
			else
			{
				l = a;
			}
			ai++;
		}
		else
		{
			if (abs(l - b) < abs(r - b))
			{
				r = b;
			}
			else
			{
				l = b;
			}
			bi++;
		}
		ans += std::max(ad, bd);

	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
r,d,x=map(int,input().split())
z_1=r*x-d
z_2=r*z_1-d
z_3=r*z_2-d
z_4=r*z_3-d
z_5=r*z_4-d
z_6=r*z_5-d
z_7=r*z_6-d
z_8=r*z_7-d
z_9=r*z_8-d
z_10=r*z_9-d
print(z_1)
print(z_2)
print(z_3)
print(z_4)
print(z_5)
print(z_6)
print(z_7)
print(z_8)
print(z_9)
print(z_10)


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

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




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;




int n;
ll a,b;



bool test(ll x, vector<ll> h) {
    ll boost = a-b;
    ll need = 0;
    for (int i=0; i<n; i++) {
	h[i] -= x*b;
	if (h[i]<0) continue;
	need += (h[i]+boost-1)/boost;
    }
    return need<=x;    
}

vector<ll> h;
ll ans;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n>>a>>b;
    h.resize(n);
    for (int i=0; i<n; i++) {
	cin>>h[i];
    }

    ll lo=0;
    ll hi = 1e10;
    while (hi-lo>1) {
	ll mid = (lo+hi)/2;
	if (test(mid, h)) {
	    hi=mid;
	} else {
	    lo=mid;
	}
    }
    
    cout<<hi<<endl;
  

    return 0;
}


Measured memory_bytes: 1792
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let s: String = read!();
    let s = s.chars().collect_vec();

    let mut before = "".to_string();
    let mut now = "".to_string();
    let mut ans = 0;
    for &c in &s{
        now.push(c);
        if before!=now{
            before=now;
            now="".to_string();
            ans+=1;
        }
    }

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


Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int a, b, k; cin >> a >> b >> k;
  set<int> ans;
  for (int i = 0; i < k && a + i <= b; i++)
    ans.insert(a + i);
  for (int i = 0; i < k && b - i >= a; i++)
    ans.insert(b - i);
  
  for (auto& n : ans) outl(n);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

	    Scanner scanner = new Scanner(System.in);
	    String line1 = scanner.next();
        String tmpStr = "";
        boolean chkflg = false;
        String[] strArray = line1.split("");
        for(String s : strArray) {
            if (tmpStr.equals(s)) {
              chkflg = true;
            }
            tmpStr = s;
        }
        if (chkflg) {
            System.out.println("Bad");
        } else {
            System.out.println("Good");   
        }
    }
}

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

int64_t f(int64_t x,int64_t n){
  if(n != 0 && x >= 0)
  	return x/n + 1;
  else 
    return 0;
}
  
int main(){
  int64_t a,b,c;
  cin >> a >> b >> c;
  int64_t count = 0;
  cout << (int64_t)f(b,c) - (int64_t)f(a-1,c) << endl;
}


Measured memory_bytes: 256
import math
N=int(input())
S=list()
ans=0

const=math.factorial(N-1)*2/math.factorial(N)

for i in range(N):
    S.append(list(map(int,input().split())))


for i in range(N-1):
    for j in range(i+1,N):
        x1,y1=S[i]
        x2,y2=S[j]
        ans+=const*(((x1-x2)**2+(y1-y2)**2)**(1/2))

print(ans)

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

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string[] ps = Console.ReadLine().Split(' ');
            int[] intps = ps.Select((x, i) => { return int.Parse(x); }).ToArray();
            Array.Sort(intps, (x, y) => { return x - y; });
            int count = 0;
            int res = 0;
            for(int i = 0;i < intps.Length; i++)
            {
                count++;
                if(count == int.Parse(n) / 2)
                {
                    if(i + 1 != intps.Length && intps[i] != intps[i  + 1])
                    {
                        res = intps[i + 1] - intps[i];
                    }
                    else
                    {
                        res = 0;
                    }
                }
            }
            Console.WriteLine(res);
        }
    }
}


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

class Program
{
    static void Main(string[] args)
    {
    	var sc = new Scanner();
    	int n = sc.NextInt();
    	int t = sc.NextInt();
    	int a = sc.NextInt();
    	double[] h = new double[n];
    	int ans = 0;
    	double min = 1000000;
    	for (int i = 0; i < n; i++)
    	{
    	    double d = Math.Abs(t - sc.NextInt() * 0.006 - a);
    	    if (d < min)
    	    {
    	    	min = d;
    	    	ans = i;
    	    }
    	}
    	Console.WriteLine(ans + 1);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }
    
    public double NextDouble()
    {
    	CheckNext();
    	return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

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

using namespace std;
const int mod = 924844033;
const int maxn = 4000 + 10;
typedef long long int lli;

int link[maxn];
lli x[maxn];
lli dp[maxn][maxn][2];

int main() {
    int n, k, tot = 0;
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= k; i++) {//i枚举链的起点
        for (int p = 0; p < 2; p++) {//因为p=0时,起点为第i个点,p=1时,为第i个坑
            for (int j = i; j <= n; j += k) {
                tot++;
                if (j != i) link[tot] = 1;//link[i]代表第i条边是否与上一条边相连
            }
        }
    }
    x[1] = 1;
    x[0] = 1;
    for (int i = 2; i <= n; i++) {
        x[i] = x[i - 1] * i % mod;
    }
    dp[0][0][0] = 1;
    for (int i = 0; i < n * 2; i++) {
        for (int j = 0; j <= n; j++) {
            dp[i + 1][j][0] = (dp[i][j][0] + dp[i][j][1]) % mod;
            if (link[i + 1]) dp[i + 1][j + 1][1] = dp[i][j][0];
        }
    }
    lli sum = 0, t = 1;
    for (int i = 0; i <= n; i++) {
        sum += ((dp[n * 2][i][0] + dp[n * 2][i][1]) % mod * x[n - i] % mod * t + mod) % mod;
        sum %= mod;
//        lli tmp = (dp[n * 2][i][0] + dp[n * 2][i][1]) % mod * x[n - i] % mod;
//        sum = (sum + (tmp * t + mod) % mod) % mod;
        t *= -1;
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 249728
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        int a = Integer.parseInt(arr[0]);
        int b = Integer.parseInt(arr[1]);
        out.println(a - b + 1);
        out.close();
    }
}


Measured memory_bytes: 21460
H, W, M = gets.split.map(&:to_i)
targets = M.times.map { gets.split.map(&:to_i) }

exists = Hash.new { |h, k| h[k] = {} }
counter_H = Hash.new(0)
counter_W = Hash.new(0)

targets.each do |y, x|
  exists[y][x] = true
  counter_H[y] += 1
  counter_W[x] += 1
end

maxH = -Float::INFINITY
cand_H = []
maxW = -Float::INFINITY
cand_W = []

counter_H.each do |y, cnt|
  if maxH < cnt
    maxH = cnt
    cand_H = [y]
  elsif maxH == cnt
    cand_H << y
  end
end

counter_W.each do |x, cnt|
  if maxW < cnt
    maxW = cnt
    cand_W = [x]
  elsif maxW == cnt
    cand_W << x
  end
end

maxV = counter_H[cand_H.first] + counter_W[cand_W.first]

cand_H.product(cand_W) do |y, x|
  if !exists[y][x]
    puts maxV
    exit
  end
end

puts maxV - 1


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

using namespace std;

set<int> bad;

int n, k;

bool check(int x)
{
	while (x)
	{
		if (bad.count(x % 10)) return false;
		x /= 10;
	}
	return true;
}

int main()
{
	cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		int a;
		cin >> a;
		bad.insert(a);
	}
	while (!check(n)) n++;
	cout << n << '\n';
	return 0;
}


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

int main() {
	int bingo[3][3];
	for(int i = 0; i < 3; ++i) 
		for(int j = 0; j < 3; ++j) {
			cin >> bingo[i][j];
		}
	int n;
	cin >> n;
	while(n--) {
		int tmp;
		cin >> tmp;
		for(int i = 0; i < 3; ++i) 
			for(int j = 0; j < 3; ++j)
				if(bingo[i][j] == tmp)
					bingo[i][j] = 0;
			
	}
	bool win = false;
	for(int i = 0; i < 3; ++i) {
		int sumR = 0, sumC = 0, sumD = 0, sumDI = 0;
		for(int j = 0; j < 3; ++j) {
			sumR += bingo[i][j];
			sumC += bingo[j][i];
			sumD += bingo[j][j];
			sumDI += bingo[j][2-j];
		}
		if(sumR == 0 || sumC == 0 || sumD == 0 || sumDI == 0) {
			win = true;
			break;
		} 
	}
	
	cout << ((win)?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

ll n, m, ans;
vll visited;
vvll g;

void dfs(ll u, ll depth = 1) {
    visited[u] = 1;
    if (depth == n) {
        ans++;
    }
    for (ll &v : g[u]) {
        if (visited[v]) {
            continue;
        }
        dfs(v, depth + 1);
    }
    visited[u] = 0;
}

int main() {
    fast_io; cout_precision;
    cin >> n >> m;
    g.resize(n + 1);
    for (ll i = 0, a, b; i < m; i++) {
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    ans = 0;
    visited.resize(n + 1);
    dfs(1);
    cout << ans << endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);


inline LL in() { LL in; scanf("%lld", &in); return in; }
inline void outLL(LL out, bool endl = 1) { printf("%lld%c", out, " \n"[endl]); }


int main() {
	LL K = in();
	LL N = 50;
	vector<LL> a(N);
	LL add = K / N;
	K %= N;
	FOR(i, 0, K%N) {
		a[i] = N - i;
	}
	FOR(i, K%N, N) {
		a[i] = N - K - 1;
	}
	FOR(i, 0, N) {
		a[i] += add;
	}
	outLL(N);
	FOR(i, 0, N) {
		outLL(a[i], i + 1 == N);
	}

}

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

ll N, Z, W;
vector<ll> a;

ll dfs(ll x, ll y, ll i, ll c){
    if(i == N-1){
        if(c%2 == 0) return abs(y-a[N-1]);
        else return abs(x-a[N-1]);
    }
    if(c%2 == 0){
        ll ret1 = dfs(a[i], y, i+1, c+1);
        ll ret2 = dfs(x, y, i+1, c);
        return max(ret1, ret2);
    }else{
        ll ret1 = dfs(x, a[i], i+1, c+1);
        ll ret2 = dfs(x, y, i+1, c);
        return min(ret1, ret2);
    }
}

int main(){
    cin >> N >> Z >> W;
    a.resize(N);
    rep(i, 0, N) cin >> a[i];

    if(N == 1) cout << abs(W-a[0]) << endl;
    else cout << max(abs(W-a[N-1]), abs(a[N-2] - a[N-1]));    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
void READ() {
#define R READ();
#define INFI 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MEMX(x,num) memset(x,num,sizeof(x))
#define prln(x) cout<<#x<<"="<<x<<endl
#define prt(x) cout<<x<<endl
#define prk(x) x<<" "
#define sz(x) int(x.size())
#define PB(x) push_back(x)
#define LINK(x,y) G[x].PB(y),G[y].PB(x)
#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
#endif
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(6);
}
///////////////////////////
const int N = 5 + 3e2;

int n,ans;
char s[N][N],s2[N][N];
bool check(int k) {
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            s2[i][j]=s[i][(j+k)%n];
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(s2[i][j]!=s2[j][i])return 0;
        }
    }
    return 1;
}
int main() {
    
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> s[i];
    for(int k = 0; k < n; k++) {
        if(check(k))ans += n;
    }
    cout<<ans;

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
int i,j,k,n,m;
string s;

int main() {
  cin >> n>>k;
  vector<int> v(n);
  vector<int> sum(n-k+1);
  for(i=0; i< n; ++i) cin >> v[i];
  for(i=0; i< n-k+1; ++i) {
    int r,l;
    r = abs(v[i]) + abs(v[i+k-1] - v[i]);
    l = abs(v[i+k-1]) + abs(v[i+k-1] - v[i]);
    sum[i] = min(r,l);
  }
  sort(sum.begin(),sum.end());
  cout << sum[0] << endl;
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "
#define F           first
#define S           second
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353 ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());  after namespace std
// srand(chrono::high_resolution_clock::now().time_since_epoch().count()); after ios:base
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll dp[3005][3005];
    ll prefsum[3005][3005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*ll n,i;
    cin>>n;
    ll a[n];
    ll h[n];
    for(i=0;i<n;i++)
        cin>>h[i];
    for(i=0;i<n;i++)
        cin>>a[i];
    set<pair<ll,ll> >s;
    ll dp[n];
    dp[0]=a[0];
    for(i=1;i<n;i++)
    {

    }*/

    memset(dp,0,sizeof(dp));
    memset(prefsum,0,sizeof(prefsum));
    ll n,i,j;
    cin>>n;
   string s;
   cin>>s;
    for(i=1;i<=n;i++)
    {
            dp[0][i]=1;
    }
    /*prefsum[0][1]=dp[0][1];
    for(i=2;i<=n;i++)
        prefsum[0][i]=prefsum[0][i-1]+dp[0][i];*/
    //cout<<prefsum[0][10]<<"\n";
    for(i=1;i<n;i++)
    {   ll p=dp[i-1][1];
        prefsum[i-1][1]=p;
        for(j=2;j<=n;j++)
            {
                p=(p+dp[i-1][j])%hell;
                prefsum[i-1][j]=p;
            }
        for(j=1;j<=(i+1);j++)
        {if(s[i-1]=='<')
            {   if(j==1)
                {
                    dp[i][j]=0;
                    continue;
                }
                dp[i][j]=prefsum[i-1][j-1];
            }
        else
            {
                dp[i][j]=(prefsum[i-1][i]-prefsum[i-1][j-1]+hell)%hell;
            }
        }
    }
    ll ans=0;
    for(i=1;i<=n;i++)
        ans=(ans+dp[n-1][i])%hell;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 141440
#include<stdio.h>
int main()
{
  int a,b,c,d,e;
  scanf("%d",&a);
  scanf("%d %d",&b,&c);
  d=b%a;
  e=c-b+d;
  if(d==0||(a>=d&&a<=e)) printf("OK\n");
  else printf("NG\n");
   return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    ll a[100010];
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    //for(int i=0;i<n;i++) cout<<a[i]<<endl;
    int cnt=0;
    vector<ll>v;
    int i=n-1;
    while(i>=1){
        if(a[i]==a[i-1]){
            cnt++;
            v.push_back(a[i]);
           // cout<<a[i]<<endl;
            i-=2;
        }
        else{
            i--;
        }
        if(cnt==2) break;
    }
    if(cnt==2)cout<<v[0]*v[1]<<endl;
    else cout<<0<<endl;
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int cnt = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

	}

	for (int i = 1; i < n; i++) {
		bool f = true;
		for (int j = 0; j < i; j++) {
			if (a[i] < a[j]) {
				f = false;
				break;
			}
		}
		if (f) cnt++;
	}
	cout << cnt;

}

Measured memory_bytes: 256
str = input()
words = ["dream", "dreamer", "erase", "eraser"]

def replace(S, s):
    reversedS = S[::-1]
    reverseds = s[::-1]
    replaced = reversedS.replace(reverseds, "", 1)
    return replaced[::-1]

while True:
    tmp = str
    for word in words:
        if str.endswith(word):
            str = replace(str, word)
            break
    if tmp == str:
        print("NO")
        break
    if str == "":
        print("YES")
        break
    tmp = str

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

int main(){
    int N, L;
    cin >> N >> L;
    int tastes[N];
    int min_abs = 10000;
    
    int sum = 0;
    
    for(int i = 1; i <= N; i++){
        int aji = i + L - 1;
        min_abs = min(min_abs, abs(aji));
        sum += aji;
    }
    if (sum > 0){
        cout << sum - min_abs << endl;
    } else {
        cout << sum + min_abs << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
 int n,a,b; 
  cin >> n >> a >> b;
  
  int p;
  int res1=0,res2=0,res3=0;
  for(int i=0;i<n;i++){
    cin >>p;
    if(p<=a) res1++;
    else if(p<=b) res2++;
    else res3++;
  }
 cout << min(res1,min(res2,res3)) << endl;
   
}

Measured memory_bytes: 256
#include <iostream>

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))
#define each(i, map) for (auto& i : map)

int main()
{
    char a; cin >> a;
    if (isupper(a)) {
        cout << "A" << endl;
    }
    else if (islower(a)) {
        cout << "a" << endl;
    }

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
vector <string> a;
map <string,int> b;
string s;
int k;

int main(){
	cin>>s>>k;
	for(int i=0;i<s.size();i++){
		string t="";
		t=t+s[i];
		if(b[t]!=1){
			a.push_back(t);
			b[t]=1;
		}
		if(s.size()-i>1){
			t=t+s[i+1];
			if(b[t]!=1){
				a.push_back(t);
				b[t]=1;
			}
			if(s.size()-i>2){
				t=t+s[i+2];
				if(b[t]!=1){
					a.push_back(t);
					b[t]=1;
				}
				if(s.size()-i>3){
					t=t+s[i+3];
					if(b[t]!=1){
						a.push_back(t);
						b[t]=1;
					}
					if(s.size()-i>4){
						t=t+s[i+4];
						if(b[t]!=1){
							a.push_back(t);
							b[t]=1;
						}
					}
				}
			}
		}
	}
	sort(a.begin(),a.end());
	cout<<a[k-1]<<endl;
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N, H, W;
    bool flag = false;
    cin >> N >> H >> W;
    int count = 0;
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            if (j + W - 1 <= N) {
                flag = true;
            } else {
                flag = false;
            }

            if (flag && i + H - 1 <= N) {
                ++count;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 2e5 + 5;

#ifndef M_PI
#define M_PI acos(-1)
#endif

double toDeg(double a) {
	return a * 180.0 / M_PI;
}

double toRad(double a) {
	return a * M_PI / 180.0;
}

double a, b, k;

bool validWater(double t) {
	double y = b * sin(toRad(t));
//	double x = y / sin(90 - t);
	double x = y / cos(toRad(t));
	return x * b / 2.0 < k;
}

bool validAir(double t) {
//	double y = b * sin(toRad(t));
	double x = a / tan(toRad(t));
	return x * a / 2.0 > k;
}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cout << fixed << setprecision(10);
	cin >> a >> b >> k;
	k /= a;
	if (k > a * b / 2.0) {
		k = a * b - k;
		double st = 0, size = 90;
		for (; size > eps; size *= 0.5) {
			if (validAir(st + size))
				st += size;
		}
		double res = 90 - st;
		cout << res << endl;
	} else {
		double st = 0, size = 90;
		for (; size > eps; size *= 0.5) {
			if (validWater(st + size))
				st += size;
		}
		double res = 90 - st;
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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











int main(){
    ll n;
    cin >> n;
    cout << n * n * n << endl;
}


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

int main() {
   int k, a, b;
   cin >> k >> a >> b;
   bool can = false;
   for (int i = a; i <= b; i++)
   {
       if (i % k == 0) {
           can = true;
           break;
       }
   }
   if (can)  cout << "OK";
   else  cout << "NG";
   return 0;
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  if(k%2==1){
    x-=d;
    x = abs(x);
  }
  d *= 2;
  k /= 2;
  int64 n = x / d;
  if(n >= k){
    ANS(x - d * k);
  }else{
    ANS(min(x-d*n, d*(n+1)-x));
  }
  return 0;
}

Measured memory_bytes: 3660