akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using P = pair<int, int>;

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

ll func(ll a, ll b) {
  return pow(a, 4) + pow(a, 3) * b + pow(a, 2) * pow(b, 2) + a * pow(b, 3) + pow(b, 4);
}

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

  ll x;
  cin >> x;
  // for (const auto d : divisor(x)) {
  //   for (ll b = - d / 2; b < 1000000000; ++b) {
  //     ll a = b + d;
  //     ll v = func(a, b) * d;
  //     if (v > x) break;
  //     if (v == x ) {
  //       cout << a << " " << b << endl;
  //       return 0;
  //     }
  //   }
  //   for (ll b = - d / 2; b > -1000000000; --b) {
  //     ll a = b + d;
  //     ll v = func(a, b) * d;
  //     if (v > x) break;
  //     if (v == x ) {
  //       cout << a << " " << b << endl;
  //       return 0;
  //     }
  //   }

  // }

  for (const auto d : divisor(x)) {
    ll start = - d / 2;
    const ll upper = 10000;
    const ll lower = -upper;

    ll left = start;
    ll right = upper;

    while(right - left > 1) {
      // cout << d << ", " << left << ", " << right << endl;
      ll m = (left + right) / 2;
      if (func(m + d, m) * d > x) left = m;
      else right = m;
    }
    if (func(left + d, left) * d == x) {
        cout << left + d << " " << left << endl;
        return 0;
    }

    left = lower;
    right = start;

    while(right - left > 1) {
      // cout << d << ", " << left << ", " << right << endl;
      ll m = (left + right) / 2;
      if (func(m + d, m) * d < x) right = m;
      else left = m;
    }
    if (func(left + d, left) * d == x) {
        cout << left + d << " " << left << endl;
        return 0;
    }
  }


}

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

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

	Y /= 1000;
	int x = -1, y = -1, z = -1;
	rep(i, 0, N + 1) {
		rep(j, 0, N + 1) {
			int k = Y - (i * 10 + j * 5);
			if (k < 0) continue;
			if (k == N - i - j) {
				x = i;
				y = j;
				z = N - x - y;
				break;
			}
		}
	}
	cout << x << " " << y << " " << z << endl;

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define re register
using namespace std;
struct ios{
	template <typename ty> inline ios& operator >> (ty &x)
	{
		register int f=1;x=0;register char c=getchar();
		for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
		for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
		x*=f;return *this;
	}
	template <typename ty>  inline ios& operator << (ty x)
	{
		if(x<0) x=-x,putchar('-');
		if(x>9) *this << x/10;
		putchar(x%10+48);
		return *this;
	}
	inline ios& operator << (char c){putchar(c);return *this;}
}io;
int a[200000],b,c,n;
int main()
{
	io >> n;
	int maxx = -1;
	for(int i=1;i<=n;i++)
	{
		io >> a[i];
	}
	maxx = a[1];
	for(int i=1;i<=n;i++)
	{
		maxx = max(maxx,a[i]-1);
		if(a[i] < maxx) 
		{
			puts("No");
			return 0;
		}		
	}

	puts("Yes");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n; cin>>n;
    vector <int> x(n);
    vector <int> t(n);
    for(int i=0;i<n;i++){
        cin>>x[i];
        t[i]=x[i];
    }
    sort(x.begin(),x.end());
    int m1=x[n/2-1], m2=x[n/2];
    for(int i=0;i<n;i++){
        if(t[i]<=m1 ) cout<<m2<<endl;
        else cout<<m1<<endl;
    }
}

Measured memory_bytes: 3712
a,b,c = [],[],[]
n,m,l = map(int,input().split())

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

for i in range(n):
    x = []
    for i2 in range(l):
        y = 0
        for i3 in range(m):
            y += a[i][i3]*b[i3][i2]
        x .append(y)
    print(' '.join(map(str,x)))


Measured memory_bytes: 6308
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    rep(i, n-1){
        if (c*(n-1-i) - d*i <= b-a && b-a <= -c*i + d*(n-1-i)){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3616
import java.math.BigDecimal;
import java.util.PriorityQueue;
import java.util.Scanner;

class Stuff implements Comparable<Stuff> {
    int v;
    int w;
    double performance;

    Stuff(int v, int w) {
        this.v = v;
        this.w = w;
        performance = 1.0 * v / w;
    }

    public int compareTo(Stuff s) {
        if(performance < s.performance) return 1;
        if(performance > s.performance) return -1;
        return 0;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int w = sc.nextInt();
        PriorityQueue<Stuff> que = new PriorityQueue<>();
        for(int i = 0; i < n; i++) {
            int vi = sc.nextInt();
            int wi = sc.nextInt();
            que.add(new Stuff(vi, wi));
        }

        double res = 0;
        while(w > 0 && !que.isEmpty()) {
            Stuff s = que.poll();
            if(w >= s.w) {
                res += s.v;
                w -= s.w;
            }else {
                res += s.performance * w;
                w = 0;
            }
        }

        System.out.println(BigDecimal.valueOf(res).toPlainString());
 
        sc.close();
    }
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a, b, c; cin >> a >> b >> c;
    cout << (a+b+c >= 22 ? "bust" : "win") << '\n';
}



Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	while (cin >> N, N) {
		int M;
		cin >> M;
		vector<vector<int> > results(N, vector<int>(N, -1));
		for (int i = 0; i < M; ++i) {
			int x, y;
			cin >> x >> y; --x, --y;
			results[x][y] = 1;
			results[y][x] = 0;
		}
		vector<pair<int, int> > allpair;
		for (int i = 0; i < N; ++i) {
			for (int j = i + 1; j < N; ++j) {
				allpair.push_back(make_pair(i, j));
			}
		}
		int S = allpair.size(), LS = S / 2, RS = S - LS;
		vector<vector<int> > winL(1 << LS, vector<int>(N));
		vector<vector<int> > winR(1 << RS, vector<int>(N));
		for (int i = 0; i < 1 << LS; ++i) {
			bool ok = true;
			for (int j = 0; j < LS; ++j) {
				if ((i >> j) & 1) {
					if (results[allpair[j].first][allpair[j].second] != 0) ++winL[i][allpair[j].first];
					else ok = false;
				}
				else {
					if (results[allpair[j].first][allpair[j].second] != 1) ++winL[i][allpair[j].second];
					else ok = false;
				}
			}
			if (!ok) winL[i] = vector<int>(N, -1);
		}
		for (int i = 0; i < 1 << RS; ++i) {
			bool ok = true;
			for (int j = 0; j < RS; ++j) {
				if ((i >> j) & 1) {
					if (results[allpair[j + LS].first][allpair[j + LS].second] != 0) ++winR[i][allpair[j + LS].first];
					else ok = false;
				}
				else {
					if (results[allpair[j + LS].first][allpair[j + LS].second] != 1) ++winR[i][allpair[j + LS].second];
					else ok = false;
				}
			}
			if (!ok) winR[i] = vector<int>(N, -1);
		}
		sort(winR.begin(), winR.end());
		int ans = 0;
		for (vector<int> v : winL) {
			vector<int> tar(N);
			for (int i = 0; i < N; ++i) tar[i] = (N - 1) / 2 - v[i];
			ans += upper_bound(winR.begin(), winR.end(), tar) - lower_bound(winR.begin(), winR.end(), tar);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 39800
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int sum1 = 0;
        int sum2 = 0;

        for (int i = 0; i < a; i++) {
            String b = sc.next();
            String c = sc.next();
            if (b.compareTo(c) > 0)
                sum1 += 3;
            else if (b.compareTo(c) < 0)
                sum2 += 3;
            else {
                sum1 += 1;
                sum2 += 1;
            }
        }
        System.out.println(sum1 + " " + sum2);
    }
}



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

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

    int count4 = 0;
    int count2 = 0;
    int count1 = 0;
    int in;
    for (int i = 0; i < n; i++) {
        cin >> in;
        if (in % 4 == 0) {
            count4++;
        } else if (in % 2 == 0) {
            count2++;
        } else {
            count1++;
        }
    }

    string ans = "No";
    if (count2 == 0) {
        if (count4 >= count1 - 1) {
            ans = "Yes";
        }
    } else {
        if (count4 >= count1) {
            ans = "Yes";
        }
    }

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

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

typedef long long ll;

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

    int a[3];
    for(int i=0;i<3;i++) cin >> a[i];
    cout << a[2] << ' ' << a[0] << ' ' << a[1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

long long int sum(string s){
	long long res=stoll(s);
	for(int i=1;i<s.size();i++){
		auto a=s.substr(0,i);
		res += stoi(a)*pow(2,s.size()-i-1);
		auto b =s.substr(i,s.size()-1);
		res += sum(b);
	}
	return res;
}

int main(){
	string s; cin >> s;
	ll ans=0;
	cout << sum(s) << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
x = list(map(int, input().split()))

l = int(1e9)
idx = 0
for i in range(n-k+1):
    if x[i] < 0 and x[i+k-1] > 0:
        lx = x[i+k-1] - x[i] + min(abs(x[i]), x[i+k-1])
    else:
        lx = max(abs(x[i]), x[i+k-1])
    if l >= lx:
        l = lx
        idx = i

print(l)
    

Measured memory_bytes: 14380
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

double Dist(double X1, double Y1, double X2, double Y2){
  double ans = (X1 - X2) * (X1 - X2);
  ans += (Y1 - Y2) * (Y1 - Y2);
  ans = sqrt(ans);
  return ans;
}

int main(){
  double Xs, Ys, Xt, Yt;
  cin >> Xs >> Ys >> Xt >> Yt;

  int N; cin >> N;
  double X[N + 2], Y[N + 2], R[N + 2];
  X[0] = Xs; Y[0] = Ys; R[0] = 0;
  for (int i = 1; i <= N; i++){
    cin >> X[i] >> Y[i] >> R[i];
  }
  X[N + 1] = Xt; Y[N + 1] = Yt; R[N + 1] = 0;

  vector < pair<double, int> > Graph[N + 2];
  for (int i = 0; i < N + 2; i++){
    for (int j = 0; j < N + 2; j++){
      double dist = Dist(X[i], Y[i], X[j], Y[j]);
      dist -= R[i] + R[j];
      if (dist < 0) dist = 0;
      Graph[i].push_back(make_pair(dist, j));
      Graph[j].push_back(make_pair(dist, i));
    }
  }

  vector <double> ans(N + 2);
  vector <bool> visited(N + 2);

  priority_queue <pair<double, int>, vector<pair<double, int> >, greater<pair<double, int> > > que;
  que.push(make_pair(0, 0));

  while (!que.empty()){
    pair <double, int> P = que.top(); que.pop();
    double D = P.first;
    int now = P.second;

    if (visited[now] == true) continue;

    visited[now] = true;
    ans[now] = D;

    for (int i = 0; i < Graph[now].size(); i++){
      int next = Graph[now][i].second;
      double deg = Graph[now][i].first;
      if (visited[next] == true) continue;      

      que.push(make_pair(D + deg, next)); 
    }
  }
  
  cout << setprecision(32) << ans[N + 1] << endl;

  return 0;
}


Measured memory_bytes: 50860
#include <iostream>

int main(void){
	int a[]={1,3,5,7,8,10,12,4,6,9,11,2};
	int x,y;
	std::cin >> x >> y;
	int i;
	for(i=0;i<12;i++){
		if(a[i]==x && i<7)x=-1;
		else if(a[i]==x && i<11)x=-2;
		else if(a[i]==x && i==11)x=-3;
	}
	for(i=0;i<12;i++){
		if(a[i]==y && i<7)y=-1;
		else if(a[i]==y && i<11)y=-2;
		else if(a[i]==y && i==11)y=-3;
	}
	if(x==y)std::cout << "Yes";
	else std::cout <<"No";
}

Measured memory_bytes: 256
S = input()
T = input()

if S == T:
    print('Yes')
else:
    l = len(S)
    L = list(S)
    for i in range(l):
        a = L[0]
        del L[0]
        L.append(a)
        s = ''.join(L)
        if s == T:
            print('Yes')
            break
    else:
        print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long K, N;
    cin >> K >> N;
    long long a[N];
    for(int i = 0; i < N; i++) cin >> a[i];
    long long d[N];
    for(int i = 0; i < N; i++){
        if(i != N - 1) d[i] = a[i + 1] - a[i];
        else d[i] = K + a[0] - a[i];
    }
    sort(d, d + N);
    long long ans = 0;
    for(int i = 0; i < N - 1; i++) ans += d[i];
    cout << ans << endl;
}

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

int main() {
  int H,W;
  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0)
      break;
    for(int i=1; i<=H; i++){
      for(int j = 1; j <= W; j++){
        if(i == 1 || i == H){
          cout << "#";
        }
        else{
          if(j == 1 || j == W){
            cout << "#";
          }
          else{
            cout << ".";
          }
        }
      }
    cout << endl;
    }
    cout << endl;
  }
}



Measured memory_bytes: 3080
// JAI SHREE RAM
#pragma GCC optimize("O3")
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define loop for(int i=0;i<n;i++)
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max3(a,max(b,c),d)
#define max5(a,b,c,d,e) max4(a,max(b,c),d,e)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min3(a,min(b,c),d)
#define min5(a,b,c,d,e) min4(a,min(b,c),d,e)
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
// #define all(a) (a).begin(),(a).end()
#define vec vector<int>
#define M_PI           3.14159265358979323846  /* pi */
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;

int main() 
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int n, m,x;
	cin >> n >> m;
	int height[n];

	rep(i, n)
	cin >> height[i];

	std::vector<int> g[n];

	rep(i, m)
	{
		int u, v;
		cin >> u >> v;u--,v--;
		g[u].pb(v);
		g[v].pb(u);
	}
	int res = 0;
	rep(i, n)
	{
		bool ca = true;
		if(!g[i].empty())
		for (int j = 0; j < g[i].size(); j++)
		{
			if (height[g[i][j]] >= height[i])
			{
			//	cout<<i<<endl;
				ca = false;
				break;
			}

		}
	//	cout << ca << endl;
		if (ca == true)
			res++;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
typedef long long ll;

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

    int a,b;
  	cin >> a >> b;
  	if(a<=9 && a>=1 && b>=1 && b<=9){
    	cout << a*b;
    }
  	else
      	cout << -1;
}

Measured memory_bytes: 256
#include<iostream>

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int a[n][m], b[m], c, i, j;
	
	// input
	rep(i,n) {
		rep(j,m) {
			cin >> a[i][j];
		}
	}
	rep(i,m) {
		cin >> b[i];
	}
	rep(i,n) {
		c = 0;
		rep(j,m) c += b[j] * a[i][j];
		cout << c;
		if (i < n-1) cout << "\n"; 
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1200
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func main() {
  var n int 
  var s string
  fmt.Scan(&n, &s)
  l := make([]int, n); l[0] |= 1 << uint(s[0] - 'a')
  r := make([]int, n); r[n-1] |= 1 << uint(s[n-1] - 'a')
  for i := 0; i < n - 1; i++ {
    l[i+1] = l[i] | (1 << uint(s[i+1] - 'a'))
  }
  for i := n - 1; i > 0; i-- {
    r[i-1] = r[i] | (1 << uint(s[i-1] - 'a'))
  }

  ans := 0
  for i := 0; i < n - 1; i++ {
    res := l[i] & r[i+1]
    cnt := 0
    for j := uint(0); j < 26; j++ {
      if res >> j & 1 == 1 {
        cnt++
      }
    }
    ans = maxInt(ans, cnt)
  }
  fmt.Println(ans)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    int left = A+B;
    int right = C+D;
    if (left == right) {
        cout << "Balanced" << endl;
    }else if (left > right) {
        cout << "Left" << endl;
    }else{
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
#include<math.h>
#include<set>
#include<string>
#include<vector>
using namespace std;

#define int long long

void fastio()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int32_t main()
{
  fastio();
  int n , m;
  cin >> n >> m;
  int a[m];
  int s = 0;
  for (int i = 0; i < m; ++i)
  {
    cin >> a[i];
    s = s + a[i];
  }
  if (s > n)
    cout << -1;
  else
  {
    cout << n - s;
  }
  return 0;
}


Measured memory_bytes: 3236
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(){
    long long int n;
    scanf("%lld",&n);
    long long int a[n],i;
    long long int sum=0;
    long long int sigma=(n*(n+1))/2;
    for(i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    if(sum%sigma!=0)printf("NO");
    else{
        while(a[1]>=1){
            long long int min=a[1],minnum=1;
            for(i=2;i<=n;i++){
                if(a[i]<min){
                    min=a[i];
                    minnum=i;
                }
            }
            for(i=1;i<=minnum-1;i++)a[i]-=n-minnum+1+i;
            for(i=minnum;i<=n;i++)a[i]-=i-minnum+1;
        }
        int flag=0;
        for(i=1;i<=n;i++)if(a[i]!=0)flag=1;
        if(flag==0)printf("YES");
        else printf("NO");
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> C(n-1), S(n-1), F(n-1);
    rep(i, n-1) cin >> C[i] >> S[i] >> F[i];

    rep(s, n-1) {
        int t = S[s];
        for (int i = s; i < n - 1; i++) {
            t = S[i] + max(0, (t - S[i] + F[i] - 1) / F[i] * F[i]);
            t = t + C[i];
        }
        put(t);
    }

    put(0);

    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  bool flag = true;
  for(int i = 0; i < S.size() - 1; i++) {
    char f = S[i];
    for(int j = i + 1; j < S.size(); j++) {
      if(f == S[j]) {
        flag = false;
        break;
      }
    }
  }
  if(flag) {
    cout << "yes" << endl;
  } else {
    cout << "no" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,c=1;
    scanf("%d",&n);
    char s[n-1];
    for (int i = 0 ;i<=n;i++){
    scanf("%c",&s[i]);
    if(i!=0&&i!=1){
    if (s[i]!=s[i-1]){
        c++;
    }
    }
    }
printf("%d",c);
return 0;
}

Measured memory_bytes: 256
from fractions import gcd

n = int(raw_input())
a = list(map(int, raw_input().split()))
p = list(a)
s = list(a)
for i in range(1, n):
    p[i] = gcd(p[i - 1], p[i])
for i in range(n - 2, -1, -1):
    s[i] = gcd(s[i], s[i + 1])

ans = max(p[-2], s[1])
if n > 2:
    ans = max(ans, max(gcd(p[i - 1], s[i + 1]) for i in range(1, n - 1)))

print(ans)


Measured memory_bytes: 12784
#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>
#include <algorithm>
using namespace std;

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

    int N;
    cin >> N;

    unordered_map<string, int> frequency;
    int max_count = 1;
    for (int i = 0; i < N; ++i) {
        string word;
        cin >> word;

        if (frequency.count(word)) {
            int count = frequency[word] + 1;
            frequency[word] = count;
            max_count = (count > max_count)? count : max_count;
        }

        frequency.insert({word, 1});
    }

    vector<string> to_print;
    for (auto val : frequency) {
        if (val.second == max_count) to_print.push_back(val.first);
    }

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

    cout << to_print[0];
    for (size_t i = 1; i < to_print.size(); ++i) {
        cout << '\n' << to_print[i];
    }
 
    return 0;
}

/*
file=c
g++ -W -Wall -pedantic --std=c++17 -ggdb3 -o ${file}.out ${file}.cpp && ./${file}.out

*/


Measured memory_bytes: 25284
input_lines = readlines.map(&:chomp)
N = input_lines.shift
AN = input_lines.shift.split(' ').map(&:to_i)
LIMIT = 10 ** 18 

is_zero = AN.index {|ai| ai == 0 }

if is_zero
  puts 0
else
	m = 1
	AN.each do |ai|
	  m *= ai
	  #puts "m=#{m}"
	  if m > LIMIT 
	  	m = -1
	  	break 
	  end
	end
	puts m
end

Measured memory_bytes: 21764
#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 X;
    cin >> X;
    int happy1000 = X/500 * 1000;
    int happy5 = ((X % 500) / 5) * 5;

    cout << happy1000 + happy5 << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <vector>
# include <algorithm>
# include <string>
# include <set>
# include <map>
# include <bitset>
# include <queue>
# include <iomanip>
# include <string>

# define FILE
# define x first
# define y second
using namespace std;



int main()
{
    # ifdef FILEs
        freopen( "travel.in", "r", stdin );
        freopen( "travel.out", "w", stdout );
    # endif // FILE

    # ifdef FILEs
        freopen( "input.txt", "r", stdin );
        freopen( "output.txt", "w", stdout );
    # endif // FILE
    ios_base::sync_with_stdio( false );
    int a, b;
    cin >> a >> b;
    cout << max( 0, a-2*b);






    # ifdef FILEs
        cout << endl << "------------------------";
        cout << endl << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s. |";
        cout << endl << "------------------------";
    # endif
    return 0;
}




Measured memory_bytes: 256
nmx = list(map(int, input().split()))
toll = list(map(int, input().split()))
s = 0
lng = len(toll)
for i in range(lng):
    if toll[i] < nmx[2]:
        s = s + 1
    else:
        break

if s < nmx[1] - s:
    print(s)
else:
    print(nmx[1] - s)

Measured memory_bytes: 3060
import bisect
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []
for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break
for i in range(Q):
    l, r = (int(i) for i in input().split())
    left = bisect.bisect_left(onon,l)
    right = bisect.bisect_left(onon,r)
    print(right - left)

Measured memory_bytes: 6596
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int w=0,e=0,ss=0,n=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='W')w=1;
		else if(s[i]=='E')e=1;
		else if(s[i]=='S')ss=1;
		else if(s[i]=='N')n=1;
	}
	if(w==e&&n==ss)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
 }  

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int x,res,y;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>x;
	for(y=x;y;res+=y%10,y/=10);
	cout<<(x%res==0?"Yes":"No")<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    long num,i,j=0,count=0;
    long a[1000000];
    while(scanf("%ld",&num) != EOF){
        for(i = 0 ; i < 1000000 ; ++i){
            a[i]=1;
        }
        for(i = 2 ; i <= num ; i++){
            if(a[i] != 0){
                    count++;
                    a[i]=count;
                    for(j = i + i ; j <= num ; j += i){
                        a[j]=0;
                    }
                
            }
        }
        if(num == 1){
            printf("0\n");
        } else {
            for(i = num ; a[i] == 0 ; i--){}
            printf("%ld\n",a[i]);
        }
        count=0;
    }
    return 0;
}

Measured memory_bytes: 8420
s = input()
a = 0
b = 0
for i in range(len(s)):
    if i%2 == 0:
        a += 2**i
    else:
        b += 2**i
s = int(s, 2)
print(min(bin(a^s).count('1'), bin(b^s).count('1')))


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

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

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

ll lcm(ll x, ll y){
    ll g = gcd(x,y);
    return x*y/g;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll  n, m;
    cin >> n >> m;
    lvec a(n), aa;
    for (ll i = 0; i < n; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());
    aa.push_back(a[0]/2);
    for (ll i = 1; i < n; i++){
        if(a[i] == a[i-1]) continue;
        aa.push_back(a[i]/2);
    }
    ll lc=1;
    for (ll &x : aa ) {
        lc = lcm(max(lc,x), min(lc,x));
        if ((lc/x)%2 == 0){
            cout << 0 << endl;
            return 0;
        } 
        if ((lc/aa[0])%2==0){
            cout << 0 << endl;
            return 0;
        }
    }
    
    cout << ((m/lc) - 1)/2 + !(lc > m) << endl;
    
    //cout << ((2*m/g)/(mm)-1)/2 + !(mm > 2*m/g) << endl;
    
}

Measured memory_bytes: 1024
N = int(input())
print(N-1)
base = input()
def srh(n,t,str):
	print(((n-1)//2)+t)
	point = input()
	if point == "Vacant":
		return
	if n % 4 == 1:
		if point == str:
			srh((n//2)+1,t,point)
		else:
			srh((n//2)+1,t+(n//2),str)
	else:
		if point == str:
			srh(n//2,t+(n//2)+1,str)
		else:
			if point == "Male":
				srh(n//2,t,"Female")
			else:
				srh(n//2,t,"Male")

srh(N,0,base)	

Measured memory_bytes: 3660
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	var ary = make([]int, n+1)
	for i := 0; i < m; i++ {
		broken := nextInt()
		ary[broken] = -1
	}

	ary[0] = 1
	if ary[1] == -1 {
		ary[1] = 0
	} else {
		ary[1] = 1
	}

	for i := 2; i < n+1; i++ {
		if ary[i] == -1 {
			ary[i] = 0
			continue
		}
		ary[i] = (ary[i-1] + ary[i-2]) % 1000000007
	}
	fmt.Println(ary[n])
}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <utility>

std::pair<std::vector<int>, std::vector<int>> read_input()
{
    std::vector<int> x;
    std::vector<int> y;

    int H, W;
    std::cin >> H >> W;

    std::string buf;
    for (int hi = 0; hi < H; ++hi)
    {
        std::cin >> buf;
        for (int wi = 0; wi < W; ++wi)
        {
            if (buf[wi] == '#')
            {
                x.push_back(hi);
                y.push_back(wi);
            }
        }
    }

    return {x, y};
}

void solve(const std::pair<std::vector<int>, std::vector<int>>& input)
{
    const std::vector<int> x = input.first;
    const std::vector<int> y = input.second;

    int tmp{};
    for (auto&& i : x)
    {
        if (tmp > i)
        {
            std::cout << "Impossible" << std::endl;
            return;
        }
        tmp = i;
    }

    tmp = 0;
    for (auto&& i : y)
    {
        if (tmp > i)
        {
            std::cout << "Impossible" << std::endl;
            return;
        }
        tmp = i;
    }

    std::cout << "Possible" << std::endl;
    return;
}

int main()
{
    solve(read_input());
    return 0;
}

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

ll solve() {
    ll N;
    string C;
    cin >> N >> C;
    int i=0, j=N-1;
    ll ans = 0;
    while ( true ) {
        while ( i < N && C[i] == 'R' ) i++;
        while ( j >= 0 && C[j] == 'W' ) j--;
        if ( i <= j ) {
            ans++;
            i++;
            j--;
        } else {
            break;
        }
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3748
N = int(input())

A = []

[A.append(int(input())) for x in range(N)]

max_num = max(A)
num = A.index(max(A))
A[num] = 0

st_max_num = max(A)

for i in range(num):
    print(max_num)
print(st_max_num)

for i in range(num+1,N):
    print(max_num)

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

int main(){
  ll i,N,x,ans=0,t=0;
  cin>>N;
  vector<ll> color(13,0);
  while(N--){
    cin>>x;
    color[x/400]++;
  }
  rep(i,13){
    if(i<8&&color[i]>0)ans++;
    if(i>=8)t+=color[i];
  }
  if(ans==0){t--;ans++;}
  cout<<ans<<" "<<ans+t<<endl;
  return 0;
}


Measured memory_bytes: 256
from collections import deque
s=deque(input())
q=int(input())
rev=0
for i in range(q):
    p=list(map(str,input().split()))
    if p[0]=="1":
        rev^=1
    else:
        z,f,c=p
        if f=="1":
            if rev:
                s.append(c)
            else:
                s.appendleft(c)
        else:
            if rev:
                s.appendleft(c)
            else:
                s.append(c)
if rev:
    s=list(s)[::-1]
else:
    s=list(s)
print("".join(s))



Measured memory_bytes: 10228
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORR(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b - 1; i >= a; i--)
#define FORI(i, a, b, inc) for (int i = a; i <= b; i += inc)
#define FORRI(i, a, b, inc) for (int i = a; i < b; i += inc)
#define REPD(i, a, b, dec) for (int i = b - 1; i >= a; i -= dec)
#define SORT(a, n) sort(a, a + n, greater<int>())
#define PREC(n) cout << fixed << setprecision(n)
#define ULL unsigned long long
#define FT first
#define SN second
#define Vsort(v) sort(v.begin(), v.end())
#define FORV(it, l) for (auto it : l)
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define RESET(a, b) memset(a, b, sizeof(a))
#define PI acos(-1)
#define VSE(v) v.begin(), v.end()
#define S " "
typedef vector<int> VC;
typedef vector<long long> VCL;
typedef vector<VC> VCC;
typedef pair<int, int> PR;
typedef vector<PR> VPR;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef set<PR> STP;
int isPrime(LL n)
{
    for (LL i = 2; i * i <= n; i++)
        if (n % i == 0)
            return 0;
    return 1;
}
void solve()
{
    /*Md. Bokhtiar Nadeem Shawon
    Institute of Information Technology
    Jahangirnagar University
    */
    string s, t;
    int sz,h,f=0;
    cin >> s >> t;
    sz = s.size();
    FORR(i,1,sz)
    {
        if(s==t)
        {
            f = 1;
            cout << "Yes\n";
            break;
        }
        else
        {
            h = s.size() - 1;
            auto pos = s.insert(s.begin(), s[h]);
            h = s.size() - 1;
            s.erase(s.begin() + h);
        }  
    }
    if(f==0)
        cout << "No\n";

}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*int t;
    cin >> t;
    while (t--)*/
        solve();
    return 0;
}

Measured memory_bytes: 3520
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int ans=0;
  int tmp;
  for(int i=0;i<n;i++){
    if(ans<a[i]){
      ans=a[i];
      tmp=i;
    }
  }
  sort(a.begin(),a.end());
  int cnt=a[n-2];
  for(int i=0;i<n;i++){
    if(tmp==i)cout<<cnt<<endl;
    else cout<<ans<<endl;
  }
}

Measured memory_bytes: 2432
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)


int main(){
    long long int a,b,c,d=0;
    cin>>a>>b>>c;
    a-=b;
    cout<<a%c;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc062/tasks/abc062_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    vector<vector<char>> v(h + 2, vector<char>(w + 2, '#'));
    REP(i, h) REP(j, w) { cin >> v[i + 1][j + 1]; }
    REP(i, h + 2) REP(j, w + 2) { cout << v[i][j] << (j == w + 1 ? "\n" : ""); }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
int n,m;
int a,b,c;
pair<int,int> p[100000];
long long ans;
int main(){
    cin>>n>>m;
    priority_queue<int,vector<int>,greater<int>> que;
    for(int i=0;i<n;i++){
        cin>>a;
        que.push(a);
        ans+=a;
    }
    for(int i=0;i<m;i++){
        cin>>b>>c;
        p[i]=make_pair(c,b);
    }sort(p,p+m);
    bool End=false;
    for(int i=m-1;i>=0&&!End;i--){
        for(int j=0;j<p[i].second;j++){
            int next=que.top();
            if(p[i].first<=next){
                End=true;
                break;
            }que.pop();
            ans+=(p[i].first-next);
            que.push(p[i].first);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

void solve(long long K)
{
    int a[32] = {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};
    cout << a[K - 1] << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long K;
    scanf("%lld", &K);
    solve(K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*int find(int a){
     if(a==par[a])return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);
     if(a==b)return ;
     par[b]=a;
}
ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/
int main(){
    int n;
    cin>>n;
    vector<int> a(n);rep(i,n)cin>>a[i];
    int mx=*max_element(a.begin(),a.end());
    int mn=*min_element(a.begin(),a.end());
    cout<<2*n-2<<endl;
    if(mx>=-mn){
         int id1=max_element(a.begin(),a.end())-a.begin();
         for(int i=0;i<n;i++){
              if(i!=id1)cout<<id1+1<<" "<<i+1<<endl;
         }
         for(int i=1;i<n;i++){
              cout<<i<<" "<<i+1<<endl;
         }
    }
    else{
         int id1=min_element(a.begin(),a.end())-a.begin();
         for(int i=0;i<n;i++){
              if(i!=id1)cout<<id1+1<<" "<<i+1<<endl;
         }
         for(int i=n-2;i>=0;i--)cout<<i+2<<" "<<i+1<<endl;
    }
}
 
 
 
 

























Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
	int a, i;
	
	cin >> a;
	
	if (a % 2 == 0) {
		cout << a << endl;;
	}
	else {
		cout << a * 2 << endl;
	}
	
	return (0);
}

Measured memory_bytes: 764
from sys import stderr
from functools import reduce
from operator import add
f = lambda: [int(i) for i in input().split()]
debug = lambda *x: stderr.write(reduce(add, repr(x)) + '\n')

a, b, c, d = f()
if (abs(a - b) <= d and abs(b - c) <= d) or abs(a - c) <= d:
    print("Yes")
else:
    print("No")

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s; cin >> s >> s;
	map<char,ll> cnt;
	for (char c: s) cnt[c]++;
	cout << (cnt['B'] < cnt['R'] ? "Yes" : "No") << endl;

}



Measured memory_bytes: 256
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

L,R = II()

ans = float('inf')
for i in range(L,L+2018):
  for j in range(i+1,min(R+1,i+2019)):
    temp = i*j%2019
    if temp < ans:
      ans = temp
print(ans)

Measured memory_bytes: 41452
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
const int MOD=1e9+7;
const int INF=1e18;
void io(string s="file"){freopen((s + ".in").c_str(), "r", stdin);freopen((s + ".out").c_str(), "w", stdout);}

int f[1000001];

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;cin>>n;
    
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            f[j]++;
        }
    }
    
    int cnt=0;
    for(int ab=1;ab<=n;ab++){
        int c=n-ab;
        if(c<=0)continue;
        cnt+=f[ab];
        
    }
    cout<<cnt;
}



Measured memory_bytes: 11380
using System;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		int n = int.Parse(Console.ReadLine());

        if(n == 1){
            Console.WriteLine("Hello World");
        }
        else if(n == 2){
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            Console.WriteLine(a+b);
        }
	}
}

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

int main()
{
	string s; cin >> s;
	
	string ans = "Good";

	for (int i = 0; i < s.size()-1; i++) {
		if (s[i] == s[i + 1]) {
			ans = "Bad";
		}
	}

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

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        MyScanner sc = new MyScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        long x = sc.nextLong(), y = sc.nextLong();
        int ans = 1;
        while (x << 1 <= y) {
            x <<= 1;
            ans++;
        }
        out.println(ans);
        out.flush();
        out.close();
    }

    private static class MyScanner {
        StringTokenizer st;
        BufferedReader br;

        public MyScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public MyScanner(String filename) throws IOException {
            br = new BufferedReader(new FileReader(new File(filename)));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N; cin>>N;
    vint h(N);
    REP(i,N) cin>>h[i];

    int minus=0;
    REP(i,N-1){
        minus+=min(h[i],h[i+1]);
    }
    cout<<accumulate(ALL(h),0)-minus<<endl;
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 1000;
int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N);
  for (int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
  }
  int ans = INF;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      int p = x[j] - x[i];
      int q = y[j] - y[i];
      vector<vector<int>> E(N);
      for (int k = 0; k < N; k++){
        for (int l = 0; l < N; l++){
          if (x[l] - x[k] == p && y[l] - y[k] == q){
            E[k].push_back(l);
            E[l].push_back(k);
          }
        }
      }
      vector<bool> used(N, false);
      int cnt = 0;
      for (int k = 0; k < N; k++){
        if (!used[k]){
          used[k] = 0;
          queue<int> Q;
          Q.push(k);
          while (!Q.empty()){
            int v = Q.front();
            Q.pop();
            for (int w : E[v]){
              if (!used[w]){
                used[w] = true;
                Q.push(w);
              }
            }
          }
          cnt++;
        }
      }
      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
def gcd(x,y):
  if(y==0):
  	return x
  if(x<y):
    x,y=y,x
  return gcd(y,x % y)
def lllen(a,b,c):
  at=a//c
  at=at*c
  b=b//c *c
  ansc=0
  while(at<a):
    at+=c
  ansc=b-at
  if ansc<0 :
  	ansc=0
  else:
  	ansc=ansc//c + 1
  return ansc

a,b,c,d=map(int , input().strip().split() )
tl=b-a+1

ansc=lllen(a,b,c)
ansd=lllen(a,b,d)
ansl=lllen(a,b,(c*d)//gcd(c,d))
#print(ansc,ansl,ansd)
print(b-a+1 -ansc -ansd + ansl)


  

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

int main() {
    string s;
    cin >> s;
    int head, tail;
    for (int i=0; i<int(s.size()); i++) {
        if (s.at(i)=='A') {
            head = i;
            break;
        }
    }
    reverse(s.begin(), s.end());
    for (int i=0; i<int(s.size()); i++) {
        if (s.at(i)=='Z') {
            tail = i;
            break;
        }
    }
    cout << s.size()-head-tail << "\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll dp[102][100002];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,w;
    cin>>n>>w;
    ll pes[n+2],val[n+2];
    rep(i,0,102){
        rep(j,0,100002){
            dp[i][j]=INF;
        }
    }
    rep(i,1,n+1){
        cin>>pes[i]>>val[i];
    }
    dp[0][0]=0;
    rep(i,1,n+1){
        rep(j,0,100002){
            if(j>=val[i]){
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i]]+pes[i]);
            }
            else dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    rep(i,0,100002){
        if(dp[n][i]<=w)ans=i;
    }
    cout<<ans<<'\n';
    return 0;   
}

Measured memory_bytes: 80000