akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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; }
inline void Yes (bool condition) { if(condition) { cout << "Yes" << endl; } else { cout << "No" << endl;} }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

signed main(){
	int n;
	cin>>n;
	if(n==3){
		cout<<2<<" "<<5<<" "<<63<<endl;
		return 0;
	}
	vector<int> ret;
	vector<P> p;
	vector<int> s;
	rep(i,2,30001){
		if(i%6==0){
			s.push_back(i);
			if(i%12==6){
				if(i+3<=30000)p.push_back(P(i-3,i+3));
			}
		}else if(i%2==0){
			if(i%6==2){
				if(i+4<=30000)p.push_back(P(i,i+2));
			}
		}
	}
	int now=0;
	while(n-2>=0&&now<p.size()){
		ret.push_back(p[now].first);
		ret.push_back(p[now].second);
		n-=2;
		now++;
	}
	now=0;
	while(n>0){
		ret.push_back(s[now]);
		now++;
		n--;
	}
	rep(i,ret.size())cout<<ret[i]<<" ";
	cout<<endl;
}


Measured memory_bytes: 832
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	ans := make([]int, 0)
	for {
		var v int
		fmt.Scan(&s)
		if s == "0" {
			break
		}
		for i := 0; i < len(s); i++ {
			j, _ := strconv.Atoi(string(s[i]))
			v += j
		}
		ans = append(ans, v)
	}
	for i := range ans {
		fmt.Println(ans[i])
	}
}



Measured memory_bytes: 1124
n = int(input())
l = [""]
i = 1
 
while i <= n:
    x = int(i)
    if x%3 == 0:
        l.append(str(i))
        i += 1
        continue
    while x != 0:
        if x%10 == 3:
            l.append(str(i))
            break
        else:
            x //= 10
    i += 1

print(" ".join(l))


Measured memory_bytes: 5976
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

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

  ll n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(ALL(a));
  ll ma = a.back();
  a.pop_back();
  ll mi = INF;
  for (auto& v : a) {
    if (abs(v - ((ma+1)/2)) < abs(mi - ((ma+1)/2))) mi = v;
  }

  cout << ma << " " << mi << endl;

  return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;
    REP(i, n-1){
        ans += s[i] != s[i+1];
    }
    cout << ans << endl;
    return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    ll n ; cin >> n ;
    ll a[n] ; loopcin(n , a) ;
    sort(a , a + n) ;
    cout << a[n - 1] - a[0] << endl ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  priority_queue<double, vector<double>, greater<double>> que;
  for (int i = 0; i < N; i++) {
    double v;
    cin >> v;
    que.push(v);
  }
  while ((int)que.size() > 1) {
    double nxt = 0;
    nxt += que.top();
    que.pop();
    nxt += que.top();
    que.pop();
    que.push(nxt / 2);
  }
  cout << fixed << setprecision(10) << que.top() << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define ll long long
#define pp pair<int,int> 
#define v(T) vector<T>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
//int 2×10の9乗
//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
//cout << fixed << setprecision(10);
//int gcd(int x, int y){
  //if(y==0) return x;
  //return gcd(y, x%y);
//}
//sort小さい順(昇順)
 
int main() {
  int n,d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  rep(i,n) rep(j,d) cin >> x[i][j];
  int cnt=0;
  rep(i,n){
    for (int j=i+1;j<n;j++){
      int dis=0;
      rep(k,d){
        dis+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      rep(l,150){
          if(dis==l*l) cnt++;
      }
    }
  }
  cout << cnt << endl;
}  

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define infinity 1000000010;
int n,cnt=0;
int A[500010],L[250010],R[250010];

void merge(int left,int mid,int right){
	for(int i=0;i<mid-left;i++) L[i]=A[left+i];
	for(int i=0;i<right-mid;i++) R[i]=A[mid+i];
	L[mid-left]=infinity;R[right-mid]=infinity;
	int i=0,j=0;
	for(int k=left;k<right;k++){
		cnt++;
		if(L[i]>R[j]) A[k]=R[j++];
		else A[k]=L[i++];
	}
	return ;
}

void merge_sort(int left,int right){
	if(left+1<right){
	int mid=(left+right)/2;
	merge_sort(left,mid);
	merge_sort(mid,right);
	merge(left,mid,right);
	return ;
	}
}

int main (){
	cin>>n;
	for(int i=0;i<n;i++) cin>>A[i];
	merge_sort(0,n);
	for(int i=0;i<n;i++) {
		if(i) cout<<" ";
		cout<<A[i];
	}
	cout<<endl<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 6868
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<stack>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
const ll mod = (1e+9) + 7;

int main() {
	int n, k;
	static ll dp[55][55][2705];
	cin >> n >> k;
	dp[0][0][0] = 1;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= n; ++j) {
			for (int l = 0; l <= k; ++l) {
				dp[i + 1][j][l + 2 * j] = (dp[i + 1][j][l + 2 * j] + dp[i][j][l]) % mod;
				dp[i + 1][j + 1][l + 2 * (j + 1)] = (dp[i + 1][j + 1][l + 2 * (j + 1)] + dp[i][j][l]) % mod;
				dp[i + 1][j][l + 2 * j] = (dp[i + 1][j][l + 2 * j] + dp[i][j][l] * 2 * j) % mod;
				if (j >= 1)
					dp[i + 1][j - 1][l + 2 * (j - 1)] = (dp[i + 1][j - 1][l + 2 * (j - 1)] + dp[i][j][l] * j * j) % mod;
			}
		}
	}
	cout << dp[n][0][k] << endl;
	return 0;
}

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

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int INF = 1000000000;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

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

    int n, k;
    cin >> n >> k;
    vector<int> logs(n);
    rep(i, n) cin >> logs[i];

    int left = 0, right = INF, mid;
    while (right - left > 1) {
        mid = left + (right - left) / 2;
        int cut = 0;
        rep(i, n) {
            if (cut > k) break;
            cut += (logs[i] + mid - 1) / mid - 1;
        }
        if (cut <= k) right = mid;
        else left = mid;
    }

    cout << right << endl;

    return 0;
}

Measured memory_bytes: 3952
// #include<bits/stdc++.h>
// using namespace std;
 
// const int N = 10000, MAXI = 10000;
 
// int main() {
//     freopen("output.txt", "r", stdin);
//     freopen("input.txt", "w", stdout);
//     srand(time(nullptr));
//     int tc = 10;
//     cout << tc << "\n";
//     while (tc--)
//     {
//         int n = rand()%N+1;
//         cout << n << " ";
//         cout << rand()%n + 1 << "\n";
//         for(int i=1;i<=n;i++)
//             cout << rand()%MAXI + 1 << " ";
//         cout << "\n";
//         cout << "~\n";
//     }
 
//     return 0;
// }
 
 
 
 
 
 
 
 
//---------------------------------------------//
 
 
 
 
 
 
 
 
 
 
//  /* while(!cin.eof()) */
 
#include<bits/stdc++.h>
using namespace std; 
#define int long long 
#define mod (int)(1e9+9)
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 100005
 
 
// Driver code to test above functions
int32_t main()
{
    
     
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
 
    string s, t;
    cin >> s >> t;

    int n = t.size();
    if(s==t.substr(0, n-1))
    	cout << "Yes";
    else
    	cout << "No";
 
    return 0;
 
} 

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

int main(){
  int h,a;
  cin >> h >> a;
  cout << (h + a -1)/a << endl;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=998244353;

int32_t main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int x=(c*d)/__gcd(c,d);
	int l1=b/c-(a-1)/c;
	int l2=b/d-(a-1)/d;
	int l3=b/x-(a-1)/x;
	int tot=l1+l2-l3;
	cout<<(b-a+1-tot);	
}

Measured memory_bytes: 256
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

stdin.ReadLine()

readIntArray ()
|> Array.indexed
|> fun x ->
    [ for (i1, a) in x do
        for (i2, b) in x |> Array.filter (fun (i, _) -> i > i1) do
            for (_, c) in x |> Array.filter (fun (i, _) -> i > i2) -> [ a; b; c ] ]
|> List.map List.sortDescending
|> List.filter (fun [ a; b; c ] -> a < b + c && a <> b && b <> c)
|> List.length
|> printfn "%d"


Measured memory_bytes: 91456
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+15;

vector<int> ret[N];
void solve(){
    int n;
    scanf("%d",&n);
    int k;
    for(k = 1;(k*(k-1))/2<n;++k);
    
    if( (k*(k-1)) != n*2){
        cout<<"No\n";
    } else {
        int pos = 1;
        for(int x = 1;x<=k;++x){
            for(int y = x+1;y<=k;++y){
                ret[x].push_back(pos);
                ret[y].push_back(pos++);
            }
        }
        printf("Yes\n%d\n",k);
        for(int i=1;i<=k;++i){
            printf("%d ", (int)ret[i].size());

            for(int v : ret[i]){
                printf("%d ", v);
            }
            putchar('\n');
        }
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    solve();
}


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

using namespace std;
int n,a[100005];
vector<int> wr;
bool v[100005];

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
		if(a[i]==i)
		{
			wr.push_back(i);
			v[i]=true;
		} 
	}
	
	int res=0;
	for(int i=0;i<int(wr.size());i++)
	{
		if(!v[wr[i]]) continue;
		v[wr[i]]=false;v[wr[i]+1]=false;
		res++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)(j);i <= (int)(k);i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    set<string>st;
    int n;cin>>n;rep(i,1,n){
        string s;cin>>s;st.insert(s);
    }
    cout<<st.size()<<endl;
}

Measured memory_bytes: 19236
# from math import gcd
from fractions import gcd

def yakusu(n):
    results = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            results.append(i)
            results.append(n // i)
    return set(results)

A, B = map(int, input().split())

sy = sorted(list(yakusu(gcd(A, B))))
ans = []
for i in sy[1:]:
    flag = True
    for a in ans:
        if i % a == 0:
            flag = False
            break
    if flag:
        ans.append(i)
print(len(ans)+1)

Measured memory_bytes: 65516
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,a,b,c,d;
    double s,s1,s2,s3;
    cin>>n>>k;
    vector<double>vc;
    for(i=0;i<n;i++)
    {
        cin>>l;
        b=l+1;
        s1=(l*b)/2*1.00;
        s1=s1/l;
        vc.push_back(s1);
    }

    s=0;
    s1=0;
    for(i=0;i<k;i++)
    {
        s1+=vc[i];
    }
    if(s1>=s)
    {
        s=s1;
    }
    for(i=k,j=0;i<n;i++,j++)
    {
        s1+=vc[i];
        s1-=vc[j];
        if(s1>=s)
        {
            s=s1;
        }
    }
    cout<<fixed<<setprecision(12)<<s<<endl;
    return 0;

}


Measured memory_bytes: 2420
from itertools import combinations
from itertools import permutations
import math

n = int(input())

loc = [None]*n
for i in range(0, n):
	x, y = [int(el) for el in input().split(' ')]
	loc[i] = [x, y]



# compute all distance
comb = combinations([i for i in range(0, n)], 2)

dist = dict()
for c in comb:
	start = c[0]
	goal = c[1]

	d = math.sqrt(pow(loc[start][0] - loc[goal][0], 2) \
		+ pow(loc[start][1] - loc[goal][1], 2))
	dist[c] = d

# all possible ways to go around the cities
pattern = permutations([i for i in range(0, n)])

total_d = 0
for pat in pattern:
	sub_total_d = 0
	for j in range(0, n-1):
		start = min(pat[j], pat[j+1])
		goal = max(pat[j], pat[j+1])

		sub_total_d += dist[(start, goal)]
	total_d += sub_total_d
print(total_d / math.factorial(n))

Measured memory_bytes: 3188
N = int(input())
A_lis = list(map(int, input().split()))

A_lis.sort()

N_neg = 0
for j in A_lis:
  if j < 0:
    N_neg += 1
  else:
    break
    
N_pos = len(A_lis) - N_neg

seq = []

neg = A_lis[0]
pos = A_lis[-1]

if N_neg == 0:
  for j in range(N_pos-2):
    ind = j + 1
    seq.append((neg, A_lis[ind]))
    neg = neg - A_lis[ind]
  seq.append((pos, neg))
  print(pos-neg)
  for j in seq:
    print("%d %d" % j)
  exit()
  
if N_pos == 0:
  for j in range(N_neg-1):
    ind = j
    seq.append((pos, A_lis[ind]))
    pos = pos - A_lis[ind]
  print(pos)
  for j in seq:
    print("%d %d" % j)
  exit()
    
for j in range(N_pos-1):
  ind = N_neg + j
  seq.append((neg, A_lis[ind]))
  neg = neg - A_lis[ind]

  
for j in range(N_neg-1):
  ind = j + 1
  seq.append((pos, A_lis[ind]))
  pos = pos - A_lis[ind]
  
seq.append((pos, neg))
print(pos-neg)

for j in seq:
  print("%d %d" % j)


Measured memory_bytes: 19384
using System;
using System.Collections.Generic;
using System.Linq;

class aizu_judge
{
    static void Main(string[] args)
    {
        while(true)
        {
            int[] num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (num[0] + num[1] == 0)
                break;


            for (int i = 0; i < num[0]; i++)
            {
                string width = string.Empty;
                if (i == 0 || i == num[0] - 1)
                    width = new string('#', num[1]);
                else if (num[1] > 2)
                    width = "#" + new string('.', num[1] - 2) + "#";

                Console.WriteLine(width);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9336
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			if ((w | h) == 0)
				break;
			map = new boolean[h][w];
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					map[i][j] = scanner.nextInt() == 0;
			ans = 0;
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++) {
					if (map[i][j])
						continue;
					dfs(i, j, 1);
				}
			System.out.println(ans);
		}
	}

	private void dfs(int y, int x, int depth) {
		map[y][x] = true;
		for (int[] m : move) {
			int ny = y + m[0];
			int nx = x + m[1];
			if (!isOK(ny, nx))
				continue;
			if (map[ny][nx])
				continue;
		
			dfs(ny, nx, depth + 1);
			
		}
		map[y][x] = false;
		ans = Math.max(ans, depth);
	}

	private boolean isOK(int y, int x) {
		if (0 <= y && y < h && 0 <= x && x < w)
			return true;
		return false;
	}

	int h, w;
	int[][] move = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
	boolean[][] map;
	int ans;
}

Measured memory_bytes: 36364
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main(){
    let i:i32 = read();
    let h = i/3600;
    let m = i%3600 / 60;
    let s = i % 3600 % 60;
    println!("{}:{}:{}", h, m, s);
}




Measured memory_bytes: 5024
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int num,task;
    cin >> num >> task;

    vector<int> vec(task);
    for(int i=0; i<task; i++){
        cin >> vec.at(i);
    }
    for(int i=0;i<task;i++){
        num = num - vec[i];
    }
    if(num<0){
        cout << "-1" << endl;
    }
    else{
        cout << num << endl;
    }
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{	
	int N, X, T;
  	cin >>N >>X >>T;
  	int count = 0;
  	while (N > 0)
  	{
  		N -= X;
    	count ++;
  	}
  	cout <<count*T<<"\n";
	return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>

int main(void){
  int A, B, T, n;
  scanf("%d %d %d", &A, &B, &T);
  n = 0;
  while(n * A < T + 0.5) n++;
  printf("%d\n", (n - 1) * B);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    
    // 重なりなし
    if (A > D || B < C) {
        cout << 0 << endl;
        return 0;
    }

    cout << min(B, D) - max(A, C)<< endl;
    return 0;
}


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

int main() {
    int n, m;
    int x[100000];
    cin >> n >> m;
    for (int i = 0; i < m; i++) cin >> x[i];

    if (m == 1) {
        cout << 0 << endl;
        return 0;
    }

    sort(x, x + m);
    int dis[99999];
    for (int i = 0; i < m - 1; i++) {
        dis[i] = abs(x[i + 1] - x[i]);
    }

    sort(dis, dis + m - 1);
    int ans = 0;
    for (int i = 0; i < m - n; i++) ans += dis[i];

    cout << ans << endl;
}

Measured memory_bytes: 4208
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return ('0' <= c && c <= '9')?(c - '0'):-1;}

// TODO: write
int main() {
  string s;cin>>s;
  bool isOk = true;
  isOk &= s[0] == 'A';
  int c = 0;
  for(int i = 2;i < s.size()-1;++i){
    c += s[i] == 'C';
  }
  isOk &= c == 1;
  rep(i,s.size()){
    if(i){
      if(!(s[i] <= 'z' && s[i] >= 'a')){
        if(s[i] != 'C')isOk = false;
      }
    }
  }
  if(isOk)print("AC");
  else print("WA");
  return 0;
}



Measured memory_bytes: 256
n = int(input())
s = input()

r = s.count("R")
g = s.count("G")
b = s.count("B")

ans = r * g * b


for i in range(n):
    for j in range(1, n // 2 + 1):
        if i-j < 0 or i+j > n-1:
            break
        if s[i] != s[i-j] and s[i] != s[i+j] and s[i-j] != s[i+j]:
            ans -= 1
print(ans)



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

int main(void) {
  int n,cnt=0;
  cin >> n;
  vector<long> L(n);
  rep(i,n) cin>>L[i];
  sort(L.begin(),L.end());
  for(int i = 0; i < n; i++) {
    for(int j = i+1; j < n; j++) {
      for(int k = j+1; k < n; k++) {
        if(L[i] != L[j] && L[j] != L[k]) {
          if(L[i] + L[j] > L[k]) cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3628
using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var n = int.Parse(line.Trim());
            var f = new bool[n + 1];
            Console.WriteLine(generatePrime(f));
        }
    }
    public static int generatePrime(bool[] f)
    {
        var pL = f.Length;                                           // prime :  false
        f[0] = true; f[1] = true;
        var count = 0;
        for (int i = 2; i < pL; i++)
            if (!f[i])
                for (int j = i + i; j < pL; j += i)
                    if (!f[j]) { f[j] = true; count++; }
                    else f[j] = true;
        return pL - count - 2;
    }
}




Measured memory_bytes: 12088
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()

    val numbers = mutableListOf<Long>()
    (1 .. n).forEach { num ->
        when {
            (num % 5L == 0L) || (num % 3L == 0L) -> {}
            else -> {
                numbers.add(num)
            }
        }
    }

    val sum = numbers.sum()
    println(sum)
}

Measured memory_bytes: 58968
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
        }
    return digit;
    }

ll F(ll x,ll y){
    return max(GetDigit(x),GetDigit(y));
}

int main(){
    ll N;
    cin >> N;
    ll ans=INF;
    for(ll i=1;i*i<=N;i++){
        if(N%i==0){
            ans=min(ans,F(i,N/i));

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t,u; int a,b;
    cin >> s >> t >> a >> b >> u;
    if(s==u) a--;
    if(t==u) b--;
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
bool isPrime(int n){
    rep(i, 2, sqrt(n) + 1){
        if(i > 3){
            i++;
        }
        if(!(n % i)){
            return false;
        }
    }
    return true;
}
main(){
    INCANT;
    int n, tmp, res = 0;
    string s;
    in(n);
    vector<int> v;
    rep(i, 2, 55555){
        if(isPrime(i) && i % 5 == 1){
            v.pb(i);
        }
    }
    while(n--){
        out(v[n]), space();
    }
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"----------------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
#define bug(x) cerr << "[" << #x << "] = ["<<x<<"]"<<'\n'
using namespace std;
int  main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> v;
    for(ll  i=0;i<n;i++)
    {
        ll  x; cin>>x;
        v.pb(x);
    }
    sort(v.rbegin(),v.rend());
    ll  sum=0;
    if(v.size()>k)
    {
        for(ll  i=k;i<v.size();i++) sum+=v[i];
    }
    cout<<sum<<endl;
}
		

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

#define what_is(x)    cerr<<#x<<" is "<<x<<"\n";
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n;
    cout<<n*n;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
  int a,b,c ;
  cin >> a >> b>> c ;
  
  vector<int> ans(100) ;
  int cnt = 0 ;
  for(int i=100;i>0;i--){
    if(a%i ==0 && b%i ==0 ){
      cnt++ ;
      if(cnt == c){
        cout << i << endl ;
        return 0 ;
      }
    }
  }
}


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;
int main(){
    int n,m,i;
    cin>>n>>m;
    int l[m],r[m];
    for(i=0;i<m;i++){
        cin>>l[i]>>r[i];
        if(l[0]<l[i]) l[0]=l[i];
        if(r[0]>r[i]) r[0]=r[i];
    }
    if(r[0]-l[0]>-1)cout<<r[0]-l[0]+1<<endl;
    else cout<<0<<endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(){
    int N;
    while(cin >> N){
        vector<int> a(N);
        for(auto& t : a) cin >> t;
        int sum = accumulate(a.begin(), a.end(), 0);
        int res = 0;
        for(auto t : a){
            sum -= t;
            res += t * sum;
        }
        cout << res << endl;
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int N; cin >> N;

	int a[100005];
	for (int i = 0;i < N;i++){
		cin >> a[i];
	}

	sort(a,a+N);

	int ans = 0;

	int now = a[0];
	int cnt = 1;
	for (int i = 1;i < N;i++){
		if(a[i] != now){
			if(cnt < now) ans += cnt;
			else ans += cnt-now;
			now = a[i]; cnt = 1;
		}else{
			cnt++;
		}
	}

	if(cnt < now) ans += cnt;
	else ans += cnt-now;

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
     
using namespace std;
    
int gcd(int a, int b){

  if(b == 0)  return a;

  return gcd(b, a % b);
}
     
int lcm(int a, int b, int ans_gcd) {
  int ans;
  
  ans = a / ans_gcd * b;

  return ans;
}
     
     
     
     
int main(){
  int a, b;
  int ans_gcd, ans_lcm;

  while (cin >> a >> b) {
    if((a == 0) && (b == 0)) break;

    ans_gcd = gcd(a, b);
    ans_lcm = lcm(a, b, ans_gcd);

    cout << ans_gcd << " " << ans_lcm << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    int ans =0;
    while(true){
        for(int i=0;i<n;i++){
            
            if(a[i] % 2 == 1){
                cout << ans << endl;
                return 0;
            }
            a[i] = a[i]/2;

        }
        ans ++;
    }
}


Measured memory_bytes: 256
n,l = map(int, input().split())
ringo = [l+(i+1)-1 for i in range(n)]

def min_index(list):
    return [i for i, x in enumerate(list) if x == min(list)][0]

abs_ringo = [abs(i) for i in ringo]
ans = sum(ringo) - ringo[min_index(abs_ringo)]

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    if(K % 2  == 0) {
        output(A - B);
    }
    else {
        output(B - A);
    }
    
    return 0;
}


Measured memory_bytes: 256
def main():
    N,M=map(int, input().split())
    ANS = [0]*N
    BOO = [False]*N
    for _ in range(M):
            s,c=map(int, input().split())
            if BOO[s-1] and c!=ANS[s-1]:
                print(-1)
                return
            if s-1 == 0 and c == 0 and N>1:
                print(-1)
                return
            ANS[s-1] = c
            BOO[s-1] = True
        
    if ANS[0] == 0 and N>1:
        ANS[0] = 1
    
    print(''.join([str(n) for n in ANS]))
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=3e5;
long long stack[N],s[N],f[N];
int tn,n,q;
void dfs(long long x,long long w)
{
	if(!x)return;
	int i=upper_bound(stack+1,stack+tn+1,x)-stack-1;
	if(!i)s[1]+=w,s[x+1]-=w;
	else f[i]+=x/stack[i]*w,dfs(x%stack[i],w);
}
int main()
{
	scanf("%d%d",&n,&q);tn=1;stack[1]=n;
	for(int i=1;i<=q;i++)
	{
		long long w;
		scanf("%lld",&w);
		while(tn&&w<=stack[tn])--tn;
		stack[++tn]=w;
	}
	f[tn]=1;
	for(int i=tn-1;i>=1;i--)f[i]+=f[i+1]*(stack[i+1]/stack[i]),dfs(stack[i+1]%stack[i],f[i+1]);
	s[1]+=f[1];
	for(int i=2;i<=stack[1];i++)s[i]+=s[i-1];
	for(int i=1;i<=n;i++)printf("%lld\n",s[i]);
}

Measured memory_bytes: 6528
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)44e15;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
llint fute(llint s,int a){
	//xa+y(a+1)=s,x>0,y>0 となるpair(x,y)の個数を求める
	//(x+y)*a + y = s
	//まず
	s-=a;s-=a+1;if(s<0){return 0;}
	llint ans=0;
	llint y=s%a,syo=(s-y)/a;
	if(y>syo){return 0;}
	return 1+((syo-y)/(a+1));
}
llint kuri(int a){
	llint ans=1,bgen=10;
	for(int h=0;h<30;h++){
		if((a&(1<<h))!=0){ans*=bgen;ans%=mod;}
		bgen*=bgen;bgen%=mod;
	}
	return ans;
}
int main(void){
	llint ans=0;
	int s,i,j,k;cin>>s;
	//7桁を使う場合 全探索 O(1000万)
	llint keta=1,jketa=1,aga=10,jaga=10,gen=0;
	j=0;i=0;
	while(i<1e7-1){
		while(gen<s){
			j++;
			if(j==jaga){jketa++;jaga*=10;}
			gen+=jketa;
		}
		if(gen==s){ans++;}
		i++;
		if(i==aga){keta++;aga*=10;}
		gen-=keta;
	}
	//cout<<ans<<endl;
	//iだけを使う
	for(i=1;i*i<=s;i++){
		if(s%i!=0){continue;}
		if(i>=8){ans+=9*kuri(i-1)+1- s/i;ans%=mod;}
		int ii=s/i;if(ii==i){continue;}
		if(ii>=8){ans+=9*kuri(ii-1)+1- s/ii;ans%=mod;}
	}
	//iとi+1を使う
	for(i=8;i<s;i++){ans+=fute(s,i);ans%=mod;}
	cout<<ans<<endl;
	RE;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize
    }
    let mut max = 1;
    for i in 1..n {
        for k in 1..n {
            let p = vec![i+1; k+1];
            let q = p.iter().fold(1, |acc, x| acc * x);
            if q > n { break; }
            max = std::cmp::max(max, q);
        }
    }

    println!("{}", max);
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;
    lint ans=0;
    vector<lint> vec(n);for(int i=0;i<n;i++)cin>>vec[i];
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(vec[i]!=vec[j]&&vec[j]!=vec[k]&&vec[i]!=vec[k]){
                    if(vec[i]+vec[j]>vec[k]&&vec[j]+vec[k]>vec[i]&&vec[i]+vec[k]>vec[j]){
                        ans++;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, 0, H) {
        cin >> S[i];
    }
    vector<vector<int>> dp(H, vector<int>(W, 1 << 30));
    dp[0][0] = S[0][0] == '#' ? 1 : 0;
    rep(i, 0, H) rep(j, 0, W) {
        // right
        if (j + 1 < W) {
            chmin(dp[i][j + 1], dp[i][j] + (S[i][j] == '.' && S[i][j + 1] == '#' ? 1 : 0));
        }
        // down
        if (i + 1 < H) {
            chmin(dp[i + 1][j], dp[i][j] + (S[i][j] == '.' && S[i + 1][j] == '#' ? 1 : 0));
        }
    }
    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

Measured memory_bytes: 384
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

const int N = 100010;
const string ABC = "ABC";

int n, v[3];
string s[N];

bool ok = false;
char ans[N];

void dfs(int d, vector<int> x) {
    if (d == n) {
        ok = true;
        return;
    }

    bool b[3] = {};
    int z = 0;
    for (char c : s[d]) {
        b[c - 'A'] = true;
        z += c - 'A';
    }
    rep(i, 3) if (b[i]) {
        vector<int> nx(x);
        ++nx[i];
        --nx[z - i];

        bool valid = true;
        rep(j, 3) if (abs(nx[j]) > 2 || v[j] + nx[j] < 0) valid = false;

        if (valid) {
            ans[d] = ABC[i];
            dfs(d + 1, nx);
        }
        if (ok) return;
    }
}

int main() {
    cin >> n;
    rep(i, 3) cin >> v[i];
    rep(i, n) cin >> s[i];

    dfs(0, vector<int>(3, 0));

    if (!ok) {
        cout << "No\n";
        return 0;
    }

    cout << "Yes\n";
    rep(i, n) cout << ans[i] << "\n";
    return 0;
}


Measured memory_bytes: 25600
// WARNING: Add compile option "-std=c++11" for C++11 compile.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

// Macro
#define rep(i, a, b) for(int i=a; i<(int)b; i++)
#define mp make_pair
#define pb push_back

// Type
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

// Constants
const int MOD = (int)1e9 + 7;
int dy[] = {0, 1, -1, 0};
int dx[] = {1, 0, 0, -1};

/**
  型に合わせたINFを返す
  int: 214,748,364 (2.14 * 1e8)
  ll : 922,337,203,685,477,580 (9.22 * 1e17)
*/
template <typename T>
T getINF() {
  // NOTE: INF同士を足してもオーバーフロー起こさないように、10で割っている
  return numeric_limits<T>::max() / 10;
}

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int N, K;
ll v[50];

int main() {
  cin >> N >> K;
  rep(i, 0, N) cin >> v[i];

  ll ans = -100000000000;
  rep(k, 0, min(N+1, K+1)) {  // k: 取り出す回数
    rep(kl, 0, k+1) {  // kl: 左から取り出す回数
      vector<ll> _v;
      int kr = k - kl;  // kr: 右から取り出す回数
      // cout << "k=" << k << ", kl=" << kl << ", kr=" << kr << endl;
      rep(i, 0, kl) _v.pb(v[i]);
      rep(i, N-kr, N) _v.pb(v[i]);
      // rep(i, 0, kr) cout << i << ", ";
      // rep(i, N-kr, N) cout << i << ", ";
      // cout << endl;


      // rep(i, 0, k) cout << _v[i] << ", ";
      // cout << endl;

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

      // rep(i, 0, k) cout << _v[i] << ", ";
      // cout << endl;

      // cout << "-----------------" << endl;

      ll tmp_max = 0;
      rep(i, 0, k) tmp_max += _v[i];
      ans = max(ans, tmp_max);
      rep(i, 0, min(k, K-k)) {
        tmp_max -= _v[i];
        ans = max(ans, tmp_max);
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
typedef long long ll;
ll n,x,res,las,now,t;
int main(){
	scanf("%lld%lld",&n,&x);
	res=n,las=n-x,now=x;
	while(now){
		if(las%now==0){res+=(las<<1)-now;break;}
		res+=(las/now*now)<<1,t=now,now=las%now,las=t;
	}
	printf("%lld\n",res);
	return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll N, M;
    cin >> N >> M;

    cout << abs(N - 2) * abs(M - 2) << endl;
    return 0;
}

Measured memory_bytes: 256