akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    int H, W, M;
    cin >> H >> W >> M;
    //各行、列に存在する爆破対象の分布を格納
    vector<int> h(H), w(W);
    //爆破対象の座標を集合stに格納
    set<pair<int, int>> st;

    //入力
    rep(i, M){
        int r, c;
        cin >> r >> c;
        r--, c--;
        h[r]++;
        w[c]++;
        st.emplace(r, c);
    }

    //各行、列に分布している爆破対象の最大値を格納
    int mh = 0, mw = 0;
    rep(i, H) mh = max(mh, h[i]);
    rep(i, W) mw = max(mw, w[i]);

    //爆破対象を最大値と同じだけ持つ行、列の番号を格納
    vector<int> ih, iw;
    rep(i, H) if(h[i] == mh) ih.push_back(i);
    rep(i, W) if(w[i] == mw) iw.push_back(i);

    //爆破対象を最大値分持つ行、列の交差する点に、爆破対象が存在するかをチェック
    //爆破対象が存在しない点が1つでもあるなら、ans = mh + mw;
    //爆破対象が存在しない点が見つからないなら、ans = mh + mw -1;
    int ans = mh + mw;
    rep(i, (int)ih.size()){
        rep(j, (int)iw.size()){
            //交差点に爆破対象が存在ない物がみつかれば、答えを出力して終了
            if(st.count(make_pair(ih[i], iw[j]))) continue;
            cout << ans << endl;
            return 0;
        }
    }
    ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23876
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;


lli mod197 = 1000000007LL;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

lli ac[100000] = {};

int main(void) {

	lli N, Q;
	cin >> N >> Q;
	string str;
	cin >> str;

	for (int i = 0; i < N; i++) {
		if (str[i] == 'A' && str[i + 1] == 'C') {
			ac[i] = 1;
		}
	}

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


	for (int i = 0; i < Q; i++) {
		lli l, r;
		cin >> l >> r;

		COUT(ac[r - 2] - (l - 2 < 0 ? 0 : ac[l - 2]));
	}



	return 0;
}





Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 5*(int)1e5 + 10;
// make sure N size is correctttt!!!!!!!!!


int n, a[N], b[N];
int32_t main(){_

   cin>>n;

   int sa = 0, sb = 0;

   for (int i = 1; i <= n; ++i)
   {
      cin>>a[i];
      sa += a[i];
   }

   for (int i = 1; i <= n; ++i)
   {
      cin>>b[i];
      sb += b[i];
   }


   if(sa < sb){
      cout<<-1;
      return 0;
   }

   int remove = 0;
   int ans = 0;
   vector<int> v;
   for (int i = 1; i <= n; ++i)
   {
      if(a[i] >= b[i]){
         v.pb(a[i]-b[i]);
      }
      else{
         remove += b[i] - a[i];
         ans++;
      }
   }

   sort(v.rbegin(), v.rend());
   for (int i = 0; i < sz(v) and remove > 0; ++i)
   {
      int tt = min(v[i], remove);
      ans++;
      remove -= tt;
   }

   cout<<ans;
   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 6264
#include <iostream>

using namespace std;
int main() {
	long int n, ans, a, b, amari;
	cin >> n >> a >> b;
	amari = n % (a + b);
	if (amari > a)amari = a;
	ans = (n / (a + b)) * a + amari;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(int i=0;s[i];i++){
		if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){
			cout<<"vowel";
		}else cout<<"consonant";
	}
}

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

using namespace std;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) (int)a.size()
#define fi first
#define se second
#define ar array

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int > pii;
const ll MOD =1e9+7;

void solve(){
	int n,k,ans=1e9+10; cin >> n >> k;
	vi a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	for(int i = 0; i < n-k+1; ++i){
		if(a[i] > 0)
			ans = min(ans,a[i+k-1]);
		else if(a[i+k-1]<0)
			ans = min(ans,-a[i]);
		else
			ans =min(ans,-a[i]+a[i+k-1]+min(-a[i],a[i+k-1]));
	}
	cout << ans;
}
int main(){
	int t=1;
	//cin >> t;
	while(t--){
		solve();
		cout <<'\n';
	}
}


Measured memory_bytes: 3720
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scanln(&s)

	size := len(s)
	n, _ := strconv.Atoi(s)

	p3 := 9
	cnt := 0
	for i := 3; i < size; i++ {
		p3 *= 3
		p2 := 1 << uint(i)
		cnt += p3 - p2*3 + 3
	}

	ds := make([]int, size)

	base3 := make([]int, len(ds))
	base10 := make([]int, len(ds))
	for i, _ := range ds {
		j := len(ds) - i - 1
		base3[j] = int(math.Pow(3, float64(i)))
		base10[j] = int(math.Pow(10, float64(i)))
	}

	masks := []int{1, 2, 4}
	vals := []int{3, 5, 7}

	nLoop := base3[0] * 3
	for t := 1; t < nLoop; t++ {
		mask := 0
		sum := 0
		for i, u := range base3 {
			if t%u == 0 {
				ds[i] = (ds[i] + 1) % 3
			}
			mask = mask | masks[ds[i]]
			sum += vals[ds[i]] * base10[i]
		}
		if sum > n {
			break
		}
		if mask == 7 {
			cnt += 1
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
ll N;
ll a[410];
ll dp[410][410] = {};
ll sum[410] = {};
ll dfs(ll lv, ll rv){
    ll &res = dp[lv][rv];
    if(~res) return res;
    res = INF;
    if(lv+1 == rv){
        res = 0;
        return 0;
    }
    rep(k,lv+1,rv){
        res = min(res, dfs(lv,k) + dfs(k,rv) + (sum[rv] - sum[lv]));
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    rep(i,0,N){
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));
    rep(i,0,N){
        sum[i+1] = sum[i] + a[i];
    }
    dfs(0,N);
    print(dp[0][N]);


}


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

P f(int x) {
  int a = x%10;
  int b = 0;
  while (x) {
    b = x;
    x /= 10;
  }
  return P(a,b);
}

int main() {
  int n;
  cin >> n;
  map<P,int> freq;
  for (int i = 1; i <= n; ++i) {
    P p = f(i);
    freq[p]++;
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    P p = f(i);
    P q(p.second, p.first);
    ans += freq[q];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import  math

n = int(input())

ans = n-1

for i in range(1,math.ceil(math.sqrt(n))+1):
    if n % i == 0: ##もしiがnの約数ならば
        j = int(n / i) #i x j = N を j = N / iに式変形
        ans = min(ans,i+j-2) #(1,1)から(i,j)に至るまでの　i-1+j-1 = i + j - 2の最小値を求める

print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <vector>

using namespace std;

int n, m;

struct Factor 
{
	int num;
	int count;
};

std::vector<Factor> factors;

int maxG;

void doFactor(int m)
{
	factors.clear();
	
	int num = m;
	int d = 2;
	while (d * d <= num)
	{
		if (num % d == 0)
		{
			Factor newFactor;			
			newFactor.num = d;
			newFactor.count = 1;
			num = num / d;
			while (num % d == 0)
			{
				num = num / d;
				newFactor.count++;
			}
			
			factors.push_back(newFactor);
		}
		
		d++;
	}
	
	if (num != 1)
	{
		Factor newFactor;
		newFactor.num = num;
		newFactor.count = 1;
		factors.push_back(newFactor);
	}
}

void doSearch(int d, int curNum)
{
	if (d >= factors.size())
	{
		if (curNum >= n)
		{
			int curCount = m / curNum;
			if (maxG < curCount)
				maxG = curCount;
		}
	}
	else
	{
		int newNum = curNum;
		for (int i = 0 ; i <= factors[d].count ; i++)
		{
			doSearch(d + 1, newNum);
			newNum = newNum * factors[d].num;			
		}
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	
	doFactor(m);
	
	maxG = 1;
	doSearch(0, 1);
	
	printf("%d\n", maxG);
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int N;
  cin >> N;
  vector<int> A;

  for (size_t i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
  }

  string result = "second";
  for (int a : A) {
    if (a % 2 == 1) {
      result = "first";
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define eps 1e-6
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=0, k=0, i, j,l=2e9+7;
  string s, r, y;
  cin>>n;
  ll ar[n];
  rep(i,0,n){ cin>>ar[i];k+=ar[i];}
  m=abs(k-ar[0]);
  rep(i,0,n)
  {
    b+=ar[i];
    ll z=k-b;
    m=min(m,abs(z-b));
  }
  //k=min(n+a,min(n+b,a+b));
  cout<<m;
  /*if(n<a) cout<<0;
  else cout<<10;*/
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

string N;
int K;

ll dp[110][2][4];

ll rec(int i = 0, bool smaller = false, int k = K) {
    if (k == 0) return 1;
    if (i >= N.size()) return 0;

    ll &ret = dp[i][(int)smaller][k];
    if (ret > 0) return ret;
    ret = 0;

    if (smaller) {
        ret += rec(i + 1, true, k);            // 次の桁が0の時
        ret += rec(i + 1, true, k - 1) * 9LL;  // 次の桁が0以外の時
    } else {
        if (N[i] == '0') {  // 次の桁が0しかありえない時
            ret += rec(i + 1, false, k);
        } else {
            ret += rec(i + 1, true, k);                     // 次の桁が0の時
            ret += rec(i + 1, true, k - 1) * (N[i] - '1');  // 次の桁が0でもS[i]でも無い時
            ret += rec(i + 1, false, k - 1);                // 次の桁がS[i]の時
        }
    }
    return ret;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    cin >> N;
    cin >> K;
    cout << rec() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
const int N=410,P=998244353;
int n,fac[N],ifac[N],dp[N][N],dd[N][N],ta,tb,sum,inv,a[N],b[N],ans;
int ksm(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%P) if(b&1) ans=1ll*ans*a%P;
	return ans;
}
void pre(int n){
	fac[0]=1;
	rep(i,1,n) fac[i]=1ll*fac[i-1]*i%P;
	ifac[n]=ksm(fac[n],P-2);
	per(i,n,1) ifac[i-1]=1ll*ifac[i]*i%P;
}
void upd(int &x,int y){((x+=y)>=P)&&(x-=P);}
int main(){
	scanf("%d",&n);pre(400);
	rep(i,1,n) scanf("%d%d",a+i,b+i),sum+=a[i];
	dp[0][0]=1;inv=ksm(sum,P-2);
	rep(i,1,n){
		rep(j,0,ta) rep(k,0,tb) dd[j][k]=dp[j][k],dp[j][k]=0;
		rep(j,0,ta) rep(k,0,tb) if(dd[j][k]){
			upd(dp[j+a[i]][k],dd[j][k]);int orz=1,cmz=1ll*a[i]*inv%P;
			rep(l,0,b[i]-1)	upd(dp[j][k+l],P-1ll*orz*ifac[l]%P*dd[j][k]%P),orz=1ll*orz*cmz%P;
		}
		ta+=a[i],tb+=b[i]-1;
	}
	//rep(i,0,ta){rep(j,0,tb) printf("%d ",dp[i][j]);puts("");}
	rep(i,0,sum-1){
		int orz=1ll*ksm(sum-i,P-2)*sum%P,cmz=orz;
		rep(j,0,tb) upd(ans,1ll*cmz*dp[i][j]%P*fac[j]%P),cmz=1ll*orz*cmz%P;
	}
	printf("%d\n",ans?P-ans:0);
	return 0;
}

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

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie();
    cout.tie();
    int i;
	int n;
	cin>>n;
	int a[n],b[n];
	for (i = 0 ; i < n ; i++) cin>>a[i];
	for (i = 0 ; i < n ; i++) cin>>b[i];
	int s[3*n+2];
	s[0] = -2;
	for (i = 1; i < n+1 ; i++) s[i] = b[i-1]^b[i%n];
	s[n+1] = -1;
	for (i = n+2; i < 2*n+2 ; i++) s[i] = a[i-n-2]^a[(i-n-1)%n];
	for (i = 2*n+2; i < 3*n+2 ; i++) s[i] = s[i-n];
	//for (i = 0; i < 3*n+2; i++) cout<<s[i]<<" ";
	int P[3*n+2];
	P[1] = 0;
	for (i = 2; i < 3*n+1; i++){
		int ps = P[i-1];
		while (s[i] != s[ps+1] && ps) ps = P[ps];
		if (s[i] == s[ps+1]) P[i] = ps+1;
		else P[i] = 0;
		if (P[i] == n) cout<<i-2*n-1<<" "<<(b[0]^a[i-2*n-1])<<"\n";
	}
    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,X;
int A[202020];
int B[202020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X;
	if(X==1 || X==2*N-1) return _P("No\n");
	FOR(i,2*N-1) A[(i+N-1)%(2*N-1)]=(X-1+i)%(2*N-1)+1;
	_P("Yes\n");
	FOR(i,2*N-1) _P("%d\n",A[i]);
	return;
	/*
	X=2*N-1;
	while(X>1) {
		FOR(i,X-2) {
			int C[3]={A[i],A[i+1],A[i+2]};
			sort(C,C+3);
			B[i]=C[1];
			_P("%d ",B[i]);
		}
		_P("\n");
		X-=2;
		swap(A,B);
	}
	*/
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 2304
n = int(input())
s = [input() for _ in range(n)]
set_s = list(set(s))
m = int(input())
t = [input() for _ in range(m)]
ans = [s.count(set_s[i]) - t.count(set_s[i]) for i in range(len(set_s))]
print(max(0, max(ans)))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	VE p(m), y(m); rep(i, m)cin >> p[i] >> y[i];
	vector<P>tmp(m);
	rep(i, m)tmp[i] = make_pair(p[i], y[i]);
	sort(ALL(tmp));
	map<P, int>mp;
	int now = 0;
	rep(i, m) {
		if (i - 1 >= 0) {
			if (tmp[i - 1].first != tmp[i].first)now = 0;
		}
		mp[make_pair(tmp[i].first,tmp[i].second)] = now + 1;
		now++;
	}
	rep(i, m) {
		int ans = mp[make_pair(p[i], y[i])];
		printf("%06d", p[i]);
		printf("%06d\n", ans);
	}
	return 0;
}

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

int main(){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    int j = 0;
    int ans;
    if(S[0] == 'L'){
        rep(i, N-1){
            if(S[i] == 'L' && S[i+1] == 'R'){
                j++;
            }
        }
        if(j <= K) ans = N-1;
        else if(S[N-1] == 'L') ans = N-1 - 2*(j-K);
        else ans = N - 2*(j-K);
    }
    if(S[0] == 'R'){
        rep(i, N-1){
            if(S[i] == 'R' && S[i+1] == 'L'){
                j++;
            }
            if(j <= K) ans = N-1;
            else if(S[N-1] == 'R') ans = N-1 - 2*(j-K);
            else ans = N- 2*(j-K);
        }
    }
    cout << ans << endl;
}

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

int n,a,sol=0;
vector<int> V;
int arr[1000020];

int main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a;
        V.push_back(a);
    }
    sort(V.begin(),V.end());
    V.push_back(INT_MAX);
    for (int i=0;i<n;i++) {
        if (arr[V[i]]==0 && V[i]!=V[i+1]) {sol++;}
        if (i>0 && V[i]==V[i-1]) {continue;}
        for (int j=1;j<=1000005/V[i];j++) arr[j*V[i]]=1;
    }
    cout << sol << endl;

}


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

int N,A,B,C;
int l[8];

int dfs(int depth, int a, int b, int c){
	if(depth == N){
		if(a == 0 || b == 0 || c == 0)return 1e9;//竹が1本も使われていなければ延長魔法も使えない
		return abs(a - A) + abs(b - B) + abs(c - C);
	}
	int ans = 1e9;
	ans = min(ans, dfs(depth + 1, a + l[depth], b, c) + (a > 0 ? 10 : 0)/*a > 0 なら10、そうでなければ0*/);//l[depth]の竹を竹Aに使うとき
	ans = min(ans, dfs(depth + 1, a, b + l[depth], c) + (b > 0 ? 10 : 0)/*b > 0 なら10、そうでなければ0*/);//l[depth]の竹を竹Bに使うとき
	ans = min(ans, dfs(depth + 1, a, b, c + l[depth]) + (c > 0 ? 10 : 0)/*c > 0 なら10、そうでなければ0*/);//l[depth]の竹を竹Cに使うとき
	ans = min(ans, dfs(depth + 1, a, b, c));//l[depth]の竹を使わないとき
	return ans;
}

int main(){
	cin >> N >> A >> B >> C;
	for(int i = 0; i < N; i++)cin >> l[i];
	cout << dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n,m;
  cin>>n>>m;
  bool hole[100010]={};
  int a;
  REP(i,m){
    cin>>a;
    hole[a]=true;
  }
  long long dp[100010]={};
  dp[0]=1;
  REPP(i,100005){
    if(hole[i]){
      continue;
    }else{
      if(i>=2){
        dp[i]=mod(dp[i-1]+dp[i-2]);
      }else{//iが1以上の時
        dp[i]=dp[i-1];
      }
    }
  }
  cout<<dp[n]<<endl;
  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;  
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const double eps = 1e-14;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl  
#define DIV 1000000007

map<int,ll> data;
int N;

void fill_data(int n){
	for(int i = 2; i <= n; i++){
		if(n%i == 0){
			n /= i;
			data[i]++;
			i--;
		}
	}
	return;
}

int main(){
	cin >> N;
	for(int i = 1; i <= N ; i++)
		fill_data(i);
	ll ans = 1;
	for(int i = 1; i <= N; i++){
		ans *= ((data[i] + 1) % DIV);
		ans %= DIV;
	}
	cout << ans << endl;
	return 0;
}

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

#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define eb emplace_back
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using ull = unsigned long long;
using Vi = vector<int>;

void run() {
 	int m, n;
 	cin >> m >> n;
 	Vi ara(m);
 	int sum = 0;

 	for (auto& I : ara) {
 		cin >> I;
 		sum += I;
 	}
 	bool ok = 1;
 	int cnt = 0;
 	double need = (sum*1.0)/ (4*n);
 	for (auto i : ara) {
 		if((double)i < need) {
 			ok = 0;
 			// break;
 		}
 		else cnt ++;
 	}

 	cout << (cnt >= n? "Yes" : "No")  << endl;
}

// y > x/z;
// yz < x;

int main() 
{
    IO;
    double st = clock();
    run();
    cerr << "\n" << "time = " << (clock() - st) / CLOCKS_PER_SEC << "\n";
    return 0;
}

Measured memory_bytes: 3816
#include<iostream>
#include<algorithm>
#include<deque>
using namespace std;

int main(){
    string s,t;
    int q;
    cin>>s>>q;
    for(int i=0;i<q;i++){
        int n; cin>>n;
        if(n==1){
            swap(s,t);
        }else{
            int f;
            char c;
            cin>>f>>c;
            if(f==1) t+=c;
            else s+=c;
        }
    }
    reverse(t.begin(),t.end());
    cout<<t+s<<endl;
}

Measured memory_bytes: 1248
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(ans%(10**9+7)-1)

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s;
  cin>>s;
  string t = "CODEFESTIVAL2016";
  int k=0;
  REP(i,s.size())k+=!(s[i]==t[i]);
  cout<<k<<endl;
  return 0;
}


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

int main()
{
  long  n;
  long k;
  cin>>n;
  cin>>k;
  vector<long> nums(n);
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    nums[i]=x;
  }
    vector<long> dp(n,INT_MAX);
    dp[0]=0;
    dp[1]=abs(nums[0]-nums[1]);
    for(long i=2;i<=n;i++)
    {  
  		for(long j=1;j<=k && (i-j)>=0 && (i-j)<n;j++)
          dp[i]=min(dp[i],dp[i-j]+abs(nums[i]-nums[i-j]));
    }
    cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll h,w,n;
    cin >> h >> w >> n;
    ll ans=0;
    if(h<w){
        ans=(n/w)+1;
        if(n%w==0) ans--;
    }
    else {
        ans=(n/h)+1;
        if(n%h==0) ans--;
    }
    cout << ans << endl;
}

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

int A[200005];

int cnt[1000005];

bool isComposite[1005];
vector<int> p;

int main(){
    int N;
    scanf("%d", &N);

    for(int i = 2; i*i <= 1001; i ++){
        if(!isComposite[i]){
            for(int j = i*i; j <= 1001; j += i){
                isComposite[j] = 1;
            }
        }
    }

    for(int i = 2; i <= 1001; i ++){
        if(!isComposite[i]){
            p.push_back(i);
        }
    }

    memset(cnt, 0, sizeof(cnt));
    for(int i = 0; i < N; i ++){
        scanf("%d", &A[i]);
        cnt[A[i]] ++;
    }

    int ans = 0;
    for(int i = 0; i < N; i ++){
        cnt[A[i]] --;
        bool legit = true;
        for(int j = 1; j <= 1001; j ++){
            if(A[i]%j == 0){
                if(cnt[j] || cnt[A[i]/j]){
                    legit = false;
                    break;
                }
            }
        }
        ans += legit;
        cnt[A[i]] ++;
    }

    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 8456
#include "bits/stdc++.h"
using namespace std;

constexpr long long MOD = 998244353;

int main() {
	int N;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	if (N % 2 == 1) {
		long long COUNT = 0;
		for (int i = 0; i < N; i++) COUNT += A[i];
		cout << (COUNT % 2 == 0 ? "Second" : "First") << endl;
		return 0;
	}
	long long COUNT = 0, MIN = 1000000000000;
	for (int i = 0; i < N; i++) COUNT += A[i], MIN = min(MIN, A[i]);
	cout << ((COUNT % 2 == 0 && MIN % 2 == 0) ? "Second" : "First") << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */
const ll MAXV = e5 + 5;
vl xy[MAXV * 2];
vl cnt;
bool visited[MAXV * 2];

void dfs(ll now) {
    visited[now] = true;
    each(e, xy[now]) {
        if (visited[e]) continue;
        cnt[e / MAXV]++;
        dfs(e);
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll n = inl();
        rep(i, n) {
            ll x, y;
            cin >> x >> y;
            xy[x].eb(y + MAXV);
            xy[y + MAXV].eb(x);
        }
        ll ans = 0;
        rep(i, MAXV * 2) {
            if (visited[i]) continue;
            cnt = vl(2);
            cnt[i / MAXV]++;
            dfs(i);
            ans += cnt[0] * cnt[1];
        }
        cout << ans - n << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 10240
#include <iostream>

using namespace std;

bool solve(int a)
{
    for(int i=1;i*i<=a;i++) if(i*i==a) return 1;
    return 0;
}

int main()
{
    int n,d;
    cin >> n >> d;
    int a[n][d];
    for(int o=0;o<n;o++) for(int i=0;i<d;i++) cin >> a[o][i];
    int res=0;
    for(int o=0;o<n;o++)
    {
        for(int i=o+1;i<n;i++)
        {
            int t=0;
            for(int j=0;j<d;j++) t+=((a[o][j]-a[i][j])*(a[o][j]-a[i][j]));
            res+=solve(t);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int m, r, f;
	while (1) {
		cin >> m;
		cin >> r;
		cin >> f;
		if (m == -1 && r == -1&&f == -1)break;
		if (m == -1 || r == -1)cout << "F\n";
		else if(m + r >= 80)cout << "A\n";
		else if (m + r >= 65 && m + r < 80)cout << "B\n";
		else if (m + r >= 50 && m + r < 65)cout << "C\n";
		else if (m + r >= 30 && m + r < 50 && f >= 50)cout << "C\n";
		else if (m + r >= 30 && m + r < 50 && f < 50)cout << "D\n";
		else if (m + r < 30)cout << "F\n";



	}








}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int n,i,ali,bob;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ali = 0;
	bob = 0;
	rep(i, n) {
		if (i % 2 == 0)ali += a.at(i);
		else bob += a.at(i);
	}

	cout << ali - bob << endl;

	return 0;
}

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

int main(){
	int n, output = 100000;
	cin >> n;
	for (int i = 0; i < n; i++){
		output *= 1.05;
		if (output % 1000 != 0){
			output += 1000;
			output -= output % 1000;
		}
	}
	cout << output << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  vector<vector<char>> c(N,vector<char>(10));
  rep(i,N) {
    cin >> s[i];
    rep(j,10) c[i][j]=s[i][j];
    sort(c[i].begin(),c[i].end());
  }
  sort(c.begin(),c.end());
  ll ans=0,count=1;
  rep(i,N) {
    if(i<N&&c[i]==c[i+1]) count++;
    else {
      ans+=count*(count-1)/2;
      count=1;
    }
  }
  cout << ans << endl;
}

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

int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() != B.size()) {
    if (A.size() > B.size()) {
      cout << "GREATER" << endl;
    } else {
      cout << "LESS" << endl;
    }
  } else {
    if (A > B) {
      cout << "GREATER" << endl;
    } else if (A < B) {
      cout << "LESS" << endl;
    } else {
      cout << "EQUAL" << endl;
    }
  }
}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int gr[10][10];
int n,m;
int vis[10];

int solve(int p, int depth) {
  if (depth == n){
    return 1;
  }
  vis[p] = 1;
  int res = 0;
  for(int i=0;i<n;i++){
    if(i==p)continue;
    if(gr[p][i] && !vis[i]){
      res += solve(i, depth+1);
    }
  }
  vis[p] = 0;
  return res;
}

int main(int argc, char *argv[]) { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    gr[a][b]=1;
    gr[b][a]=1;
  }

  int res = solve(0, 1);
  cout<<res<<endl;

  return 0;
}


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

int main() {
  int m,n;
  cin >> n >> m;
  vector<string> a(n),b(m);
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }
  for(int i=0;i<m;i++) {
    cin >> b[i];
  }
  for(int h=0;h<=n-m;h++) {
    for(int w=0;w<=n-m;w++) {
      bool flag=true;
      for(int i=h;i<h+m;i++) {
        for(int j=w;j<w+m;j++) {
          if(a[i][j]!=b[i-h][j-w]) {
            flag=false;
            break;
          }
        }
      }
      if(flag) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF INT_MAX/2

int N;

bool comp(pair<int, int> a, pair<int, int> b)
{
	return a.first < b.first;
}

int maketime(int s, int m, int h)
{
	int hh = (h - (m / 12) + 60) % 60;
	if (hh % 5 != 0) return -1;
	hh /= 5;

	return hh * 60 * 60 + m * 60 + s;
}

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

	while (cin >> N)
	{
		if (N == 0) return 0;
		vector<pair<int, int> > times;
		rep(i, 0, N)
		{
			int s, t, u; cin >> s >> t >> u;
			t -= s;
			u -= s;
			s = 0;

			rep(ss, 0, 60)
			{
				int tt = (ss + t + 60) % 60;
				int uu = (ss + u + 60) % 60;

				int time = maketime(ss, tt, uu);
				if (0 <= time) times.push_back(make_pair(time, i));

				time = maketime(ss, uu, tt);
				if (0 <= time) times.push_back(make_pair(time, i));

				time = maketime(tt, ss, uu);
				if (0 <= time) times.push_back(make_pair(time, i));

				time = maketime(tt, uu, ss);
				if (0 <= time) times.push_back(make_pair(time, i));

				time = maketime(uu, tt, ss);
				if (0 <= time) times.push_back(make_pair(time, i));

				time = maketime(uu, ss, tt);
				if (0 <= time) times.push_back(make_pair(time, i));
			}
		}

		sort(times.begin(), times.end(), comp);

		int ans = INF;
		int ans_s = -1, ans_t;

		rep(i, 0, times.size())
		{
			int m = 0;
			rep(j, i, times.size())
			{
				m = m | (1 << times[j].second);
				if (m == (1 << N)-1)
				{
					int len = times[j].first - times[i].first;
					if (len < ans)
					{
						ans = len;
						ans_s = times[i].first;
						ans_t = times[j].first;
					}
					break;
				}
			}
		}

		if (ans_s < 0)
			cout << "???" << endl;
		else
		{
			int hh, mm, ss;
			ss = ans_s % 60; ans_s /= 60;
			mm = ans_s % 60; ans_s /= 60;
			hh = ans_s;
			printf("%02d:%02d:%02d", hh, mm, ss);
			ss = ans_t % 60; ans_t /= 60;
			mm = ans_t % 60; ans_t /= 60;
			hh = ans_t;
			printf(" %02d:%02d:%02d\n", hh, mm, ss);
		}
	}
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
const int MN=10000+5;
using namespace std;
typedef long long ll;
template<typename T>T&IN(T&in){
	in=0;char c=getchar();int f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))in=in*10+c-'0',c=getchar();
	in*=f;return in;
}
struct data{int c[4];}a[MN],t;
int n;ll ans;
ll has[MN],fact[4],tmp[4];
map<ll,int>mp;
void add(ll has,int d){
	for(int i=3;i>=0;--i)tmp[i]=has%1000,has/=1000;
	for(int i=0;i<4;++i){
		has=0;
		for(int j=0;j<4;++j)
			has=has*1000+tmp[(i+j)&3];
		mp[has]+=d;
	}
}
ll get(data a){ll res=0;for(int i=0;i<4;++i)res=res*1000+a.c[i];return res;}
void input(){
	IN(n);
	for(int i=1;i<=n;++i){
		for(int j=0;j<4;++j)IN(a[i].c[j]);
		has[i]=get(a[i]),add(has[i],1);
	}
	for(int i=1;i<=n-5;++i){
		add(has[i],-1);
		for(int j=i+1;j<=n;++j){
			add(has[j],-1);
			for(int k=0;k<4;++k){
				int F=0;ll s=1;
				for(int l=0;l<4;++l){
					t.c[0]=a[i].c[(l+1)&3],t.c[1]=a[i].c[l];
					t.c[2]=a[j].c[(k-l+4)&3],t.c[3]=a[j].c[(k-l+3)&3];
					fact[l]=get(t);
					if(!mp[fact[l]]){F=1;break;}
				}
				if(F)continue;
				for(int l=0;l<4;++l)s*=mp[fact[l]],add(fact[l],-1);
				for(int l=0;l<4;++l)add(fact[l],1);
				ans+=s;
			}
			add(has[j],1);
		}
	}
	printf("%lld\n",ans);
}
int main(){
	input();
	return 0;
}

Measured memory_bytes: 20352
#include<iostream>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  
  long a;
  long b;
  
  if(A > B) {
    a = A;
    b = B;
  }
  else {
    a = B;
    b = A;
  }
  
  if(a % b == 0) cout << a << endl;
  
  else {
    for(int i = 1; i <= b; i++) {
      if(a * i % b == 0) {
        cout << a * i << endl;
        break;
      }
    }
  } 
}

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

typedef long long int ll;
long long int N, dn[3003][3003], a[3003];

ll mx(ll a, ll b){ return (a > b ? a : b); }

ll dp(int start, int end){
    if(start > end) return 0;
    if(dn[start][end] != -1) return dn[start][end];
    ll p1 = a[start] - dp(start+1, end), p2 = a[end] - dp(start, end-1);
    return dn[start][end] = mx(p1, p2);
}

int main(int argc, char **argv){
    memset(dn, -1, sizeof dn);

    scanf("%lld", &N); for(int i = 0; i < N; ++i) scanf("%lld", &a[i]);
    printf("%lld\n", dp(0, N-1));

    return 0;
}

//cikisir


Measured memory_bytes: 70784
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
double D;
int x[200005],y[200005];
cin>>n>>D;
for(int i=0;i<n;i++)
cin>>x[i]>>y[i];
double d;

int ans=0;

for(int i=0;i<n;i++)
{   double a=x[i],b=y[i];
    d=sqrt(a*a+b*b);
    if(d<=D)
    ans++;

}

cout<<ans;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	ll n, lt, c, t, res = INF;
	cin >> n >> lt;
	REP(i, n) {
		cin >> c >> t;
		if (t <= lt) res = min(res, c);
	}
	if (res >= INF) cout << "TLE" << endl;
	else cout << res << endl;
	return 0;
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import bisect
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0

A,B=[0],[0]
for i in range(n):
  A.append(a[i]+A[i])
for i in range(m):
  B.append(b[i]+B[i])

for j in range(n+1):
  K=k-A[j]
  if K<0:
    break
  else:
    ans=max(ans,bisect.bisect_right(B,K)+j-1)
print(ans)
    

Measured memory_bytes: 127072
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll N,M,ans=0;
  cin>>N>>M;
  vector<ll> h(N);
  vector<ll> check(N);
  for(ll i=0;i<N;i++){
    cin>>h.at(i);
  }
    for (ll i=0; i<M; i++) {
        int a, b;
        cin >> a >> b;
        if(h.at(a-1)>=h.at(b-1)){check.at(b-1)++;}
        if(h.at(a-1)<=h.at(b-1)){check.at(a-1)++;}
    }
  for(ll i=0;i<N;i++){
    if(check.at(i)==0){ans++;}
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4840
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
  input! {
    N:Chars,
  }
  let mut ans = 0;
  for &i in N.iter(){
    ans += (i as u8 -'0' as u8) as u64;
  }
  ans %= 9;
  println!("{}", if ans ==0 {"Yes"}else{"No"});
}


Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int n,m,a,b,r;
	cin>>n>>m;
	vector<int>w[100001];
	while(m--)
    {
        cin>>a>>b;
        w[a].push_back(b);
        w[b].push_back(a);
    }
    r=0;
    bool y[100001]={0};
    for(int i=1;i<=n;i++)
    {
        if(y[i])
            continue;
        r++;
        vector<int>p;
        p.push_back(i);
        y[i]=1;
        int k=0;
        while(1)
        {
            if(k>=p.size())
                break;
            int pi=p[k];
            int pki=w[pi].size();
            for(int j=0;j<pki;j++)
            {
                if(y[w[pi][j]])
                    continue;
                y[w[pi][j]]=1;
                p.push_back(w[pi][j]);
            }
            k++;
        }
    }
    cout<<r-1<<endl;
	return 0;
}


Measured memory_bytes: 9072
N = int(input())
As = sorted(map(int, input().split()))
Bs = sorted(map(int, input().split()))
Cs = sorted(map(int, input().split()))

A_ind = 0
C_ind = 0
ans = 0
for B in Bs:
    while A_ind < N and As[A_ind] < B:
        A_ind += 1
    while C_ind < N and Cs[C_ind] <= B:
        C_ind += 1
    ans += A_ind * (N - C_ind)

print(ans)

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

using namespace std;

int ans[26] = {};

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

	for (int i = 0; i < n; i++)
	{
		ans[s[i] - 'a'] = 1;
	}

	for (int i = 0; i < 26; i++)
	{
		if (ans[i] == 0)
		{
			putchar(i + 'a');
			break;
		}
		if (i == 25)
		{
			cout << "None";
		}
	}
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
const int N = 200001;
using namespace std;




int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int n;
    cin >> n;
    int a[n + 1][n + 1];
    for (int i = 1; i < n + 1; i++) {
        for (int j = 1; j < n + 1; j++) {
            a[i][j] = __gcd(i, j);
        }
    }

    ll ans = 0;
    for (int i = 1; i < n + 1; i++) {
        for (int j = 1; j < n + 1; j++) {
            for (int k = 1; k < n + 1; k++) {
                ans += a[i][a[j][k]];
            }
        }
    }

    cout << ans;

}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
#define N (int)2e5
int n, m, sum;
int a[N], ans[N + 1];
int main(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> a[i];
        sum += a[i];
    }
    cout << (n >= sum ? n - sum : -1) << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int x[100005],xx[100005];
int main()
{

    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>x[i];

    for (int i=1;i<=n;i++)
        xx[x[i]]=i;

    for (int i=1;i<=n;i++){
        if(i!=1)cout<<" ";

        cout<<xx[i];
    }
    cout<<endl;

	return 0;
}


Measured memory_bytes: 1536
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    H, A = read_ints()
    return H//A + (1 if H%A != 0 else 0)


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 61824
#include<bits/stdc++.h>
using namespace std;
int main(){
	char S[100001];
	scanf("%s", S);
	int ans = 0;
	for(int i = 0; i < strlen(S) - 1; i++){
		if(S[i] != S[i + 1]) ans++;
	}
	printf("%d\n", ans);
	return 0;
}


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

using namespace std;

int main() {
	int k;
	cin >> k;
	int o,e;
	if (k%2 == 0) {
		e = k/2;
		o = k/2;
	} else {
		e = (k-1)/2;
		o = e+1;
	}
	cout << e*o << "\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Person implements Comparable<Person> {

    final int no;
    final double time;

    Person( final int no, final double time ) {
	this.no = no;
	this.time = time;
    }
    
    public int compareTo( final Person p ) {
	return Double.compare( time, p.time );
    }

    public String toString() {
	return String.format( "%d %.2f", no, time );
    }
}

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );
	final ArrayList<Person> last = new ArrayList<Person>();
	final ArrayList<Person> rest = new ArrayList<Person>();
	
	for ( int i = 0; i < 3; i++ ) {
	    final ArrayList<Person> semifinal = new ArrayList<Person>();
	    for ( int j = 0; j < 8; j++ ) {
		semifinal.add( new Person( stdin.nextInt(), stdin.nextDouble() ) );
	    }
	    Collections.sort( semifinal );
	    last.add( semifinal.remove( 0 ) );
	    last.add( semifinal.remove( 0 ) );
	    rest.addAll( semifinal );
	}
	Collections.sort( rest );
	last.add( rest.remove( 0 ) );
	last.add( rest.remove( 0 ) );
	for ( Person p : last ) {
	    System.out.println( p );
	}
    }    
}

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


class StringSearch {
	const int n;
	string S;
	vector<int> SA, Rank;
public:
	StringSearch(const string &S_)
		: n(S_.size()), S(S_), SA(n + 1), Rank(n + 1)
	{
		for (int i = 0; i <= n; i++) {
			SA[i] = i;
			Rank[i] = i < n ? S[i] : -1;
		}

		vector<int> tmp(n + 1);
		for (int k = 1; k <= n; k *= 2) {
			auto Compare_SA = [=](int i, int j) {
				if (Rank[i] != Rank[j]) return Rank[i] < Rank[j];
				else {
					int ri = i + k <= n ? Rank[i + k] : -1;
					int rj = j + k <= n ? Rank[j + k] : -1;
					return ri < rj;
				}
			};
			sort(SA.begin(), SA.end(), Compare_SA);

			tmp[SA[0]] = 0;
			for (int i = 1; i <= n; i++) {
				tmp[SA[i]] = tmp[SA[i - 1]] + (Compare_SA(SA[i - 1], SA[i]) ? 1 : 0);
			}
			for (int i = 0; i <= n; i++) {
				Rank[i] = tmp[i];
			}
		}
	}

	bool Contain(const string &T) {
		int a = 0, b = n;
		while (b - a > 1) {
			int c = (a + b) / 2;
			if (S.compare(SA[c], T.length(), T) < 0) a = c;
			else b = c;
		}
		return S.compare(SA[b], T.length(), T) == 0;
	}
};

int main()
{
	int Q;
	string T, P;
	cin.sync_with_stdio(false);
	cin >> T;
	StringSearch SS(T);
	cin >> Q;
	while (Q--) {
		cin >> P;
		cout << SS.Contain(P) << endl;
	}
	return 0;
}

Measured memory_bytes: 16588