akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main(void){

	string rubi[8];
	char tmp;
	string S;

	rubi[0]=("..rr......");
	rubi[1]=("..rr......");
	rubi[2]=("ggyybbww..");
	rubi[3]=("ggyybbww..");
	rubi[4]=("..oo......");
	rubi[5]=("..oo......");

	while(1){
		S=getchar();
		if(S=="\n") break;
		if(S=="R"){
			tmp=rubi[0][3];
			rubi[0][3]=rubi[2][3];
			rubi[2][3]=rubi[4][3];
			rubi[4][3]=rubi[3][6];
			rubi[3][6]=tmp;
			tmp=rubi[1][3];
			rubi[1][3]=rubi[3][3];
			rubi[3][3]=rubi[5][3];
			rubi[5][3]=rubi[2][6];
			rubi[2][6]=tmp;
			tmp=rubi[2][4];
			rubi[2][4]=rubi[3][4];
			rubi[3][4]=rubi[3][5];
			rubi[3][5]=rubi[2][5];
			rubi[2][5]=tmp;
		}
		if(S=="L"){
			tmp=rubi[0][2];
			rubi[0][2]=rubi[3][7];
			rubi[3][7]=rubi[4][2];
			rubi[4][2]=rubi[2][2];
			rubi[2][2]=tmp;
			tmp=rubi[1][2];
			rubi[1][2]=rubi[2][7];
			rubi[2][7]=rubi[5][2];
			rubi[5][2]=rubi[3][2];
			rubi[3][2]=tmp;
			tmp=rubi[3][1];
			rubi[3][1]=rubi[2][1];
			rubi[2][1]=rubi[2][0];
			rubi[2][0]=rubi[3][0];
			rubi[3][0]=tmp;
		}
		if(S=="U"){
			tmp=rubi[2][0];
			rubi[2][0]=rubi[2][2];
			rubi[2][2]=rubi[2][4];
			rubi[2][4]=rubi[2][6];
			rubi[2][6]=tmp;
			tmp=rubi[2][1];
			rubi[2][1]=rubi[2][3];
			rubi[2][3]=rubi[2][5];
			rubi[2][5]=rubi[2][7];
			rubi[2][7]=tmp;
			tmp=rubi[0][2];
			rubi[0][2]=rubi[1][2];
			rubi[1][2]=rubi[1][3];
			rubi[1][3]=rubi[0][3];
			rubi[0][3]=tmp;
		}
		if(S=="D"){
			tmp=rubi[3][0];
			rubi[3][0]=rubi[3][6];
			rubi[3][6]=rubi[3][4];
			rubi[3][4]=rubi[3][2];
			rubi[3][2]=tmp;
			tmp=rubi[3][1];
			rubi[3][1]=rubi[3][7];
			rubi[3][7]=rubi[3][5];
			rubi[3][5]=rubi[3][3];
			rubi[3][3]=tmp;
			tmp=rubi[4][2];
			rubi[4][2]=rubi[5][2];
			rubi[5][2]=rubi[5][3];
			rubi[5][3]=rubi[4][3];
			rubi[4][3]=tmp;
		}
		if(S=="F"){
			tmp=rubi[1][2];
			rubi[1][2]=rubi[3][1];
			rubi[3][1]=rubi[4][3];
			rubi[4][3]=rubi[2][4];
			rubi[2][4]=tmp;
			tmp=rubi[1][3];
			rubi[1][3]=rubi[2][1];
			rubi[2][1]=rubi[4][2];
			rubi[4][2]=rubi[3][4];
			rubi[3][4]=tmp;	
			tmp=rubi[2][3];
			rubi[2][3]=rubi[2][2];
			rubi[2][2]=rubi[3][2];
			rubi[3][2]=rubi[3][3];
			rubi[3][3]=tmp;
		}
		if(S=="B"){
			tmp=rubi[0][2];
			rubi[0][2]=rubi[2][5];
			rubi[2][5]=rubi[5][3];
			rubi[5][3]=rubi[3][0];
			rubi[3][0]=tmp;
			tmp=rubi[0][3];
			rubi[0][3]=rubi[3][5];
			rubi[3][5]=rubi[5][2];
			rubi[5][2]=rubi[2][0];
			rubi[2][0]=tmp;
			tmp=rubi[2][6];
			rubi[2][6]=rubi[3][6];
			rubi[3][6]=rubi[3][7];
			rubi[3][7]=rubi[2][7];
			rubi[2][7]=tmp;
		}
	}

	for(int i=0;i<=5;i++){
		for(int j=0;j<=7;j++){
			cout<<rubi[i][j];
		}
		cout<<endl;
	}

}

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

int main(){
    int n;

    cin >> n;
    cin.get();
    string str;

    for(int i=1; i<=n; i++){
        getline(cin, str);
        while(str.find("Hoshino") != string::npos){
            str.at(str.find("Hoshino") + 6) = 'a';
        }
        cout << str << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

long get_lcm(int a, int b);
long get_gcd(int x, int y);

int main(void)
{
	int i, n, m;
	long lcm, gcd;
	scanf("%d %d%*c", &n, &m);
	lcm = get_lcm(n,m);
	gcd = get_gcd(n,m);

	char s[100002], t[100002];
	for(i=0;i<n;i++)
		scanf("%c", &s[i]);
	s[i] = '\0';
	//printf("%s\n", s);
	scanf("%*c");
	for(i=0;i<m;i++)
		scanf("%c", &t[i]);
	t[i] = '\0';
	//printf("%s\n", t);

	if(s[0] != t[0]) {
		printf("%d\n", -1);
		return 0;
	}
	if(gcd == 1) {
		printf("%ld\n", lcm);
		return 0;
	}

	int a = n / gcd, b = m / gcd;
	int flag = 0;
	for(i=1;i<gcd;i++) {
		if(s[i*a] != t[i*b]) {
			flag = 1;
			break;
		}
	}
	if(flag) {
		printf("%d\n", -1);
		return 0;
	} else {
		printf("%ld\n", lcm);
		return 0;
	}

	return 0;
}

long get_lcm(int a, int b)
{
	long g, l, lcm;
	if(a>b) {
		g = a; l = b;
	} else {
		g = b; l = a;
	}
	lcm = g;

	while(lcm % l != 0) lcm += g;

	return lcm;
}

long get_gcd(int x, int y)
{
    long r;

    while((r = x % y) != 0)  // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

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

int main(){
	int a,b;
	cin >> a >> b;
	int sum=a+b;
	int dec=a-b;
	int mul=a*b;
	
	int ans=max(sum,max(dec,mul));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int getlcs(char *,char  *,int ,int);

#define MAX 1000


int main(){
  char s1[MAX];
  char s2[MAX];
  int n=0;
  int i=0;
  int j=0;
  char change;
  int s1_l=0;
  int s2_l=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s", s1,s2);
    s1_l=strlen(s1);
    s2_l=strlen(s2);
    
    for(j=s1_l;j>0;j--){
      s1[j]=s1[j-1];
    }
    s1[0]=' ';
    
    for(j=s2_l;j>0;j--){
      s2[j]=s2[j-1];
    }
    s2[0]=' ';    
    printf("%d\n",getlcs(s1,s2,s1_l,s2_l));
  }
  return 0;
}

int getlcs(char *X, char *Y,int m,int n){
  int c[MAX+1][MAX+1];
  int maxlcs=0;
  int i=0;
  int j=0;
  
  for(i=0;i<m;i++) c[i][0]=0;
  for(j=1;j<n;j++) c[0][j]=0;

  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i]==Y[j]) c[i][j]=c[i-1][j-1]+1;
      else if(c[i-1][j]>c[i][j-1]) c[i][j]=c[i-1][j];
      else c[i][j]=c[i][j-1];
      maxlcs=c[i][j];
    }
  }

  return maxlcs;
}



Measured memory_bytes: 5640
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 2e5+5;

ll n,k;
ll a[N];

bool check(ll x){
	ll ans=0;
	for(int i=0;i<n;++i){
		if(a[i]==x)continue;
		ans+=a[i]/x;
	}	
	return ans<=k;
}

void solve(){
	cin>>n>>k;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}	
	ll l=1,r=1e9,ans=1e9;
	while(l<=r){
		ll m=(l+r)/2;
		if(check(m)){
			ans=m;
			r=m-1;
		}
		else l=m+1;
	}
	cout<<ans;
}

int main(){
	ios_base :: sync_with_stdio(false);
	int test = 1; 
	//cin >> test;	
	while (test--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 5212
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto o(C *x)->decltype(os << *x, 0);
template<class C> static char o(...);
template<class C> typename enable_if<sizeof o<C>(0)!=1,Dbg&>::type operator<<(const C &x) {os<<x; return *this;}
template<class C> Dbg &dump(C b, C e) {
    for (struct{C i;int j;} i={(*this<<"\n[",b),0}; i.i!=e and i.j<26; i.i++, i.j++) *this<<", "+2*(i.i==b)<<*i.i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof o<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator<<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator<<(const pair<B, C> &x) {return *this<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = -1;

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    int a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if (a <= b) cout << (a+v*ll(t) >= b+w*ll(t) ? "YES\n" : "NO\n");
    else cout << (a-v*ll(t) <= b-w*ll(t) ? "YES\n" : "NO\n");
}

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


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

class UnionFind{
public:
    int n;
    vector<int> v;

    UnionFind():n{0}{}
    UnionFind(int n_in):n{n_in}{
        v.assign(n,-1);
    }
    
    int find(int x){
        assert(0<=x && x<n);
        if(v[x]<0) return x;
        v[x]=find(v[x]);
        return v[x];
    }
    
    bool same(int a,int b){
        assert(0<=a && a<n);
        assert(0<=b && b<n);
        if(find(a)==find(b)) return true;
        return false;
    }
    
    int merge(int a,int b){
        assert(0<=a && a<n);
        assert(0<=b && b<n);
        int a_p=find(a),b_p=find(b);
        if(a_p==b_p) return a_p;
        if(a_p>b_p) swap(a_p,b_p);
        v[a_p]+=v[b_p]; v[b_p]=a_p;
        return a_p;
    }
    
    int size(int a){
        assert(0<=a && a<n);
        return -v[find(a)];
    }

    int group_cnt(){
        int res=0;
        for(auto p:v)if(p<0) res++;
        return res;
    }
};


int main(){
    int n,q; cin>>n>>q;
    UnionFind uf(n);
    rep(_,q){
        int t,u,v; cin>>t>>u>>v;
        if(t==0){
            uf.merge(u,v);
        }
        else{
            printf("%d\n",(int)uf.same(u,v));
        }
    }
}

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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
	for(int i = 0; i < 5; ++i){
		int tmp;
		cin>>tmp;
		if(!tmp)
			cout<<i+1<<"\n";
	}
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    int black[3] = {0};
    int blue[] = { 0,0,255 };
    int lime[] = {0,255,0};
    int aqua[] = {0,255,255};
    int red[] = {255,0,0};
    int fuchsia[] = {255,0,255};
    int yellow[] = {255,255,0};
    int white[] = {255,255,255};
    while(true){
	string s;
	cin >> s;
	if(s == "0") break;
	int rgb[3];
	rgb[0] = stoi(s.substr(1,2),nullptr,16);
	rgb[1] = stoi(s.substr(3,2),nullptr,16);
	rgb[2] = stoi(s.substr(5,2),nullptr,16);
	string ans;
	int m = 10000000;
	int sum = 0;
	REP(j,3) sum += (rgb[j]-black[j])*(rgb[j]-black[j]);
	if(m > sum){
	    m = sum;
	    ans = "black";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-blue[j])*(rgb[j]-blue[j]);
	if(m > sum){
	    m = sum;
	    ans = "blue";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-lime[j])*(rgb[j]-lime[j]);
	if(m > sum){
	    m = sum;
	    ans = "lime";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-aqua[j])*(rgb[j]-aqua[j]);
	if(m > sum){
	    m = sum;
	    ans = "aqua";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-red[j])*(rgb[j]-red[j]);
	if(m > sum){
	    m = sum;
	    ans = "red";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-fuchsia[j])*(rgb[j]-fuchsia[j]);
	if(m > sum){
	m = sum;
	ans = "fuchsia";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-yellow[j])*(rgb[j]-yellow[j]);
	if(m > sum){
	    m = sum;
	    ans = "yellow";
	}
	sum = 0;
	REP(j,3) sum += (rgb[j]-white[j])*(rgb[j]-white[j]);
	if(m > sum){
	    m = sum;
	    ans = "white";
	}
	cout << ans << endl;
    }
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N, K;
    cin >> N >> K;
    vector<ll> l(N);
    REP(i, N) cin >> l[i];
    sort(l.rbegin(), l.rend());
    ll res = 0;
    REP(i, K) res += l[i];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <time.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef int ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=1e+5 + 1;
const ut INF=1<<30;
const ld eps=1e-6;
const LL mod=1e+9 + 7;

int main() {
	int n;
	while(cin >> n && n){
		bool check[4096] = {0};
		LL sum[4096] = {0};
		vector<int> data;
		REP(i,n){
			LL id, money, num; 
			scanf("%lld%lld%lld", &id, &money, &num);
			if(!check[id]){
				check[id] = true;
				data.PB(id);
			}
			sum[id] += money * num;
		}
		bool ok = false;
		REP(i,data.size()){
			if(sum[data[i]] >= 1000000){
				printf("%d\n", data[i]);
				ok = true;
			}
		}
		if(!ok)
			cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1332
INF = 10**9 + 1

def merge(a,left,mid,right)
  inv = 0
  lSize = mid-left;
  rSize = right-mid;
  l = []
  r = []
  (0...lSize).each do |i|
    l[i] = a[left+i]
  end
  (0...rSize).each do |i|
    r[i] = a[mid+i]
  end
  l[lSize] = INF
  r[rSize] = INF
  i,j=0,0
  tmp=0
  (left...right).each do |k|
    if l[i] <= r[j]
      inv += tmp
      a[k] = l[i]
      i += 1
    else 
      tmp += 1
      a[k] = r[j]
      j += 1
    end
  end
  return inv
end

def mergeSort(a,left,right)
  inv = 0
  if left+1 < right
    mid = (left+right)/2;
    inv += mergeSort(a,left,mid)
    inv += mergeSort(a,mid,right)
    inv += merge(a,left,mid,right)
  end
  return inv
end

n = gets.to_i
a = gets.split.map(&:to_i)
count = mergeSort(a,0,n)
printf("%d\n",count)


Measured memory_bytes: 34472
// --------------
// Tejas Pandey  |
// 30 - 05 - 20  |
// Kawaiiiiiii   |
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll h1,m1,h2,m2,t;
  cin >> h1 >> m1 >> h2 >> m2 >> t;
  ll f1 = h1*60 + m1;
  ll f2 = h2*60 + m2;
  cout << f2 - f1 - t << "\n";
  return 0;
}


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

int a, b, c, d;

int main(){
    cin >> a >> b >> c >> d;
    if(a + b > c + d){
        cout << "Left" << endl;
        return 0;
    }else if(a + b < c + d){
        cout << "Right" << endl;
        return 0;
    }else{
        cout << "Balanced" << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
while True:

    H, W = [int(i) for i in input().split()]

    if H == 0:
        break

    min_h = 10 ** 8
    min_w = 10 ** 8
    a = H ** 2 + W ** 2

    for w in range(1, 151):
        for h in range(1, w):
            d = w ** 2 + h ** 2
            e = min_h ** 2 + min_w ** 2
            if d < a:
                continue
            if d == a and h <= H:
                continue

            if d < e:
                min_h = h
                min_w = w
            elif d == e and h < min_h:
                min_h = h
                min_w = w

    print(min_h, min_w)
      


Measured memory_bytes: 5600
#include <iostream>
using namespace std;
int main()
{
	int n,k,a[55],sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n-1;i++)
		for(int j=i+1;j<n;j++)
			if(a[i]<a[j]) swap(a[i],a[j]);
	for(int i=0;i<k;i++) sum+=a[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
SW=[0]
SE=[0]
for i in range(n):
  if(s[i]=="W"):
    SW.append(SW[-1]+1)
    SE.append(SE[-1])
  else:
    SE.append(SE[-1]+1)
    SW.append(SW[-1])
mi=n
SE.append(SE[-1])
for i in range(n):
  mi=min(SW[i]+SE[-1]-SE[i+1],mi)
print(mi)

Measured memory_bytes: 17984
#include <iostream>
#include <string>
#include <sstream>
//#include <fstream>

using namespace std;

string itos (int n)
{
	stringstream ss;
	ss << n;

	return ss.str();
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.string", "r", stdin );
	string str = "";
	int n;

	while (getline (cin, str ) ){
		stringstream ssn(str);
		ssn >> n;

		if (n == 0 ){
			break;
		} // end if

		getline (cin, str );

		for (int i = 0; i < n; ++i){
			string rstr = "";
			char c = 0;
			bool issame = false;
			int count = 1;

			for (int j = 0; j < str.length() - 1; ++j){
				if (!issame ){
				 	c = str[j];
				} // end if
				if (str[j] == str[j+1] ){
					++count;
					if (!issame ){
						issame = true;
					} // end if
				}else{
					rstr += itos (count);
					rstr += c;
					count = 1;
					issame = false;
				} // end if
			} // end for

			if (issame ){
				rstr += itos (count);
				rstr += c;
			}else{
				rstr += itos (1);
				rstr += str[str.length()-1];
			} // end if
			str = rstr;
		} // end for
		cout << str << endl;

	} // end loop
		
	return 0;
}

Measured memory_bytes: 1084
#include <stdio.h>
#include <string.h>

int main() {
	int len, ans[100010], temp;
	char s[100010];
	scanf("%s", s);
	len = strlen(s);
	memset(ans, 0, sizeof ans);
	for (int i = 0; i < len; i++) {
		temp = i;
		while (temp + 1 < len) {
			if (s[temp + 1] != s[i])
				break;
			temp++;
		}
		if (s[i] == 'L') {
			ans[i - 1] += (temp - i + 1) / 2;
			ans[i] += (temp - i + 2) / 2;
		}
		else {
			ans[temp + 1] += (temp - i + 1) / 2;
			ans[temp] += (temp - i + 2) / 2;
		}
		i = temp;
	}
	for (int i = 0; i < len; i++) {
		if (i)
			putchar(' ');
		printf("%d", ans[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 896
import sys
read = sys.stdin.read
readline = sys.stdin.readline
from fractions import gcd

class SegmentTree:
    def __init__(self, N, func, I):
        self.sz = N
        self.func = func
        self.I = I
        self.seg = [I for i in range(self.sz * 2)]
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k //= 2
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a % 2 == 1:
                R = self.func(R, self.seg[a])
                a += 1
            if b % 2 == 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a //= 2
            b //= 2
        return R

def main():
    N = int(readline())
    m = map(int,read().split())
    seg = SegmentTree(N , gcd , 0)
    for i in range(N):
        seg.assign(i , next(m))
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
    print(ans)

main()


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

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define fi first
#define se second
#define pb push_back
 
#define ll long long
#define pii pair<int, int>
//#define int ll
const int MOD = 1000000007;

#define thr 10000000
int primes[3000000]; int cnt;
ll ans[thr+5];
int ex[thr+5], mx[thr+5];
ll init(int n) {
	ans[1] = 1;
	iter(i, 2, n+1) {
		if(!ans[i]) {
			primes[cnt++] = i;
			ans[i] = 2;
			ex[i] = 1;
			mx[i] = i;
		}
		for(int j=0; j<cnt && i*primes[j]<=n; j++) {
			int v = i*primes[j];
			if(i%primes[j]) {
				ans[v] = ans[i]*2;
				ex[v] = 1;
				mx[v] = primes[j];
			} else {
				ans[v] = ans[i/mx[i]]*(ex[i]+2);
				ex[v] = ex[i]+1;
				mx[v] = mx[i]*primes[j];
				break;
			}
		}
	}
	ll as = 0;
	rep1(i, n) {
		as += 1ll * i * ans[i];
	}
	return as;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int p; cin >> p;
    cout << init(p);
}



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


int main()
{
    int H, W;
    char tmp = '#';

    while (1) {

        cin >> H;
        if (H == 0) break;
        else {
            cin >> W;
            for (int i = 0; i < H; i++) {
                tmp = (i % 2 == 0) ? '#' : '.';
                for (int j = 0; j < W; j++) {
                    cout << tmp;
                    tmp = (tmp == '#') ? '.' : '#';
                }
                cout << endl;
            }
            cout << endl;
        }

    }
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>

#define MAXN 50
#define INF ( ~(1LL << 63) )

using namespace std;

typedef long long ll;

struct POINT {
  ll x, y;
} typedef point;

int K,N;
point A[MAXN];


int calk ( ll xh, ll xl, ll yh, ll yl )
{
  int ans = 0;
  if ( xh < xl ) swap(xh,xl);
  if ( yh < yl ) swap(yh,yl);
  for ( int i = 0; i < N; ++i ) {
    if ( A[i].x <= xh && A[i].x >= xl && A[i].y <= yh && A[i].y >= yl ) ++ans;
  }

  return ans;
}

ll axis ( void )
{
   ll min = INF;

   for ( int a = 0; a < N; ++a ) {
     for ( int b = 0; b < N; ++b ) {
       for ( int c = 0; c < N; ++c ) {
         for ( int d = 0; d < N; ++d ) {
           if ( calk( A[a].x, A[b].x, A[c].y, A[d].y ) >= K ) {
             ll tmp = abs( (A[a].x-A[b].x)*(A[c].y-A[d].y) );
             if ( tmp < min ) min = tmp;
           }
         }
       }
     }
   }

   return min;
}

int main()
{
  scanf("%d%d", &N,&K);
  for ( int i = 0; i < N; ++i ) {
    ll x,y;
    scanf("%ld%ld", &x, &y);
    A[i] = { x,y};
  }

  cout << axis() << "\n";
}


Measured memory_bytes: 504
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<set>
using namespace std;
set<string> all;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string ss;
        cin>>ss;
        all.insert(ss);
    }
    int ans=(int)all.size();
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 19200
module Main where

import Control.Applicative
import Control.Monad
import Control.Monad.State
import Data.List
import qualified Data.ByteString.Lazy.Char8 as L

type Tokenizer = State [L.ByteString]

expand0 :: [Int] -> [Int]
expand0 [] = [1]
expand0 [1] = [-1, 1]
expand0 (x:xs) = (-x:2 * x:xs)

gen0, gen1 :: Int -> [Int]
gen0 n = (iterate expand0 []) !! n

gen1 1 = [1]
gen1 n = map negate $ gen0 n

solve_01 :: [Int] -> (Int -> [Int]) -> Int
solve_01 vs gen = sum $ zipWith (*) vs' cs'
    where vs' = sort vs
          cs' = sort . gen $ length vs

solve :: [Int] -> Int
solve vs = max (solve_01 vs gen0) (solve_01 vs gen1)

nextInt :: Tokenizer Int
nextInt = state $ \(s:ss) -> case L.readInt s of
                               Just (x, _) -> (x, ss)
                               Nothing -> error $ "Can't parse Int from " ++ L.unpack s

go :: Tokenizer Int
go = do
  n <- nextInt
  vs <- replicateM n nextInt
  return $ solve vs
  

main :: IO ()
main = do
  input <- L.words <$> L.getContents
  let answer = evalState go input
  print answer


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

int main(){
	string s;
	cin>>s;
	
	int win=0;
	
	for(int i=0;i<s.length();i++){
		if(s[i]=='o'){
			win++;
		}
	}
	
	if(15-s.length()>=8-win){
		cout<<"YES"<<endl;
	}
	else
		cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N;
vector<int>graph[114514];
using ULL = unsigned long long;

ULL P = 1000000007;
ULL seed(int prev, int now)
{
	//vector<ULL>cash;

	int res = 0;
	for (int ch : graph[now])
	{
		if (ch == prev)continue;
		res ^= (seed(now, ch) + 1);
	}
	return res;
}

int main(void)
{
	cin >> N;
	for (int i = 1; i < N; ++i)
	{
		int x, y;
		cin >> x >> y;
		--x; --y;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}

	ULL S = seed(-1, 0);



	if (S == 0)
	{
		cout << "Bob" << endl;
	}
	else
	{
		cout << "Alice" << endl;
	}
	return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> color(9, 0);
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        if (a < 3200) color[a/400]++;
        else color[8]++;
    }
    int min = 0;
    int max = 0;
    for (int i = 0; i < 8; i++){
        if (color[i]){
            min++;
            max++;
        }
    }
    if (min == 0) min = 1;
    max += color[8];
    cout << min << " " << max<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n, k;
  cin >> n >> k;

  ll num = k;
  int keta = 1;
  while (num <= n) {
    num *= k;
    keta++;
  }

  cout << keta << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char s[100];
	
	scanf("%s",s);
	
	if(s[5]!='0'){
		printf("TBD\n");
	}else if(s[6]=='1'||s[6]=='2'||s[6]=='3'||s[6]=='4'){
		printf("Heisei\n");
	}else{
		printf("TBD\n");
	}
	
	return 0;
	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  int a[N];
  for(int i = 0;i<N;i++){
    cin>>a[i];
  }
  int ans = 0;
  int temp = 0;
  for(int i = 0;i<N-1;i++){
    if(a[i]>=a[i+1]){
      temp++;
    }
    else{
      ans = max(ans,temp);
      temp = 0;
    }
  }
  ans = max(ans,temp);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n, q; cin >> n >> q;
    string s; cin >> s;
    vint cum(n);
    rep(i, n-1){
        cum[i+1] += cum[i];
        if(s[i]=='A' && s[i+1]=='C') cum[i+1]++;
    }

    rep(i, q){
        int l, r; cin >> l >> r;
        l--; r--;
        int ans = cum[r] - cum[l];
        // if(l>0 && cum[l] > cum[l-1]) ans--;
        pr(ans);
    }
    return 0;}

Measured memory_bytes: 3816
'use strict'

function main(input) {
  input = input.split('\n').map(v => v.split(' ').map(v => ~~v))
  const n = input[0][0]
  const m = input[0][1]
  const ans = input.slice(1, -1)
  const counts = Array.apply(null, { length: m + 1 }).fill(0)
  for (let i = 0; i < n; i++) {
    for (let j = 1; j <= ans[i][0]; j++) {
      counts[ans[i][j]] += 1
    }
  }

  const f = counts.filter(v => {
    return v >= n
  })

  console.log(f.length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1e9+5

int frog(int *a,int i, int n, int *dp){
    if(i>=n-1){
        return 0;
    }
    if(dp[i]!=inf) return dp[i];

    int op1=frog(a,i+1,n,dp) + abs(a[i]-a[i+1]);
    int op2=frog(a,i+2,n,dp) + abs(a[i]-a[i+2]);

    dp[i] = min(op1,op2);
    return dp[i];
}

int main() {
    ll n;cin>>n;
    int a[n]={0};
    for(int i=0;i<n;i++) cin>>a[i];
    int dp[n];
    for(int i=0;i<n;i++) dp[i] = inf;
    cout<<frog(a,0,n,dp)<<endl;
    // for(int i=0;i<n;i++) cout<<dp[i]<<" ";
}



Measured memory_bytes: 8832
import string
import sys

alpha = string.ascii_lowercase

for line in sys.stdin:
    for i in range(len(alpha)):
        cipher_str = ""
        for s in line:
            if s in alpha:
                cipher_str += alpha[(alpha.index(s)+i) % len(alpha)]
            else:
                cipher_str += s

        if "the" in cipher_str or "this" in cipher_str or "that" in cipher_str:
            print(cipher_str, end="")
            break
    else:
        print(line, end="")

Measured memory_bytes: 6720
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N; cin >> N;

	bool flag = false;
	for (int i = 0; i <= N && !flag; i++) {
		int w = i * 108;
		w /= 100;
		if (w == N) {
			cout << i << endl;
			flag = true;
		}
	}
	if (!flag) cout << ":(" << endl;

	return 0;
}

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

int main()
{
  int H, W, i, j;

  while(1)
    {
      cin >> H >> W;

      if(H==0 && W==0)
	break;

      for(i=0; i<H; i++)
	{
	  if(i%2==1)
	    {
	      for(j=0; j<W; j++)
		{
		  if(j%2==1)
		    {
		      cout << "#";

		    }
		  else
		    {
		      cout << ".";
		    }
		}
	    }
	  else
	    {
	      for(j=0; j<W; j++)
		{
		  if(j%2==1)
		    {
		      cout << ".";
		    }
		  else
		    {
		      cout << "#";
		    }
		}
	    }
	  cout << endl;
	}
      cout << endl;
    }
}

Measured memory_bytes: 1152
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define pb  push_back
#define mod  1000000007
#define ps(x, y) fixed<<setprecision(y)<<x
#define w(t) int t; cin>>t;while(t--)
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef vector<int>		vi;
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             1e18


int power (int b , int a) {
	int ans = 1;
	a = a % mod;
	while (b != 0) {
		if (b & 1)
		{ans = (ans * a) % mod;}
		b >>= 1; //b/2
		a = a * a;
		a %= mod;

	}
	return ans;
}

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int x = 0;
	int cost = 0;
	while (x < n) {
		x += 1000;


	}
	cost = x - n;

	cout << cost << "\n";

	return 0;

}



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

typedef long long ll;

ll x;

bool is_prime(int n) {
  for (int i = 2; i*i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  cin >> x;
  while (!is_prime(x)) {
    x++;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
long i,j,k,n,m,P,f[303][303][303];main(){std::cin>>n>>m>>P;for(*f[i=0][1]=1;i<=n;i++)for(j=0;m/++j;)for(k=i;~k;k--)((k?f[i][j][k-1]:f[i][j+1][i])+=f[i][j][k])%=P,(f[i+1][j][k]+=f[i][j][k]*(1+k)%P)%=P;std::cout<<*f[n][m];}

Measured memory_bytes: 217344
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

ll sum[202020];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; cin>>N;
  ll D,A; cin>>D>>A;
  vector<ll> X(N),H(N);
  map<ll,int> mp;
  rep(i,N){
    cin>>X[i]>>H[i];
    mp[X[i]]=i;
  }
  sort(X.begin(),X.end());
  X.push_back(1e15);
  mp[1e15]=202020;
  ll ans=0;
  rep(i,N){
    int j=mp[X[i]];
    if(i) sum[j]+=sum[mp[X[i-1]]];
    H[j]+=sum[j];
    if(H[j]<=0) continue;
    int ub=upper_bound(X.begin(),X.end(),X[i]+2*D)-X.begin();
    sum[j]-=A*(H[j]/A+min(1LL,H[j]%A));
    sum[mp[X[ub]]]+=A*(H[j]/A+min(1LL,H[j]%A));
    ans+=H[j]/A+min(1LL,H[j]%A);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 18688
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;

public class Main {
	long N;

	public int f(long a,long b){
		return Math.max(String.valueOf(a).length(),String.valueOf(b).length());
	}

	public void solve() {
		N = nextLong();

		ArrayList<Long> list = new ArrayList<Long>();
		for(long i = 1;i * i <= N;i++){
			if(N%i == 0)list.add(i);
		}
		int min = (int)1e9+7;
		for(int i = 0;i < list.size();i++){
			min = Math.min(min,f(list.get(i),N/list.get(i)));
		}
		out.println(min);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21588
n=int(input())
a=[0]+list(map(int,input().split()))

cnt={}
ans = 0
for i in range(1,n+1):
    if a[i] +i not in cnt:
        cnt[a[i] +i] = 0
    cnt[a[i] + i] += 1
for i in range(1, n+1):
    if i-a[i] in cnt:
        ans+= cnt[i-a[i]]
print(ans)

Measured memory_bytes: 40148
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    //Seiranchan!
    int N,M;
    cin >> N >> M;
    vector <int> road(N);

    REP(i,M){
        int a,b;
        cin >> a>> b;
        road[a-1]++;
        road[b-1]++;
    }

    REP(i,N){
        cout << road[i]<< endl;
    }

}

Measured memory_bytes: 256
//A x B + C 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int d(int t){
    map<int,int>m;
    for(int i=2;i*i<=t;i++){
        while(t%i==0){
            m[i]++;
            t/=i;
        }
    }
    if(t!=1)m[t]++;
    int res=1;
    for(auto i:m)res*=(i.second+1);
    return res;
}

signed main (){
    int n;cin>>n;
    int ans=0;
    rep(i,1,n){
        ans+=d(i);
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 3588
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int m = Integer.parseInt(str[1]);
    int x = Integer.parseInt(str[2]);
    int[] c = new int[n];
    int[][] a = new int[n][m];
    
    for(int i = 0; i < n; i++) {
      str = in.readLine().split(" ");
      c[i] = Integer.parseInt(str[0]);
      for(int j = 0; j < m; j++) {
        a[i][j] = Integer.parseInt(str[j+1]);
      }
    }
    
    long ans = Long.MAX_VALUE;
    
    loop1: for(int i = 0; i < Math.pow(2,n); i++) {
//  loop1: for(int i = 0; i < (1<<n);        i++) {
      boolean ok = true;
      long res = 0;
      loop2: for(int k = 0; k < m; k++) {
        long sum = 0;
        for(int j = 0; j < n; j++) {
//        2進数iをjだけ右にビットシフトした時の、iの1桁目と1とでビット論理積をとって、
//        演算結果が1であるならば、処理を実行する
          if((1&i >> j) == 1) {
            res += c[j];
            sum += a[j][k];
          }
          //System.out.println(sum);
        }
        if(sum < x) {
          ok = false;
          break loop2;
        }
        //System.out.println();
      }
      //System.out.println(res/m);
      if(ok) {
        ans = Math.min(ans,res/m);
      }
    }
    
    if(ans == Long.MAX_VALUE) {
      System.out.println(-1);
    } else {
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 33036
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef pair<int,int> P;
vector<int> xc;
vector<int> yc;
int x1[1000];
int y1[1000];
int x2[1000];
int y2[1000];
int used[3005][3005];
int dx[4]={-1,0,0,1};
int dy[4]={0,1,-1,0};
int w,h,n;
void bfs(int x,int y){
	used[x][y]=1;
	queue<P> que;
	que.push(P(x,y));
	while(!que.empty()){
		P p=que.front();
		que.pop();
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i];
			int ny=p.second+dy[i];
			if(nx>=0&&nx<w&&ny>=0&&ny<h&&used[nx][ny]==0){
				used[nx][ny]=1;
				que.push(P(nx,ny));
			}
		}
	}
}
int main(){
	int i,j;
	while(1){
	scanf("%d %d",&w,&h);
	if(w==0)return 0;
	scanf("%d",&n);
	xc.clear();
	yc.clear();
	xc.push_back(0);
	xc.push_back(w-1);
	yc.push_back(0);
	yc.push_back(h-1);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&x1[i],&y1[i],&x2[i],&y2[i]);
		x2[i]--;y2[i]--;
		xc.push_back(x1[i]);
		xc.push_back(x2[i]);
		yc.push_back(y1[i]);
		yc.push_back(y2[i]);
		if(x1[i]>0)xc.push_back(x1[i]-1);
		if(y1[i]>0)yc.push_back(y1[i]-1);
	}
	sort(xc.begin(),xc.end());
	sort(yc.begin(),yc.end());
	xc.erase(unique(xc.begin(),xc.end()),xc.end());
	yc.erase(unique(yc.begin(),yc.end()),yc.end());
	w=xc.size();
	h=yc.size();
	for(i=0;i<w;i++)for(j=0;j<h;j++)used[i][j]=0;
	for(i=0;i<n;i++){
		int ax=find(xc.begin(),xc.end(),x1[i])-xc.begin();
		int bx=find(xc.begin(),xc.end(),x2[i])-xc.begin();		
		int ay=find(yc.begin(),yc.end(),y1[i])-yc.begin();		
		int by=find(yc.begin(),yc.end(),y2[i])-yc.begin();
		used[ax][ay]++;
		used[bx+1][by+1]++;
		used[ax][by+1]--;
		used[bx+1][ay]--;
	}
	for(i=0;i<w;i++){
		for(j=1;j<h;j++)used[i][j]+=used[i][j-1];
	}
	for(i=0;i<h;i++){
		for(j=1;j<w;j++)used[j][i]+=used[j-1][i];
	}
	int ans=0;
	for(i=0;i<w;i++){
		for(j=0;j<h;j++){
			if(used[i][j]==0){
				bfs(i,j);
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	}
}

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

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

	string S;
	cin >> S;

	vector<int> Nums;

	int now = 1;
	int cnt = 0;
	for (auto& c : S) {
		if (c == (char)('0' + now)) ++cnt;
		else
		{
			Nums.push_back(cnt);
			cnt = 1;
			now = 1 - now;
		}
	}
	if (cnt != 0) Nums.push_back(cnt);

	//if (Nums.size() % 2 == 0) Nums.push_back(0);

	int add = 2 * K + 1;
	int ans = 0;

	int left = 0;
	int right = 0;

	int tmp = 0;

	for (int i = 0; i < Nums.size(); i += 2) {
		int left_next = i;
		int right_next = min(i + add, (int)Nums.size());
		while (left_next > left) {
			tmp -= Nums[left];
			++left;
		}
		while (right_next > right) {
			tmp += Nums[right];
			++right;
		}
		ans = max(ans, tmp);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1020
#include <stdio.h>
#define max 10000

int main(void)
{
	int n;
	scanf("%d",&n);
	int i , k;
	int c[max];
	unsigned short *a , *b;
	a = malloc(sizeof(short)*n+1);
	b = malloc(sizeof(short)*n+1);

	scanf("%d",&a[0]);
	k = a[0];
	b[0] = 0;
	
	for( i = 1; i < n; i++)
	{
		scanf("%d",&a[i]);
		if(k < a[i])
		{
			k = a[i];
		}
		b[i] = 0;
	}
	
	for( i = 0; i <= k; i++)
	{
		c[i] = 0;
	}
	
	for( i = 0; i < n; i++)
	{
		c[a[i]]++;
	}
	
	for( i = 1; i <= k; i++)
	{
		c[i] = c[i] + c[i-1];
	}
	for( i = n; i >= 0; i--)
	{
		b[c[a[i]]] = a[i];
		c[a[i]]--;
	}
	for( i = 1; i <= n; i++)
	{
		if(i != n) printf("%d ",b[i]);
		else printf("%d\n",b[i]);
	}
	
	return 0;
}




Measured memory_bytes: 9652
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i;
	char a[100000];
	cin>>a;
	for(i=0;i<strlen(a);i++)
	{
		if((i+1)%2!=0)
		{
			cout<<a[i];
		}
	}
	cout<<endl;
 	return 0;
}


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

using namespace std;

int main()
{
  int N;
  cin >> N;
  int a = 0, b = 0;
  vector< int > A(N), nums(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    nums[i] = A[i];
  }
  sort(begin(nums), end(nums));
  for(int i = 0; i < N; i++) {
    int K = lower_bound(begin(nums), end(nums), A[i]) - begin(nums);
    if(i & 1) a += K % 2 == 0;
    else b += K % 2 == 1;
  }
  cout << max(a, b) << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
#define int long long
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 1000000007
#define pb push_back
#define MAXN 100005

int n, m, a[110], ans;

signed main()
{
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    for(int i = 0; i < n; i++){
        if(a[i] <= m){
            ans++;
            m -= a[i];
        }
        if(m > 0 && i == n - 1 && ans == n){
            ans--;
        }
    }
    ans = max(ans, 0ll);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
  
  std::string a,b,c;
  std::cin>>a>>b>>c;
  
  std::transform(a.begin(), a.end(), a.begin(), ::toupper);
  std::transform(b.begin(), b.end(), b.begin(), ::toupper);
  std::transform(c.begin(), c.end(), c.begin(), ::toupper);
  
  cout<<a.substr(0,1)<<b.substr(0,1)<<c.substr(0,1);
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    string s;
    cin >> n >> s;
    map<char, ll> mp;
    rep(i, n) mp[s[i]]++;
    ll cnt = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            int k = 2*j - i;
            if (k < 0 || n <= k) continue;
            if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) cnt++; 
        }
    }
    ll ans = mp['R'] * mp['G'] * mp['B'] - cnt;
    cout << ans << endl;
    
}

Measured memory_bytes: 3664
import Control.Monad
import Control.Applicative
import Data.List

maxNum :: Int
maxNum = 100000

data Seat = Seat Int Int

readPair :: IO Seat
readPair = do
    s <- words <$> getLine
    let [l, r] = map read s :: [Int]
    return (Seat l r)

calcSeats :: Seat -> Int
calcSeats (Seat l r) = r - l + 1

calcTotalSeats :: [Seat] -> Int ->  Int
calcTotalSeats [] n = n
calcTotalSeats (x:xs) n = 
    calcTotalSeats xs (n + calcSeats x)

main :: IO()
main = do
    n <- readLn :: IO Int
    seats <- replicateM n readPair
    let ans = calcTotalSeats seats 0
    print ans 

Measured memory_bytes: 1788