akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };

ll H, W;
std::string S[410];
bool used[410][410];
ll fld[410][410];

ll color( char ch ) 
{ return ch == '#' ? 0 : 1; }

void dfs( ll si, ll sj, ll con ) {
  used[si][sj] = true;
  fld[si][sj] = con;

  rep( d, 4 ) {
    ll ni = si+dy[d], nj = sj+dx[d];

    if( ni >= 0 && ni < H && nj >= 0 && nj < W && S[ni][nj] != S[si][sj] && !used[ni][nj] )
      dfs( ni, nj, con );
  }
}

ll cnt[2][160010];

int main()
{
  std::cin >> H >> W;

  rep( i, H )
    std::cin >> S[i];

  ll timer = 0;

  rep( i, H ) rep( j, W ) if( !used[i][j] )  
    dfs( i, j, timer++ );

  rep( i, H ) rep( j, W ) 
    ++cnt[color(S[i][j])][fld[i][j]];

  ll ans = 0;

  rep( t, timer )
    ans += cnt[0][t]*cnt[1][t];

  std::cout << ans << std::endl;

  return 0;
}

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

int main(){
  string str1,str2,str3;
  cin >> str1 >> str2 >> str3;
  if(str1[str1.size()-1]==str2[0]&&str2[str2.size()-1]==str3[0]){
    cout << "YES" <<endl;
    return 0;
  }
  cout << "NO" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

int nmoney(int s, double ratio, int cost, int pmomey, int year) {
	int nmoney;
	int total_ratio = 0;

	if (s == 0) {
		for (int i = 0; i < year; i++) {
			total_ratio += pmomey*ratio;
			pmomey -= cost;
		}
		nmoney = pmomey + total_ratio;
	} else if (s == 1) {
		for (int i = 0; i < year; i++) {
			pmomey += pmomey*ratio - cost;
		}
		nmoney = pmomey;
	}

	return nmoney;
}

int main(void) {
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		int pmoney;
		cin >> pmoney;

		int year;
		cin >> year;

		int n;
		int money = 0;
		cin >> n;
		for (int j = 0; j < n; j++) {
			int s, cost;
			double ratio;
			cin >> s >> ratio >> cost;
			int n;
			n = nmoney(s, ratio, cost, pmoney, year);
			if (n > money) {
				money = n;
			}
		}
		printf("%d\n", money);
	}
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a);
        a=(a*a);
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i));
        pro/=(i+1);
    }
    return pro;
}
vector<int> prime;
void seive(){
    vector<bool > isprime(101,true);
    for(int i=2;i*i<=100;i++){
        if(isprime[i]){
            for(int j=i*i;j<=100;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=100;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    int c=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]) c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<int,int>
ll n,p, k, b, c, i, j, x, y, z = 1, m = 0;
double a[100000] = {}, yy[100000] = {};
double xx,zz=0;
string s;
P pp[100000];
vector<ll> v;
char cc[100000][10];
int main() {
	
	cin>>n ;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	zz = a[0];
	rep(i, n - 1) {
		zz = (zz + a[i + 1]) / 2;
	}

	cout << fixed<<setprecision(7)<<zz;
	return 0;
}


Measured memory_bytes: 256
#include<iostream> 
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
#include<iomanip>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));

int main(){
	string a,b;
	cin>>a>>b;
	int c,d;
	cin>>c>>d;
	map<string,int>mp;
	mp[a]=c;
	mp[b]=d;
	string aa;
	cin>>aa;
	mp[aa]--;
	cout<<mp[a]<<' '<<mp[b]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a,b,c,x,i,k,l,p=0;
  cin>>a>>b>>c>>x;
  for (i=0;i<=a;i++) {
    for (k=0;k<=b;k++) {
      for (l=0;l<=c;l++) {
        if (500*i+100*k+50*l==x) p++;
      }
    }
  }
  cout<<p;
}

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

int main(){
int cards[4][13] = {0};
string suit = "SHCD";
int n,A,b;
char a;
cin >> n;


for(int i = 0;i < n;i++){
  cin >> a >> b;
  switch (a)
  {
  case 'S':
    cards[0][b-1] = 1;
    break;
  case 'H':
    cards[1][b-1] = 1;
    break;
  case 'C':
    cards[2][b-1] = 1;
    break;
  default:
    cards[3][b-1] = 1;
    break;
  }
}



for(int i = 0;i < 4;i++){
  for(int j = 0;j < 13;j++){
    if(cards[i][j] == 0){
      cout << suit[i] << " " << j + 1 << endl;
    }
  }
}
return 0;
}


Measured memory_bytes: 3216
#include<iostream>
int main(){
	int a,b,c,s=0;
	while(std::cin>>a>>b){
		c=a+b;
		while(c>=10){
			c=c/10;
			s+=1;
		}
		std::cout<<s+1<<std::endl;
		s=0;
	}

	return 0;
}

Measured memory_bytes: 1160
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let mut iter = buf.split_whitespace();
	let a: i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	let b: i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	let c: i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	let d: i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		Err(_) => panic!(""),
	};
	let x = (a+d - 1) / d;
	let y = (c+b-1) / b;
	if x >= y { println!("Yes"); } else { println!("No"); }
}

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

int main(){
	int n;
	long long sum=0;
	cin>>n;
	
	int a[n+5];
	for(int i=1;i<=n;i++)  a[i]=i;
	
	for(int i=1;i<=n;i++){
		if(a[i]%5==0 || a[i]%3==0)  continue;
		
		else
			sum+=a[i];
	}
	
	cout<<sum <<endl;
	return 0;
}

Measured memory_bytes: 7456
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int main()
{
	int a, b, t;
	cin >> a >> b >> t;
	int cnt = t/a;
	cout << cnt * b << endl;
  return 0;
}


Measured memory_bytes: 384
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;

int main()
{
    int n,m;
    cin>>n>>m;
    if(n>m){
        for(int i=0;i<n;i++){
            cout<<m;
        }
        cout<<"\n";
    }
    else{
        for(int i=0;i<m;i++){
            cout<<n;
        }
        cout<<"\n";
    }
    
}


Measured memory_bytes: 256
from collections import deque

n=4
m=3
g=[[] for _ in range(n)] 
for _ in range(m):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
    
def bfs(u, g, n):
    u -= 1
    queue = deque([u])
    d = [-1] * n
    d[u] = 0
    while queue:
        v = queue.popleft()
        for i in g[v]:
            if d[i] is -1:
                d[i] = d[v] + 1
                queue.append(i)
    return d

d = bfs(1, g, n)
d.sort()
if d[-1]==3:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 9460
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,k;
  string s;
  cin >> n >> k >> s;
  k *= 2;
  int ans = 0;
  rep(i, n - 1){
    if(s[i] != s[i + 1]){
      if(k > 0) ans++;
      k--;
    }else ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1e9+7;
// const ll INF = 1000000000000000000LL;


 int main() {
	 int n;
	 cin >> n;
	 vector<ll> l(n);
	 rep(i,n) cin >> l[i];
	 sort(l.begin(),l.end());
	 ll cnt=0;
	 for(ll i=0;i<l.size();i++){
		 for(ll j=i+1;j<l.size();j++){
			 for(ll k=j+1;k<l.size();k++){
				 if(l[i]==l[j]||l[j]==l[k]) continue;
				 if(l[i]+l[j]>l[k]) cnt++;
				 if(l[i]+l[j]<=l[k]) break;
			 }
		 }
	 }
	 cout << cnt << endl;
	 
	 return 0;
 }

Measured memory_bytes: 3616
out = []

def out.higher?(v)
  return true if self.size < 3
  self.each do |h|
    return true if v > h
  end
  return false
end

def out.push(v)
  if self.size < 3
    self << v
    return
  end
  min = 10000
  min_i = 3
  self.each_with_index do |h, i|
    min, min_i = h, i if min > h
  end
  self[min_i] = v
end

def out.puts_desc
  order = []
  3.times do
    max = 0
    max_i = 3
    self.each_with_index do |h, i|
      max, max_i = h, i if max < h
    end
    order << max
    self.delete_at(max_i)
  end
  order.each do |v|
    puts v
  end
end

10.times do |count|
  num = readline.to_i
  if out.higher? num
    out.push num
  end
end

out.puts_desc

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

#define maxn 100000008
#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main(int argc, char *argv[])
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	puts(b - a == c - b ? "YES" : "NO");
	return 0;
}


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

int main() {
  int N;
  vector<string> s(100);
  vector<int> ss(100, 0);
  int i, j;
  string S;
  cin >> N;
  for (i=0; i<N; i++) {
    cin >> S;
    for (j=0;;j++) {
      if ( S == s.at(j) ) {
        ss.at(j)++;
        break;
      } else if ( s.at(j) == "" ) {
        s.at(j) = S;
        ss.at(j) = 1;
        break;
      }
    }
  }
  cin >> N;
  for (i=0; i<N; i++) {
    cin >> S;
    for (j=0;;j++) {
      if ( S == s.at(j) ) {
        ss.at(j)--;
        break;
      } else if ( s.at(j) == "" ) {
        s.at(j) = S;
        ss.at(j) = 1;
        break;
      }
    }
  }
  for (j=0, i=ss.at(0);j<100;j++)
    if (i < ss.at(j)) i = ss.at(j);
  cout << i << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=r*n%mod;
		n=n*n%mod;
	}
	return r;
}

vvl mul(vvl A,vvl B){
	vvl C(A.size(),vl(B[0].size()));
	for(int i=0;i<A.size();i++) for(int k=0;k<B.size();k++) for(int j=0;j<B[0].size();j++) (C[i][j]+=A[i][k]*B[k][j])%=mod;
	return C;
}

vvl pow(vvl A,ll n){
	int N=A.size();
	vvl B(N,vl(N));
	for(int i=0;i<N;i++) B[i][i]=1;
	for(;n>0;n>>=1){
		if(n&1) B=mul(B,A);
		A=mul(A,A);
	}
	return B;
}

int h,w;
ll k;
vs a;

int main(){
	cin>>h>>w>>k;
	a=vs(h);
	for(int i=0;i<h;i++) cin>>a[i];
	bool H=0,W=0;
	int S=0;
	for(int i=0;i<h;i++) if(a[i][0]=='#'&&a[i][w-1]=='#') H=1;
	for(int i=0;i<w;i++) if(a[0][i]=='#'&&a[h-1][i]=='#') W=1;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) if(a[i][j]=='#') S++;
	if(H&&W||!k) cout<<1<<endl;
	else if(!H&&!W) cout<<Pow(S,k-1)<<endl;
	else{
		if(W){
			vs b(w);
			for(int i=0;i<w;i++) for(int j=0;j<h;j++) b[i]+=a[j][i];
			a=b;
			swap(h,w);
		}
		vvl A(2,vl(2));
		A[1][1]=S;
		for(int i=0;i<h;i++){
			vi b;
			for(int j=0;j<w;j++) if(a[i][j]=='#'){
				int j_=j;
				while(j<w&&a[i][j]=='#') j++;
				b.push_back(j-j_);
				j--;
			}
			int n=b.size();
			if(!n) continue;
			if(b[0]==w) A[0][0]++;
			else if(a[i][0]=='#'&&a[i][w-1]=='#'){
				A[0][0]++;
				A[0][1]+=n-1;
			}
			else A[0][1]+=n;
		}
		A=pow(A,k-1);
		cout<<(A[0][0]+A[0][1])%mod<<endl;
	}
}

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

using namespace std;

#define io freopen("test.txt", "r", stdin);
#define fast ios_base::sync_with_stdio(0);cin.tie(0);


#define ull unsigned long long int
#define lli long long int
#define li long int
#define ld long double

#define cout(x) cout<<x<<" "
#define coutn(x) cout<<x<<endl
#define newline cout<<endl

#define sz(x) (int)x.size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define ar array

#define pii pair<int,int>
#define pll pair<lli,lli>
#define pps pair<pair<int,int>, string>

const int MOD=1000000007;
const lli INF=1e18;
const int MX=100001;
const int N=1000000;


void solve(){

    int n;
    cin>>n;

    int c=0;
    
    for(int i=n-1;i>0;i--){
        int d=n/i;
        if(i*d==n) c+=d-1;
        else if(d==i){
            if(d*i==n) c+=d-1;
            else c+=d;
        }
        else c+=d;
        // cout<<c<<"\n";
    }

    cout<<c<<"\n";
}


int main(){
    fast
    // #ifndef godzqa
    //     io
    // #endif

    lli t;
    // cin>>t;
    t=1;

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

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k, a, b; cin >> k >> a >> b;
  
  bool kabbao = false;
  if(k<=b && b%k == 0) kabbao = true;
  if(k<=b && k*(b/k) >= a) kabbao = true;
    
  if(kabbao)cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-9;

void solve() {
    string s;
    cin >> s;
    ll ans = 0;
    for(ll i = 0; i < 4; i++) {
        if(s[i] == '+') ans++;
        else ans--;
    }
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main {
	static int r; 
	static int c;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
		s = s.replace(" ", "");
		int k = in.nextInt();
		int cnt =  0; 
		String ans = "";
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == ',') {
				cnt += 1;
				continue;
			}
			if(cnt == k - 1) ans += s.substring(i, i + 1);
		}
		System.out.println(ans);
	}
} 


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

ll f(ll n, ll k) {
  ll res = 0;
  while(n % k == 0) {
    res++;
    n /= k;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) {
    double d;
    cin >> d;
    a[i] = round(d * 1e9);
  }
  vector<vl> v(19, vl(19, 0));
  vl two(n), five(n);
  rep(i, n) {
    two[i] = f(a[i], 2);
    five[i] = f(a[i], 5);
    ll ti = min(18LL, two[i]);
    ll fi = min(18LL, five[i]);
    v[ti][fi]++;
  }

  ll cnt = 0;
  rep(i, n) {
    rep(j, 19) rep(k, 19) if(j >= 18 - two[i] && k >= 18 - five[i]) cnt +=
        v[j][k];
    if(min(two[i], five[i]) >= 9) cnt--;
  }
  cout << cnt / 2 << endl;
}

Measured memory_bytes: 8140
open System.Collections.Generic

let n = stdin.ReadLine() |> int

let array6 =
    [| 
        let mutable count = 1
        while count<= 100000 do
            yield count
            count <- count * 6
    |]
let array9 =
    [| 
        let mutable count = 1
        while count<= 100000 do
            yield count
            count <- count * 9
    |]

/// メモ化再帰に用いる辞書
let cache = Dictionary<_,_>()
let memoize f = 
    fun x -> 
        if cache.ContainsKey(x) then cache.[x]
        else
        cache.[x] <- f x
        cache.[x]

/// メモ化再帰
let rec memCount n=
    let count n=
        if n <> 0 then
            let cand1 = 
                n - (array6 |> Array.findBack (fun x -> x <= n))
            let cand2 = 
                n - (array9 |> Array.findBack (fun x -> x <= n))
            min
                (memCount cand1)
                (memCount cand2)
            + 1
        else 0
    let memCount = memoize count
    memCount n

memCount n |> stdout.WriteLine

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const int MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int H, W, N;
	int h, w;
	cin >> H >> W >> N;
	cin >> h >> w;
	string s, t;
	cin >> s;
	cin >> t;
	//up
	{
		int subh = h;
		for (int i = 0; i < N; i++) {
			if (s[i] == 'U') {
				subh--;
			}
			if (subh == 0) {
				cout << "NO" << endl;
				cerr << "up"  << i<< endl;
				return 0;
			}
			if (t[i] == 'D' && subh != H) {
				subh++;
			}
		}
	}
	//down
	{
		int subh = h;
		for (int i = 0; i < N; i++) {
			if (s[i] == 'D') {
				subh++;
			}
			if (subh == H+1) {
				cout << "NO" << endl;
				cerr << "down" << i << endl;
				return 0;
			}
			if (t[i] == 'U'&& subh != 1) {
				subh--;
			}
		}
	}
	//left
	{
		int subw = w;
		for (int i = 0; i < N; i++) {
			if (s[i] == 'L') {
				subw--;
			}
			if (subw == 0) {
				cout << "NO" << endl;
				cerr << "left" << i << endl;
				return 0;
			}
			if (t[i] == 'R'&& subw != W) {
				subw++;
			}
		}
	}
	//right
	{
		int subw = w;
		for (int i = 0; i < N; i++) {
			if (s[i] == 'R') {
				subw++;
			}
			if (subw == W+1) {
				cout << "NO" << endl;
				cerr << "right" << i << endl;
				return 0;
			}
			if (t[i] == 'L'&& subw != 1) {
				subw--;
			}
		}
	}
	cout << "YES" << endl;
	return 0;
}



Measured memory_bytes: 776
*inputs, = map(int, open(0).read().split())
A = inputs[:9]
B = inputs[9:]

C = [0] * 9
for b in B:
  if b in A:
    C[A.index(b)] = 1
    
if any([
     all(C[:3]), all(C[3:6]), all(C[6:]),
     all(C[::3]), all(C[1::3]), all(C[2::3]),
     all([C[0], C[4], C[8]]), all([C[2], C[4], C[6]])
    ]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::{BTreeMap,BTreeSet};
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! tf {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}

fn main() {
    let (a, b) = {
        let xs = read_vec_i64();
        (xs[0], xs[1])
    };
    let res = a * b - a - b + 1;
    println!("{}", res);
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    //ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


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

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, m, k;
	cin >> n >> m >> k;
	vector < int > a(n), b(m);
	vector < long long > a_p(n + 1, 0), b_p(m + 1, 0);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		a_p[i + 1] = a_p[i] + a[i];
	}
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
		b_p[i + 1] = b_p[i] + b[i];
	}
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		if (a_p[i] <= k) {
			int j = prev(upper_bound(b_p.begin(), b_p.end(), k - a_p[i])) - b_p.begin();
			ans = max(ans, i + j);
		}
		else
			break;
	}
	cout << ans << '\n';
}


Measured memory_bytes: 7920
n=int(input())
a=[int(input()) for i in range(n)]
b=[a[i] for i in range(n)]
b.sort()
m=b[n-1]
m2=b[n-2]
for i in range(n):
  if a[i]==m:
    print(m2)
  else:
    print(m)

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

public class Main{


	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{

			while(true){
			String str=reader.readLine();

			String[] str_Array=str.split(" ");
			int a=Integer.parseInt(str_Array[0]);
			int b=Integer.parseInt(str_Array[2]);
			String c=str_Array[1];

			if("?".equals(c))break;
			if("+".equals(c)){
				System.out.println(a+b);
			}else if("-".equals(c)){
				System.out.println(a-b);
			}else if("/".equals(c)){
				System.out.println(a/b);
			}else if("*".equals(c)){System.out.println(a*b);
}
			}

			reader.close();
		}catch(IOException e){
			System.out.println("??¨??????:"+e);

		}

	}

}

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

typedef long long ll;

ll x, n, Dif, Ans, xx, N;
bool vis[50];
char ch[50];

inline ll Min(ll a, ll b) {
	return a < b ? a : b;
}
inline ll Abs(ll a) {
	return a < 0 ? -a : a;
}

void dfs(ll u, ll Ad, ll l) {
	if (l > n) {
		ll dif = Min(N - Abs(u - x), Abs(u - x));
		if (dif >= Dif) {
			if (Dif < dif || Ans > u) Ans = u;
			Dif = dif;
		}
		return;
	}
 	for (ll i = 0; i <= 9; i++)
		if (!vis[i]){
			vis[i] = 1;
			dfs(u + Ad * i, Ad * 10ll, l + 1);
			vis[i] = 0;
		}
}

int main(void) {
//	freopen("1.in", "r", stdin);
//	gets(ch);
	scanf("%s", ch);
	n = strlen(ch);
	for (int i = 0; i < n; i++)
		x = x * 10ll + ch[i] - '0';
	N = 1;
	for (ll i = 0; i < n; i++) N *= 10;
	dfs(0, 1, 1);
	if (Ans * 10ll < N) putchar('0');
//	printf("%lld\n", Ans);
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 3180
#import <stdio.h>
#import <stdlib.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
typedef long long Int;
int desc(const void *a, const void *b) {
    Int d = *(Int *)b - *(Int *)a;
    return (d > 0) ? 1 : (d < 0) ? -1 : 0;
}
int main() {
    Int n;
    scanf("%lld", &n);
    Int *a = (Int *)malloc(sizeof(Int) * 3*n);
    rep(i, 3 * n) scanf("%lld", a + i);
    qsort(a, 3 * n, sizeof(Int), desc);
    Int ans = 0;
    rep(i, n) ans += a[2 * i + 1];
    printf("%lld\n", ans);
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for(int i = 0; i < N; ++i) cin >> L[i];
  vector<int> Lsum(N+1, 0);
  for(int i = 0; i < N; ++i) Lsum[i+1] = Lsum[i]+L[i];
  vector<vector<int> > dp(N+1, vector<int>(Lsum[N]+1, -1));
  dp[0][0] = INT_MAX;
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j <= i; ++j) {
      int len = Lsum[i+1]-Lsum[j];
      for(int k = 0; k < Lsum[N]; ++k) {
	if(dp[j][k] == -1) continue;
	int idx = max(k, len);
	dp[i+1][idx] = max(dp[i+1][idx], min(dp[j][k], len));
      }
    }
  }
  int ans = *max_element(L.begin(), L.end())-*min_element(L.begin(), L.end());
  for(int i = 0; i < Lsum[N]; ++i) {
    if(~dp[N][i]) ans = min(ans, i-dp[N][i]);
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 12732
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

long long MOD = 1e6 + 3;

long long inq(long long a, long long x)
{
    if (x == 0) return 1;
    long long l = inq(a, x / 2);
    if (x % 2) return l * l % MOD * a % MOD;
    return l * l % MOD;
}

long long fact[1200000];

int main()
{
    fact[0] = 1;
    for (int i = 1; i <= MOD; i++) fact[i] = i * fact[i - 1] % MOD;
    int q;
    long long x, d, n;
    cin >> q;
    while (q--)
    {
        cin >> x >> d >> n;
        if (d % MOD == 0)
        {
            cout << inq(x, n) << "\n";
            continue;
        }
        if (n >= MOD)
        {
            cout << 0 << "\n";
            continue;
        }
        x = x * inq(d, MOD - 2) % MOD;
        if (x + n - 1 >= MOD) cout << "0\n";
        else cout << fact[x + n - 1] * inq(fact[x - 1], MOD - 2) % MOD * inq(d, n) % MOD << "\n";
    }
}


Measured memory_bytes: 9088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    public class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            Dictionary<string, int> vs = new Dictionary<string, int>();

            var maxVal = 1;

            //foreach(var _ in Enumerable.Range(0, n))

            for (int i = 0; i < n; i++)
            {
                var oneString = Console.ReadLine();
                if (vs.ContainsKey(oneString))
                {
                    vs[oneString]++;
                    maxVal = Math.Max(maxVal, vs[oneString]);
                }
                else
                {
                    vs.Add(oneString, 1);
                }
            }

            var ans = vs.Where(tmp => tmp.Value == maxVal).Select(tmp => tmp.Key).OrderBy(tmp => tmp,StringComparer.Ordinal).ToArray();
            
            foreach(var tmp in ans)
            {
                Console.WriteLine(tmp);
            }
            
        }
    }
}


Measured memory_bytes: 48496
import java.util.*;
import java.util.stream.*;
class Main {
    public static ArrayList<Integer> divisors(int n) {
        ArrayList<Integer> div = new ArrayList<Integer>();
        for (int i = 1; i < (int)Math.pow(n,0.5)+1;i++){
            if (n%i == 0){
                div.add(i);
                if (i != n/i){
                    div.add((int)n/i);
                }
            }
        }
        return div;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a,b,c;
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        ArrayList<Integer> div = divisors(c);
        int ans = 0;
        for (int i = a; i < b+1; i++){
            for (int j = 0; j < div.size(); j++){
                if (i == div.get(j)){
                    ans += 1;
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26292
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int q, ans;
  long long a, b, c;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%lld%lld", &a, &b);
    c = sqrt(a*b);
    if(a == b) ans = (a-1)*2;
    else if(abs(a - b) == 1) ans = (a+b) - 3;
    else if(c*c == a*b) ans = c*2 - 3;
    else if(c*(c+1) < a*b) ans = c*2 - 1;
    else ans = c*2 - 2;
    printf("%d\n", ans);
  }
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    int a, b;

    cin >> a >> b;
    cout << (a < 10 && b < 10 ? a*b : -1) << '\n';

    return 0;
}


Measured memory_bytes: 256
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pob pop_back
#define ft first
#define ftt ft.ft
#define ftc ft.sc
#define sc second
#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define ctz __builtin_ctz
typedef pair<int, int> pii;
typedef pair<ll ,ll> pll;
const int maxn = 1e6 + 120;
 



int a ,b ,c;
int main(){FAST;
    cin >> a >> b >> c;
    a+b - 1 >= c && a <= c? cout << "YES" : cout << "NO";

   return 0;
}
 












Measured memory_bytes: 256
n,*h=map(int,open(0).read().split())
ans=0
left=0
while True:
    while left<n and h[left]==0:
        left+=1
    
    if left==n:
        break
    
    right=left

    while right+1<n and h[right+1]>0:
        right+=1
    
    ans+=1
    for i in range(left,right+1):
        h[i]-=1
    
print(ans)

Measured memory_bytes: 68300
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

struct par{
    int right;
    int left;
    int num;
    int diff;

    par(int right, int left) :right(right), left(left){
        num = 1;
        if(left>0 and right==0) num = 2;
        if(right>0 and left==0) num = 0;
        diff = left-right;
    };

    bool operator<(const par& p) const{
        return num==p.num?diff>p.diff:num>p.num;
    }

};

int N;
string s;
vector<par> p;
int main(void){
    cin >> N;
    REP(i,N){
        cin >> s;
        int right = 0, left = 0;
        REP(j, s.length()){
            if(s[j] == '(') left++;
            else if (s[j] == ')' and left == 0) right++;
            else if (s[j] == ')' and left > 0) left--;
        }
        p.emplace_back(right, left);
    }
    sort(p.begin(), p.end());
    ll count = 0;
    REP(i, p.size()){
        count -= p[i].right;
        if(count < 0){
            cout << "No" << endl;
            return 0;
        }
        count += p[i].left;
    }
    if(count == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int a;
  long double b;
  cin >> a >> b;
  cout << int(a * b) << '\n';
  return 0;
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	int N,count = 0;
  cin >> N;
  vector<int> a(N);
  froop1(0,N){
    cin >> a.at(i);
  }
  froop1(0,N){
    for(int j = i + 1;j < N;j++){
      for(int k = j + 1;k < N;k++){
        if(i != j && j != k && k != i && a.at(i) != a.at(j) && a.at(j) != a.at(k) && a.at(k) != a.at(i)){
          if(a.at(i) < a.at(j) + a.at(k) && a.at(j) < a.at(i) + a.at(k) && a.at(k) < a.at(i) + a.at(j)){
				count++;
          }
        }
      }
    }
  }
  cout << count << endl;

return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long 
// int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1};
// int dx[]={2,2,-2,-2,1,1,-1,-1}; int dy[]={1,-1,1,-1,2,-2,2,-2};
const long long mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector< pair< int, int > > vii;
typedef map<int, int> mii;
typedef pair<int, ii> pip;
typedef pair<ii, int> ppi;
#define arrinp(arr,init,final,size,type) type* arr=new type[size];for(int i=init;i<final;i++)cin>>arr[i];
#define cr2d(arr,n,m,t) t**arr=new t*[n];for(int i=0;i<n;i++)arr[i]=new t[m];
#define w(t) int t;cin>>t; while(t--)
#define takeInp(n) int n;cin>>n;
#define fr(i,init,final) for(int i=init;i<final;i++)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  nds; 
vi init(string s)
{
	istringstream sin(s);
	int n;
	vi arr;
	while(sin>>n)arr.push_back(n);
	return arr;
}
int pow(int x, int y)
{ 
	if(y==0)return 1;
	int u=pow(x,y/2);
	u=u*u;
	if(y%2)u=x*u;
	return u;
    
}
int gcd(int a,int b)
{
	if(a<b)return gcd(b,a);
	return (b==0?a:(a%b?gcd(b,a%b):b));
}
int gcd_e(int a,int b,int &x,int &y)
{
	
	if(b==0){x=1; y=0; return a;}
	int x1,y1;
	int p=gcd_e(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;
	return p;
}
signed main()
{
	IOS
	int n;
	cin>>n;
	long long arr[n+1];
	fr(i,1,n+1)
	{   arr[i]=0;
		fr(j,1,sqrt(((double)(2*i))+1))
		{
			for(long long  k=1;j+k<=sqrt(2*i);k++)
			{
				for(long long r=1;(j+k)*(j+k)+(j+r)*(j+r)+(k+r)*(k+r)<=2*i;r++)
				{
					if( (j+k)*(j+k)+(j+r)*(j+r)+(k+r)*(k+r)==2*i)arr[i]++;
				}
			}
		}
	}
	fr(i,1,n+1)cout<<arr[i]<<endl;
	
}



Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7


def f(index, l):
    if index == len(l):
        return 1
    if l[index] == '1':
        return ( pow(3, len(l)-1-index, MOD) + 2 * f(index+1, l) ) % MOD
    else:
        return f(index+1, l) % MOD


def main():
    l = input()
    print(f(0, l))


main()

Measured memory_bytes: 92252
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 1000000007
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define INF 1LL << 60
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	fast_io();
	int n,k;
	cin >> n >> k;
	vector<ll> id, cnt;
	for(int x = 1,la; x <= n;x = la + 1){
		la = min(n/(n/x), n);
		id.pb(x);
		cnt.pb(la - x + 1);
	} 
	int h = id.size();
	vector<ll> pans(h), cans(h);
	pans[0] = 1;
	while(k--){
		ll sum = 0;
		ll pnt = 0;
		cd(i,h,0){
			while(pnt < h && id[pnt] <= n/id[i]){
				sum += pans[pnt++];
				sum %= MOD;
			}
			cans[i] = sum * cnt[i] % MOD;
		}
		swap(cans, pans);
	}
	ll res = 0;
	cu(i,0,h)res += pans[i];
	res%=MOD;
	cout << res << '\n';
}


Measured memory_bytes: 2420
#include <iostream>
	#include <vector>
	#include <algorithm>
	#include <utility>
	#include <queue>
	#include <set>
	#include <stdio.h>
	#include <string>
	using namespace std;
	#define ll long long


	int main() {
		int i;
		cin >> i;
		cout << i * i << endl;
		return 0;
	}

Measured memory_bytes: 256
require 'prime'

N = gets.to_i
hash = {}

2.step(N) do |i|
  Prime.prime_division(i).each do |array|
    factor = array[0]
    count = array[1]
    if hash[factor].nil?
      hash[factor] = count
    else
      hash[factor] += count
    end
  end
end

answer = 1
hash.each do |key, value|
  answer = answer * (value + 1) % (10**9 + 7)
end
puts answer


Measured memory_bytes: 2172
#include <cstdio>
#include <algorithm>
#include <map>
#include <atcoder/all>

using i8 = std::int8_t;
using u8 = std::uint8_t;
using i16 = std::int16_t;
using u16 = std::uint16_t;
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

using mint = atcoder::modint998244353;

i32 bucket[100000];

mint fac[50001];
mint ifac[50001];

auto main() -> i32 {
	i32 n;
	scanf("%d", &n);
	for (i32 i = 0; i < 2 * n; ++i) {
		i32 h;
		scanf("%d", &h);
		bucket[h] += 1;
	}
	fac[0] = mint(1);
	for (i32 i = 1; i <= n; ++i) {
		fac[i] = mint(i) * fac[i - 1];
	}
	ifac[n] = fac[n].inv();
	for (i32 i = n - 1; i >= 0; --i) {
		ifac[i] = ifac[i + 1] * mint(i + 1);
	}
	std::vector<mint> poly;
	std::vector<mint> poly2;
	poly.emplace_back(1);
	poly2.emplace_back(1);
	i32 p = 0;
	for (i32 i = 0; i < 100000; ++i) {
		if (i64 k = bucket[i]; k >= 2) {
			p += bucket[i] / 2;
			std::vector<mint> b;
			b.emplace_back(1);
			mint x = mint(1);
			for (i64 i = 2; i <= k; i += 2) {
				x *= mint((k - i + 2) * (k - i + 1) / 2) / mint(i / 2);
				b.emplace_back(x);
			}
			if (poly.size() <= n / 2) {
				poly = atcoder::convolution(poly, b);
			} else {
				poly2 = atcoder::convolution(poly2, b);
			}
		}
	}
	poly = atcoder::convolution(poly, poly2);
	std::vector<mint> table;
	table.emplace_back(1);
	for (i32 i = 1; i <= n; ++i) {
		mint x = table[i - 1] * mint(2 * i - 1);
		table.emplace_back(x);
	}
	mint ans = mint(0);
	for (i32 i = 0; i <= p; ++i) {
		ans = ans + (i % 2 == 0 ? poly[i] : -poly[i]) * table[n - i];
	}
	printf("%d\n", ans.val());
	return 0;
}


Measured memory_bytes: 5312
#include <iostream>
#include <cstdio>

using namespace std;

int H, W;

int ans_x, ans_y;

string str[500];

bool map[500][500];

bool search(int x, int y){
	if(x < 0 || x >= W || y < 0 || y >= H){
		return false;
	}
	
	if(map[y][x]){
		return false;
	}
	
	map[y][x] = true;
	
	if(str[y][x] == '.'){
		ans_x = x;
		ans_y = y;
		return true;
	}else if(str[y][x] == '^'){
		return search(x, y - 1);
	}else if(str[y][x] == 'v'){
		return search(x, y + 1);
	}else if(str[y][x] == '<'){
		return search(x - 1, y);
	}else if(str[y][x] == '>'){
		return search(x + 1, y);
	}
}

int main(){
	
	cin >> H >> W;
	
	while(H != 0 || W != 0){
		
		for(int i = 0; i < H; i++){
			cin >> str[i];
		}
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				map[i][j] = false;
			}
		}
		
		if(search(0,0)){
			printf("%d %d\n", ans_x, ans_y);
		}else{
			printf("LOOP\n");
		}
		
		cin >> H >> W;
	}
	
	return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}
bool bitcheck(ll x, ll y) { return (x >> y) & 1; }

template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}
map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> as(n);
    REP(i, n) { cin >> as[i]; }
    ll ng = 0;
    ll ok = 1000000001;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        ll sum = 0;
        REP(i, n) { sum += (as[i] + mid - 1) / mid - 1; }
        if (sum <= k) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << endl;
}

Measured memory_bytes: 4740