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

using namespace std;

char s[110][110]; 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15); 
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)    
        for (int j = 1; j <= m; ++j)
            cin >> s[i][j]; 
    while (1) {
        int mh, ml;
        mh = ml = 0;  
        for (int i = 1; i <= n; ++i) {
            bool flag = 0; 
            bool can = 0; 
            for (int j = 1; j <= m; ++j) {
                if (s[i][j] == '#') {
                    flag = 1; 
                    break; 
                }
                if (s[i][j] == '.') {
                    can = 1; 
                }
            }
            if (!flag && can) {
                mh = i; 
                break; 
            }
        }
        if (mh) {
            for (int j = 1; j <= m; ++j)
                s[mh][j] = ' ';
            continue;  
        }
        for (int i = 1; i <= m; ++i) {
            bool flag = 0; 
            bool can = 0; 
            for (int j = 1; j <= n; ++j) {
                if (s[j][i] == '#') {
                    flag = 1; 
                    break; 
                }
                if (s[j][i] == '.') {
                    can = 1; 
                }
            }
            if (!flag && can) {
                ml = i; 
                break; 
            }
        }
        if (ml) {
            for (int i = 1; i <= n; ++i)
                s[i][ml] = ' '; 
            continue; 
        }
        break; 
    }
    for (int i = 1; i <= n; ++i) {
        bool flag = 0; 
        for (int j = 1; j <= m; ++j) {
            if (s[i][j] != ' ') {
                cout << s[i][j];
                flag = 1; 
            }
        }
        if (flag) cout << endl; 
    }
    return 0;  
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

sums = 0
for i in range(N):
    sums ^= a[i]

f = True
for i in range(N):
    if a[i] == sums ^ a[i]:
        pass
    else:
        f = False

if f:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14116
#include "bits/stdc++.h"
#define int long long

using namespace std;

struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x, int y) {
        x = root(x);
        y = root(y);
        if(x != y) {
            if(data[y] < data[x])
                swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
};

signed main() {
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind g(N);
    vector<vector<int>> friends(N, vector<int>());
    for(auto i = 0LL; i < M; i++) {
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        friends[A].push_back(B);
        friends[B].push_back(A);
        g.unionSet(A, B);
    }
    vector<vector<int>> blocks(N, vector<int>());
    for(auto i = 0LL; i < K; i++) {
        int C, D;
        cin >> C >> D;
        C--;
        D--;
        blocks[C].push_back(D);
        blocks[D].push_back(C);
    }
    for(auto i = 0LL; i < N; i++){
        int ans = g.size(i) - friends[i].size() - 1;
        for(auto j = blocks[i].begin(); j!= blocks[i].end(); j++){
            if(g.findSet(i, *j))
                ans--;
        }
        cout << ans;
        if(i < N - 1){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}


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

#define FOR(i,a,b)  for(ll (i)=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll (i)=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cout << #a << " = " << a << endl

const ll inf = 1e15;
const ll mod = 1e9+7;

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

int N, H[21];

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

    int max_h = 0, result = 0;
    for (int i = 0; i < N; i++) {
        if (H[i] >= max_h) {
            result++;
        }
        max_h = max(max_h, H[i]);       
    }

    cout << result << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;

int main() {
    int a, b, c;
    scanf("%d %d %d",&a,&b,&c);
    printf(a <= c && a+b >= c ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <unordered_set>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <climits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>
#include <atomic>
#include <thread>

using namespace std;
typedef long long ll;
#define ln '\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define drep(i,n) int i = 0;for(;i<(n);++i)
#define FOR(i,s,e) for(int i=s;i<=(e);++i)
#define DFOR(i,s,e) int i = s;for(;i<=(e);++i)
#define FORR(i,s,e) for(int i=s;i>=(e);--i)
#define DFORR(i,s,e) int i = s;for(;i>=(e);--i)
#define fore(a, x) for(auto& a : x)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ft first
#define sd second
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define Fill(a,b) memset(a,b,sizeof(a))
template<typename T1, typename T2> bool Max(T1& a, T2 b) { return a<b ? a = b, 1 : 0; }
template<typename T1, typename T2> bool Min(T1& a, T2 b) { return a>b ? a = b, 1 : 0; }



const int N = 200001, inf = 10000;
int b[N];
vector<int> rt[N];
vector<int> st;
int n,m;

void upd(int i, int v) {
  for (i += n + 1; st[i] > v; i >>= 1) st[i] = v;
}

int que(int l, int r) {
  int ret = N;
  for (l += n + 1, r += n + 2; l < r; l >>= 1, r >>= 1) {
    if (l & 1) Min(ret, st[l++]);
    if (r & 1) Min(ret, st[--r]);
  }
  return ret;
}

void solve() {
  cin >> n;
  st.assign(2 * n + 2, N);
  int ans = 0;
  FOR(i, 1, n)cin >> b[i], ans += b[i] == 0;
  cin >> m;
  int l, r;
  while (m--) {
    cin >> l >> r;
    rt[l].push_back(r);
  }
  upd(0, 0);
  FOR(i, 1, n) {
    fore(r, rt[i]) {
      upd(r, que(i - 1, r));
    }
    upd(i, que(i - 1, i - 1) + (b[i] ? 1 : -1));
  }
  ans += que(n, n);
  cout << ans << ln;
}


void init() {
  
}

int main(void) {
  ios::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
  //freopen("C:\\Users\\LENOVO\\Documents\\Visual Studio 2015\\Projects\\Test\\Input\\in.in", "r", stdin);

  init();
  int TC = 1;
#if 0
  cin >> TC; cin.get();
#endif
  FOR(TI, 1, TC) {
    //cout << "Case #" << TI << ": ";
    solve();
  }
  
  
  return 0;
}



Measured memory_bytes: 11264
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;

  ll a = stoi(S.substr(0, 2));
  ll b = stoi(S.substr(2, 2));

  if (a >= 1 && a <= 12) {

    if (b >= 1 && b <= 12) {
      cout << "AMBIGUOUS" << endl;
    } else {
      cout << "MMYY" << endl;
    }

  } else if (b >= 1 && b <= 12) {
    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;

namespace Atc_0027
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            string result = "";

            for (int i = 0; i < str.Length; i++)
            {
                result += "x";
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 25876
/*
AizuOnline A2252
Title
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
char left[]="qwertasdfgzxcvb";
char buf[34];
//
int side(char c)
{
  if(strchr(left,c))
    return(1);
  else
    return(0);
}
main()
{
  int i,cnt;
  char pr;

  while(1)
    {
      fgets(buf,sizeof(buf),stdin);
      if(buf[0]=='#' && buf[1]=='\n')
	 break;
      pr=buf[0];cnt=0;
      for(i=1;i<strlen(buf)-1;i++)
	{
	  if(side(pr)!=side(buf[i]))
	    cnt++;
	  pr=buf[i];
	}
      printf("%d\n",cnt);
    }
  return(0);
}

Measured memory_bytes: 524
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
#include<bitset>
using namespace std;

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

	for (int i = 1; i <= 3; i++) {
		int seven = fmod(N, pow(10, i)) / pow(10, i - 1);
		
		if (seven == 7)
		{
			cout << "Yes" << endl;
			return 0;
		}

	}

	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3908
#include <iostream>
#include <string>
using namespace std;
int main(void){
    string s;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s[i]=='1'){
            s[i]='9';
        }else{
            s[i]='1';
        }
    }
    cout<<s<<endl;
}


Measured memory_bytes: 256
while True:
    n=int(input())
    count=0
    if n==0:
        break
    x=1000-n
    if x>=500:
        count+=1
        x-=500
    a=x//100
    count+=a
    if a>0 :
        x=x-a*100
    if x>=50 :
        count+=1
        x-=50
    b=x//10
    count+=b
    if b>0 :
        x=x-b*10
    if x>=5 :
        count+=1
        x-=5
    count+=x
    
    print(count)
    
    


Measured memory_bytes: 5592
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
        int h,n;
        cin>>h>>n;
        int a,sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>a;
            sum+=a;
        }
        if(sum>=h)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }
        
        return 0;
    }

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

using namespace std;

int N, M, r, q;

int start = 540;
bool use[10010][1000];
int login[10010][1000];

int main() {
	while (1) {
		cin >> N >> M; if (N == 0 && M == 0) break;
		cin >> r;
		
		memset(use, 0, sizeof(use));
		memset(login, -1, sizeof(login));
		for (int i = 0; i < r; i++) {
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			n--; m--;
			if (s) {
				login[m][n] = t - start;
			} else {
				int in = login[m][n], out = t - start;
				for (int p = in; p < out; p++) use[m][p] = true;
			}
		}
		
		cin >> q;
		for (int i = 0; i < q; i++) {
			int ts, te, m; cin >> ts >> te >> m;
			ts -= start; te -= start; m--;
			int ans = 0;
			for (int p = ts; p < te; p++) if (use[m][p]) ans++;
			cout << ans << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 50044
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
inline void add(int &x, int v) { x += v; if (x >= MOD) x -= MOD; }
inline int mul(int x, int y) { return (1LL*x*y)%MOD; }

int fact[(1<<16)+1];

int modpow(int x, int k) {
  int a = 1;
  while (k > 0) {
    if (k & 1) a = (1LL*a*x) % MOD;
    x = (1LL*x*x) % MOD;
    k >>= 1;
  }
  return a;
}

int inv(int x) {
  return modpow(x, MOD-2);
}

int nCr(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  return (1LL * fact[n] * inv((1LL*fact[k]*fact[n-k]) % MOD)) % MOD;
}

// 10:39-10:59-11:04
int N, M;
int A[16];
int dp[17][2][1<<16];
int nCr2k[(1<<16)+1][16];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=1<<16; i++) fact[i] = mul(i, fact[i-1]);
  rep(all, (1<<16)+1) rep(i, 16) {
    nCr2k[all][i] = nCr(all, (1<<i)-1);
  }

  cin >> N >> M;
  rep(i, M) cin >> A[i];
  sort(A, A+M, greater<int>());

  dp[0][0][0] = 1;
  rep(i, M) {
    rep(sz, 2) {
      rep(S, 1<<N) {
        add(dp[i+1][sz][S], dp[i][sz][S]);

        int all = (1<<N)-A[i];
        rep(j, N) if ((S>>j)&1) all -= 1<<j;
        if (all < 0) continue;
        rep(j, N) if (((S>>j)&1) == 0) {
          int v = dp[i][sz][S];
          assert(all >=0 && all <= 1<<16);
          v = mul(v, nCr2k[all][j]);
          add(dp[i+1][sz^1][S|(1<<j)], v);
        }
      }
    }
  }
  int s = 0;
  rep(sz, 2) {
    rep(S, 1<<N) {
      int v = dp[M][sz][S];
      int all = (1<<N)-1;
      rep(i, N) if ((S>>i)&1) all -= 1<<i;
      rep(i, N) if (((S>>i)&1) == 0) {
        v = mul(v, nCr(all, 1<<i));
        all -= 1<<i;
      }
      assert(all == 0);
      if (sz==1) v = (MOD-v)%MOD;
      add(s, v);
    }
  }
  rep(i, N) s = mul(s, mul(2, fact[1<<i]));
  cout << s << "\n";
  return 0;
}


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

int main(){
  int A,B,x,y;
  cin >> A >> B;
  x = A + B;
  y = x % 2;
  if(y == 0)
    cout << x / 2 << '\n';
  else
    cout << "IMPOSSIBLE" << '\n';
  return 0;
}


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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
// const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto &(i) : (vec))

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

inline void update(Vint &DP, Vint &A, int i, int j){
  int cost = abs(A.at(i) - A.at(j));
  DP.at(i) = min(DP.at(i), DP.at(j) + cost);
}

int main(void){
  int n, k; cin >> n >> k;
  Vint A(n), DP(n + 2, INFi); vREP(ele, A) cin >> ele;
  // DP[i] := i までの最小値
  DP.at(0) = 0;
  REP(i, n){
    FOReq(j, 1, k){
      if(i + j <= n - 1) update(DP, A, i + j, i);
    }
  }
  //vREP(ele, DP) cout << ele << "\n";
  cout << DP.at(n - 1) << "\n";
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

void swap(double *xp, double *yp)
{
    double temp = *xp;
    *xp = *yp;
    *yp = temp;
}
  
void bubbleSort(double arr[], int n)
{
    int i, j;
    for (i = 0; i < n-1; i++){
        for (j = 0; j < n-i-1; j++){
            if (arr[j] > arr[j+1])
                swap(&arr[j], &arr[j+1]);
        }
    }
}

int main(void) {
    int n;
    cin >> n;
    
    double material_value[n];
    
    for (int i = 0; i < n; i++) {
        cin >> material_value[i];
    }
    
    bubbleSort(material_value, n);
    double total = material_value[0];
    
    for (int k = 1; k < n; k++) {
        total = (material_value[k] + total) / 2;
    }
    cout << total << endl;

    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var line = Console.ReadLine().Split(' ');

        var l = int.Parse(line[0]);
        var r = int.Parse(line[1]);
        var d = int.Parse(line[2]);

        var ans = 0;

        for(var i = l; i <= r; i++)
        {
            if(i % d == 0)
            {
                ans++;
            }

        }

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



Measured memory_bytes: 17836
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
	int type,a,b;
	scanf("%d",&type);
	if(type==1)printf("Hello World\n");
	if(type==2){
		scanf("%d\n%d",&a,&b);
		printf("%d\n",a+b);
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

//		long[] li = new long[n];
//		for (int i=0; i < n; i++) {
//			li[i] = sc.nextLong();
//		}

		int count = 0;
		for (int i=0; i < n; i++) {
			int x = sc.nextInt();
			if ( isPrime(x) ) count++;
		}

		System.out.println(count);

	}

	static boolean isPrime(int n) {
		if (n < 2) return false;
		else if (n == 2) return true;
		else {
			if (n % 2 == 0) return false;
			else {

				int i = 3;
				while (i*i <= n) {
					if (n % i == 0) return false;
					i += 2;
				}
				return true;

			}
		}
	}

}

Measured memory_bytes: 41188
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  char a;
  cin >> a;
  if (a >= 'A' && a <= 'Z') {
    cout << "A" << endl;
  } else {
    cout << "a" << endl;
  }
  return 0;

}


Measured memory_bytes: 3648
#include <cstdio>

typedef long long LL;
const int MN = 100005, MQ = 100005;

int N, Q; LL M;
int pa[MN]; int fp(int x) { return pa[x] ? pa[x] = fp(pa[x]) : x; }
int qu[MQ], qv[MQ], K;
int E;

int main() {
	scanf("%d%lld%d", &N, &M, &Q);
	for (int i = 1; i <= Q; ++i) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		++x, ++y;
		if (z == 0) { if ((x = fp(x)) != (y = fp(y))) pa[y] = x, ++E; }
		else qu[++K] = x, qv[K] = y;
	}
	if (K && M == N - 1) return puts("No"), 0;
	for (int i = 1; i <= K; ++i)
		if ((qu[i] = fp(qu[i])) == (qv[i] = fp(qv[i])))
			return puts("No"), 0;
	int C = N - E;
	if (C == 2) return puts("No"), 0;
	if (M > E + (LL)C * (C - 1) / 2) return puts("No"), 0;
	return puts("Yes"), 0;
	return 0;
}


Measured memory_bytes: 2444
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
#include <map>
using ll = long long int;
using namespace std;

int main()
{
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int> A(N, 0);
    for (int i = 0; i < N - 1; i++)
    {
        if ((S[i] == 'A') && (S[i + 1] == 'C'))
        {
            A[i + 1] = A[i] + 1;
        }
        else
        {
            A[i + 1] = A[i];
        }
    }
    for (int i = 0; i < Q; i++)
    {
        int l, r;
        cin >> l >> r;
        cout << A[r - 1] - A[l - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
import sys

readline = sys.stdin.readline
N = int(readline())
A = []
B = []
for _ in range(N):
    a, b = map(int, readline().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N % 2 == 0:
    mi = A[N//2-1]+A[N//2]
    ma = B[N//2-1]+B[N//2]
else:
    mi = A[N//2]
    ma = B[N//2]
print(ma-mi+1)


Measured memory_bytes: 25412
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    static Scanner scanner;

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

        int N=gi();
        String s=gs();
        int[][] a=new int[10][10];
        boolean[] f=new boolean[10];

        long ans=0;
        for (int i=0; i<N;i++) {
        	int v1=Integer.parseInt(s.substring(i,i+1));
        	if (!f[v1]) {
        	    for (int j=i+1; j<N;j++) {
        		    int v2=Integer.parseInt(s.substring(j,j+1));
            	    if(a[v1][v2]==0) {
            		    Set<Integer> l=new HashSet<Integer>();
            		    for (int k=j+1; k<N;k++) {
            			    int v3=Integer.parseInt(s.substring(k,k+1));
            			    l.add(v3);
                		}
                		a[v1][v2]=l.size();
                	}
                }
        	    f[v1]=true;
        	}
        }

        for (int i=0; i<10;i++) {
        	for (int j=0; j<10;j++) {
            	ans+=a[i][j];
            }
        }

        System.out.println(ans);
    }

    // 文字列として入力を取得
    public static String gs() {
         return scanner.next();
    }

    // intとして入力を取得
    public static int gi() {
         return Integer.parseInt(scanner.next());
    }

    // longとして入力を取得
    public static long gl() {
         return Long.parseLong(scanner.next());
    }

    // doubleとして入力を取得
    public static double gd() {
         return Double.parseDouble(scanner.next());
    }
}

Measured memory_bytes: 59740
#include<iostream>
using namespace std;
int main()
{
  string s,t;
  cin>>s>>t;
  int count=0;
  for(int i=0;i<s.size();i++)
  {
    if(s[i]!=t[i])
      count++;
  }
  cout<<count;
  
  return 0; 
}

Measured memory_bytes: 3908
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    check = 10000
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x / check)
        x = x % check
        check /= 10
        #print(keta_wa,check,x)
    
    if a <= keta_wa and keta_wa <= b:
        ans += i 

print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<vector>
int vis[105];
int t[105];
int a[105];
int b[105];
int all = -1;
long long ans = 0;

int gcd(int a,int b){ return b?gcd(b,a%b):a; }

int min(int a,int b){ return a>b?b:a; }

void getAnswer(int size,int n){
    for(int i = 1; i <= n; i++) t[i] = 0;
    for(int i = 1; i <= size; i++){ 
        //printf("%d ",a[i]);
        for(int j = a[i]; j <= n; j+=a[i]) t[j] = 1;
    }
    //printf("\n");
    //for(int i = 1; i <= n; i++) if(!t[i]) printf("%d ",i);
    //printf("\n");
    for(int i = 1; i <= n; i++){
        if(!t[i] && i>32){
            long long sum = 0;
            for(int j = i; j <= n; j+=i) if(!t[j]) sum += (long long)b[j];
            if(sum<0){
                for(int j = i; j <= n; j+=i) t[j] = 1;
            }
        }
    }
    long long res = 0;
    for(int i = 1; i <= n; i++) if(!t[i]) res += (long long)b[i];
    //printf("res = %lld\n",res);
    if(res>ans) ans = res;
}

void dfs(int last,int size,int n){
    getAnswer(size,all);
    int find = 0;
    for(int i = last+1; i <= n; i++){
        if(!vis[i]){
            find++;
            a[size+1] = i;
            std::vector<int>keep;
            for(int j = i; j <= n; j+=i) if(vis[j]) keep.push_back(j);
            for(int j = i; j <= n; j+=i) vis[j] = 1;
            dfs(i,size+1,n);
            for(int j = i; j <= n; j+=i) vis[j] = 0;
            for(int u: keep) vis[u] = 1;
        }
    }
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++) scanf("%d",&b[i]);
    for(int i = 1; i <= n; i++){
        if(b[i]<0){
            if(i*2>n) b[i] = 0;
        }
    }
    all = n;
    int upper = min(n/2,32);
    dfs(0,0,upper);
    printf("%lld\n",ans);
    return 0;
}


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

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

    int sum, minus, product;
    sum = a+b, minus = a-b, product = a*b;

    int max;
    max = sum;
    if (max < minus) {
        max = minus;
    }
    if (max < product) {
        max = product;
    }

    int ans;
    ans = max;

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//constexpr ll P = 1e9 + 7;
	//constexpr ll P = 998244353;

	ll q;
	cin >> q;

	priority_queue<ll> l;
	priority_queue<ll, vector<ll>, greater<ll>> r;
	ll sum = 0, suml = 0, sumr = 0;
	while (q--) {
		ll x;
		cin >> x;
		if (x == 1) {
			ll a, b;
			cin >> a >> b;
			if (l.empty()) {
				l.push(a);
				suml += a;
			}
			else if (a <= l.top()) {
				l.push(a);
				suml += a;
			}
			else {
				r.push(a);
				sumr += a;
			}
			while (l.size() > r.size() + 1) {
				r.push(l.top());
				l.pop();
				suml -= r.top(); sumr += r.top();
			}
			while (l.size() < r.size()) {
				l.push(r.top());
				r.pop();
				sumr -= l.top();
				suml += l.top();
			}
			sum += b;
		} else {
			cout << l.top() << ' ';
			cout << sum + (l.top() * (ll)l.size() - suml) + (sumr - l.top() * (ll)r.size()) << '\n';
		}
	}
}

Measured memory_bytes: 5056
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int c[3][3];
  for(int i = 0; i < 3; ++i){
    cin >> c[i][0] >> c[i][1] >> c[i][2];
  }
  bool flag = true;
  int gap1 = c[0][0] - c[1][0];
  int gap2 = c[1][0] - c[2][0];
  for(int i = 1; i <= 2; ++i){
    if(gap1 != c[0][i] - c[1][i]) flag = false;
    if(gap2 != c[1][i] - c[2][i]) flag = false;
  }
  int gap3 = c[0][1] - c[0][0];
  int gap4 = c[0][2] - c[0][1];
  for(int i = 1; i <= 2; ++i){
    if(gap3 != c[i][1] - c[i][0]) flag = false;
    if(gap4 != c[i][2] - c[i][1]) flag = false;
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int n;
    cin>>n;
    cout<<180*(n-2)<<endl;
    return 0;
}

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

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

    map<string, int> m;
    int max_cnt = 1;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (m.find(s) == m.end())
            m[s] = 1;
        else
            max_cnt = max(max_cnt, ++m[s]);
    }

    for (const auto &e : m)
        if (e.second == max_cnt)
            cout << e.first << endl;
}

Measured memory_bytes: 19108
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --i)
#define REP(i, n) for(int i=0; i<n; ++i)
#define rREP(i, n) for(int i=n-1; i>=0; --i)
#define all(a)  a.begin(), a.end()
#define MAXNUM 100000
using namespace std;
typedef long long ll;

int main(){
  int a[3];
  REP(i, 3) cin >> a[i];
  sort(a, a+3);
  if((2*a[2] - a[1] - a[0])%2 == 0){
    cout << (2*a[2] - a[1] - a[0])/2 << endl;
  }else{
    cout << (2*a[2] - a[1] - a[0])/2 + 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
 
using namespace std;
 
typedef long long ll;
 
bool check(string s){
    if(s.size() < 6) return false;
    bool a = false, A = false, num = false;
    rep(i, s.size()){
        if('a' <= s[i] && s[i] <= 'z') a = true;
        if('A' <= s[i] && s[i] <= 'Z') A = true;
        if('0' <= s[i] && s[i] <= '9') num = true;
    }
    return a&A&num;
}
 
int main(){
    string s;
    cin >> s;
    cout << (check(s)?"VALID":"INVALID") << endl;
 
    return 0;
}

Measured memory_bytes: 1184
#include <cassert>
#include "limits.h"
#include <limits>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename H,typename... T>
void debug_out(H head,T... tail){
  std::cerr<<" "<<head;
  debug_out(tail...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

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

  ll n,x;
  std::cin>>n>>x;

  struct Test{
    ll b,l,u;
  };

  std::vector<Test> test(n);

  rep(i,0,n){
    ll b,l,u;
    std::cin>>b>>l>>u;
    test[i]={b,l,u};
  }

  ll k=0;
  rep(i,0,n)k+=test[i].b*test[i].l;

  std::sort(all(test),[x](Test a,Test b)->bool{
    return (a.b*a.l+(x-a.b)*(a.u))>(b.b*b.l+(x-b.b)*(b.u));
  });

  std::vector<ll> sum(n+1,0);

  rep(i,1,n+1)sum[i]=sum[i-1]+(test[i-1].b*test[i-1].l+(x-test[i-1].b)*(test[i-1].u));

  ll left=-1,right=n*x;

  while(right-left>1){
    ll mid=left+(right-left)/2;
    ll val=0;
    ll p=mid/x;
    ll q=mid-x*p;
    rep(i,0,n){
      ll temp=sum[p];
      if(i<p)temp=sum[p+1]-(test[i].b*test[i].l+(x-test[i].b)*(test[i].u));
      if(q<test[i].b)temp+=q*test[i].l;
      else temp+=test[i].b*test[i].l+(q-test[i].b)*test[i].u;
      chmax(val,temp);
    }
    if(val>=k)right=mid;
    else left=mid;
  }

  std::cout<<right<<"\n";

  return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<stdlib.h>

int main(){
  int i,j,k,l,n,m,flag=0;
  scanf("%d%d",&n,&m);
  int count[m];
  for(i=0;i<=m;i++){
    count[i]=0;
  }
  for(i=1;i<=n;i++){
    scanf("%d",&k);
    for(j=1;j<=k;j++){
      scanf("%d",&l);
      count[l]++;
    }
  }
  for(i=1;i<=m;i++){
    if(count[i]==n){
      flag++;
    }
  }

  printf("%d\n",flag);
  return 0;
  
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 200005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000000
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    int  n, x, y;
    cin>>n>>x>>y;
    map<int, int>mp;
    for(int i = 1; i <= n; i++)
    {
        for(int j = i + 1; j <= n; j++)
        {
            int dist = j - i;
            dist = min(dist, (abs(i - x) + 1 + abs(y - j)));
            dist = min(dist, (abs(i - y) + 1 + abs(x - j)));
            mp[dist]++;
        }
    }

    for(int i = 1; i < n; i++)
        cout<<mp[i]<<endl;

    //End();
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> cnt(n + 1, 0);
  for(int i = 1; i < n; ++i)
  {
    if (s[i - 1] == 'A' && s[i] == 'C') { cnt[i + 1]++; }
    cnt[i + 1] += cnt[i];
  }

  int l, r;
  for(int i = 0; i < q; ++i)
  {
    cin >> l >> r;
    cout << cnt[r] - cnt[l] << endl;
  }

}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m = 1e9+7,b;

int main(){
	b = 1;
	int n;
	cin >> n;
	for(int i = 1;i<=n;i++){
		b*=i;
		b%=m;
	}
	cout<<b<<endl;


}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int q;
  cin >> q;
  VI a(q), b(q);
  REP(i, q) {
    cin >> a[i] >> b[i];
    if(a[i] > b[i]) swap(a[i], b[i]);
  }

  REP(i, q) {
    if(abs(a[i]-b[i]) <= 1) {
      cout << 2*a[i] - 2 << endl;
      continue;
    }
    int lb = -1, ub = b[i]-a[i]+1;
    auto check = [&](int mid) -> bool {
      for(int j=mid/2-2; j<=mid/2+2; ++j) {
        if(j<0 || b[i]-a[i]<j) continue;
        if((a[i]+j)*(a[i]+mid-j) >= a[i]*b[i]) return false;
      }
      return true;
    };
    while(ub-lb > 1) {
      int mid = (lb+ub)/2;
      if(check(mid)) {
        lb = mid;
      } else {
        ub = mid;
      }
    }
    cout << a[i]*2-2 + lb << endl;
  }

  return 0;
}


Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let x: u64 = sc.read();
    let l: Vec<u64> = sc.vec(n);
    let mut d = 0;
    let mut ans = 1;
    for l in l.into_iter() {
        d = d + l;
        if d <= x {
            ans += 1;
        }
    }
    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main() {
    int D;
    cin >> D;
    switch (D) {
        case 25:
            cout << "Christmas" << endl;
            break;
        case 24:
            cout << "Christmas Eve" << endl;
            break;
        case 23:
            cout << "Christmas Eve Eve" << endl;
            break;
        case 22:
            cout << "Christmas Eve Eve Eve" << endl;
            break;
    }
}


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

int main()
{
    int N, K;
    int num = 1;
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
    {
        if (num < K) num *= 2;
        else num += K;
    }
    cout << num << endl;
}


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

int main() {
  int n, a, b; cin >> n >> a >> b;
  int sum = 0;
  for (int i=1; i<=n; i++) {
    int c = 0;
    int pn = i;
    while (pn != 0) {
      c += pn%10;
      pn /= 10;
    }
    if (a <= c && c <= b) {
      sum += i;
    }
  }

  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 256
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def resolve():
    n = int(input())
    ans = float('inf')
    c = divisor(n)
    for a in c:
        b = n//a
        ans = min(ans,a+b-2)
    print(ans)
resolve()

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

typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int sumW[345678];
int sumE[345678];

int main(){

    int n;
    string s;
    cin >> n >> s;
    
    int sz = s.size();

    for(int i=1;i<sz+1;i++){
        if(s[i-1] == 'W'){
            sumW[i] = sumW[i-1] + 1;
            sumE[i] = sumE[i-1];
        }else{
            sumW[i] = sumW[i-1];
            sumE[i] = sumE[i-1] + 1;
        }
    }
    int ans = 345678;
    REP(i,sz){
        ans = min(ans,sumW[i] + sumE[sz] - sumE[i+1]);
    }
  	REP(i,sz+1)cerr << sumW[i] << " " ;
  REP(i,sz+1)cerr << sumE[i] << " " ;
        
    
    cout << ans;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n; cin>>n;
    vector<vector<int>> a(2);
    for(auto& v: a) {
        v.push_back(0);
        for(int i=0; i<n; ++i) {
            int t; cin>>t;
            v.push_back(v[i]+t);
        }
    }
    int res=0;
    for(int i=1; i<=n; ++i)
        res=max(res, a[0][i]+a[1][n]-a[1][i-1]);
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto it : x) {cerr << " [" <<  it << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 2e18;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	ld cur = 0;
	for(int i = 0;i < n;++i){
		ld t;
		cin >> t;
		cur += 1LL / t;
	}
	cout << 1LL / cur << '\n';
	return 0;
	
}


Measured memory_bytes: 256
//written by libra9z
#include <immintrin.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
#define rep(i,n) for (int i=0;i<(n);i++)
#define Debug(x) cerr<<#x<<" = "<<x<<endl
template <typename T> void read(T &a) {cin>>a;}
template <typename T,typename... Args> void read(T& a,Args&... b){read(a);read(b...);}
template <typename T> void write(T a) {cout<<a;}
template <typename T,typename... Args> void write(T a,Args... b){write(a);write(b...);}
unsigned long long rdtsc()
{
	unsigned long long ret = 0;
	#ifdef __clang__
    return __builtin_readcyclecounter();
	#endif
	#ifndef _MSC_VER
    asm volatile("rdtsc" : "=A" (ret) : :);
	#endif
	return ret;
}
const int inf=1e9;
const ll mod=1000000007;
const int dx[]={1,0,-1,0,1,0,-1,0};
const int dy[]={0,1,0,-1,1,0,-1,0};
const double pi=3.141592653589793;
ll x,y,ans;
signed main()
{
	rdtsc();
	ios_base::sync_with_stdio();cin.tie();cout.tie();
	read(x,y);
	while (x<=y)
	{
		x<<=1;
		ans++;
	}
	write(ans);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int E = sc.nextInt();
    int F = sc.nextInt();
    Set<Integer> setWater = new HashSet<Integer>();
    Set<Integer> setSuger = new HashSet<Integer>();
    for(int i=0; i<=F; i++){
      for(int j=0; j<=F; j++){
        int tmp = 100 * i * A + 100 * j * B;
        if(tmp <= F) setWater.add(tmp);
      }
    }
    setWater.remove(0);
    for(int i=0; i<=F; i++){
      for(int j=0; j<=F; j++){
        int tmp = i * C + j * D;
        if(tmp <= F) setSuger.add(tmp);
      }
    }
    double max = -1;
    int ans = 0;
    int ansSuger = 0;
    for(int water : setWater){
      for(int suger : setSuger){
        if((double)water / 100 * E < suger) continue; 
        int tmp = water + suger;
        if(tmp > F) continue;
        double con = (double)suger / tmp;
        if(con > max){
          max = con;
          ans = tmp;
          ansSuger = suger;
        }
      }
    }
    out.println(ans + " " + ansSuger);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

Measured memory_bytes: 26824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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(){
    vector<float> ans={0,0};
    float tmp=0;
    float a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
    for(int i=0;i*a*100<=f;i++){
        for(int j=0;j*b*100+i*a*100<=f;j++){
            float water=j*b*100+i*a*100;
            for(int x=0;water*e/100>=x*c && water+x*c<=f;x++){
                for(int y=0;water*e/100>=x*c+y*d && water+x*c+y*d<=f;y++){
                    float sugar=x*c+y*d;
                    if(water+sugar==0) continue;
                    if(sugar/(water+sugar)>tmp){
                        tmp=sugar/(water+sugar);
                        ans={water+sugar,sugar};
                    }
                }
            }
        }
    }
    if(ans[0]==0) ans={100*a,0};
    cout<<ans[0]<<' '<<ans[1]<<endl;
}

Measured memory_bytes: 384
h,n=map(int,input().split())
a,b=[],[]
for i in range(n):
    A,B=map(int,input().split())
    a.append(A)#ダメージ量
    b.append(B)#消費魔力

dp=[float('inf')]*(h+1)
dp[0]=0
for i in range(h):
    for j in range(n):

        next=i+a[j] if i+a[j]<=h else h
        dp[next]=min(dp[next],dp[i]+b[j])
print(dp[-1])

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

using ll=long long;

int main() {
    ll N,A,B,i,r=0;
    cin >> N >> A >> B;
    vector<int> X(N);

    for(i=0; i<N; i++)
        cin >> X.at(i);
    
    for(i=0; i<N-1; i++)
        if((X.at(i+1)-X.at(i))*A < B)
            r += (X.at(i+1)-X.at(i))*A;
        else
            r += B;
    
    cout << r << endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string S;

int main() {
  INCANT;
  cin >> S;
  int n = S.size();
  if (S[n-1]=='s') {
    cout << S << "es" << endl;
  } else {
    cout << S << "s" << endl;
  }

  return 0;
}

Measured memory_bytes: 3648