akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n, ma, mb;
    cin >> n >> ma >> mb;

    vector<vector<int>> v(n, vector<int>(3));
    for(auto& i : v){
        for(auto& j : i){
            cin >> j;
        }
    }

    int const inf = 1e9;
    vector<vector<vector<int>>> dp(n+1, vector<vector<int>>(1000, vector<int>(1000, inf)));
    dp[0][0][0] = 0;
    
    for(int i=0; i<n; i++){
        for(int ca=0; ca<500; ca++){
            for(int cb=0; cb<500; cb++){
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
                dp[i+1][ca + v[i][0]][cb + v[i][1]] = min(dp[i+1][ca + v[i][0]][cb + v[i][1]], dp[i][ca][cb] + v[i][2]);
            }
        }
    }

    int ans = inf;
    for(int ca=1; ca<500; ca++){
        for(int cb=1; cb<500; cb++){
            if(ca*mb == cb*ma){
                ans = min(ans, dp[n][ca][cb]);
            }
        }
    }

    cout << ((ans == inf) ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 166016
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
count = 0

for i in range(N):
	
	if A[i] < B[i]:
		count = count + A[i]
		B[i] = B[i] - A[i]
		A[i] = 0
	else:
		count = count + B[i]
		A[i] = A[i] - B[i]
		B[i] = 0
	
	if A[i + 1] < B[i]:
		count = count + A[i + 1]
		B[i] = B[i] - A[i + 1]
		A[i + 1] = 0
	else:
		count = count + B[i]
		A[i + 1] = A[i + 1] - B[i]
		B[i] = 0

print(count)

Measured memory_bytes: 18476
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1010;

int n, m;
char s[N][N];
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i)
    scanf("%s", s[i] + 1);
  vector<pair<int, int>> v1, v2;
  int cnt = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (s[i][j] == '#')
        v1.emplace_back(i, j);
  while (!v1.empty()) {
    ++cnt;
    for (const auto& pr : v1) {
      int x = pr.first, y = pr.second;
      for (int i = 0; i < 4; ++i)
        if (s[x + dx[i]][y + dy[i]] == '.') {
          s[x + dx[i]][y + dy[i]] = '#';
          v2.emplace_back(x + dx[i],y + dy[i]);
        }
    }
    v1 = v2;
    v2.clear();
  }
  printf("%d\n", cnt - 1);

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 14696
#include "iostream"
#include "stdio.h"
#include "iomanip"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "string"
#include "utility"

using namespace std;

int sx, gx, sy, gy;
int x, y;

int main() {
	cin >> sx >> sy >> gx >> gy;
	for (int i = 0; i < gx - sx; i++) {
		cout << "R";
	}
	for (int i = 0; i < gy - sy; i++) {
		cout << "U";
	}
	for (int i = 0; i < gx - sx; i++) {
		cout << "L";
	}
	for (int i = 0; i < gy - sy; i++) {
		cout << "D";
	}
	cout << "D";
	for (int i = 0; i < gx - sx; i++) {
		cout << "R";
	}
	cout << "R";
	for (int i = 0; i < gy - sy; i++) {
		cout << "U";
	}
	cout << "U";
	cout << "L";
	cout << "U";
	cout << "L";
	for (int i = 0; i < gx - sx; i++) {
		cout << "L";
	}
	for (int i = 0; i < gy - sy; i++) {
		cout << "D";
	}
	cout <<"D";
	cout << "R\n";
	return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
  ll N,Q;cin>>N;
  vl A(N);
  rep(i,N)cin>>A[i];
  cin>>Q;
  vl B(Q),C(Q);
  rep(i,Q)cin>>B[i]>>C[i];
  ll tot =0;
  rep(i,N)tot+=A[i];
  vl num(100001);
  rep(i,N){
    num[A[i]]++;
  }
  rep(i,Q){
    num[C[i]]+=num[B[i]];
    tot += (C[i]-B[i])*num[B[i]];
    num[B[i]]=0;
    cout<<tot<<endl;
  }

}


Measured memory_bytes: 6344
n = int(input())

s = input()

alphabet = 'abcdefghijklmnopqrstuvxwyz'
A = [0] * len(alphabet)
B = A.copy()


for c in s:
    pos = alphabet.find(c)
    A[pos]+=1

#print(A)
#print(B)

ans = 0
for c in s:
    pos = alphabet.find(c)
    A[pos] -= 1
    B[pos] += 1
    
    #print(A)
    #print(B)

    t = sum(1 if ae>0 and be > 0 else 0 for ae, be in zip(A,B) )

    ans = max(t,ans)

    

print(ans)


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

int Partition(int elem[], int start, int end)
{
    int i;
    int mid;
    int target;

    target = elem[end - 1];
    mid    = start - 1;

    for (i = start; i < end - 1; i++) {
        if (elem[i] <= target){
            ++mid;
            swap(elem[mid], elem[i]);
        }
    }

    ++mid;
    swap(elem[mid], elem[end-1]);

    return mid;
}

int main(void)
{
    int i;
    int target;
    int num;
    int elem[100000];
    int left, right;

    scanf("%d", &num);
    for (i = 0; i < num; i++) {
        scanf("%d", &elem[i]);
    }

    target = Partition(elem, 0, num);

    printf("%d", elem[0]);
    for (i = 1; i < num; i++) {
        if (i == target) {
            printf(" [%d]", elem[i]);
        }
        else {
            printf(" %d", elem[i]);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 1584
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var k = vars[0];
        var n = vars[1];
        var a = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var max = k - a[a.Length - 1] + a[0];
        for(long i = 0; i < a.Length - 1; i++)
        {
            var d = a[i + 1] - a[i];
            if(d > max)
            {
                max = d;
            }
        }
        System.Console.WriteLine(k - max);
    }
}

Measured memory_bytes: 36468
#include <algorithm>
#include <vector>
#include <cassert>
#include <iostream>
#include <vector>

using namespace std;

namespace monoid {
template <class T>
struct add {
  typedef T value_t;
  T identity() const { return 0; }
  T merge(T a, T b) const { return a+b; }
};
} // namespace monoid

template <class Monoid>
struct SegmentTree {
  typedef typename Monoid::value_t value_t;
  const Monoid monoid;
  int n; // n_以上の最小の2冪
  vector<value_t> data;
  SegmentTree(int n_): monoid() {
    n = 1;
    while (n < n_) n *= 2;
    data.assign(2*n-1, monoid.identity());
  }

  // k番目の値(0-indexed)をaに変更
  void update(int k, int a) { // 0-indexed
    assert(0 <= k && k < n);
    // 葉の節点
    data[k+n-1] = a;
    // 登りながら更新
    for (k = (k+n)/2; k > 0; k /= 2) {  // 1-indexed
      data[k-1] = monoid.merge(data[2*k-1], data[2*k]);
    }
  }

  value_t query(int l, int r) {  // 0-indexed, [l, r)
    assert(0 <= l && l <= r && r <= n);
    value_t vl = monoid.identity(), vr = monoid.identity();
    for (l += n, r += n; l < r; l /= 2, r /= 2) {  // 1-indexed
      if (l & 1) vl = monoid.merge(vl, data[(l++)-1]);
      if (r & 1) vr = monoid.merge(data[(--r)-1],vr);
    }
    return monoid.merge(vl, vr);
  }
};

struct Event {
  int c, l, r, id;
};

int main() {
  int n, m, Q;
  cin >> n >> m >> Q;
  vector<Event> events;
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r; --l; --r;
    events.push_back((Event){0, l, r, -1});
  }
  for (int i = 0; i < Q; ++i) {
    int p, q;
    cin >> p >> q; --p; --q;
    events.push_back((Event){1, p, q, i});
  }
  sort(events.begin(), events.end(), [](auto l, auto r) {
    if (l.r == r.r) {
      if (l.l == r.l) return l.c < r.c;
      return l.l > r.l;
    }
    return l.r < r.r;
  });
  vector<int> ans(Q);
  SegmentTree<monoid::add<int>> st(n+1);
  for (auto &e : events) {
    // cerr << e.c << " " << e.l << " " << e.r << endl;
    if (e.c == 0) st.update(e.l, st.query(e.l,e.l+1)+1);
    else ans[e.id] = st.query(e.l, e.r+1);
  }
  for (int i = 0; i < Q; ++i) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 10476
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
       if(i%3 && i%5) ans += i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3636
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;

#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const int  N     =  4e5+5;
const int  mod   =  1e9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const int  LEVEL =  log2(N)+1;

ll n, a[N], b[N], sta[N], stb[N], ena[N], enb[N], c[N], bad[N];

void solve(){
	mset(stb, -1);
	mset(sta, -1);
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(sta[a[i]] == -1) sta[a[i]] = i;
		ena[a[i]] = i;
	}
	for(int i = 0; i < n; i++){
		cin >> b[i];
		if(stb[b[i]] == -1) stb[b[i]] = i;
		enb[b[i]] = i;
	}
	for(int i = 1; i <= n; i++){
		if(sta[i] == -1 or stb[i] == -1) continue;
		int st = (sta[i] - stb[i] + n)%n;
		int en = (ena[i] - stb[i] + n)%n;
		bad[st] ++;
		bad[en+1] --;
		if(st > en) bad[0] ++;
		st = (sta[i] - enb[i] + n)%n;
		en = (ena[i] - enb[i] + n)%n;
		bad[st] ++;
		bad[en+1] --;
		if(st > en) bad[0] ++;
	}
	int mx = -1;
	for(int i = 1; i < n; i++){
		bad[i] += bad[i-1];
		if(bad[i] == 0) mx = i;
	}
	if(mx == -1){
		deb1("No")
		return;
	}
	for(int i = 0; i < n; i++){
		c[(i+mx)%n] = b[i];
	}
	deb1("Yes")
	for(int i = 0; i < n; i++) cout << c[i] << " ";
}

int main(){
	GODSPEED;
	int test = 1;
	//cin >> test;
	for(int i = 1; i <= test; i++){
		solve();
	}
	#ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif
}

Measured memory_bytes: 19228
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
int main()
{
	while(1)
	{
		int n;
		cin >> n;
		if(n == 0) return 0;
		for(int i=0;i<n;i++)
		{
			int a,b,c;
			cin >> a >> b >> c;
			if(a == 100 || b == 100 || c == 100 || a+b >= 180 || a+b+c >= 240)
			{
				puts("A");
			}
			else if(a+b+c >= 210 || (a+b+c >= 150 && (a >= 80 || b >= 80)))
			{
				puts("B");
			}
			else
			{
				puts("C");
			}
		}
	}
}

Measured memory_bytes: 1116
n,m=map(int,input().split())
S=[list(map(int,input().split()))[1:] for i in range(m)]
P=list(map(int,input().split()))
cnt=0
for i in range(2**n):
    pattern=format(i,"b").zfill(n)
    point=0
    for j in range(m):
        swi=0
        for k in S[j]:
            if pattern[k-1]=="1":swi +=1
        if swi%2==P[j]:point +=1
    if point==m:cnt +=1
print(cnt)

Measured memory_bytes: 3188
#pragma GCC optimize(3)
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i, k, j) for(register int i = (k); i <= (j); i++)
#define INF (1 << 30) - 1
#define ll long long
#define reaD() read()
using namespace std;
inline int read()
{
    int num=0,flag=1;char c=' ';
    for(;c>'9'||c<'0';c=getchar()) if(c=='-') flag = -1;
    for(;c>='0'&&c<='9';num=(num<<1)+(num<<3)+c-48,c=getchar());
    return num*flag;
}
#define MAXN 500005
int a[MAXN], n, m, Qnum;
signed main()
{
	cout << (read() + read() + 1) / 2; 
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    ll n; cin >> n;
    vector<pair<ll,ll>> vecp(n);
    for(int i=0; i<n; i++){
        ll x, y; cin >> x >> y;
        vecp.at(i) = make_pair(x,y);
    }
    sort(vecp.begin(),vecp.end());
    for(int i=0; i<n; i++){
        cout << vecp.at(i).first << " " << vecp.at(i).second << endl;
    }
}



Measured memory_bytes: 4408
import numpy as np
N, M = map(int, input().split())
den = [0 for i in range(M)]
for i in range(M):
    inputlist = list(map(int, input().split()))
    newlist = [k-1 for k in inputlist]
    den[i] = newlist[1:]
p = list(map(int, input().split()))
#print(den)
count = 0
for i in range(2** N):
    sinsu = bin(i)[2:].zfill(N)
    num = np.array([int(k) for k in list(sinsu)])
    now = True
    for j in range(M):
        sumnum = sum(num[den[j]])
        if sumnum % 2 != p[j]:
            now = False
            break
    if now:
        count += 1
print(count)



Measured memory_bytes: 12508
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

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

    ll n;
    cin>>n;
    ll ans = 2*(n/11);
    n%=11;
    if (n>0) ans++;
    if (n>6) ans++;
    cout<<ans;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int n;

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

ll labs(ll x){
	if(x<0LL){
		return -x;
	}
	return x;
}

ll a[200005],b[200005];
vector<int> G[200005];
map<P,int> mp;
int cnt=0;
ll as=0;
ll bs=0;
ll twop[200005];

int main(void){
	scanf("%d",&n);
	twop[0]=1;
	for(int i=1;i<=n;i++){
		twop[i]=twop[i-1]*2LL%MOD;
	}
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		if(a[i]==0 && b[i]==0){
			cnt++;
			continue;
		}
		if(a[i]==0){
			as++;
			continue;
		}
		if(b[i]==0){
			bs++;
			continue;
		}
		ll g=gcd(labs(a[i]),labs(b[i]));
		a[i]/=g;
		b[i]/=g;
		if(b[i]<0){
			b[i]=-b[i];
			a[i]=-a[i];
		}
		mp[P(a[i],b[i])]++;
	}
	ll ans=(twop[as]+twop[bs]-1LL)%MOD;
	for(map<P,int>::iterator it=mp.begin();it!=mp.end();it++){
		ll av=(*it).first.first;
		ll bv=(*it).first.second;
		ll val=twop[(*it).second];
		ll iav=-bv;
		ll ibv=av;
		if(ibv<0){
			ibv=-ibv;
			iav=-iav;
		}
		if(mp.find(P(iav,ibv))!=mp.end()){
			if(av<0)continue;
			val+=twop[mp[P(iav,ibv)]]-1LL;
			val%=MOD;
		}
		ans=ans*val%MOD;
	}
	ans--;
	ans+=cnt;
	if(ans<0){
		ans+=MOD;
	}
	ans%=MOD;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 25592
#include<iostream>
using namespace std;
typedef long long li;
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int a,b,c; cin >>a >>b >>c; if(a>b)swap(a,b);
  yn(a<=c and c<=b);
}





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


int cnt[26];

int main(){
	int num =0;
	string s;

	while(getline(cin,s)){
		if(s=="") break;

	for(int i=0; i < s.length(); i++){
		if(islower(s[i])){
			num = s[i] - 'a';
			if(num>=0)
				cnt[num]++;
		}
		else{
			s[i]=tolower(s[i]);
			num = s[i] - 'a';
			if(num>=0)
				cnt[num]++;
		}
	}
}
	int j=97;
	for(int i=0; i<26; i++){
		printf("%c"" : ""%d\n", j,cnt[i]);
		j++;
	}
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int r;
    cin >> r;
    cout << 3 * r * r<< endl;
    return 0;
}

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

int main() {
    string name;
    int i,n,q,time,elapsedt = 0;
    list<pair<string,int> > que,ans;
    list<pair<string,int> >::iterator it;
    cin>>n>>q;
    for(i=0;i<n;i++) {
        cin>>name>>time;
        que.push_back(make_pair(name,time));
    }
    it = que.begin();
    while(!que.empty()){
        if((*it).second <= q) {
            elapsedt += (*it).second;
            ans.push_back(make_pair((*it).first,elapsedt));
            it = que.erase(it);
        } else {
            elapsedt += q;
            (*it).second -= q;
            it++;
        }
        if (it == que.end()) it=que.begin();
    }
    for(it=ans.begin();it!=ans.end();it++) {
        cout<<(*it).first<<" "<<(*it).second<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int M = 101;
const int two = 2;

ll n, a[M], b1;
bool used[M];
ll ans;

void gen(int b)
{
    if (3 * b > n)
    {
        //for (int i = 0; i <= n; i++)
        //    cerr << used[i];
        //cerr << "\n";
        ll s = 0;
        for (int i = 1; i <= n; i++)
            if (used[i])
                s += a[i];
        for (int x = b1 + 1; x <= n; x++)
            if (used[x] && ((x % 2 == 1) || x < 2 * b) && a[x] < 0)
                s -= a[x];
        for (int x = 2 * b; x <= n; x += 2)
        {
            int y = (x / 2);
            if (!used[y] && !used[x])
                continue;
            if (!used[y] && a[x] < 0)
                s -= a[x];
            else if (!used[x] && a[y] < 0)
                s -= a[y];
            else if (used[x] && used[y])
            {
                if (s < max(s - a[x] - a[y], s - a[x]))
                    s = max(s - a[x] - a[y], s - a[x]);
            }
        }
        ans = max(s, ans);
        return;
    }
    gen(b + 1);
    vector<int> id;
    for (int i = b; i <= n; i += b)
        if (used[i])
            id.push_back(i);
    if (!id.empty())
    {
        for (int i : id)
            used[i] = 0;
        gen(b + 1);
        for (int i : id)
            used[i] = 1;
    }
}

int main()
{   /*
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout); /**/
    cin.sync_with_stdio(0);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i + 1];
    ans = 0;
    for (int i = 1; i <= n; i++)
        used[i] = 1;
    b1 = 0;
    while (b1 * 2 <= n)
        b1++;
    b1--;
    gen(1);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    N,M = map(int, input().split())
    data = []
    for i in range(N):
        a,b = map(int, input().split())
        data.append([a, b])
    checks = []
    for i in range(M):
        c,d = map(int, input().split())
        checks.append([c, d])

    for a,b in data:
        res = 1 << 50
        p = -1
        for idx, check in enumerate(checks):
            tmp = abs(a - check[0]) + abs(b - check[1])
            if (tmp < res):
                res = tmp
                p = idx + 1
        print (p)


Measured memory_bytes: 3316
h, n = list(map(int, input().split()))

hp_and_magic = [list(map(int, input().split())) for _ in range(n)]

arr = [10 ** 9] * (h+1)
# arr[k] := hpがkの敵を倒すのに必要な最小魔力
arr[0] = 0
arr[1] = min([ele[1] for ele in hp_and_magic])

for i in range(2, h+1):
    # arr[i] = 10 ** 9
    for ele in hp_and_magic:
        if i-ele[0] >= 0:
            arr[i] = min(arr[i], arr[i-ele[0]] + ele[1])
        else:
            arr[i] = min(arr[i], ele[1])

print(arr[h])

Measured memory_bytes: 41072
let fact n =
  if n = 0 || n = 1 then 1
  else
    let rec doit i x y =
      if i = n then x + y
      else doit (i + 1) y (x + y)
    in
    doit 2 1 1

let () =
  let n = read_int () in
  Printf.printf "%d\n" (fact n)

Measured memory_bytes: 2336
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
#from decimal import *

N, M = MAP()
X = LIST()
X.sort()
#print(X)
Y = [X[i]-X[i-1] for i in range(1, M)]
Y.sort()
#print(Y)
if N != 1:
	del Y[-(N-1):]
#print(Y)

print(sum(Y))


Measured memory_bytes: 15380
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 100005
#define LL long long
int a[N],op[N];
LL sum[N];
char s[4];
int main()
{
	int n,i,j;
	scanf("%d%d",&n,&a[1]);op[1]=1;
	for(i=2;i<=n;i++){
		scanf("%s%d",s,&a[i]);
		if(s[0]=='-')op[i]=-1;
		else op[i]=1;
	}
	for(i=n;i>=1;i--)sum[i]=sum[i+1]+a[i];
	LL s1=0,s2,ans=-0x3f3f3f3f3f3f3f3fll;
	for(i=2;i<=n;i++){
		s1+=1ll*a[i-1]*op[i-1];
		if(op[i]==-1){
			s2=1ll*a[i];
			for(j=i+1;j<=n;j++){
				if(op[j]==-1)break;
				s2+=1ll*a[j];
			}
			ans=max(ans,s1-s2+sum[j]);
		}
	}
	s1+=1ll*a[n]*op[n];
	printf("%lld",max(s1,ans));
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int N, M;
int A[100000];
vector<int> G[100000];
bool used[100000];
multiset<int> ms[100000];

void DFS(int from, int prev, int start) {
  used[from] = true;
  ms[start].insert(A[from]);
  for(int to : G[from]){
    if (to == prev || used[to]) continue;
    DFS(to, from, start);
  }
}

int main() {
  cin >> N >> M;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<int> tr;
  for (int i = 0; i < N; ++i) {
    if (used[i]) continue;
    tr.push_back(i);
    DFS(i, -1, i);
  }
  
  long long sum = 0;
  multiset<int> merged = ms[tr[0]];
  for (int i = 1; i < tr.size(); ++i) {
    multiset<int>& now = ms[tr[i]];
    if (merged.size() +  now.size() < 2) {
      cout << "Impossible" << endl;
      return 0;
    } else if (i == 1 || now.size() <= 1 || (merged.size() >= 1 && *merged.begin() < *next(now.begin()))) {
      sum += *merged.begin();
      sum += *now.begin();
      merged.erase(merged.begin());
      now.erase(now.begin());
    } else {
      sum += *now.begin();
      sum += *next(now.begin());
      now.erase(now.begin());
      now.erase(now.begin());
    }
    for(int i : now){
      merged.insert(i);
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 20352
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int beki(int a, int n){
    int ret = 1;
    rep(i,n)ret *= a;
    return ret;
}
int main(void) {
    int i,j;
    int n,m,k;
    while(cin >> n >> m >> k, n){
        double ans = 0;
        int sum = beki(m,n);
        rep(i,sum){
            int s = 0;
            int t = i;
            rep(i,n){
                s += t % m + 1;
                t /= m;
            }
            s = max(s-k, 1);
            ans += 1.0*s/sum;
        }
        cout << shosu(10) << ans << endl;
    }
}



Measured memory_bytes: 3212
N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1, N):
    d = 0
    for k in range(D):
      d += (X[i][k] - X[j][k]) ** 2
    d **= 0.5
    if d.is_integer():
      ans += 1
print(ans)

Measured memory_bytes: 9436
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long dp[2][60] = {};
int main() {
#define int long long
	dp[0][0] = 1;
	int n, p;
	cin >> n >> p;
	REP(i, n) {
		int hoge = 0;
		cin >> hoge;
		if (hoge % 2 == 0) {
			dp[0][i + 1] = dp[0][i] * 2;
			dp[1][i + 1] = dp[1][i] * 2;
		}
		else {
			dp[0][i + 1] = dp[0][i] + dp[1][i];
			dp[1][i + 1] = dp[0][i] + dp[1][i];
		}
	}
	cout << dp[p][n] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    int n, v, k;
    int a[100];
    
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i]; 
    }

    for (int j = 1; j < n ; j++) {
            for (int m = 0; m < n; m++) {
                if (m == n - 1) {
                    std::cout << a[m];    
                } else {
                    std::cout << a[m] << " ";
                }
            }
            std::cout << std::endl;
        v = a[j];
        k = j - 1;
        while (k >= 0 && a[k] > v){
            a[k+1] = a[k];
            k--;
        }
        a[k+1] = v;
    }
    
    
    for (int m = 0; m < n; m++) {
            if (m == n - 1) {
                std::cout << a[m];    
            } else {
                std::cout << a[m] << " ";
            }
        }
    std::cout << std::endl;
    
    
}


Measured memory_bytes: 3120
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int dp[32][1<<17];
int point[1<<17];

int P(int x){
	if(point[x]!=-1)return point[x];
	else {
		point[x]=0;
		int X=x;
		for(int i=0;i<16;i++){
			point[x]+=X%2;
			X/=2;
		}
	}
	return point[x];
}

int main(){
	for(int i=0;i<1<<17;i++){
		point[i]=-1;
	}
while(1){
	for(int i=0;i<32;i++){
		for(int j=0;j<1<<17;j++){
			dp[i][j]=-1000000000;
		}
	}

	int n,c;
	int a[32][20];
	int A[32]={0};
	int b[32][20];
	int B[32]={0};

	scanf("%d%d",&n,&c); if(n==0&&c==0)break;
	for(int i=0;i<n;i++){
		for(int j=0;j<16;j++){
			scanf("%d",&a[i][j]);
			A[i]*=2; A[i]+=a[i][j];
		}
	}
	for(int i=0;i<c;i++){
		for(int j=0;j<16;j++){
			scanf("%d",&b[i][j]);
			B[i]*=2; B[i]+=b[i][j];
		}
	}

	dp[0][A[0]]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<1<<16;j++){
			for(int k=0;k<c;k++){
				int d=j&B[k];
				int next=(j-d)|A[i+1];
				dp[i+1][next]=max(dp[i+1][next],dp[i][j]+P(d));
			}
		}
	}

	int ret=0;
	for(int i=0;i<1<<16;i++){
		ret=max(ret,dp[n][i]);
	}

	printf("%d\n",ret);
}
}
	

Measured memory_bytes: 18092
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    ll x; cin >> x;
    ll ct = 2 * (x/11);
    int rem = x % 11;
    if (0 < rem && rem <= 6) ct++;
    if (rem > 6) ct += 2;
    cout << ct << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if (a>b){
	printf("a > b\n");
	}else if(a < b){
	printf("a < b\n");
	}else{
	printf("a == b\n");
	}
    return 0;
}

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

int main(void){
	int a[4];
	int b[4];
	int hit, blow;
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		hit = 0; blow = 0;
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i])	hit++;
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(i != j && a[i] == b[j])	blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    long long a,b,c,ans=0;
    cin >> a >> b >> c;
    while(a+b>0&&c>0){
        if(b>0 && c>0){
            b--;c--;
            ans+=2;
        }else if(a>0 && c>0){
            a--;c--;
            ans++;
        }
    }
    ans+=b;
    if(c>0)ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
y = int(S[:4])
m = int(S[5:7])
d = int(S[8:])
if y < 2019:
    print("Heisei")
elif y == 2019 and m < 4:
    print("Heisei")
elif y == 2019 and m == 4 and d <= 30:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 9100
import java.util.*;

public class Main {
    static long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        int min = 0;
        int max = 100000;
        for (int i = 0; i < m; ++i) {
            int l = sc.nextInt();
            int r = sc.nextInt();
            min = Math.max(min, l);
            max = Math.min(max, r);
        }
        System.out.println(Math.min(n, Math.max(0, max - min + 1)));
    }
}


Measured memory_bytes: 65116
#include <iostream>

using namespace std;

int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  int ans = 0;
  for (int i = 0; i <= 3000; i++)
    for (int j = 0; j <= 3000; j++) {
      int v = i * R + j * G;
      if (N >= v && (N - v) % B == 0) ans++;
    }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int i,j;
    cin>>i>>j;
    if(i<j)
        cout<<0<<endl;
    else
        cout<<10<<endl;
    return 0;
}


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


int main(){

    int N,K;
    cin >> N >> K;

    vector<int> state(N+1, 0);

    int d,tmp;
    for(int i=0;i<K;i++){
        cin >> d;
        for(int j=0;j<d;j++){
            cin >> tmp;
            state[tmp] = 1;
        }
    }

    int count =0;
    for(int i=1;i<=N;i++){
        if(state[i]==0){
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  I n,k;
  string s;
  cin >> n >> k;
  cin >> s;
  I kao=0,se=0,line=0;
  REP(i,n){
    if (i==0){
      continue;
    }else{
      if (s.at(i-1) == s.at(i)){
        line++;
      }else if (s.at(i-1) == 'L' && s.at(i) == 'R'){
        se++;
      }else if (s.at(i-1) == 'R' && s.at(i) == 'L'){
        kao++;
      }
    }
  }
  if (k >= max(kao,se)){
    cout << n-1 << endl;
  }else{
    if (k >= min(kao,se)){
      line += min(kao,se)*2;
      line += (k - min(kao,se));
    }else{
      line += k*2;
    }
    cout << line << endl;
  }
  return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/* Precode Start Here *\


    Integer  to Binary

void bti(ll n)
{
ll k=1;
  while(n!=0)
    {
    bin[k++]=n%2;
    n/=2;
    }
}

     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}


/* Precode Ends */
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}
ll gcd(ll a,ll b)
{
    while(b!=0)
    {
        ll t=b;
        b=a%b;
        a=t;
    }
    return a;
}
int main()
{
    sieve();
   ll a,b,cnt=0;
   cin>>a>>b;
   ll d=gcd(max(a,b),min(a,b));
   for(int i=2;i<=sqrt(d);i++)
   {
      if(d%i==0)
      {
          while(d%i==0)
            d/=i;
          cnt++;
      }
   }
   if(d!=1)
    cnt++;
   cout<<cnt+1<<endl;
return 0;
}



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


int main(){
  string s,t;
  cin >> s >> t;
  int n=s.size();
  int ans=0;
  for(int i=0;i<n;++i){
    if(s[i]!=t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3916
#include<stdio.h>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>

using namespace std;
const int mod = 1e9+7;
int ad(int x,int y) { x+=y; return x>=mod?x-mod:x; }
int sb(int x,int y) { x-=y; return x<0?x+mod:x; }
int mu(int x,int y) { return 1ll*x*y%mod; }
int n;
int f[4005][4005];
int X[200005],Y[200005];
int fac[8005],inv[8005];
int GC(int x,int y) {
	if(x<y) return 0;
	return mu(fac[x],mu(inv[y],inv[x-y]));
}
const int py = 2001;
int main() {
	scanf("%d",&n);
	fac[0] = fac[1] = 1;
	inv[0] = inv[1] = 1;
	for(int i=2;i<=8002;i++) fac[i] = mu(fac[i-1],i),inv[i]=mu(inv[mod%i],mod-mod/i);
	for(int i=2;i<=8002;i++) inv[i] = mu(inv[i-1],inv[i]);
	int ans = 0;
	for(int i=1;i<=n;i++) {
		int x,y;
		scanf("%d%d",&x,&y);
		X[i] = x; Y[i] = y;
		f[-x+py][-y+py]++;
		ans = sb(ans,GC(2*x+2*y,2*x));
	}
	for(int i=1;i<=4002;i++) {
		for(int j=1;j<=4002;j++) {
			f[i][j] = ad(f[i][j],ad(f[i-1][j],f[i][j-1]));
		}
	}
	for(int i=1;i<=n;i++) {
		ans = ad(ans,f[X[i]+py][Y[i]+py]);
	}
	printf("%d",mu(ans,inv[2]) );
}

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

int main(){
	//freopen("readin.txt","r",stdin);
	int r,g,b;
	cin >> r >> g >> b;
	int ans = r*100 + g*10 + b;
	if(ans%4)
		puts("NO");
	else
		puts("YES");
}

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

using namespace std;

int main(){
        int a, b, c, d;
        cin>>a>>b>>c>>d;
        if(abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)){
                cout<<"Yes"<<endl;
        }
        else{
                cout<<"No"<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

ll dp[3456][3456];
signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	string s, t; cin >> s >> t;
	vector<ll>S, T;
	rep(i, s.size()) { S.push_back((ll)(s[i])); }
	rep(i, t.size()) { T.push_back((ll)(t[i])); }
	sort(all(S)); sort(all(T)); reverse(all(T));
	rep(i, min(s.size(),t.size())) {
		if (S[i] < T[i]) { cout << "Yes\n"; return 0; }
		if (S[i] > T[i]) { cout << "No\n"; return 0; }
	}
	if (s.size() < t.size()) { cout << "Yes\n"; }
	else { cout << "No\n"; }
	return 0;
}

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

#define INF 1E18



int main(){
    vector<ll> a(3);
    rep(i,3) cin>>a[i];

    sort(a.begin(), a.end());

    if(a[2]%2==0)cout<<0<<endl;
    else cout<<a[0]*a[1]<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long LL;
#define exp double(1e-6)
#define PI acos(-1)
const int MAXN=int(1e5+5);
double a,b,x;
int main()
{
    scanf("%lf%lf%lf",&a,&b,&x);
    double K=2.0*x/(a*b);
    if(K-a<=exp)
        printf("%.8f",90-atan(K/b)/PI*180.0);
    else {
        K=(double)(a*a*b-x)/(a*a)*2;
        printf("%.8f",90-atan(a/K)/PI*180);
    }
}


Measured memory_bytes: 128
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
    ll n;
    cin >> n;
    auto mp = prime_factor(n);
    int ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        if (itr->first == 1) continue;
        int cur = 1;
        while (itr->second >= cur) {
            itr->second -= cur;
            cur++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    int h[n];
    for(int i = 0;i < n;i++){
        scanf("%d", &h[i]);
    }
    int count = n;
    for(int i = 1;i < n;i++){
        int j = 0;
        while(j < i){
            if(h[j]>h[i]){
                count--;
                break;
            }
            j++;
        }
    }
    printf("%d\n", count);
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

// 約数列挙
template <class T>
vector<T> dividers(T n) {
    vector<T> ret;
    for (T x = 1; x * x <= n; x++) {
        if (n % x == 0) {
            ret.push_back(x);
            if (x * x != n) ret.push_back(n / x);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N, 0);
    rep(i, N) cin >> A[i];
    sort(all(A));

    vector<vector<int>> divs(N);
    for (int i = 0; i < N; i++) {
        divs[i] = dividers(A[i]);
    }

    // for (int i = 0; i < N; i++) {
    //     dump(divs[i]);
    // }

    int ans = 0;
    set<int> d{};

    for (int i = 0; i < N; i++) {
        if (i < N - 1) {
            if (A[i + 1] == A[i]) {
                ans++;
                d.insert(A[i]);
                continue;
            }
        }
        for (int j = 0; j < divs[i].size(); j++) {
            int a = divs[i][j];
            if (d.find(a) == d.end()) {
                continue;
            } else {
                // d(A[i]);
                ans++;
                break;
            }
        }
        d.insert(A[i]);
    }
    cout << N - ans << endl;
    return 0;
}

Measured memory_bytes: 61784
#include <stdio.h>

int main(void){
    int A, B;
    int n = 0, h = 1;

    scanf("%d %d",&A, &B);

    n = A;
    while(n < B){
        n += (A-1);
        h++;
    }
    if(B == 1)
        h = 0;
    printf("%d\n",h);

    return 0;
}


Measured memory_bytes: 128