akhauriyash/Code-Regression huggingface dataset:
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

// 1. dp?????????
int dp[(1<<20)];
// 2. n?????????
int N,M;
int D[21][100001]={};
int R;
// 7. calc?????????
int calc(int k){
	// 8. dp???????????°??????
	if(dp[k]>=0)return dp[k];
	// 9. dp????¨????
	int dd[20]={};
	int total=0;
	for (int i=0;i<20;i++){
		int p=(1<<i);
		if((p&k)==p){
			dd[i]=1;
			total+=D[i][N];
		}
	}
	dp[k]=N+1;
	for(int i=0;i<20;i++){
		if(dd[i]==1){
			int k2=k-(1<<i);
			dp[k]=min(dp[k],calc(k2)+D[i][N]-D[i][total]+D[i][total-D[i][N]]);
		}

	}
	return dp[k];
}


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

	//3.?????????
	for(int i=0;i<(1<<20);i++){
		dp[i]=-1;
	}
	//4.??\???
	int d1;
	for(int i=1;i<N+1;i++){
		cin>>d1;
		for(int j=0;j<20;j++)D[j][i]=D[j][i-1];
		D[d1-1][i]++;
	}
	//5.???????????¨???
	dp[0]=0;
	//6.??????

	cout<<calc((1<<M)-1)<<endl;


	return 0;
}

Measured memory_bytes: 14908
#include <iostream>
#include <climits>

using namespace std;

bool Check(const int* input, int s, int left, int right) {
  if (s == 10) return true;
  bool ret = false;
  if (input[s] >= left) {
    ret = Check(input, s + 1, input[s], right);
    if (ret) return true;
  } else if (input[s] >= right) {
    ret = Check(input, s + 1, left, input[s]);
    if (ret) return true;
  }
  return false;
}

int main() {
  int input[10];
  int left, right;
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> input[j];
    }
    if (Check(input, 0, INT_MIN, INT_MIN)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end()
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define rep(i, n) for(int i=0;i<(n);++i)
#define repp(i, a, b) for(int i=(a);i<=(b);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

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

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;


void solve() {
	ll n, k;cin>>n>>k;
	n %= k;
	cout << min(n, k-n);
}
int main() {
	fastio;
	solve();
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
fenum = sum(A)

if B[0] >= A[0]:
    B[0] -= A[0]
    A[0] = 0
    if B[0] > A[1]:
        A[1] = 0
    else:
        A[1] -= B[0]
        B[0] = 0
    
else:
    A[0] -= B[0] 
    B[0] = 0
    
for i in range(1, N):
    if B[i] >= A[i]:
        B[i] -= A[i]
        A[i] = 0
        if B[i] > A[i + 1]:
            A[i + 1] = 0
            continue
        A[i + 1] -= B[i]
        B[i] = 0
    
    else:
        A[i] -= B[i]
        B[i] = 0

print(fenum - sum(A))


Measured memory_bytes: 19004
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=300005;
int ans,top1,top2,n,tree[N<<2],add[N<<2],w,h;
pair<int,int> a[N],q1[N],q2[N];
inline bool cmp(pair<int,int> a,pair<int,int> b){
	return a.second<b.second;
}
void del(int l,int r,int i,int j,int s,int nod){
	//cout<<l<<" "<<r<<" "<<i<<" "<<j<<" "<<s<<endl;
	if(i>j)return;
	if(l==i&&r==j){
		tree[nod]+=s; add[nod]+=s; return;
	}
	int mid=(l+r)>>1;
	if(j<=mid)del(l,mid,i,j,s,nod<<1); else if(i>mid)del(mid+1,r,i,j,s,nod<<1|1);
	else{
		del(l,mid,i,mid,s,nod<<1); del(mid+1,r,mid+1,j,s,nod<<1|1);
	}
	tree[nod]=max(tree[nod<<1],tree[nod<<1|1])+add[nod];
}
void build(int l,int r,int nod){
	if(l==r){
		tree[nod]=w-a[l].second; return;
	}
	int mid=(l+r)>>1;
	build(l,mid,nod<<1); build(mid+1,r,nod<<1|1);
	add[nod]=0; tree[nod]=max(tree[nod<<1],tree[nod<<1|1]);
}
void solve(){
	sort(&a[1],&a[n+1],cmp);
	build(0,n,1);
	int mid=w>>1;
	q1[0].first=q2[0].first=-1;
	q1[top1=1]=mp(0,0); q2[top2=1]=mp(0,w);
	for(int i=1;i<=n;i++){
		ans=max(ans,tree[1]+a[i].second); //cout<<a[i].second<<" "<<tree[1]<<endl;
		if(a[i].first<=mid){
			while(top1&&a[i].first>q1[top1].second){
				del(0,n,q1[top1-1].first+1,q1[top1].first,q1[top1].second-a[i].first,1); top1--;
			}
			q1[++top1]=mp(i-1,a[i].first); 
		}else{
			while(top2&&a[i].first<q2[top2].second){
				del(0,n,q2[top2-1].first+1,q2[top2].first,a[i].first-q2[top2].second,1); top2--;
			}
			q2[++top2]=mp(i-1,a[i].first);
		}
		q1[++top1]=mp(i,0); q2[++top2]=mp(i,w);
	}
	ans=max(ans,tree[1]+h);
}
int main(){
	w=read(); h=read(); n=read();
	for(int i=1;i<=n;i++){
		a[i].first=read(); a[i].second=read();
	}
	solve();
	swap(w,h);
	for(int i=1;i<=n;i++)swap(a[i].first,a[i].second);
	solve();
	cout<<ans*2<<endl;
}


Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <unordered_map>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

vector<int> posMap[26];

int main(int argc, char** argv) {
  string s, t;
  cin >> s;
  cin >> t;

  // For Debug
  // cout << s << endl;
  // cout << t << endl;
  int s_len = s.size();
  rep(i, s_len) {
    int c = s[i] - 'a';
    posMap[c].push_back(i);
  }

  // For Debug
  // rep(i, 26) {
  //   cout << (char)('a' + i) << ": ";
  //   for (auto e : posMap[i]) {
  //     cout << e << " ";
  //   }
  //   cout << endl;
  // }

  bool impossible = false;
  int last_index = -1; // -1 is the sentinel.
  uint64_t cycle_cnt = 0;  // The count of cycle.
  int t_len = t.size();
  rep(i, t_len) {
    int c = t[i] - 'a';
    if (posMap[c].size() == 0) {
      impossible = true;
      break;
    }

    auto it = upper_bound(all(posMap[c]), last_index); // posMap[c] is sorted.

    // If last_index is lower than any element in posMap[c], we use the next value of posMap[c].
    // If last_index is larger than all value of posMap[c], we have to cycle.
    if (it == posMap[c].end()) { // last_index is larger than the largest value of posMap[c].
      cycle_cnt += 1;
      last_index = posMap[c][0];
    } else {
      last_index = *it;
    }
  }


  if (impossible) {
    cout << -1 << endl;
  } else {
    uint64_t res = (s_len * cycle_cnt) + last_index + 1;
    cout << res << endl;
  }
}


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

int main(){
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  rep(i,N) cin >> A.at(i);
  int sum = 0;
  rep(i,N) sum += A.at(i);
  if (sum >= H) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int R, C, K;
    cin >> R >> C >> K;
    auto V = make_vec<ll>(R, C);
    for (int i = 0; i < K; i++) {
        ll r, c, v;
        cin >> r >> c >> v;
        r--, c--;
        V[r][c] = v;
    }

    auto dp = make_vec<ll>(R + 1, C + 1, 5);
    for (int r = 0; r < R; r++) {
        for (int c = 0; c < C; c++) {
            for (int i = 0; i <= 3; i++) {
                chmax(dp[r][c + 1][i], dp[r][c][i]);  // don't get & right
                chmax(dp[r + 1][c][0], dp[r][c][i]);  // don't get & down
            }
            for (int i = 0; i < 3; i++) {
                chmax(dp[r][c + 1][i + 1], dp[r][c][i] + V[r][c]);  // get & right
                chmax(dp[r + 1][c][0], dp[r][c][i] + V[r][c]);      // down
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i <= 3; i++) {
        chmax(ans, dp[R][C - 1][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 706740
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

ll MOD=1e9+7;

ll modinv(ll x)
{
    ll res=1;
    ll pw=MOD-2;
    while(pw>0)
    {
        if(pw%2) res=(res*x)%MOD;
        pw/=2;
        x=(x*x)%MOD;
    }
    return res;
}

ll t[100009];
ll fact=1;
ll n;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    ll sum=0;
    ll ans=0;
    for(ll i=0; i<n; i++)
    {
        cin>>t[i];
        if(i==0) continue;
        fact=(fact*i)%MOD;
        ll va=t[i]-t[i-1];
        sum+=modinv(i);
        ll pl=(sum*va)%MOD;
        ans=(ans+pl)%MOD;
    }
    ans=(ans*fact)%MOD;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define f(i,n) for(ll i=0;i<n;i++)
    #define fz for(ll j=i+1;j<n;j++)
    #define f2(i,n) for(ll i=1;i<=n;i++)
    #define endl "\n"
    #define vll vector <ll>
    #define mod 1000000009
    #define pb push_back
    #define inf 1e13+5

    ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
    ll lcm(ll a, ll b){return a*b/gcd(a, b);}
    ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod; b/=2;a=a*a%mod;}return ans;}
    ll inverse(ll a, ll p){return fexp(a, p-2);}

    
    void solve(){
        ll n;cin>>n;
        ll a[n+1]={0};f2(i,n)cin>>a[i];
        ll dp[n+1]={0};
        dp[2]=abs(a[2]-a[1] );
        for(ll i=3;i<=n;i++){
            dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(  a[i]-a[i-1] )  );
        }
        // f2(i,n)cout<<dp[i]<<" ";
        cout<<dp[n]<<endl;

    }


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

        

        ll t;
        t=1;
        // cin>>t;
        while(t--){
            solve();
        }

       
        
        return 0;
    }

Measured memory_bytes: 1792
import itertools
H, W = map(int, input().split())

A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
# print(A)
# print(B)

X = (H + W) * 80 # 偏りとしてあり得そうな最大値
# dp[y][x]のn-Xビット目: 上からyマス目、左からxマス目のマスで
# 偏りがnとなり得るか（なり得る場合は1）
dp = [[0] * (W+1) for _ in range(H+1)]

# 左上のマス(dp[1][1])の上のマスに、偏り0があり得るというフラグを立てておく
# (左からXビット目を1にする)
# こうすると、左上から走査を始めるときにX +- abs(A[0][0] - B[i][0])ビット目に
# フラグを立てられる
dp[0][1] = 1 << X

for i in range(1, H + 1):
  for j in range(1, W + 1):
    k = abs(A[i-1][j-1] - B[i-1][j-1]) # マス[i, j]での偏り（の絶対値）
    # 左のマスで取り得る偏りに+-kしたものが、このマスで取り得る偏り
    dp[i][j] |= dp[i][j - 1] << k
    dp[i][j] |= dp[i][j - 1] >> k
    # 上のマスで取り得る偏りに+-kしたものも、このマスで取り得る偏り
    dp[i][j] |= dp[i - 1][j] << k
    dp[i][j] |= dp[i - 1][j] >> k

# print(dp)
ans = X
# 右下のマスで取り得る偏りを抽出し、絶対値が0に最も近いもの
# (1になっているビットの中で最もXビット目に近いもの)を解とする
for k in range(2 * X + 1):
  # 左からkビット目が1だったら、abs(k-X)の偏りが存在し得る
  if (dp[H][W] >> k) & 1:
    ans = min(ans, abs(k - X))

print(ans)

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

ll X;

int main(){
	cin>>X;
	for(ll i=-200;i<=200;i++){
		for(ll j=-200;j<=200;j++){
			if(i*i*i*i*i-j*j*j*j*j==X){
				cout<<i<<' '<<j<<endl;
				return 0;
			}
		}
	}
}


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

using namespace std;

using ll = long long;

struct Info{
  ll b;
  ll c;
  bool operator<(const Info &another){
    return c < another.c;
  }
};

int main(void){
  int n, m;
  cin >> n >> m;
  cin.ignore();

  ll a[n];
  for(int i = 0; i <n; i++){
    cin >> a[i];
  }
  cin.ignore();
  sort(a, a+n);

  Info info[m];
  for (int j = 0; j < m; j++){
    cin >> info[j].b >> info[j].c;
    cin.ignore();
  }

  sort(info, info +  m);

  int j = m - 1;
  ll sum = 0;

  for(int i = 0; i < n; i++){
    if((a[i] < info[j].c) && (info[j].b > 0)){
      sum += info[j].c;
      info[j].b = info[j].b - 1;
    } else {
      sum += a[i];
    }
    if(info[j].b == 0){
      if(j == 0) continue;
      else j--;
    }
  }

  cout << sum << endl;

  return 0;
}

  


Measured memory_bytes: 2560
#include <iostream>

unsigned long long C(int n, int k)
{
	unsigned long long res = 1;
	for (int i=0; i<k; i++) res *= (unsigned long long)(n-i);
	for (int i=1; i<=k; i++) res /= (unsigned long long)i;
	return res;
}

int main()
{
	int n;
	while (std::cin >> n) {
		if (n>2000) n = 4000 - n;
		if (n<=1000) std::cout << C(n+3, 3) << std::endl;
		else std::cout << C(n+3, 3) - 4 * C(n-998, 3) << std::endl;
	}
	
	return 0;
}



Measured memory_bytes: 3096
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (isok).erase(unique(ALL((isok))),(isok).end())
# define LOWER(s)    transform(ALL((maze)),(maze).begin(),TL<char>)
# define UPPER(s)    transform(ALL((maze)),(maze).begin(),TU<char>)
# 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 INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int a[201010];
int b[201010];
LL ans = 0;
int main() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
		b[a[i]] = i;
	}
	set<int> st;
	st.insert(-1), st.insert(n);
	for (int i = 1; i <= n;i++) {
		auto r = st.upper_bound(b[i]);
		auto l = r;
		l--;
		//cout << *l << " " << *r << endl;
		st.insert(b[i]);
		ans += 1LL*((*r) - b[i])*(b[i]-(*l))*i;
		//cout << ans << endl;
	}
	cout << ans << endl;
	//system("pause");
}

Measured memory_bytes: 11136
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
//#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 1LL<<60
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 5e5 + 3;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes"); exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No"); exit(0); }
void one() { puts("-1"); exit(0); }

ll num[22];

ll dfs(int le, int ri, ll d)
{
	if (le >= ri)
	{
		if (d == 0)
		{
			if (le == ri)
			{
				return 10;
			}
			else
			{
				return 1;
			}
		}
		else
		{
			return 0;
		}
	}
	int t = (10 - d % 10) % 10;
	ll sur = d - t*num[ri - le] + t;
	return ((le ? 10 : 9) - t)*(dfs(le + 1, ri - 1, llabs(sur) / 10));
}

int main()
{
	num[0] = 1;
	for (int i = 1; i <= 20; i++)
	{
		num[i] = num[i - 1] * 10;
	}
	ll d;
	scanf("%lld", &d);
	ll ans = 0;
	for (int i = 0; i < 19; i++)
	{
		ans += dfs(0, i, d);
	}
	printf("%lld", ans);
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,M;
  cin>>N>>M;
  long long T=M*1900+(N-M)*100;
  long long Ans=T;
  for(int i=0;i<M;i++){
    Ans=2*Ans;
  }
  cout<<Ans<<endl;
}


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

signed main() {
	int N,X;
	cin>>N>>X;
	int ans=0;
	int k=0;
	std::vector<int> v(N);
	for(int i=0;i<N;i++)cin>>v[i];
	for(int i=1;i<N;i++){
		if(v[i-1]+v[i]>X){
			ans+=v[i-1]+v[i]-X;
			v[i]=max(k,X-v[i-1]);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
def inpl(): return list(map(int, input().split()))

N = int(input())
P = input().split()

def calc(a, b):
    if a == "T" and b == "F":
        return "F"
    else:
        return "T"

a = P[0]
for b in P[1:]:
    a = calc(a, b)
print(a)


Measured memory_bytes: 7020
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
priority_queue <int> q;
const int N = 3e5+5;
int a[N];
int main(){
	ios::sync_with_stdio(false);
	double a,b;
	cin>>a>>b;
//	cout<<a/0.08<<" "<<b/0.1;
	double mina=a/0.08,minb=b/0.1;
	double maxa=(a+1)/0.08,maxb=(b+1)/0.1;
	double minn=max(mina,minb);
	double maxx=min(maxa,maxb);
	int ans=minn;
	while(1){
		if(ans>=maxx){
			cout<<"-1"<<endl;
			break;
		}
		if(ans<maxx && ans>=minn){
			cout<<ans<<endl;
			break;
		}
		ans++;
	}
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: Chars
    };

    let n = n
        .into_iter()
        .map(|ch| ch.to_digit(10).unwrap() as isize)
        .rev()
        .chain(vec![0])
        .collect::<Vec<_>>();
    let len = n.len();
    // dp[i][j] = 最小のコイン数
    // i: 後ろからi桁目まで見た
    // j: 0: 繰り下がりがない, 1: 繰り下がりがある
    let mut dp = vec![vec![1_isize << 30; 2]; len + 1];
    dp[0][0] = 0;
    for i in 0..len {
        let a = n[i];
        for j in 0..2 {
            for b in 0_isize..=9 {
                let to_i = i + 1;
                let x = b - if j == 0 { 0 } else { 1 };
                if x >= a {
                    let to_j = 0;
                    dp[to_i][to_j] = dp[to_i][to_j].min(dp[i][j] + b + (x - a));
                } else {
                    let to_j = 1;
                    dp[to_i][to_j] = dp[to_i][to_j].min(dp[i][j] + b + (x - a + 10));
                }
            }
        }
    }
    println!("{}", dp[len][0]);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


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

using namespace std;
using Int = long long;

signed main(){
    Int a, b, ans;
    cin >> a >> b;
    if (a <= 5) {
        ans = 0;
    } else if (a <= 12) {
        ans = b / 2;
    } else{
        ans = b;
    }
    cout << ans << endl;
    return 0;
}

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

class Program
{
    static void Main(string[] args) {
        string b = Console.ReadLine();
        if (b == "A") Console.WriteLine("T");
        else if (b == "T") Console.WriteLine("A");
        else if (b == "G") Console.WriteLine("C");
        else Console.WriteLine("G");
    }
}

Measured memory_bytes: 11092
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#include <climits>
#include <memory>
#include <numeric>
#include <utility>


#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
#define PI 3.14159265358979323846264338327950L;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
const ll LINF = 1e18 + 100;
using namespace std;
using Graph = vector<vector<int>>;



int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int D;
ll G;
vector<ll> P, C;

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

	

	int n,x;

	cin >> n >> x;
	if ((n * x) % 2 == 0) {
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;


}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
char shit[maxn];
int sum[maxn];
int n;
bool check(int mid)
{
    if(sum[n]==0||sum[n]==n) return 1;
    int l=n-mid,r=mid;
    if(l>=r) return 1;
    if(sum[r]-sum[l]==0||sum[r]-sum[l]==r-l) return 1;
    return 0;
}
int main()
{
    scanf("%s",shit);
    n=strlen(shit);
    sum[0]=0;
    for(int i=0;i<n;i++)
    {
        sum[i+1]=shit[i]-'0';
        sum[i+1]+=sum[i];
    }
    int l=2,r=n;
    int ans=1;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid)){
            ans=mid;
            l=mid+1;
        }
        else r=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 768
#include <iostream>

using namespace std;
typedef long long ll;
ll N;
#define MAXN 1000001
ll A[MAXN];
int main(){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    A[N] = A[0];
    ll B[MAXN];
    B[0] = 0;
    for(int i=0;i<N;i++){
        B[i+1] = -B[i]+2*A[i];
    }
    if(B[N]!=B[0]){B[0] = B[N]/2;
        for(int i=0;i<N;i++){
            B[i+1] = -B[i]+2*A[i];
        }
    }
    for(int i=0;i<N;i++){
        cout << B[i] << ' ';
    }
    cout << endl;
    return 0;
}

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

int main()
{
  long int N, M;
  cin >> N >> M;
  if (2*N >= M) {
    cout << M/2 << endl;
  } else {
    cout << N + (M - 2*N)/4 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main
  
import (
    "fmt"
)

func main() {
    var m, k int
    fmt.Scan(&m, &k)
    max := pow(m)

    switch m {
    case 0:
        if k == 0 {
            fmt.Println("0 0")
        } else {
            fmt.Println(-1)
        }

    case 1:
        if k == 0 {
            fmt.Println("0 0 1 1")
        } else {
            fmt.Println(-1)
        }

    default:
        if k == 0 {
            for i := 0; i < max; i++ {
                if i == max-1 {
                    fmt.Printf("%d %d", i, i)
                } else {
                    fmt.Printf("%d %d ", i, i)
                }
            }
            fmt.Println("")
        } else if k < max {
            fmt.Printf("0 %d 0 ", k)
            for i := 1; i < max; i++ {
                if i != k {
                    fmt.Printf("%d ", i)
                }
            }
            fmt.Print(k)
            for i := max - 1; i >= 1; i-- {
                if i != k {
                    fmt.Printf(" %d", i)
                }
            }
            fmt.Println("")
        } else {
            fmt.Println(-1)
        }
    }
}

func pow(n int) int {
    a := 1
    for i := 0; i < n; i++ {
        a *= 2
    }
    return a
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "YES\n"
#define N cout << "NO\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i,n) for(int i = 0 ; i < n ; i++)

int main()
{
    int n , k , a[200010] , b[200010] , ans = 0 , max = 0 ;
    cin >> k >> n ;
    R(i,n)
    {
        cin >> a[i] ;
    }
    R(i,n)
    {
        if(i == (n-1) )
        {
            b[i] = k - a[i] + a[0] ;
        } 
        else
        {
            b[i] = a[i+1] - a[i] ;
        }
        if(b[i] > max)
        {
            max = b[i] ;
        }
    }
    ans = k - max ;
    cout << ans << endl ;
}

Measured memory_bytes: 1024
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    read_line();
    let heights: Vec<i32> = read_line().split_whitespace().map(|h| h.parse().unwrap()).collect();
    
    let mut count = 0;
    for x in heights.windows(2).map(|w| w[1] - w[0]) {
        if x < -1 { println!("No"); return; }
        if x == -1 {
            count += 1;
            if count >= 2 { println!("No"); return; }
        }
        if x > 0 { count = 0; }
    }
    println!("Yes")
}

Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
#define MAX 10000000

int main()
{
    ll a,b;
    vector<ll> num;
    cin >> a >> b;

    if(a==b&&a==1){
        cout << 1 << endl;
        return 0;
    }
    if(a<b){
        swap(a,b);
    }
    ll c=a;
    ll i;

    for(i=2;i*i<=c;++i){
        if(c%i!=0){
            continue;
        }
        while(c%i==0){
            c/=i;
        }
        num.push_back(i);
    }
    if(c!=1){
        num.push_back(c);
    }
    ssort(num);

    ll count=1;
    rep(i,num.size()){
        if(b>=num[i]){
            if(b%num[i]==0){
                count++;
            }
        }
    }
    cout << count << endl;
}

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


int main()
{
	int a,b;   cin>>a>>b;
	
	if(a>=13){
		cout<<b<<endl;
	}
	
	else if(a==6 || a==12){
		cout<<b/2<<endl;
	}
	
	
	else if(a<=5){
		cout<<0<<endl;
	}

}



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

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

  vector<long double> vec(num);
  for(int i = 0; i < num; ++i) cin >> vec.at(i);

  double bunbo = 0;
  for(int i = 0; i < num; ++i){
    bunbo += 1 / vec.at(i);
  }

  long double ans = 1 / bunbo;
  cout << fixed << setprecision(20);
  cout << ans << endl;

  return 0;
    
}



Measured memory_bytes: 384
using System;

namespace BYymmOrMmyy
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var inputs = Console.ReadLine().ToCharArray();

            // ２桁ずつの値を int に変換
            var first = int.Parse(String.Concat(inputs[0], inputs[1]));
            var second = int.Parse(String.Concat(inputs[2], inputs[3]));

            // それぞれが月の可能性があるか否か
            var maybeMmFirst = 1 <= first && first <= 12;
            var maybeMmSecond = 1 <= second && second <= 12;

            // 解答の出力
            if (maybeMmFirst && maybeMmSecond) Console.WriteLine("AMBIGUOUS");
            else if (maybeMmFirst && !maybeMmSecond) Console.WriteLine("MMYY");
            else if (!maybeMmFirst && maybeMmSecond) Console.WriteLine("YYMM");
            else Console.WriteLine("NA");
        }
    }
}


Measured memory_bytes: 13140
num_array=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
pos=int(input())
print(num_array[pos-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    char c; cin >> c;

    if (c - 'a' >= 0){
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
    return 0;
}

Measured memory_bytes: 3592
import sys
INPUT = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()

    parity = True
    for s in S:
        if parity:
            if s == 'L':
                print('No')
                sys.exit()
            parity = False
        else:
            if s == 'R':
                print('No')
                sys.exit()
            parity = True

    print('Yes')


if __name__ == '__main__':
    main()


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

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

    int ans = 0;
    int l = 0, r = n-1;
    while(l < r){
        if(s[l] == s[r]){
            l++;
            r--;
        } else if(s[l] == 'x'){
            l++;
            ans++;
        } else if(s[r] == 'x'){
            r--;
            ans++;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3748
import java.math.BigInteger;
import java.util.*;
import java.util.stream.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt(), k = scanner.nextInt();
        int[] a = IntStream.range(0, n).map(i -> scanner.nextInt()).toArray();
        System.out.println(k <= Arrays.stream(a).max().getAsInt() && k % gcd(a) == 0 ? "POSSIBLE" : "IMPOSSIBLE");
    }

    public static int gcd(int... array) {
        BigInteger j = BigInteger.valueOf(array[0]);
        for (int i = 1; i < array.length; i++)
            j = j.gcd(BigInteger.valueOf(array[i]));
        return j.intValue();
    }
}

Measured memory_bytes: 61664
#include <bits/stdc++.h>
#define int long long
#define range(i,x,y) i=(x);i<(y);i++
#define all(x) begin(x),end(x)
#define lim(x,r,l) (r<=x&&x<l)
typedef long long ll;
typedef long double ld;
using namespace std;

signed main(){
  int n;
  while(cin >> n, n != 0){
    vector<vector<int>> p(n);
    for(int range(i,0,n)){
      int m;
      cin >> m;
      p[i] = vector<int>(m);
      for(int range(j,0,m)){
        cin >> p[i][j];
      }
      sort(all(p[i]));
    }
    int k;
    cin >> k;
    vector<int> l(k);
    for(int range(j, 0, k)){
      cin >> l[j];
    }
    sort(all(l));
    int id = -2;

    for(int range(i,0,n)){

      if(includes(all(p[i]), all(l))){
        if(id==-2){
          id = i;
        }else{
          id = -3;
        }
      }
    }
    cout << max(-1ll, id+1) << endl;
  }
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vp;
typedef set<ll> si;
typedef map<string, ll> msi;
#define REP(i,a,b) \
for(ll i=ll(a);i<=ll(b);i++)
#define DEP(i,a,b) \
for(ll i=ll(a);i>=ll(b);i--)
#define TR(c, it) \
for (auto it = (c).begin(); it != (c).end(); it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  int T;
  T=1;
  while(T--)
  {
      ll n,i,j,k,l,m;
      cin>>n;
      cout<<n+n*n+n*n*n;
      string s;
  }
  return 0;
}

Measured memory_bytes: 3664
#include <stdio.h>

int main()
{
	int a,b,c,tmp;

	scanf("%d %d %d",&a,&b,&c);

	if(a>b){tmp=a; a=b;b=tmp;}
	if(b>c){tmp=b;b=c;c=tmp;}
	if(a>b){tmp=a; a=b;b=tmp;}
	
	printf("%d %d %d\n",a,b,c);

	return 0;
}

Measured memory_bytes: 596
H,W,K = map(int,input().split())
s = [input() for _ in range(H)]
S = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        S[i][j] = int(s[i][j])

c = [[0]*(W+1) for _ in range(H+1)]
for i in range(H):
    for j in range(W):
        c[i][j] = S[i][j]+c[i][j-1]

for i in range(H):
    for j in range(W):
        c[i][j] += c[i-1][j]

def count(x1,y1,x2,y2):
    res = c[x2][y2]
    res -= c[x2][y1-1]
    res -= c[x1-1][y2]
    res += c[x1-1][y1-1]
    return res

ans = 10**9
for n in range(2**(H-1)):
    h = [0]
    cuts = 0
    for k in range(H-1):
        if 2**k&n:
            h.append(k+1)
            cuts += 1
    h.append(H)
    w1 = 0
    for w2 in range(W):
        ok = True
        for i in range(len(h)-1):
            h1 = h[i]
            h2 = h[i+1]-1
            if count(h1,w1,h2,w2)>K:
                ok = False
                break
        if not ok:
            cuts += 1
            if w1==w2:
                cuts = 10**9
            w1 = w2
    
    ans = min(ans,cuts)

print(ans)

Measured memory_bytes: 45148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long A, long long B, std::string S)
{
    int passed = 0;
    int foreign = 1;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'a')
        {
            if (passed < A + B)
            {
                passed++;
                cout << YES << endl;
            }
            else
            {
                cout << NO << endl;
            }
        }
        if (S[i] == 'b')
        {
            if (passed < A + B && foreign <= B)
            {
                passed++;
                foreign++;
                cout << YES << endl;
            }
            else
            {
                foreign++;
                cout << NO << endl;
            }
        }
        if (S[i] == 'c')
        {
            cout << NO << endl;
        }
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    std::string S;
    std::cin >> S;
    solve(N, A, B, S);
    return 0;
}


Measured memory_bytes: 896
//This Code was made by Chinese_zjc_.
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<bitset>
#include<cmath>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<set>
#include<time.h>
// #include<windows.h>
#define int long long
#define PI 3.14159265358979323
#define INF 0x3fffffffffffffff
using namespace std;
int n,ans;
signed main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        for(int j=1;i*j<n;++j)
        {
            ++ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/***********************************************************************/

int32_t main() {
 
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int a;
  string s;
  cin >> a >> s;
  if (a < 3200) kek("red");
  else kek(s);
    
  return 0;
}


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

using namespace std;
#define fast	ios::sync_with_stdio(0);cin.tie(0);
#define ll 		long long int
#define INF     1e18L
#define precision(x)	fixed << setprecision(x)
const ll mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	if (b == 0)  return a;
	return gcd(b , a % b);
}


ll powm(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * 1LL * a) % mod;
		b >>= 1LL;
		a = (a * 1LL * a) % mod;
	}
	return res;
}
const int N = 1e6 + 5;
const int M = 2005;

//--------------------------------------------------------------------------------------------------------------------------//
int a[N];

int n, q;
int tree[4 * N];

void update(int node, int start, int end, int idx, int val) {

	if (start == end) {
		tree[node] = max(val, tree[node]);
	} else {
		int mid = (start + end) / 2;
		if (idx >= start && idx <= mid) {
			update(2 * node + 1, start, mid, idx, val);
		} else {
			update(2 * node + 2, mid + 1, end, idx, val);
		}
		tree[node] = max(tree[2 * node + 1], tree[2 * node + 2]);
	}
}
int query(int node, int start, int end, int l, int r) {
	if (l > end || start > r) {
		return 0;
	}
	if (l <= start && r >= end) {
		return tree[node];
	}
	int q1, q2;
	int mid = (start + end) / 2;
	q1 = query(2 * node + 1, start, mid, l, r);
	q2 = query(2 * node + 2, mid + 1, end, l, r);
	return max(q1, q2);
}
void solve() {
	int n, k;
	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int l = max(0, a[i] - k);
		int r = a[i] + k;
		int q = query(0, 0, N - 1, l, r);
		int best = q + 1;
		update(0, 0, N - 1, a[i], best);
		ans = max(ans, best);
	}
	cout << ans << endl;
}

int main() {
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int tc = 1;
	// cin >> tc;

	int _ = 0;
	while (_++ < tc) {
		solve();
	}

	return 0;
}






Measured memory_bytes: 7356
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

int main() {
    int r;
	cin >> r;
    cout<<fixed<<setprecision(5)<<((float)r*2)*3.14159265;
	return 0;
}

Measured memory_bytes: 3792
use std::io::Read;
fn main() {
    let buf = {
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    };
    let out = solve(buf);
    print!("{}", out);
}
fn solve(buf: String) -> String {
    let mut sc = io::Scanner::new(&buf);
    let n: usize = sc.read();
    let q: usize = sc.read();
    let queries: Vec<(usize, usize, usize)> =
        (0..q).map(|_| (sc.read(), sc.read(), sc.read())).collect();

    let mut seg = SegmentTree::<Min>::new(n);
    let mut res = String::new();

    for query in queries {
        if query.0 == 0 {
            seg.update(query.1, query.2);
        } else {
            res.push_str(&seg.query(query.1, query.2 + 1).to_string());
            res.push_str("\n");
        }
    }
    res
}
pub mod io {
    use std::str::{FromStr, SplitWhitespace};
    pub struct Scanner<'a> {
        iter: SplitWhitespace<'a>,
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.iter
                .next()
                .unwrap()
                .parse()
                .ok()
                .expect("parsing failed")
        }
        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
    }
}

type Min = usize;

impl Monoid for Min {
    fn mempty() -> Min {
        2147483647 //  == 2^31 - 1
    }

    fn mappend(a: Min, b: Min) -> Min {
        std::cmp::min(a, b)
    }
}

pub trait Monoid: Copy {
    fn mempty() -> Self;
    fn mappend(a: Self, b: Self) -> Self;
}
pub struct SegmentTree<M> {
    n: usize,
    data: Vec<M>,
}
impl<M: Monoid> SegmentTree<M> {
    pub fn new(n: usize) -> SegmentTree<M> {
        let mut m = 1;
        while m < n {
            m *= 2;
        }

        SegmentTree {
            n: m,
            data: vec![M::mempty(); 2 * m],
        }
    }
    pub fn update(&mut self, k: usize, a: M) {
        let mut k = k + self.n - 1;
        self.data[k] = a;
        while k > 0 {
            k = (k - 1) / 2;
            self.data[k] = M::mappend(self.data[k * 2 + 1], self.data[k * 2 + 2]);
        }
    }
    pub fn query(&self, l: usize, r: usize) -> M {
        self.query_range(l, r, 0, 0, self.n)
    }
    pub fn query_range(&self, a: usize, b: usize, k: usize, l: usize, r: usize) -> M {
        if r <= a || b <= l {
            M::mempty()
        } else if a <= l && r <= b {
            self.data[k]
        } else {
            let vl = self.query_range(a, b, k * 2 + 1, l, (l + r) / 2);
            let vr = self.query_range(a, b, k * 2 + 2, (l + r) / 2, r);
            M::mappend(vl, vr)
        }
    }
}



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

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

    if(S=="SUN") cout<<7<<endl;
    if(S=="MON") cout<<6<<endl;
    if(S=="TUE") cout<<5<<endl;
    if(S=="WED") cout<<4<<endl;
    if(S=="THU") cout<<3<<endl;
    if(S=="FRI") cout<<2<<endl;
    if(S=="SAT") cout<<1<<endl;
}

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

int main() {
  int n, k;
  string s;
  cin >> n >> s >> k;
  for (int i=0; i<n; i++){
    if (s[i] != s[k-1]) s[i] = '*';
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int v[10],i,j,t=5,r,a,re;
    int cn[15]={0};
    for(i=0;i<t;i++)
    {
        scanf("%d",&v[i]);
        r=v[i]%10;
        if(cn[r]!=0)
        {
            if(r!=0)
            {
                cn[r]=cn[r]+10-r;
            }
            cn[r]=cn[r]+v[i];
        }
        else
        {
            cn[r]=cn[r]+v[i];
        }
    }
    t=cn[0];
    a=10;
    for(j=9;j>=1;j--)
    {
        if(cn[j]!=0)
        {
            a=j;
            t=t+cn[a];
            t=t+(10-a);
        }
    }
    t=t-(10-a);
    printf("%d\n",t);
    return 0;
}


Measured memory_bytes: 128