akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>

std::vector<int> getInput(int n) {
  std::vector<int> input;
  for (int i = 0; i < n; i++) {
    int buf;
    std::cin >> buf;
    input.push_back(buf);
  }
  return input;
}

int getIndex(const std::vector<int> &vec, const int element) {
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i] == element) return i;
  }
  return -1;
}

std::vector<int> getLabels(const std::vector<int> &mapping,
                           const std::vector<int> &labels) {
  auto newLabels = mapping;
  std::transform(mapping.begin(), mapping.end(), newLabels.begin(),
                 [&](int e) { return labels[e - 1]; });
  return newLabels;
}

bool isSame(const std::vector<int> &first, const std::vector<int> &second) {
  int secondStartIndex = getIndex(second, first[0]);
  std::vector<int> alignedSecond;
  for (int i = secondStartIndex; i < secondStartIndex + 4; i++) {
    alignedSecond.push_back(second[i % 4]);
  }
  return first == alignedSecond;
}

bool isSameElements(std::vector<int> first, std::vector<int> second) {
  std::sort(first.begin(), first.end());
  std::sort(second.begin(), second.end());
  return first == second;
}

bool isSame(const std::vector<std::vector<int>> &dice,
            const std::vector<int> &first, const std::vector<int> &second) {
  if (!isSameElements(first, second)) return false;

  for (int i = 0; i < dice.size(); i++) {
    auto firstLabels = getLabels(dice[i], first);

    int secondIndex = getIndex(second, first[i]);
    if (secondIndex == -1) return false;
    auto secondLabels = getLabels(dice[secondIndex], second);
    if (isSame(firstLabels, secondLabels)) return true;
  }
  return false;
}

bool isAllDefferent(const std::vector<std::vector<int>> &dice,
                    const std::vector<std::vector<int>> &inputs) {
  for (int i = 0; i < inputs.size(); i++) {
    for (int j = 0; j < inputs.size(); j++) {
      if (i >= j) continue;
      if (isSame(dice, inputs[i], inputs[j])) {
        return false;
      }
    }
  }
  return true;
}

int main() {
  std::vector<std::vector<int>> dice = {{5, 3, 2, 4}, {1, 3, 6, 4},
                                        {1, 5, 6, 2}, {1, 2, 6, 5},
                                        {1, 4, 6, 3}, {5, 4, 2, 3}};
  int n;
  std::cin >> n;

  std::vector<std::vector<int>> inputs;
  while (n-- > 0) {
    inputs.push_back(getInput(6));
  }

  if (isAllDefferent(dice, inputs)) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}



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

vector<pair<long long, long long>> prime_factorize(long long n)
{
    vector<pair<long long, long long>> res;
    for (long long p = 2; p * p <= n; ++p)
    {
        if (n % p != 0)
            continue;
        int num = 0;
        while (n % p == 0)
        {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int main()
{
    long long N;
    cin >> N;
    auto pf = prime_factorize(N);
    long long res = 0;
    for (auto p : pf)
    {
        long long e = p.second;
        long long tmp = 0, cur = 1;
        while (e >= cur) {
            e -= cur;
            cur++;
            ++tmp;
        }
        res += tmp;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3604
import itertools
ab = [list(map(int,input().split())) for _ in range(3)]


for a in (list(itertools.permutations(ab))):
    for f in [a[0],list(reversed(a[0]))]:
        for g in [a[1],list(reversed(a[1]))]:
            for h in [a[2],list(reversed(a[2]))] :
                if f[1]==g[0] and g[1]==h[0] and len(set([f[0],g[0],h[0],h[1]]))==4:
                    print("YES")
                    exit()


print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <string>

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

    bool f = true;
    if (S[0] != 'A') {
        f = false;
    }

    if (!(S[1] != 'C' && 'a' <= S[1] && S[1] <= 'z')) {
        f = false;
    }

    if (S[S.size() - 1] == 'C') {
        f = false;
    }

    int c = 0;
    if (f) {
        for (size_t i = 1; i < S.size(); i++) {
            if (c == 0) {
                if (S[i] == 'C') {
                    c = i;
                } else if (S[i] < 'a' || 'z' < S[i]) {
                    f = false;
                }
            } else {
                if (S[i] < 'a' || 'z' < S[i]) {
                    f = false;
                }
            }
        }
    }

    if (f && c != 0) {
        std::cout << "AC" << '\n';
    } else {
        std::cout << "WA" << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
 double N,M;
 std::cin >> N >> M;
 bool result = true;
 double count = 0;
   vector<int> A(N);
 for (size_t i = 0; i < N; i++) {
   std::cin >> A[i];
   count += A[i];
 }
 std::sort(A.begin(), A.end() );
 for (size_t i = 0; i < M; i++) {
   double a;
   a = count/(4*M);
   if (A[N-1-i]< a) {
     result =  false;
   }
 }
 if (result) {
   std::cout << "Yes" << '\n';
 }
 else{
   std::cout << "No" << '\n';
 }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

def main():
    K,A,B = map(int,input().split())
    if A+2 >= B:
        print(K+1)
    else:
        if K<=A:
            print(K+1)
        else:
            rest = K-(A-1)
            print(A+(B-A)*(rest//2)+rest%2)
    
if __name__ == "__main__":
    main()


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

using namespace std;

constexpr int MOD = 1000000007;
constexpr int MAX_N = 100000 + 1;
constexpr int MAX_M = 100000;

int n, m;
set<int> def;
int DP[MAX_N];

int calc(int i)
{
	if (DP[i] == -1) {
		if (i == 1) {
			if (def.find(1) == def.end()) {
				DP[i] = 1;
			} else {
				DP[i] = 0;
			}
		} else {
			DP[i] = 0;
			if (def.find(i - 1) == def.end()) {
				DP[i] = ((DP[i] % MOD) + (calc(i - 1) % MOD)) % MOD;
			}
			if (def.find(i - 2) == def.end()) {
				DP[i] = ((DP[i] % MOD) + (calc(i - 2) % MOD)) % MOD;
			}
		}
	}
	return DP[i];
}

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

	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int temp; cin >> temp;
		def.insert(temp);
	}
	DP[0] = 1;
	for (int i = 1; i <= n; ++i) {
		DP[i] = -1;
	}
	cout << calc(n) << endl;
}

Measured memory_bytes: 5376
#include <stdio.h>
#include<string.h>
char s[200010];
int main(){
    scanf("%s",&s);
    int len=strlen(s);
    int sum=0;
    for(int i=0;i<len;i++){sum+=s[i]-'0';}
    if(sum%9==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1832
#include <iostream>
#include <string>
using namespace std;
int main(){
    char b;
    cin>>b;
    if (b=='A'){
        cout<<'T'<<endl;
    }
    else if(b=='T'){
        cout<<'A'<<endl;
    }
    else if(b=='G'){
        cout<<'C'<<endl;
    }
    else{
        cout<<'G'<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n;
    cin>>n;
    int v[2*n];
    for(int i=0;i<2*n;i++){
        cin>>v[i];
    }
    sort(v,v+2*n);

    int sum=0;
    int m=2*n-2; //mはvの2番目に大きいindex
    while(m>=0){
        sum+=v[m];
        //cout<<sum<<endl;
        m-=2;
    }
    
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string s;
    cin >> s;
    if(n%2==1){
        cout << "No" << endl;
        return 0;
    } 
    bool flag;
    for(int i=0;i<n/2;i++){
        if(s[i]!=s[i+n/2]){
            flag=false;
            break;
        }
        flag=true;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll r,g,b,n;
  cin >> r >> g >> b >> n;

  ll ar,ag,ab;
  ll ans = 0;

  rep(i,n / r + 1)
  {
    rep(j, (n-i*r) / g + 1)
    {
      if((n - i * r - j * g) % b == 0)
      {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=200005;
const int max_log=18;
const int inf=0x3f3f3f3f;
struct ST{
    int n,a[max_n];
    int lg[max_n],st[max_n][max_log+1];
    void init(int* _a,int _n){
        n=_n;
        for(int i=1;i<=n;i++)a[i]=_a[i];
        lg[1]=0;
        for(int i=2;i<=n;i++){
            lg[i]=lg[i-1];
            if(i==(i&-i))lg[i]++;
        }
        for(int i=1;i<=n;i++)st[i][0]=a[i];
        for(int j=1;j<=max_log;j++){
            for(int i=1;i+(1<<j)-1<=n;i++){
                st[i][j]=min(st[i][j-1],st[i+(1<<j-1)][j-1]);
            }
        }
    }
    int query(int l,int r){
        if(l>r)return inf;
        int i=lg[r-l+1];
        return min(st[l][i],st[r-(1<<i)+1][i]);
    }
}Tree[2];
struct Node{
    int l,r,x;
    bool operator < (Node p)const{
        return x<p.x;
    }
};
int n,p[max_n];
int a[max_n];
int pos[max_n];
set<Node> s;
int ans[max_n],tot;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",p+i),pos[p[i]]=i;
    for(int j=0;j<2;j++){
        for(int i=1;i<=n;i++){
            if(i%2==j)a[i]=p[i];
            else a[i]=inf;
        }
        Tree[j].init(a,n);
    }
    s.insert({1,n,Tree[1&1].query(1,n)});
    while(!s.empty()){
        Node p=*s.begin();s.erase(p);
        int l=p.l,r=p.r,x=p.x;
        int y=Tree[(l+1)&1].query(pos[x]+1,r);
        //cout<<x<<' '<<y<<endl;
        ans[++tot]=x,ans[++tot]=y;
        x=pos[x],y=pos[y];
        if(x!=l)s.insert({l,x-1,Tree[l&1].query(l,x-1)});
        if(x+1<=y-1)s.insert({x+1,y-1,Tree[(x+1)&1].query(x+1,y-1)});
        if(y!=r)s.insert({y+1,r,Tree[(y+1)&1].query(y+1,r)});
    }
    for(int i=1;i<=tot;i++)printf("%d ",ans[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 39936
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,j=0,k=0;
  cin>>N>>M;
  vector<bool> A(N,true);
  vector<int> B(N,0);
  for(int i=0;i<M;i++){
    int p;
    string S;
    cin>>p>>S;
    if(S=="AC"){
      if(A[p-1]){
        k++;
        j+=B[p-1];
        A[p-1]=false;
      }
    }else{
      B[p-1]++;
    }
  }
  cout<<k<<' '<<j<<endl;
}

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

int n,t;
int x,y;

int main()
{
   scanf("%d%d",&n,&t);
   int ans = 1;
   for(int i=1;i<=t/i;i++)
   {
      if((t%i)!=0) continue;
      if(i>=n){
         ans = t/i;
         break;
      }
      if((t/i)>=n) ans = i;
   }
   printf("%d\n",ans);
 	return 0;
}


Measured memory_bytes: 256
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=10029 の代わりにここでテスト
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               
//                                                               

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto &e : a) cin >> e;
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) cout << a[i] << " \n"[i==n-1];
    return 0;
}


Measured memory_bytes: 10748
object Main extends App {
	val a = scala.io.StdIn.readLine.toArray
	val b = scala.io.StdIn.readLine.toArray

	var flag = true

	for(i<-0 until a.size){
		if(a(i) != b(2-i)) flag = false
	}

	if(flag) println("YES")
		else println("NO")

}

Measured memory_bytes: 27188
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int x, r = 1;
  cin >> x;
  for (int i = 2; i <= x; ++i) {
    int k = i * i;
    for (int j = 2; k <= x; ++j, k *= i) r = max(r, k);
  }
  cout << r << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define Mod  1000000007
ll fast(ll n,ll a,ll M)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a,M);
        if(n%2==0)
        {
            return ((res%M)*(res%M))%M;
        }
        else
        {
            return (((((res%M)*a)%M)*res)%M);
        }
    }
}
int main()
{
    ll N,K;
    cin>>N>>K;
    ll ans[K+1];
    ll i,j;
    for(i=1;i<=K;i++)
    {
        ll res=K/i;
        ans[i]=fast(N,res,Mod);
    }
    for(i=K;i>=1;i--)
    {
        for(j=i*2;j<=K;j+=i)
        {
            ans[i]-=ans[j];
            if(ans[i]<0)
            {
                ans[i]+=Mod;
                ans[i]%=Mod;
            }
        }
    }
    ll tot=0;
    for(i=1;i<=K;i++)
    {
        ll f=ans[i];
        ll r=(i*f)%Mod;
        tot=(tot%Mod+r%Mod)%Mod;
    }
    cout<<tot;

}


Measured memory_bytes: 4416
import sys

def main():
    X,Y=map(int,input().split())
    crane=(Y-2*X)/2
    if crane!=int(crane):
        print("No")
        sys.exit()
    turtle=X-crane
    if crane>=0 and turtle>=0:
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int x, a;
  cin >> x >> a;
  if (x < a)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << 10 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll n,a[200005],ans;
string s1,s2;
map<string,ll> m1,m2;
int main()
{
    //IOS;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        /*
        itoa((a[i]+i),s,10);
        m1[s]++;
        itoa((i-a[i]),s,10);
        m2[s]++;
        */
        s1=to_string((a[i]+i));
        s2=to_string((i-a[i]));
        m1[s1]++;
        m2[s2]++;
        /*
        m1[(string)(a[i]+i)]++;
        m2[(string)(i-a[i])]++;
        */
    }
    for(int i=1;i<=n;i++)
    {
        s1=to_string((a[i]+i));
        s2=to_string((i-a[i]));
        ans+=m2[s1];
    }
    cout<<ans;
    return 0;
}
/*

*/


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

using ll = long long;

constexpr int INF = 1e9;

int main() {
    constexpr int MAX = 1000000;
    ll now = 1;
    vector<ll> v;
    while(now*(now+1)*(now+2)/6 <= MAX) {
        ll t = now*(now+1)*(now+2)/6;
        v.push_back(t);
        now++;
    }
    vector<int> dp1(MAX+1, INF);
    vector<int> dp2(MAX+1, INF);
    dp1[0] = dp2[0] = 0;
    for(auto t : v) {
        for(int i=0; i+t<=MAX; ++i) {
            dp1[i+t] = min(dp1[i+t], dp1[i] + 1);
            if(t & 1) {
                dp2[i+t] = min(dp2[i+t], dp2[i] + 1);
            }
        }
    }
    int n;
    while(cin >> n, n) {
        cout << dp1[n] << ' ' << dp2[n] << endl;
    }
}


Measured memory_bytes: 10644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <sstream>
#include <cstring>
#include <numeric>
#include <ctime>
#include <cassert>
#include <random>
#include <valarray>
//#include <fstream>

#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define y0 y32479
#define y1 y95874
#define next next239
#define prev prev239
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO() {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define in(x) int x; cin >> x;
#define in1(x) int x; cin >> x; x--;
#define inll(x) ll x; cin >> x;
#define ins(x) string x; cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

int main()
{
    int n,k;
    cin>>k>>n;
    vi v(n,0);
    rep(i,n)
        cin>>v[i];

    vector<int> seg;
    rep(i,n-1)
    {
        seg.push_back(v[i+1]-v[i]);
    }
    seg.pb(abs(k+v[0]-v[n-1]));

    int ans=*max_element(seg.begin(),seg.end());

    ans=k-ans;
    cout<<ans<<endl;

}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int N,K;
    cin >> N >> K;
    int A[N+1];
    for(int i=1;i<=N;i++)cin >> A[i];
    for(int i=K+1;i<=N;i++){
        int j=i-K;
        if(A[j]<A[i])cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4328
#include<bits/stdc++.h>
typedef unsigned long long int ll;
#define fastio ios_base::sync_with_stdio(false);
#define rep(i,start,end) for(int i=start;i<end;i++)
using namespace std;


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

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

void show(int *arr , int size){
	rep(i,0,size){
		cout << arr[i] << " ";
	}
	cout << endl;
}

int main(){
	fastio
	int n;
	cin >> n;
	for(int i=1;n<=50000;i++){
		if((int)(i*1.08) == n){
			cout << i << endl;
			return 0;
		}
		if((int)(i*1.08) > n){
			break;
		}
	}
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int a[5];
   int k;
   rep(i,5) cin >> a[i];
   cin >> k;

   bool flg = 0;
   for(int i=0;i<=3;i++){
      for(int j=i+1;j<=4;j++){
         if(a[j]-a[i] > k) flg = 1;
      }
   }

   if(flg) cout << ":(" << endl;
   else cout << "Yay!" << endl;





   return 0;
}

Measured memory_bytes: 256
int main(){
int a,b,i;
char op;
for(; ;){
scanf("%d %c %d", &a, &op, &b);
if(op=='+'){
printf("%d\n", a+b);
}else if(op=='-'){
printf("%d\n", a-b);
}else if(op=='*'){
printf("%d\n", a*b);
}else if(op=='/'){
printf("%d\n", a/b);
}else{
break;
}
}
return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var wab = ReadIntArray();
            int cal = 0;
            int ret = 0;
            if (wab[1] < wab[2])
            {
                cal = wab[2] - (wab[0] + wab[1]);
                ret = cal <= 0 ? 0 : cal;
            }
            else
            {
                cal = wab[1] - (wab[0] + wab[2]);
                ret = cal <= 0 ? 0 : cal;
            }

            Console.WriteLine(ret);
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 13396
N = input()
array_A = list(map(int, input().split()))
array_B = list(map(int, input().split()))
array_C = list(map(int, input().split()))

bonus_position = []
for i in range(len(array_A)-1):
  if array_A[i] + 1 == array_A[i+1]:
    bonus_position += [i]

bonus_dish = []
for i in bonus_position:
    bonus_dish += [array_A[i]]

bonus_point = 0
for i in bonus_dish:
    bonus_point += array_C[i-1]

score = sum(array_B) + bonus_point
print(score)

Measured memory_bytes: 3064
#include <cstdio>
#include <cctype>
#include <utility>
#include <bitset>
#include <cmath>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}

template<int N>
struct sieve {
	bool s[N];
	sieve() : s() {
		s[2] = true;
		for (int i = 3; i < N; i += 2)
			s[i] = true;
		for (int i = 9; i < N; i += 6)
			s[i] = false;
		for (int i = 6, e = sqrt(N); i <= e; i += 6) {
			for (int j : {i - 1, i + 1})
				if (s[j])
					for (int k = j * j; k < N; k += j)
						s[k] = false;
		}
	}
};

int main() {
	sieve<1000001> s;
	bitset<1000001> dp;
	for (int n, x; n = in(), x = in();) {
		dp = 1;
		while (n--)
			for (int i = in(); i <= x; i <<= 1)
				dp |= dp << i;
		int r = [&] {
		for (int i = x; i > 1; i--)
			if (dp[i] && s.s[i])
				return i;
		return 0;}();
		if (r)
			outl(r);
		else
			outl("NA");
	}
}


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

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

int n, a[4] = {0};
double dp[301][301][301];
bool vis[301][301][301] = {0};
double calc(int c1, int c2, int c3){
	if(c1 < 0 || c2 < 0 || c3 < 0)	return 0;
	if(c1+c2+c3 == 0)	return 0;
	if(vis[c1][c2][c3])	return dp[c1][c2][c3];
	vis[c1][c2][c3] = 1;
	double ans = c1*(1+calc(c1-1, c2, c3)) + c2*(1+calc(c1+1, c2-1, c3)) + c3*(1+calc(c1, c2+1, c3-1)) + (n-c1-c2-c3);
	ans /= (c1 + c2 + c3);
	return dp[c1][c2][c3] = ans;
}
int main(){
	cin>>n;	int x;
	for(int i = 0; i < n; i++){ cin>>x; a[x]++; }
	cout<<fixed<<setprecision(50)<<calc(a[1], a[2], a[3]);
}

// Time: O(C1*C2*C3)	Ci => Count of plates with i sushi
// Space: O(C1*C2*C3)

Measured memory_bytes: 125648
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  int M1, D1, M2, D2;
  cin >> M1 >> D1;
  cin >> M2 >> D2;

  if (M1!=M2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

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

int main(){

  int N=0;
  cin>>N;
  
  int A[N];
  int c[8];
  rep(i,8)c[i]=0;
  rep(i,N){
    cin>>A[i];
  }
  int spe=0;
  rep(i,N){

    if(A[i]<400)c[0]=1;
    else if(A[i]<800)c[1]=1;
    else if(A[i]<1200)c[2]=1;
    else if(A[i]<1600)c[3]=1;
    else if(A[i]<2000)c[4]=1;  
    else if(A[i]<2400)c[5]=1;
    else if(A[i]<2800)c[6]=1;
    else if(A[i]<3200)c[7]=1;
    else spe++;
  }
  
  int count=0;
  rep(i,8){
    //cout<<i<<" "<<c[i]<<endl;
    count+=c[i];
  }
  if(count==0){
  
    cout<<1<<" "<<spe<<endl;
    return 0;
    
  }
  
  cout<<count<<" "<<count+spe<<endl;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		string ans = str;
		if(str.Length==3){
			ans = "";
			for(var i=0;i<=2;i++){
				ans += str.Substring(2-i,1);
			}
		}
		Console.WriteLine(ans);
	}
}

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

using i64 = int_fast64_t;
using f64 = double;

void solve() {
    i64 t1, t2;
    cin >> t1 >> t2;
    i64 a1, a2;
    cin >> a1 >> a2;
    i64 b1, b2;
    cin >> b1 >> b2;
    i64 c1 = (a1 - b1) * t1, c2 = (a2 - b2) * t2;

    if (c1 + c2 == 0) {
        cout << "infinity" << endl;
        return;
    }

    if ((c1 ^ (c1 + c2)) >= 0) {
        cout << 0 << endl;
        return;
    }

    i64 r = abs(c1), d = abs(c1 + c2);
    cout << (r / d) * 2 + (r % d != 0) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int main(void)
{
    lin hh,ww,h,w;
    cin >> hh >> ww >> h >> w;
    lin res = (hh-h)*(ww-w);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,m,a,b,i,x=1,y,g[N],val[N],su[N],dad[N];
long long ans=0;
int gfa(int x){return g[x]==x?x:g[x]=gfa(g[x]);}
vector<int>e[N],v={0};
void dfs(int x,int fa,int v){su[x]=val[x]=v;dad[x]=fa;for(int y:e[x])if(y!=fa)dfs(y,x,-v),su[x]+=su[y];}
inline void E(){cout<<"-1\n";exit(0);}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;for(i=1;i<=n;++i)g[i]=i;
	for(i=0;i<m;++i){
		cin>>a>>b;
		if(gfa(a)==gfa(b))x=a,y=b;else e[a].push_back(b),e[b].push_back(a),g[gfa(a)]=gfa(b);
	}
	dfs(x,0,1);
	if(y && val[y]==1){
		if(su[x]&1)E();
		for(ans=abs(a=su[x]>>1),i=y;i;i=dad[i])su[i]-=a;su[x]=0;
	}else if(su[x])E();
	for(i=1;i<=n;++i)ans+=abs(su[i]);
	if(y && val[y]==-1){
		for(;y!=x;y=dad[y])v.push_back(su[y]),ans-=abs(su[y]);
		nth_element(v.begin(),v.begin()+v.size()/2,v.end());
		a=v[v.size()>>1];for(int u:v)ans+=abs(u-a);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15740
import java.util.Scanner;

//The Number of Area
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10001];
		a[0] = 1;
		for(int i=1;i<10001;i++)a[i]=a[i-1]+i;
		while(sc.hasNext())System.out.println(a[sc.nextInt()]);
	}
}

Measured memory_bytes: 12000
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[] c = sc.next().toCharArray();
        int ans = 0;
        int r = N-1;
        for (int i = 0; i < N-1; i++) {
            if (c[i] != 'W') continue;
            for (; r > i; r--) {
                if (c[r] != 'R') continue;
                ans++;
                r--;
                break;
            }
        }
        System.out.println(ans);
    }
    
}


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

#ifdef SG
	#include <debug.h>
#else
	template<typename T> struct outputer;
	struct outputable {};
	#define PRINT(...)
	#define OUTPUT(...)
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
	#define fbegin(...)
	#define fend
	#define pbegin(...)
	#define pend
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb emplace_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef int64_t ll;
typedef uint64_t ull;
typedef uint32_t ui;
typedef uint16_t us;
typedef uint8_t uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 100000;

struct Input {
	int n;
	int a[N];
	int b[N];
	
	bool read () {
		if (!(cin >> n)) {
			return 0;
		}
		forn (i, n) {
			scanf("%d", &a[i]);
		}
		forn (i, n) {
			scanf("%d", &b[i]);
		}
		return 1;
	}

	void init (const Input &input) {
		*this = input;
	}
};

struct Data: Input {
	int ans;
	
	void write () {
		cout << ans << endl;
	}
};


namespace Main {
	
	struct Solution: Data {
		int xa, xb;
		map<int, int> cnta, cntb;
		
		map<int, vi> e;
		map<int, bool> u;
		
		void dfs (int v) {
			if (u[v]) {
				return;
			}
			u[v] = 1;
			for (int to : e[v]) {
				dfs(to);
			}
		}
		
		void solve () {
			xa = 0;
			xb = 0;
			ans = 0;
			forn (i, n) {
				cnta[a[i]]++;
				cntb[b[i]]++;
				xa ^= a[i];
				xb ^= b[i];
				if (a[i] != b[i]) {
					e[a[i]].pb(b[i]);
					ans++;
				}
			}
			cnta[xa]++;
			cntb[xb]++;
			if (xa != xb) {
				e[xa].pb(xb);
			}
			
			if (cnta != cntb) {
				ans = -1;
				return;
			}
			
			debug(ans);
			debug(e);
			
			dfs(xa);
			
			forn (i, n) {
				if (sz(e[a[i]]) && !u[a[i]]) {
					++ans;
					dfs(a[i]);
				}
			}
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);

	#ifdef SG
		freopen((problemname + ".in").c_str(), "r", stdin);
//		freopen((problemname + ".out").c_str(), "w", stdout);
		while (sol.read()) {
			sol.solve();
			sol.write();
			sol.clear();
		}
	#else
		sol.read();
		sol.solve();
		sol.write();
	#endif
	
	/*
	int t;
	cin >> t;
	forn (i, t) {
		sol.read();
		sol.solve();
		sol.write();
		sol.clear();
	}
	*/
	
	return 0;
}


Measured memory_bytes: 29824
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());
        int K = Integer.parseInt(scanner.next());

        List<Integer> dislikeList = IntStream.range(0, K)
                .map(v -> Integer.parseInt(scanner.next()))
                .boxed()
                .collect(Collectors.toList());

        scanner.close();

        // n 以上の整数
        for (int i = N; i < 100000; i++) {
            boolean isCompleted = true;
            String tmp = String.valueOf(i);

            for (int j = 0; j < tmp.length(); j++) {
                int d = Integer.parseInt(String.valueOf(tmp.charAt(j)));
                if (dislikeList.contains(d)) {
                    isCompleted = false;
                    break;
                }
            }

            if (isCompleted) {
                System.out.println(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 34892
fun main(args: Array<String>) {
    val (n, m, k) = readIntegerList()
    val friendOrBlock = Array(n) { hashSetOf<Int>() }
    val unionFind = UnionFind(n)
    repeat(m) {
        val (a, b) = readIntegerList().map { it - 1 }
        friendOrBlock[a].add(b)
        friendOrBlock[b].add(a)
        unionFind.unite(a, b)
    }

    repeat(k) {
        val (a, b) = readIntegerList().map { it - 1 }
        if (unionFind.sameRoot(a, b)) {
            friendOrBlock[a].add(b)
            friendOrBlock[b].add(a)
        }
    }

    val ans = IntArray(n)
    repeat(n) {
        ans[it] = unionFind.getSize(it) - 1 - friendOrBlock[it].filter { true }.size
    }
    println(ans.joinToString(" "))
}

/**　Union find 0 ~ (n - 1)　*/
class UnionFind(n: Int) {
    val parent = IntArray(n) { -1 }

    /** O(α(n)) */
    fun rootOf(x: Int): Int {
        if (parent[x] < 0) return x

        parent[x] = rootOf(parent[x])
        return parent[x]
    }

    /** O(α(n)) */
    fun sameRoot(x: Int, y: Int) = rootOf(x) == rootOf(y)

    /** O(α(n)) */
    fun unite(x: Int, y: Int): Boolean {
        var x = rootOf(x)
        var y = rootOf(y)
        if (x == y) return false
        if (parent[x] > parent[y]) {
            val tmp = x
            x = y
            y = tmp
        }
        parent[x] += parent[y]
        parent[y] = x
        return true
    }

    /** O(α(n)) */
    fun getSize(x: Int) = -parent[rootOf(x)]
};




fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 138340
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner scan=new Scanner(System.in);
long a=scan.nextLong();
long b=scan.nextLong();
long i=0;
long s=0;
if(2*a>=b) {i=b/2;}
else if(2*a<b) {i=a;s=b-2*a;i+=s/4;}
System.out.println(i);
}
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;
 
int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = n / 2;
    for (int i = 0; i < 26; ++i) {
        int ma = 0, c = 0;
        for (int j = 0; j < n; ++j) {
            if (s[j] == i + 'a') {
                ma = max(ma, c);
                c = 0;
            }
            else ++c;
        }
        ma = max(ma, c);
        ans = min(ans, ma);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    string s;
    cin>>s;
    ll ans=0;
    ll sum=0;
    for(auto &i:s){
        if(i=='R'){sum++;}
        else{sum--;}
        if(sum==4){ans++;}
        sum%=4;
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 3204
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int C[30];

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

  for(int i=0;i<(int)w.size();i++){
    C[w[i]-'a']++;
  }
  for(int i=0;i<30;i++){
    if(C[i]%2){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll  long long
#define ull unsigned long long  
using namespace std;
#define  inf 1e18+18
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#define  f1(i,n) for(i=1;i<=n;i++)
#define f0(i,n)  for(i=0;i<n;i++)
#define w(x)   while(x--)
const int maxn=1000001;
#define  pq priority_queue
#define  ff first
#define  ss second 
#define pb  push_back
#define lb lower_bound
int db(int n)
{
    int i=0;
    int j=0;
    while(n>0)
    {
        int r=n%10;
        n=n/10;
        j+=(1<<i)*r;
        i++;
    }
    return j;
}
ll a[maxn];
int main()
{
   
    
   
  ll int n,i,j,l;
   cin>>n;
  for(i=1;i<maxn;i++)
  {
    for(j=i;j<maxn;j+=i)
        a[j]++;
  }
  j=0;
  for(i=1;i<n;i++)
  {
    l=n-i;
    l=a[l];
    j=j+l;

  }
  cout<<j;
  

}

Measured memory_bytes: 11460
#include<bits/stdc++.h>
    using namespace std;
int main(){
    int n,l=0;
string a;
cin>>n>>a;
for(int i=0;i<a.size();i++){
    if(a[i]=='A'){
        if(a[i+1]=='B'){
            if(a[i+2]=='C')l++;
        }
    }
}
cout<<l<<endl;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  string s,hands;
  cin>>s;
  int n_p=0,n_g=0,ans=0;
  for(int i=0;i<s.size();++i){
    if(s[i]=='g'){
      if(n_p+1<=n_g){
        hands+="p";
        ++n_p;
        ans+=1;
      }else{
        hands+="g";
        ++n_g;
        ans+=0;
      }
    }else{
      if(n_p+1<=n_g){
        hands+="p";
        ++n_p;
        ans+=0;
      }else{
        hands+="g";
        ++n_g;
        ans+=-1;
      }
    }
  }
  // cout<<hands<<endl;
  cout<<ans<<endl;
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }

    string s;
    cin >> s;
    cout << (s.substr(0, n / 2) + s.substr(0, n / 2) == s ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double W,H,w,h,x,y;
    cin>>W>>H>>w>>h>>x>>y;
    printf("%.10f\n",(y-h/2 + min(y+h/2, H/2)) / (x-w/2 + min(x+w/2, W/2)));
    return 0;
}



Measured memory_bytes: 3284
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct{
	int sc;
	int tm;
	int nm;
}status;

int cmp(const void *a, const void *b){
	status *ta = (status *)a;
	status *tb = (status *)b;
	if(ta->sc > tb->sc){
		return -1;
	}
	else if(ta->sc < tb->sc){
		return 1;
	}
	else{
		if(ta->tm < tb->tm){
			return -1;
		}
		else if(ta->tm > tb->tm){
			return 1;
		}
		else{
			if(ta->nm > tb->nm){
				return -1;
			}
			else{
				return 1;
			}
		}
	}
}


int main(void){
	int m, t, p, r, i, j, tn, sm, pn, pena[50][10], sc[50][10];
	status s[50];
	while(1){
		scanf("%d%d%d%d",&m,&t,&p,&r);
		if(m + t + p + r == 0){
			break;
		}
		for(i = 0;i < t;i++){
			s[i].sc = 0, s[i].tm = 0, s[i].nm = i + 1;
		}
		memset(pena,0,sizeof(pena));
		memset(sc,0,sizeof(sc));
		for(i = 0;i < r;i++){
			scanf("%d%d%d%d",&sm,&tn,&pn,&j);
			if(!j){ // 正解のとき
				s[tn - 1].sc++;
				s[tn - 1].tm += sm;
				sc[tn - 1][pn - 1] = 1;
			}
			else{
				pena[tn - 1][pn - 1]++;
			}
		}
		for(i = 0;i < t;i++){
			for(j = 0;j < p;j++){
				if(sc[i][j]){
					s[i].tm += 20 * pena[i][j];
				}
			}
		}
		qsort(s,t,sizeof(s[0]),cmp);
		printf("%d",s[0].nm);
		for(i = 1;i < t;i++){
			if(s[i - 1].sc == s[i].sc && s[i - 1].tm == s[i].tm)
				printf("=");
			else
				printf(",");
			printf("%d",s[i].nm);
		}
		printf("\n");
/*		printf("-----------\n");
		for(i = 0;i < t;i++){
			printf("%d %d %d\n",s[i].sc,s[i].tm,s[i].nm);
		}
		printf("-----------\n");*/
	}
	return 0;
}

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

bool check[101][101]={false};
int h,w;
char mas[101][101]={0};
pair<int, int> func(){
	/*for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				cout << mas[i][j];
			}
			cout << endl;
		}*/
	for(int i=0; i<h;){
		for(int j=0; j<w;){
			if(check[i][j]==true) return make_pair(-1,-1);
			check[i][j]=true;
			//cout << i << " " << j << endl;
			if(mas[i][j]=='>') j++;
			if(mas[i][j]=='<') j--;
			if(mas[i][j]=='v') i++;
			if(mas[i][j]=='^') i--;
			if(mas[i][j]=='.') return make_pair(i,j);
		}
	}
}

int main(){
	
	
	
	while(1){
		cin >> h >> w;
		if(h==0 && w==0) break;
		for(int i=0; i<h; i++){
			scanf("%s",&mas[i]);
		}
		
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				check[i][j]=false;
			}
		}
		pair<int, int> a=func();
		if(a.first==-1) cout << "LOOP" << endl;
		else cout << a.second << " " << a.first << endl;
	}
	return 0;
}

Measured memory_bytes: 3172
#include<stdio.h>
int data[9];
void sort(){
	int i,j,t;
	for(i=0;i<8;i++){
		for(j=i;j<8;j++){
			if(data[i]>data[j]){
				t=data[i];
				data[i]=data[j];
				data[j]=t;
			}
		}
	}
}
int main(){
	int n,i,j,ten=1;
	char str[10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		int max=0,min=0;
		ten=1;
		scanf("%s",str);
		for(j=0;j<8;j++){
			data[j]=str[j]-'0';
		}
		sort();

		for(j=0;j<8;j++){
			max+=ten*data[j];
			ten*=10;
		}
		ten=1;
		for(j=7;j>=0;j--){
			min+=ten*data[j];
			ten*=10;
		}
		printf("%d\n",max-min);
	}
	return 0;
}

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

cnt = 0
next = A[0]

for i in range(N) :
    buf = B[i] - next
    if buf <= 0 :
        cnt += B[i]
        next = A[i+1]
        continue
    cnt += next
    buf2 = buf - A[i+1]
    if buf2 <= 0 :
        cnt += buf
        next = A[i+1] - buf
        continue
    else :
        cnt += A[i+1]
        next = 0

print(cnt)


Measured memory_bytes: 18476
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
constexpr int K = 50;
using namespace std;

char t[100][100];

void solve() {
  int A, B;
  cin >> A >> B;

  fill(&t[0][0], &t[50][0], '.');
  A--;
  fill(&t[50][0], &t[100][100], '#');
  B--;

  for (int i = 0; i < K - 1 && B > 0; i += 2) {
    for (int p = 0; p < K * 2 && B > 0; p += 2) {
      t[i][p] = '#';
      B--;
    }
  }

  for (int i = 99; i >= K && A > 0; i -= 2) {
    for (int p = 0; p < K * 2 && A > 0; p += 2) {
      t[i][p] = '.';
      A--;
    }
  }

  printf("100 100\n");
  for (int i = 0; i < 100; i++) {
    for (int p = 0; p < 100; p++) {
      printf("%c", t[i][p]);
    }
    printf("\n");
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256