akhauriyash/Code-Regression huggingface dataset:
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

const int N = 1e6 + 5;
int f[N] ;
int sv[N] ;

void sieve() {
	for(int i = 1 ; i < N ; ++i ) sv[i] = i ;

	for(int i = 2 ; i < N ; ++i) {
		if(sv[i] == i) {
			for(int j = 2*i ; j < N ; j += i) {
				if(sv[j] == j ) sv[j] = i ; 
			}
		}
	}
}

void solve(int test) {
	
	sieve() ;

	int n; cin >> n ;
	int a[n]; rep(i,0,n) cin >> a[i] ;
	int gcd = a[0] ;
	rep(i,1,n) gcd = __gcd(gcd, a[i]) ;

	for(int i = n-1 ; i >=0 ; --i) {
		int t= a[i] ;

		while(t != 1) {
			if((f[t] != 0 and f[t] != i) or (f[sv[t]] != 0 and f[sv[t]] != i)) {
				if(gcd == 1) cout << "setwise coprime" ;
				else cout << "not coprime" ;
				return ; 
			}
			f[t] = i; 
			f[sv[t]] = i ; 
			t /= sv[t] ; 
		}

		// rep(i,1,17) cout << f[i] << " " ; cout << nl ;
	}

	cout << "pairwise coprime" ;
}

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

    fast;
	int t=1;
	// cin>>t;
	rep(i,1,t+1) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 19888
#include <stdio.h>

int main(void) {

	int A;
	int B;

	scanf("%d", &A);
	scanf("%d", &B);      
    
  
    if((A+B)%2 == 0){
      printf("%d",(A+B)/2);
    }
    else{
      puts("IMPOSSIBLE");
    }

      
  
	return 0;
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    string str;
    while (true) {
        // 入力
        cin >> str;
        if (str == "-") break;
        int m;
        cin >> m;

        int h[101] = {};
        for (int i = 1; i <= m; i++) {
            cin >> h[i];
        }

        // 処理
        string tmp;
        for (int i = 1; i <= m; i++) {
            // 移動分を退避
            tmp = str.substr(0, h[i]);
            // 移動分を消去
            str = str.replace(0, h[i], "");
            // 後ろに連結
            str = str + tmp;
        }

        // 出力
        cout << str << "\n";
    }
    return 0;
}



Measured memory_bytes: 3192
#include<iostream>
#include<cmath>
#define EPS 1e-10
using namespace std;

double simulx(double a, double b, double c, double d, double e, double f){
	return (double)(c*e - f*b) / (a*e - d*b) + EPS;
}

double simuly(double a, double b, double c, double d, double e, double f){
	return (double)(c*d - f*a) / (b*d - e*a) + EPS;
}

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double px, py;
		double a, b, c, d, e, f;
		a = 2*(x1-x2); b = 2*(y1-y2); c=x1*x1-x2*x2+y1*y1-y2*y2;
		d = 2*(x1-x3); e = 2*(y1-y3); f=x1*x1-x3*x3+y1*y1-y3*y3;
		px = simulx(a, b, c, d, e, f);
		py = simuly(a, b, c, d, e, f);
		cout.setf(ios::fixed);
		cout.precision(3);
		cout << px << " " << py << " " << sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py)) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int l=0, ll=0, r=0, rr=1e5;
  for(int i=0; i<M; i++){
    int L, R;
    cin >> L >> R;
    l=L;
    ll=max(ll, l);
    r=R;
    rr=min(rr, r);
  }
  int ans=max(0, rr-ll+1);
  cout << ans << endl;
}

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

int main()
{
	double n;
	while (cin >> n)
	{
		if (91.00 < n)
		{
			cout << "heavy" << endl;
		}
		else if (81.00 < n)
		{
			cout << "light heavy" << endl;
		}
		else if (75.00 < n)
		{
			cout << "middle" << endl;
		}
		else if (69.00 < n)
		{
			cout << "light middle" << endl;
		}
		else if (64.00 < n)
		{
			cout << "welter" << endl;
		}
		else if (60.00 < n)
		{
			cout << "light welter" << endl;
		}
		else if (57.00 < n)
		{
			cout << "light" << endl;
		}
		else if (54.00 < n)
		{
			cout << "feather" << endl;
		}
		else if (51.00 < n)
		{
			cout << "bantam" << endl;
		}
		else if (48.00 < n)
		{
			cout << "fly" << endl;
		}
		else
		{
			cout << "light fly" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
using namespace std;
int main(){
  int cnt=0;
  string s;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='o') cnt++;
  }
  cnt += 15 - s.length();
  if(cnt>=8) cout << "YES\n";
  else cout << "NO\n";
}


Measured memory_bytes: 256
import java.awt.geom.Point2D
import java.io._
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.reflect.ClassTag

object Main {
  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  case class Barrier(x: Int, y: Int, r: Int)
  type WUGraph = Array[Barrier]
  case class Coordinate(x: Int, y: Int)

  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N, T = sc.nextInt()
    val t = map(N)(_ => sc.nextInt())
    val ans = map(N - 1) { i =>
      min(t(i + 1) - t(i), T)
    }.sum + T // N番目の人の分

    out.println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
    out.flush()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  def rep(n: Int)(f: Int => Unit): Unit = {
    var i = 0
    while(i < n) { f(i); i += 1 }
  }
  def rep_r(n: Int)(f: Int => Unit): Unit = {
    var i = n - 1
    while(i >= 0) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  implicit class ArrayOpts[A](val as: Array[A]) extends AnyVal {
    // todo Orderingだとboxing発生するので自作Orderを用意したい
    def maxByOpt[B: Ordering](f: A => B): Option[A] = {
      if (as.nonEmpty) Some(as.maxBy(f)) else None
    }

    def grpBy[K](f: A => K): mutable.Map[K, ArrayBuffer[A]] = {
      val map = mutable.Map.empty[K, ArrayBuffer[A]]
      rep(as.length)(i => map.getOrElseUpdate(f(as(i)), ArrayBuffer()) += as(i))
      map
    }

    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      var sum = num.zero
      rep(as.length)(i => sum = num.plus(sum, f(as(i))))
      sum
    }

    def minByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.lt)
    }

    def maxByEx[B](f: A => B, ixRange: Range = as.indices)(implicit cmp: Ordering[B]): (A, B) = {
      limit(f, ixRange)(cmp.gt)
    }

    private def limit[B](f: A => B, ixRange: Range)(cmp: (B, B) => Boolean): (A, B) = {
      var limA = as(ixRange.head)
      var limB = f(limA)

      for (i <- ixRange.tail) {
        val a = as(i)
        val b = f(a)
        if (cmp(b, limB)) {
          limA = a
          limB = b
        }
      }
      (limA, limB)
    }
  }

  implicit class IterableOpts[A](val as: Iterable[A]) extends AnyVal {
    def sumBy[B](f: A => B)(implicit num: Numeric[B]): B = {
      as.foldLeft(num.zero)((acc, a) => num.plus(acc, f(a)))
    }
  }
}


Measured memory_bytes: 52340
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <map>
#include <random>
#include <string>
#include<vector>
#include<stack>
#include <cstdlib>


using namespace std;

int main() {
	long long n;
	long long sum = 100;
	int cnt = 0;
	cin >> n;
	while (n > sum) {
		sum *= 1.01;
		cnt++;
	}

	cout << cnt;

	return 0;
}

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

char data[9][9];
char out[9][9]; //出力用

void rotation90(){

  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      out[i][j] = data[7-j][i];
    }
  }

  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      cout<< out[i][j];
      data[i][j] = out[i][j];
    }
    cout<< endl;
  }

}

int main(){
 
  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      cin>> data[i][j];
    }
  }

  for(int i=1; i<4; i++) {
    cout<< 90*i<< endl;
    rotation90();
  }

}

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

using namespace std;

int a[8005],dp[8005][16005];

string s;

int x,y;

int main()
{
	ios::sync_with_stdio(false);
	
	cin>>s>>x>>y;
	
	int cnt=0,len=0;
	
	for(register int i=0;i<s.size();++i)
		if(s[i]=='T')
		{
			cnt++;
			a[cnt]=len;
			len=0;
		}
		else
		{
			len++;
		}
	
	cnt++;
	
	a[cnt]=len;
	
	dp[1][a[1]+8000]=1;
	
	for(register int i=3;i<=cnt;i+=2)
		for(register int j=0;j<=16000;++j)
		{
			if(j+a[i]<=16000)
				dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
				dp[i][j]=dp[i][j] || dp[i-2][j-a[i]];
		}
		
	dp[0][8000]=1;
	
	for(register int i=2;i<=cnt;i+=2)
		for (register int j=0;j<=16000;++j)
		{	
			if(j+a[i]<=16000)
				dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
				dp[i][j]=dp[i][j]||dp[i-2][j-a[i]];
		}
		
	bool ans;
	
	if(cnt%2==0) 
		ans=dp[cnt][y+8000] && dp[cnt-1][x+8000];
	else
		ans=dp[cnt][x+8000]&&dp[cnt-1][y+8000];
	
	if (!ans) cout<<"No"<<endl; else cout<<"Yes"<<endl;
	
	return 0;
}

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

using namespace std;

long long f(int a, int x) {
  return 1LL * x * a - 1LL * x * x;
}

long long calc(int a, int s) {
  return max(f(a, min(s, a / 2)), f(a, min(s, (a + 1) / 2)));
}

int get(int a, int b) {
  int l = 0, r = a;
  while (r - l > 1) {
    int s = (l + r) / 2;
    if (calc(b + s + 1, s) < 1LL * a * b) {
      l = s;
    } else {
      r = s;
    }
  }
  return l;
}

int main() {
  int qq;
  scanf("%d", &qq);
  while (qq--) {
    int a, b;
    scanf("%d %d", &a, &b);
    int va = get(a, b);
    int vb = get(b, a);
    printf("%d\n", va + vb + min(a - 1 - va, b - 1 - vb));
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
	int n,u,v;scanf("%d",&n);
	LL ans=1ll*(n+1)*n*(n+2)/6;//1*2+2*3+¡­+n*(n+1)/2
	for(int i=1;i<n;i++){
		scanf("%d%d",&u,&v);
		if(u>v)swap(u,v);
		ans-=1ll*u*(n-v+1);
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 3824
#include <iostream>
#include <map>
#include <utility>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<pair<string, int>, int> m;
    REP(i, n) {
        string town;
        int score;
        cin >> town >> score;
        pair<string, int> tmp = make_pair(town, 100 - score);
        m[tmp] = i;
    }
    for (auto itr = m.begin(); itr != m.end(); itr++)
        cout << itr->second + 1 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b,d;
	cin>>a>>b;
	char e;
	V<V<char>> c(a+2,V<char>(b+2,'.'));
	fo(i,a){
		fo(j,b){
			cin>>c[i+1][j+1];
		}
	}
	for(int i=1;i<a+1;i++){
		for(int j=1;j<b+1;j++){
			e='0';
			if(c[i][j]=='.'){
				d=0;
				for(int k=i-1;k<=i+1;k++){
					for(int l=j-1;l<=j+1;l++){
						if((k!=i||l!=j)&&c[k][l]=='#')
							d++;
					}
				}
				e+=d;
				c[i][j]=e;
			}
		}
	}
	fo(i,a){
		fo(j,b){
			cout<<c[i+1][j+1];
			if(j==b-1)
				cout<<endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    IO
    int n,m,x;
    cin>>n>>m>>x;

    vector<vector<int> > B(n,vi(m));
    vector<int> C(n);

    for(int i=0;i<n;i++)
    {
        cin>>C[i];
        for(int j=0;j<m;j++) cin>>B[i][j];
    }

    ll mn=1e18;

    for(int i=0;i<(1<<n);i++)
    {
        int cost=0;
        vi a(m,0);
        bool flg=true;
        for(int j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                cost+=C[j];
                for(int k=0;k<m;k++) a[k]+=B[j][k];
            }
        }
        for(int k=0;k<m;k++){
            if(a[k]<x){
                flg=false;break;
            }
        }
        if(flg){
            mn=min(mn,(ll)cost);
        }
    }

    if(mn==1e18) cout<<-1<<endl;
    else cout<<mn<<endl;
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll ar[n];
	for(i=0;i<n;i++){
		cin>>ar[i];
	}

	k=0;
	for(i=0;i<n-1;i++){
		if(ar[i]==i+1){
			//cout<<i<<endl;
			k++;
			l=ar[i];
			ar[i]=ar[i+1];
			ar[i+1]=l;
		}
	}
	if(ar[n-1]==n){
		k++;
	}
	cout<<k;
	return 0;
}


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int K=nextInt();
		if(K%2==1&&K%5!=0){
			long sum=7;
			for(int i=1;i<=K+1;i++){
				if(sum%K==0){
					System.out.println(i);
					System.exit(0);
				}
				sum*=10;sum%=K;
				sum+=7;sum%=K;
			}
		}
		else
			System.out.println(-1);
	}
	static boolean isOK(int index,int key,int[]a){
		if (a[index]>=key) return true;
	    else return false;
	}
	static int binary_search(int key,int[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



Measured memory_bytes: 32764
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_str(char *str, int size)
{
    char format[100];
    if (size == 0)
        return 0;
    snprintf(format, sizeof(format), "%%%ds", size);
    scanf(format, str);
    return 0;
}
#define NUM_MAX 100000

int desc(const void *a1, const void *a2) {
    return *(int*)a2 - *(int*)a1;
}

int main(void) {
    static char str[NUM_MAX+5];
    get_str(str, NUM_MAX+5);
    int len = strlen(str);
    // winner => If odd: first, If even: second
    int win = (len+1)%2; // 0: first, 1: second

    static int map[26];
    int i;
    for(i = 0; i < len; i++) {
        map[str[i] - 'a']++;
    }
    static int sorted[26];
    memcpy(sorted, map, sizeof(int)*26);
    qsort(sorted, 26, sizeof(int), desc);
    // if(len==3) {
    //     if(sorted[0] == 2) win = 1;
    // } else 
    if(len%2 == 0) {
        // abca
        if(str[0] == str[len-1]) win = 0;
    } else {
        // odd
        // First player no longer take
        // if(sorted[0] == (len/2 + 1) && sorted[1] == len/2) {
        //     win = 1;
        // }
        if(str[0] == str[len-1]) win = 1;
        // anyway, First player wins.
        // else if(sorted[0] == len/2 && sorted[1] == len/2) {
        //     // abcab
        //     for(i = 0; i < 26; i++) {
        //         if(map[i]==1) break;
        //     }
        //     char ch = i+'a';
        //     if(str[0] != ch && str[len-1] != ch) win = 0;
        // }
    }
    printf("%s\n", win==0 ? "First" : "Second");
    return 0;
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll r=0, b=0;
ll ret = 0;

void input() {
  IN(N);
  REP(i,N){
    char c;
    IN(c);
    if(c == 'R'){
      r++;
    }else if(c == 'B'){
      b++;
    }
  }
}

void solve() {
  if(r > b){
    PRINT("Yes");
  }else{
    PRINT("No");
  }
}

int main(void){
  input();
  solve();
  // PRINT(ret);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long min = (long)999999999999.0;
        for(long i=1;i<=Math.sqrt(N);i++)  if(N%i==0&&min > (i-1)+(N/i)-1) min = (i-1)+(N/i)-1;
        System.out.println(min);
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,t;
  cin >> n >> t;
  vector<int> list;
  int a,b;
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    if(b <= t) {
      list.push_back(a);
    }
  }
  if(list.empty()) {
    cout << "TLE" << endl;
  } else {
    sort(list.begin(),list.end());
    cout << list.at(0) << endl;
  }
}

Measured memory_bytes: 3612
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int N,M,T = 1900,ans = 0;
int main() {
    cin >> N >> M;
    //if(N == M == 1)
    int x = pow(2,M);
    ans = M*T*x + 100*(N - M) * x;
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    long long N,min=1e6,sum=0;
    int a=1;
    cin >> N;

    priority_queue<int> que;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        //sum += A.at(i);
    }
    for (int j = 1; j < 100; j++) {
        for (int i = 0; i < N; i++) {
            sum += pow(A.at(i) - j,2);
        }
        min = std::min(sum, min);
        sum=0;
    }
    
    cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int dp[100001];
int ndp[100001];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, X;
	cin >> N >> X;
	vector<int> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	sort(A.rbegin(), A.rend());

	dp[X] = 1;

	for (int i = 0; i < N; i++) {

		for (int j = 0; j <= X; j++) {
			ndp[j] = (dp[j] * (N - i - 1)) % MOD;
		}
		for (int j = 0; j <= X; j++) {
			int t = j % A[i];
			ndp[t] += (dp[j]);
			if (ndp[t] >= MOD)ndp[t] -= MOD;
		}
		swap(dp, ndp);
	}


	for (int j = 0; j <= X; j++) {
		res += (j * dp[j]) % MOD;
		if (res >= MOD)res -= MOD;
	}

	cout << res << endl;
}

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

int main()
{
	string str;
	cin >> str;
	if(str.substr(0, 4) < "2019")
	{
		cout << "Heisei\n";
	}
	else if(str.substr(0, 4) == "2019" && str.substr(5, 2) < "05")
	{
		cout << "Heisei\n";
	}else
	{
		cout << "TBD\n";
	}
}


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

using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t,n;long long p=0;
 cin>>t;
 for(int i=1;i<=t;i++){
   for(int j=1;j<=t;j++){
    
       n=__gcd(i,j);
       for(int k=1;k<=t;k++)p+=__gcd(n,k);
   }
 }
 cout<<p;
   return 0;
}

Measured memory_bytes: 3508
#include<stdio.h>
int main(void)
{
	int n,h[101];
	int i,j,k;
	int sa[101],b[101];
	int flg;
	
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<n+1;i++){
			scanf("%d",&h[i]);
		}
		for(i=0;i<n+1;i++){
			k=0;
			for(j=0;j<n+1;j++){
				if(i!=j){
					b[k]=h[j];
					k++;
				}
			}
			for(j=0;j<n-1;j++){
				sa[j]=b[j+1]-b[j];
			}
			flg=0;
			for(j=0;j<n-2;j++){
				if(sa[j]!=sa[j+1]){
					flg=1;
				}
			}
			if(flg==0){
				printf("%d\n",h[i]);
				break;
			}
		}	
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
using namespace std;
#define MAX 100000
#define NIL -1

vector<int> G[MAX];
int c, top, S[MAX], color[MAX];

void dfs_init(int n){
  top = 0;
  for(int i=0; i<n; i++){
    color[i] = NIL;
  }
}

void dfs(int s){
  int v;
  color[s] = c;
  S[++top] = s;
  while(top > 0){
    s = S[top];
    top--;
    for(int i = 0; i<G[s].size(); i++){
      v = G[s][i];
      if(color[v] == NIL){
        S[++top] = v;
        color[v] = c;
      }
    }
  }
}

int main(void){
  int n, m, s, t, q;
  cin >> n >> m;
  for(int i=0; i<m; i++){
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  dfs_init(n);
  for(int i=0; i<n; i++){
    if(color[i] == NIL){
      dfs(i);
      c++;
    }
  }

  c = 0;
  cin >> q;
  for(int i=0; i<q; i++){
    cin >> s >> t;
    if(color[s] == color[t]) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  return 0;
}



Measured memory_bytes: 8996
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=100000+19;

int c[N];
int n,x,y,A,B=(1<<30)-1;

bool cal(int A,int x,int y){
	return x+(y!=0)<=A&&x+y/2>=A;
}

int main(){
	n=IN();
	For(i,1,n+1) c[i]=IN();
	For(i,1,n+1){
		B=min(B,c[i]);
		A=max(A,c[i]);
	}
	if (A-B>1){
		puts("No");
		return 0;
	}
	For(i,1,n+1){
		if (c[i]==B) x++;else y++;
	}
	if (A==B){
		puts(cal(A,0,x)||cal(A+1,x,0)?"Yes":"No");
	} else{
		puts(cal(A,x,y)?"Yes":"No");
	}
}

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

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

    string s, t;
    cin >> s >> t;
    
    cout << t << s << endl;

    return 0;
}

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

const long long mod = 998244353;

int main() {
  int n;
  cin >> n;
  map<int, long long> d;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(i == 0 && a != 0){
      cout << 0 << endl;
      return 0;
    }
    d[a]++;
  }
  
  long long sum = 0, ans = 1, last = 1;
  bool ok = false;
  for(int i = 0; i < n; i++){
    if(sum == n){
      ok = true;
      break;
    }
    else if(!d.count(i)) break;
    if(d.at(0) > 1) break;
    long long now = d.at(i);
    sum += now;
    long long mul = 1;
    for(int i = 0; i < now; i++){
      mul *= last;
      mul %= mod;
    }
    ans *= mul;
    ans %= mod;
    last = now;
    if(sum == n) ok = true;
  }
  
  if(!ok) ans = 0;
  cout << ans << endl;
}

Measured memory_bytes: 9680
#include <stdio.h>
 
int main(){
 
  int n,i,a[100];
  scanf("%d",&n);
 
  for(i=0;i<n;i++){ 
    scanf("%d",&a[i]);
  }
    for(i=n-1;i>=0;i--){
      printf("%d",a[i]);
      if(i!=0){
    printf(" ");
      } else {
        printf("\n");
      }
    }
  return 0;
    }

Measured memory_bytes: 600
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll x,k,d;
    cin>>x>>k>>d;
    x=llabs(x);
    if(x/d>k){
        ll ans=llabs(x-k*d);
        cout<<ans<<endl;
    }else{
        ll dis=x%d;
        ll dis2=llabs(dis-d);
        ll num=x/d;
        //cout<<dis<<" "<<dis2<<endl;
        if((num%2==1 && k%2==0) || (num%2==0 && k%2==1)){
            cout<<dis2<<endl;
        }else{
            cout<<dis<<endl;
        }
    }
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define MAXN 1000001

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

bool chkprime( int n )
{
    if ( n == 1 )
    {
        return false;
    }
    for ( int i = 2 ; i <= sqrt(n) ; i++ )
    {
        if ( n % i == 0 )
        {
            return false;
        }
    }

    return true;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    vector<int> div;
    for ( int i = 2 ; i <= sqrt(n) ; i++ )
    {
        if ( n % i == 0 )
        {
            if ( chkprime(i) )
            {
                div.pb(i);
            }
            if ( i != n/i )
            {
                if ( chkprime(n/i) )
                {
                    div.pb(n/i);
                }
            }
        }
    }
    if ( chkprime(n) )
    {
        div.pb(n);
    }
    vector<int> p;
    // rep(i,0,div.size())
    // {
    //     out1(div[i]);
    // }
    rep(i,0,div.size())
    {
        int x = n;
        int cnt = 0;

        while ( x%div[i] == 0 )
        {
            cnt++;
            x /= div[i];
        }
        p.pb(cnt);
    }
    int ans = 0;
    rep(i,0,p.size())
    {
        int x = 1;
        while( x*(x+1)/2 <= p[i] )
        {
            x++;
        } 
        x--;
        ans += x;
    }

    cout<<ans<<endl;
}
//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3664
#include <cstdio>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

multiset<ll> st;


int main() {
    int n;
    scanf("%d", &n);
    ll a;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a);
        st.insert(a);
    }

    int ans = 0;
    while (st.size() > 1) {
        ll x = *(--st.end());
        st.erase(--st.end());

        int ok;
        for (int i = 30; i >= 0; --i){
            if (x >= (1<<i)){
                ok = i + 1;
                break;
            }
        }

        ll b = (1<<ok) - x;

        if (st.find(b) != st.end()){
            auto it = st.find(b);
            st.erase(it);
            ++ans;
        }
    }

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


Measured memory_bytes: 9600
n = int(input())
def double_fac(n):
    if n<=2:
        return 1
    return n*double_fac(n-2)
tmp=0
if n%2==1:
    ans=0
    print(ans)
else:

    r=1
    ans=0
    k=n
    while 10*r <= n:
        ans+=(n//(10*r))
        r*=5

    print(ans)
#print(double_fac(n))


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

typedef long long ll;
typedef long double ld;

using namespace std;


struct e{
    ll l, r, type;
    e(){}
    e(ll l, ll r, ll type): l(l), r(r), type(type) {}
};



ll n;
ll h;
vector < ll > a;





bool ok(ll x){
    vector < ll > b(n);
    for(ll i = 0; i < n; ++i){
        b[i] = (a[i] >= x);
    }
    ll pos = n / 2;
    if(b[pos - 1] == b[pos] || b[pos] == b[pos + 1]){
        return b[pos];
    }
    ll l = pos - 1;
    ll r = pos + 1;
    while(l - 1 >= 0 && b[l - 1] != b[l]){
        l--;
    }
    while(r + 1 < n && b[r + 1] != b[r]){
        r++;
    }
    if(l != 0){
        l++;
    }
    if(r != n - 1){
        r--;
    }
    if(l == 0 && r == n - 1){
        return b[0];
    }
    if(b[l] == b[r]){
        return 1 - b[l];
    }
    if(pos - l <= r - pos){
        return 1 - b[l];
    } else {
        return 1 - b[r];
    }
}





void solve(){
    cin >> h;
    n = 2 * h - 1;
    a.resize(n);
    for(ll i = 0; i < n; ++i){
        cin >> a[i];
        a[i]--;
    }
    ll l = -1;
    ll r = n;
    while(r - l > 1){
        ll m = (l + r) / 2;
        if(ok(m)){
            l = m;
        } else {
            r = m;
        }
    }
    cout << l + 1 << "\n";
}

signed main(){
    srand(time(0));
    ll t = 1;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else

    #endif// DEBUG
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3436
#include <stdio.h>
#include <stdlib.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))

int main(void)
{
    int n, a[100100], b[100100], c[100100];
    scanf("%d", &n);
    rep(i, n)
        scanf("%d%d%d", &a[i], &b[i], &c[i]);

    int dp[100100][3] = {0};
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 1; i < n; i++)
    {
        dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
        dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
        dp[i][2] = max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
    }

    printf("%d\n", max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])));
    return 0;
}

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

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

#define endl '\n'
#define SZ(x) (int)(x.size())
#define ALL(x) x.begin(), x.end()
#define FOR(i, n) for(int i=0;i<n;i++)

string s;

int pal(int i, int j) {
    while(i < j) {
        if(s[i] != s[j])
            return false;
        i++, j--;
    }
    return true;
}

int main()  {
    cin >> s;
    int n = SZ(s), ans = 1;

    if(!pal(0, n-1)) ans = 0;

    if(!pal(0, (n-1)/2-1)) ans = 0;
    if(!pal((n+3)/2-1, n-1)) ans = 0;

    if(ans) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val V = readLine()!!.split(" ").map(String::toInt)
    val C = readLine()!!.split(" ").map(String::toInt)
    val ans = V.zip(C).map { it.first - it.second }.filter { it > 0 }.sum()
    println(ans)
}

Measured memory_bytes: 37944
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

ll A,B,C,D;

ll GCD(ll A,ll B){
    if(B == 0) return A;
    else return GCD(B,A%B);
}

bool solve(){
    if(A < B) return 0;
    if(D < B) return 0;
    if(C >= B - 1) return 1;
    ll G = GCD(B,D);
    ll maxv = (C - A%G + G)/G;
    if(A%G + G*maxv < B) return 0;
    else return 1;
}

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int T;cin >> T;
    bool flag = 0;
    REP(query,T){
        flag = 0;
        cin >> A >> B >> C >> D;
        if(!solve()) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
	long long i, n;
	scanf("%lld",&n);
	long long int count = 0;
	for (i = 1; i < n; i++) {
		count += (n-1) / i;
	}
	printf("%lld\n", count);
	return 0;
}


Measured memory_bytes: 1732
import math,time
N = int(input())
S = input()
# length = len(S)
ans = 0
t1 = time.time()
for i in range(1000):
    locknum = str(i).zfill(3)
    a = S.find(locknum[0])
    b = S.find(locknum[1],a+1)
    c = S.find(locknum[2],b+1)
    if a!=-1 and b!=-1 and c!=-1:
        # print(i)
        ans +=1

t2 = time.time()
# print(t2-t1)                 
print(ans)




                    


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

using namespace std;
#define int long long
const int MOD = 998244353;
  
signed main(){
    int n;
    cin >>n;
    int a[n],sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    int m;
    if(sum%2==1)m=1+sum/2;
    else m=sum/2;
    
    
 
    int dp[n][m],dp2[n][m+1];
    for(int i=0;i<m;i++){
        dp[0][i]=0;
        dp2[0][i]=0;
    }
    dp2[0][m]=0;
    dp[0][a[0]]=1;
    dp[0][0]=2;
      dp2[0][a[0]]=1;
    dp2[0][0]=1;
    for(int i=1;i<n;i++){
        for(int j=0;j<a[i];j++){
            dp[i][j]=(2*dp[i-1][j])%MOD;
            dp2[i][j]=(dp2[i-1][j]);
        }
        for(int j=a[i];j<m;j++){
            dp[i][j]=(2*dp[i-1][j]+dp[i-1][j-a[i]])%MOD;
            dp2[i][j]=(dp2[i-1][j]+dp2[i-1][j-a[i]])%MOD;
        }
        if(a[i]<=m) dp2[i][m]=(dp2[i-1][m]+dp2[i-1][m-a[i]])%MOD;
    }
    int hint =0,p=1;
    for(int i=0;i<m;i++)hint=(hint+dp[n-1][i])%MOD;

    for(int i=0;i<n;i++)p=(p*3)%MOD;
    int ans=(3*hint +2*(MOD-p))%MOD;
    cerr<<sum<<' ';
    if(sum%2==1){

        cout <<ans;
       // cerr <<hint<<' '<<p;
    }else{
       // cerr<<dp2[n-1][m-1]<<' '<<ans<<' ';
        cout<<(ans+3*dp2[n-1][m])%MOD;
    }


    
    
    
    return 0;
}


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

int main(){
    while(1){
        int m,f,r;
        scanf("%d %d %d",&m,&f,&r);
        if(m == -1 && f == -1 && r == -1)break;

        char grade;
        if(m == -1 || f == -1)grade='F';
        else if(m+f >= 80)grade='A';
        else if(m+f >= 65)grade='B';
        else if(m+f >= 50)grade='C';
        else if(m+f >= 30){
            if(r >= 50)grade='C';
            else grade='D';
        }else grade='F';
        printf("%c\n",grade);
    }
    return 0;
}


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

const int MAX_H = 15;
const int W = 5;
int H;
int Pazzle[MAX_H][W];

// row行目について、ランレングス圧縮？みたいなことをして、resに格納
// (first , second) := (石の数字, 並んでいる数)
void Parse(int row, vector<pair<int, int>> &res)
{
    auto &p = Pazzle[row];
    res.push_back({p[0], 1});
    for (int i = 1; i < W; ++i)
    {
        if (res.back().first != p[i])
        {
            res.push_back({p[i], 1});
        }
        else
        {
            ++res.back().second;
        }
    }
}

// 落とせる石を一マスだけ落とす
// 落とす石がなかったらfalseを返す
bool fall()
{
    bool flg = false;
    for (int i = 0; i < H - 1; ++i)
    {
        for (int j = 0; j < W; ++j)
        {
            // インデックスが増える方向に石が落ちていく
            if (Pazzle[i + 1][j] == -1 && Pazzle[i][j] != -1)
            {
                swap(Pazzle[i][j], Pazzle[i + 1][j]);
                flg = true;
            }
        }
    }
    return flg;
}

// 消せるぷよぷよを全て消す(-1にする)
// 戻り値: 消した数
int check()
{
    int res = 0;
    for (int row = 0; row < H; ++row)
    {
        vector<pair<int, int>> L;
        Parse(row, L);
        int cur = 0;
        for (auto &p : L)
        {
            if (p.first == -1 || p.second < 3)
            {
                cur += p.second;
                continue;
            }
            // -1に塗りつぶし
            for (int i = cur; i < cur + p.second; ++i)
            {
                res += Pazzle[row][i]; // スコア
                Pazzle[row][i] = -1;
            }
            cur += p.second;
        }
    }

    // デバッグ
    /*
    for (int i = 0; i < H; ++i)
    {
        for (int j = 0; j < W; ++j)
        {
            printf("%d%c", Pazzle[i][j], j == W - 1 ? '\n' : '\t');
        }
    }
    printf("\n");
    */
    // 石を落とす
    while (fall())
    {
    }
    /*
    for (int i = 0; i < H; ++i)
    {
        for (int j = 0; j < W; ++j)
        {
            printf("%d%c", Pazzle[i][j], j == W - 1 ? '\n' : '\t');
        }
    }
    printf("\n");
    */
    return res;
}

bool solve()
{
    cin >> H;
    if (H == 0)
        return false;

    for (int i = 0; i < H; ++i)
    {
        for (int j = 0; j < W; ++j)
        {
            cin >> Pazzle[i][j];
        }
    }

    int res = 0;
    int add = 0;
    while ((add = check()) > 0)
        res += add;
    cout << res << endl;

    return true;
}

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


Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    int k,x;
    cin>>k>>x;

    if( k*500 >= x )
        cout<<"Yes";
    else
        cout<<"No";

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int M = N+1;
    vector<int> t(M),x(M),y(M);
    t[0] = x[0] = y[0] = 0;
    for(int i = 1; i < M; i++) cin >> t[i] >> x[i] >> y[i];
    for(int i = 1; i < M; i++){
        int T = t[i]-t[i-1];
        int Z = abs(x[i] - x[i-1] + y[i] - y[i-1]);
        //cout << T << Z << endl;
        if(T < Z){
            cout << "No" << endl;
            return 0;
        }
        if(T%2 != Z%2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define B begin()
#define E end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> VL;
typedef set<ll> SL;
typedef pair<ll, ll> p2;
const ll M = 1000000007;
const ll M2= 998244353;
vector<ll> v(1000005, 0);
void solve()
{
	ll n;
	cin>>n;
	ll ans=0;
	for(int i=2;i<=1000010;i++)
	{
		ll curr=0;
		while(n%i==0)
		{
			curr++;
			n/=i;
		}
		for(int j=1;j<1000000;j++)
		{
			if(curr<j)break;
			ans++;
			curr-=j;
		}
	}
	if(n>1)ans++;
	cout<<ans;
		
}
 
int main()
{
    IOS
    int _=1;
    //cin>>_;
    while(_--)
    {
	    solve();
    }
    
    return 0;
}


Measured memory_bytes: 11048
import math
n = int(input())
xy_list = []
ans = 0
for i in range(n):
    xy_list.append(list(map(int,input().split())))
for i in range(n-1):
    for j in range(i+1,n):
        ans += math.sqrt( (xy_list[j][0]-xy_list[i][0])**2 + (xy_list[j][1]-xy_list[i][1])**2 )
        # print(ans)
ans = (ans * (n-1)) / ((n**2-n)/2)
print(ans)

Measured memory_bytes: 3064