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

using namespace std;

int N, M, Q;  // 数列の長さ、要素の最大値、条件式の個数
vector<int> a, b, c, d;
int ans = 0;

void dfs(vector<int> A) {
    if (A.size() == N + 1) {
        int now = 0;
        for (int i = 0; i < Q; i++) {
            if (A.at(b.at(i)) - A.at(a.at(i)) == c.at(i)) {
                now += d.at(i);
            }
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while (A.back() <= M) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    cin >> N >> M >> Q;

    a = b = c = d = vector<int>(Q);
    for (int i = 0; i < Q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    dfs(vector<int>(1, 1));
    cout << ans << endl;

    // 考え方メモ
    // 長さNの全探索を行う -> 全パターンを書き出して、条件を満たすもののdiの総和を求める
    // 全探索のパターン
    // ・for文を重ねる -> 桁数分forを回さないといけない -> 10個作れば行ける？？？
    // ・bit全探索 -> 1,0ではない。同じ数字を使い回す場合もある
    // ・順列全探索 -> 同じ数字を使うことができない。N!
    // だめだ！！

    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 610000
ll n,m,k;
double dp[4000][4000];
ll a[N];
ll b[N];
int mp[2000][2000];
int main(){
    n=in();
    double p[3000];
    rep2(i,0,n-1)cin>>p[i];
    dp[0][0]=1.0;
    rep2(i,0,n-1){
        rep2(j,0,i){
            double temp=dp[i][j];
            dp[i+1][j]+=temp*(1.0-p[i]);
            dp[i+1][j+1]+=temp*p[i];
        }
    }
    double ans=0;
    rep2(i,(n+1)/2,n){
        ans+=dp[n][i];
    }
    printf("%.10f",ans);
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int sum=0,j=1;
  while(sum<N){
    sum+=j;
    j++;
  }
  int A=sum-N;
  for(int i=1;i<j;i++){
    if(i!=A){
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 3592
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<vector<int>> Graph(n);
    vector<pair<int, int>> edges;
    for (int i = 0; i < n - 1; i++) {
        int a,b; cin >> a >> b;
        a--,b--;
        Graph[a].push_back(b);
        Graph[b].push_back(a);
        edges.emplace_back(a,b);
    }
    vector<bool> flag(n,false);
    int k = 0;
    map<pair<int,int>,int> I;
    vector<int> cs(n,0);
    queue<int> que;
    que.emplace(0);
    flag[0]=true;

    while(que.size()) {
        int s = que.front(); que.pop();
        if (k < Graph[s].size()) k = Graph[s].size();
        int cur = 1;
        for (auto t : Graph[s]) {
            if (flag[t]) continue;
            if (cur == cs[s]) cur++;
            I[make_pair(s, t)] = I[make_pair(t, s)] = cs[t] = cur++;
            flag[t] = true;
            que.emplace(t);
        }
    }

    cout << k << "\n";
    for (auto e : edges) cout << I[e] << "\n";
}

Measured memory_bytes: 19700
#include <iostream>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k;
    
    int s = 1;
    
    for (int i = 0; i < n; i++) {
        if (s * 2 >= s + k) {
            s += k;
        }
        else {
            s *= 2;
        }
    }
    
    cout << s << endl;
}


Measured memory_bytes: 256
// D - 3N Numbers

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll a[300000];
ll left_max[200001]; // 左からi個目までからN個選ぶ時の総和の最大値
ll right_min[200001]; // 右からi個目までからN個選ぶ時の総和の最小値

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

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

	// 左からi個目までからN個選ぶ時の総和の最大値を計算
	priority_queue<ll, vector<ll>, greater<ll>> lpq;
	for (int i=1; i<=N; i++) {
		int j = i - 1;
		left_max[N] += a[j];
		lpq.push(a[j]);
	}

	//cout << "i=" << N << " " << left_max[N] << endl; // **** debug ****

	for (int i=N+1; i<=2*N; i++) {
		int j = i - 1;
		if (a[i-1] > lpq.top()) {
			left_max[i] = left_max[i-1] - lpq.top() + a[j];
			lpq.pop();
			lpq.push(a[j]);
		} else {
			left_max[i] = left_max[i-1];
		}

		//cout << "i=" << i << " " << left_max[i] << endl; // **** debug ****
	}

	// 右からi個目までからN個選ぶ時の総和の最小値を計算
	priority_queue<ll> rpq;
	for (int i=1; i<=N; i++) {
		int j = 3*N - i;
		right_min[N] += a[j];
		rpq.push(a[j]);
	}

	//cout << "i=" << N << " " << right_min[N] << endl; // **** debug ****

	for (int i=N+1; i<=2*N; i++) {
		int j = 3*N - i;
		if (a[j] < rpq.top()) {
			right_min[i] = right_min[i-1] - rpq.top() + a[j];
			rpq.pop();
			rpq.push(a[j]);
		} else {
			right_min[i] = right_min[i-1];
		}

		//cout << "i=" << i << " " << right_min[i] << endl; // **** debug ****
	}

	ll ans = -INF;

	for (int i=N; i<=2*N; i++) {
		ans = max(ans, left_max[i] - right_min[3*N - i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6132
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int h,n;
		cin>>h>>n;
		ll int a[n+1],b[n+1];
		for(ll int i=1;i<=n;i++) cin>>a[i]>>b[i];
		ll int dp[10005];
		for(ll int i=1;i<10005;i++) dp[i]=1e18;
		dp[0]=0;
		for(ll int i=1;i<=n;i++)
		{
			for(ll int j=0;j<10005;j++)
			{
				if(j-a[i]>=0) dp[j]=min(dp[j],dp[j-a[i]]+b[i]);
			}
		}
		ll int mini=1e18;
		for(ll int i=h;i<10005;i++) mini=min(mini,dp[i]);
		cout<<mini;
	}
	return 0;
}

Measured memory_bytes: 384
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int comb(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

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

	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


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

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  vector<ll> a(n);
  vector<ll> b(m);

  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];

  vector<ll> sum_a(n + 1, 0);
  vector<ll> sum_b(m + 1, 0);

  ll a_max = n;
  ll b_max = m;
  for (int i = 1; i <= n; i++) sum_a[i] = sum_a[i - 1] + a[i - 1];
  for (int i = 1; i <= m; i++) sum_b[i] = sum_b[i - 1] + b[i - 1];

  for (int i = 1; i <= n; i++)
    if (sum_a[i] > k) a_max = i - 1;
  for (int i = 1; i <= m; i++)
    if (sum_b[i] > k) b_max = i - 1;

  // if (sum_a[n] + sum_b[m] <= k) {
  //   cout << m + n << endl;
  //   return 0;
  // }

  ll ans = 0;
  ll sb = 0;
  for (ll i = a_max; i >= 0; i--) {
    for (ll j = sb; j <= b_max; j++) {
      if (sum_a[i] + sum_b[j] > k) {
        sb = j;
        break;
      }
      ans = max(ans, i + j);
      sb = j;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 9448
#include <iostream>
    using namespace std;
     
    int main()
    {
        int h, w, d;
        cin >> h;
        cin >> w;
        cin >> d;
        int ai[90001];
        int aj[90001];
        long tmp = 0;        
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> tmp;
                ai[tmp] = i;
                aj[tmp] = j;
            }
        }
        int distance[90001] ={};
        for(int i = d+1; i<=h*w; i++){
            distance[i] = distance[i-d] + abs(ai[i]-ai[i-d]) + abs(aj[i] - aj[i-d]);
        }
        int q;
        cin >> q;
        while(q--){
            int l, r;
            cin >> l;
            cin >> r;
            cout << distance[r] - distance[l]  << endl;
        }
        return 0;
    }

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

int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    int a,b;

    cin>>a>>b;

    if(a<b){
        rep(i,b){
            cout<<a;
        }
        cout<<endl;
    }
    else{
        rep(i,a){
            cout<<b;
        }
        cout<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <queue>

#define pb push_back
     
using namespace std;
typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> pll;
     
bool debug = false;
     

struct state
{
    ll a,b,c;

    state(ll a, ll b, ll c) : a(a), b(b), c(c)
    {

    }

  bool operator==(const state &other) const
  { return (a == other.a
            && b == other.b
            && c == other.c);
  }
};


struct KeyHasher
{
    size_t operator()(const state& k) const
  {
    //using std::size_t;
    //using std::hash;
    //using std::string;

    return ((hash<ll>()(k.a)
               ^ (hash<ll>()(k.b) << 1)) >> 1)
               ^ (hash<ll>()(k.c) << 1);
  }
};  


void solve(ll casen)
{
    ll res = 0;
    
    cout << "Case #" << casen << ": " << res << endl;
}

int main()
{
    // $ g++ -std=c++14 -Wshadow -Wall -o c C.cpp

    // !!! Here, unordered map was too slow!!!
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    

   ull n,m,k;
   cin >> n >> m >> k;

   vector<ull> a,b;
   vector<ull> cumA,cumB;

   for (ull i = 0; i < n; i++)
   {
   		ull x;
   		cin >> x;
   		a.pb(x);
   }
   for (ull i = 0; i < m; i++)
   {
   		ull x;
   		cin >> x;
   		b.pb(x);
   }

   cumA.pb(a[0]);
   for (ull i = 1; i < n; i++)
   	cumA.pb(cumA[i-1] + a[i]);

   cumB.pb(b[0]);
   for (ull i = 1; i < m; i++)
   	cumB.pb(cumB[i-1] + b[i]);

   ll res = 0;

   for (ull i = 0; i < n; i++)
   {
   		ull timeSpendInA = cumA[i];

   		if (timeSpendInA > k) break;

   		ll timeToUse = k - timeSpendInA;

   		if (timeToUse == 0)
   		{
   			if (i+1 > res) res = i+1;
   		}
   		else if (timeToUse > 0)
   		{

  			vector<ull>::iterator up;
  			up = upper_bound(cumB.begin(), cumB.end(), timeToUse);

  			ull booksFromB = up - cumB.begin();

  			if (i+1 + booksFromB > res) res = i+1 + booksFromB;
   		}
   }

   vector<ull>::iterator up;
  			up = upper_bound(cumB.begin(), cumB.end(), k);

  			ull booksFromB = up - cumB.begin();

  			if (booksFromB > res) res = booksFromB;

   cout << res << endl;

    return 0;
}

Measured memory_bytes: 11032
N=int(input())
for h in range(1,3500):
    for w in range(1,3500):
        if (4*h*w-N*h-N*w)==0:continue
        if N*h*w%(4*h*w-N*h-N*w):continue
        x=N*h*w//(4*h*w-N*h-N*w)
        if x>0:
            print(h,w,x);exit()


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



int main(){

	int W,H,i,j;

	for (;;){
		cin >> H >> W;
		if (W == 0 && H == 0)
			break;

		for (i = 0; i < H; i++){
			for (j = 0; j < W; j++){
				if (i == 0 || i == H - 1){ 
					cout << "#"; 
				}
				else {
					if (j == 0 || j == W - 1){
						cout << "#";
					}
					else{ cout << "."; }
				}
			}
			cout << endl;
		}cout << endl;
	
	}





	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    getline(cin,s);
    if(s[0]=='S')
    {
        if(s[1]=='U')
        cout<<"7"<<endl;
        else
        cout<<"1"<<endl;
    }

    if(s[0]=='M')
        cout<<"6"<<endl;
    if(s[0]=='T')
    {
        if(s[1]=='U')
            cout<<"5"<<endl;
        else
            cout<<"3"<<endl;
    }

    if(s[0]=='W')
        cout<<"4"<<endl;
    if(s[0]=='F')
        cout<<"2"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int a=1; a<=n; a++) {
        ans += n / a;
        if (n % a == 0) ans--;
    }
    cout << ans << '\n';
    return 0;
}

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

using int64 = long long;

int64 gcd(int64 a, int64 b) {
  int64 c = a % b;
  while (c) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

int64 Solve(int64 n, int64 x) {
  return 3 * (n - gcd(n, x));
}

int main() {
  int64 n, x;
  cin >> n >> x;
  cout << Solve(n, x) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, m; cin >> n >> m;
	long long ans;
	ans = (n - m) * 100 + m * 1900;
	for (int i = 0; i < m; i++)ans *= 2;
	cout << ans << endl;
	char c; cin >> c;
}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();
	int d = scan.nextInt();

	int r1 = a*b;
	int r2 = c*d;
	if(r1 >= r2){
	    System.out.println(r1);
	}else{
	    System.out.println(r2);
	}
    }
}
	


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int k, a, b;
    cin >> k >> a >> b;
    int count = 1, mul;
    while (true) {
        mul = k*count;
        if (mul >= a && mul <= b) {
            cout << "OK" << endl;
            break;
        } else if (mul>b) {
            cout << "NG" << endl;
            break;
        }
        count++;
    }
    return 0;
}

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

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

int disp(ll a){
    if(a==0)return 0;
    disp((a-1)/26);
    cout<<(char)('a'+((a+25)%26));
    return 0;
}

int main(){
    ll n;
    cin>>n;
    disp(n);
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
int B[100];
int ans[100];
int Right[100];
void Calc(){
	int N = rei();
	for(int i=0;i<N;i++){
		B[i] = rei()-1;
	}
	for(int i=0;i<N;i++){
		if(B[i] > i){
			cout << "-1" << endl;
			return;
		}
	}
	fill(Right,Right+N,-1);
	for(int i=N-1;i>=0;i--){
		if(B[i] > i){
			cout << "-1" << endl;
			return;
		}
		Right[B[i]] = i; 
	}
	fill(ans,ans+N,-1);
	for(int i=99;i>=0;i--){
		for(int j=N-1;j>=i;j--){
			if(ans[j] != -1){
				continue;
			}
			int c = i;
			for(int k=j+1;k<N;k++){
				if(ans[k] == -1){
					c++;
				}
				else if(ans[k] <= c){
					c++;
				}

			}
			if(B[c] == i){
				ans[j] = i;
			}
		}
	}
	for(int i=0;i<N;i++){
		cout << ans[i]+1 << endl;
	}
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;


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

    int n;
    cin >> n;
    int ans=0;
    vector<int> v(n),c(n);
    rep (i, n) cin >> v[i];
    rep (i, n) cin >> c[i];
    rep (i, n) {
        ans += max(0, v[i] - c[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> vs(n);
    for(auto &x:vs)
        cin >> x;
    int ans = 0;
    for(int i=1; i<n-1; ++i){
        int a = vs[i-1];
        int b = vs[i];
        int c = vs[i+1];
        int mn = min(a, min(b, c));
        int mx = max(a, max(b, c));
        if(vs[i]!=mn and vs[i]!=mx) ++ans;
    }
    cout << ans << endl;
}

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

int main(){
  int sum5=0, sum7=0;
  for(int i=0; i<3; i++){
    int a;
    cin >> a;
    if(a == 5){
      sum5++;
    }
    if(a == 7){
      sum7++;
    }
  }
  if(sum5 == 2 && sum7 == 1){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;

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

	ll ai, ao, at, aj, al, as, az;
	while(cin >> ai >> ao >> at >> aj >> al >> as >> az)
	{
		ll sum = ao;
		bool oddi = ai&1;
		bool oddj = aj&1;
		bool oddl = al&1;
		if((oddi && oddj && al) || (oddi && oddl && aj) || (oddl && oddj && ai))
		{
			sum += 3;
			ai--;
			aj--;
			al--;
		}
		sum += aj - (aj&1);
		sum += al - (al&1);
		sum += ai - (ai&1);
		cout << sum << endl;
	}

	return 0;
}

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

int main() {
    int n, temp;
    deque<int> b;
    cin >> n;
    rep(i, n) {
        cin >> temp;
        if(i % 2) b.push_back(temp);
        else b.push_front(temp);
    }
    if(n % 2 == 0) reverse(b.begin(), b.end());
    rep(i, n - 1) {
        cout << b.at(i) << " ";
    }
    cout << b.at(n - 1) << endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

    int n = sz(s);
    vector<vector<mint>> dp(n+1, vector<mint>(13, 0));
    dp[0][0] = 1;
    rep(i, n) {
        if (s[i] == '?') {
            rep(j, 13) rep(k, 10) {
                dp[i+1][(10*j+k) % 13] += dp[i][j];
            }
        } else {
            int x = s[i] - '0';
            rep(j, 13) {
                dp[i+1][(10*j+x) % 13] += dp[i][j];
            }
        }
    }
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 13648
#include<stdio.h>
main(){
  int x;
  int y;
  while(1){
    scanf("%d %d",&x,&y);
    if(x==0 && y==0)break;
    if(y<=x){
      printf("%d %d\n",y,x);
    }
    else if(x<=y){
      printf("%d %d\n",x,y);
    }
  }
  return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long max = 0;
            
            for (var i = 0; i < N; i++)
            {
                max += array[i] - 1;
            }

            Console.WriteLine(max);
        }
    }
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;

int A[MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);
	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
	}

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


	int res = 1;
	int t = -1;
	FOR (i, 1, n)
	{
		if (t == -1)
		{
			if (A[i] > A[i-1]) t = 0;
			if (A[i] < A[i-1]) t = 1;
		}

		if (t != -1)
		{
			if (A[i] >= A[i-1] && t == 0) continue;
			if (A[i] <= A[i-1] && t == 1) continue;

			res++;
			t = -1;
		}
	}
	cout<<res<<endl;

}


Measured memory_bytes: 640
// CODE by Kazhybay Askar

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
using namespace __gnu_pbds;

/*
find_by_order(k);
order_of_key(k);
ordered_set(int) s;
*/

/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
rng();
shuffle(permutation.begin(), permutation.end(), rng);
*/

/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC    optimize("Ofast")
#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#define F      first
#define S      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define nl     '\n'
#define ordered_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>

typedef unsigned long long ull;
typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

ll n,a[MAXN],m;

void solve(){
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
}



int main(){
    //freopen("A.in","r",stdin);
    //freopen("A.out","w",stdout);
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
increasing = []
decreasing = []
dec_special = []
for _ in range(n):
    s = input().rstrip()
    minima = 0
    fin = 0
    for ch in s:
        if ch == ")":
            fin -= 1
            if fin < minima:
                minima = fin
        else:
            fin += 1
    if fin >= 0:
        increasing.append((minima, fin))
    elif minima < fin:
        dec_special.append((minima, fin))
    else:
        decreasing.append((minima, fin))

increasing.sort(reverse=True)
decreasing.sort()
dec_special.sort()

current = 0
for minima, diff in increasing:
    if current + minima < 0:
        print("No")
        exit()
    current += diff
for minima, diff in dec_special:
    if current + minima < 0:
        print("No")
        exit()
    current += diff
for minima, diff in decreasing:
    if current + minima < 0:
        print("No")
        exit()
    current += diff
if current != 0:
    print("No")
else:
    print("Yes")

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

int main(){

  map<int,int> num;
  
  rep(i,3){
    int tmp = 0;
    cin >> tmp;
    
    num[tmp]++;
  }
  
  cout << num.size();
    
    return 0;
}


Measured memory_bytes: 256
def solve(k):
    if(k%2==0 or k%5==0):
        return -1
    if(k%7==0):
        k//=7
    amari=1
    now=1
    for i in range(k+1):
        if(now%k==0):
            return i+1
        amari*=10
        amari%=k
        now+=amari
        now%=k
    return -1

k=int(input())

print(solve(k))

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


int main() {
    string S , T;
    cin>>S>>T;
    int l = S.size(), count = 0;
    for(int i = 0; i < l; i++){
       if(S[i] != T[i]){
           count++;
       }
    }
cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3896
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        boolean che = false;
        for(int i = 0 ; i < n - 1 && che == false ; i++ ){
            if(a[i] == a[i + 1]){
                che = true;
            }
        }
        if(che == false){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        sc.close();
    }
}

Measured memory_bytes: 61088
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int train = Math.min(sc.nextInt(), sc.nextInt());
        int bus = Math.min(sc.nextInt(), sc.nextInt());

        System.out.println(train + bus);
    }
}


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	string s;
	cin >> s;
	cout << (s.rfind('Z') - s.find('A') + 1) << endl;
	return 0;
}


Measured memory_bytes: 640
use strict;
use warnings;
use utf8;
use feature qw/say/;

chomp(my $s = <>);

if ($s eq 'RRR') {
    say 3;
} elsif ($s eq 'RRS' || $s eq 'SRR') {
    say 2;
} elsif ($s eq 'SSS') {
    say 0;
} else {
    say 1;
}

Measured memory_bytes: 5236
def code(string):
  codemap = {'A': '00000', 'B': '00001', 'C': '00010', 'D': '00011', 'E': '00100', 'F': '00101', 'G': '00110', 'H': '00111', 'I': '01000', 'J': '01001', 'K': '01010', 'L': '01011', 'M': '01100', 'N': '01101', 'O': '01110', 'P': '01111', 'Q': '10000', 'R': '10001', 'S': '10010', 'T': '10011', 'U': '10100', 'V': '10101', 'W': '10110', 'X': '10111', 'Y': '11000', 'Z': '11001', ' ': '11010', '.': '11011', ',': '11100', '-': '11101', "'": '11110', '?': '11111'}
  chrs=list(string)
  for i in range(len(chrs)):
    chrs[i] = codemap[chrs[i]]
  return ("".join(chrs))

def dec1chr(string):
  decodemap = {'101': ' ', '000000': "'", '000011': ',', '10010001': '-', '010001': '.', '000001': '?', '100101': 'A', '10011010': 'B', '0101': 'C', '0001': 'D', '110': 'E', '01001': 'F', '10011011': 'G', '010000': 'H', '0111': 'I', '10011000': 'J', '0110': 'K', '00100': 'L', '10011001': 'M', '10011110': 'N', '00101': 'O', '111': 'P', '10011111': 'Q', '1000': 'R', '00110': 'S', '00111': 'T', '10011100': 'U', '10011101': 'V', '000010': 'W', '10010010': 'X', '10010011': 'Y', '10010000': 'Z'}
  for key in decodemap.keys():
    if string[0:len(key)] == key: return (decodemap[key],string[len(key):])
  return ("",string)

def decode(string):
  answer=""
  while True:
    chr, string = dec1chr(string)
    if chr=="": return answer
    else:
      answer += chr
    
inputs=[]
while True:
  try:
    inputs.append(input())
  except EOFError:
    break
for ipt in inputs:
  print(decode(code(ipt)))


Measured memory_bytes: 5716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)


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

	string S;
	cin >> S;
	if (!S.compare("ABC")) {
		cout << "ARC" << endl;
	}
	else {
		cout << "ABC" << endl;
	}
	
	return(0);
}


Measured memory_bytes: 3652
using System;
using System.IO;
namespace aoj{
    class program{
     
    static void Main() {
		
		LinearSearch ls = new LinearSearch(
			int.Parse(Console.ReadLine()), Console.ReadLine());
		 int.Parse(Console.ReadLine());
		string[] tmp = Console.ReadLine().Split(' ');
		//int[] slist = new int[tmp.Length];
		for(int i=0; i<tmp.Length;i++)
			ls.search(int.Parse(tmp[i]));
		ls.show(); 
	    
    }
}
class LinearSearch{
	int[] list;
	int count=0;
	public LinearSearch(int length,string rl){
		list = new int[length+1];
		string[] tmp = rl.Split(' ');
		for(int i=0; i<length; i++)
			list[i] = int.Parse(tmp[i]);
	}
	public void search(int key){
		list[list.Length-1]=key;
		int i=0;
		while(list[i]!=key)
			i++;
		if(i!=(list.Length-1))
			count++;
	}
	public void show(){
		Console.WriteLine("{0}",count);
	}
}
		
}

Measured memory_bytes: 19960
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
	int n, m, l;
	cin >> n >> m >> l;

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

	int b[100][100] = {};
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}

	long c[100][100] = {};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				c[i][j] += a[i][k] * b[k][j];
			}
			cout << c[i][j];
			if (j < l - 1) cout << " ";
		}
		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3248
// AOJ 0163
#include <iostream>

using namespace std;

int main(void)
{
	int data[7][7] = {{0, 300, 500, 600, 700, 1350, 1650},
					  {6, 0, 350, 450, 600, 1150, 1500},
					  {13, 7, 0, 250, 400, 1000, 1350},
					  {18, 12, 5, 0, 250, 850, 1300},
					  {23, 17, 10, 5, 0, 600, 1150},
					  {43, 37, 30, 25, 20, 0, 500},
					  {58, 52, 45, 40, 35, 15}};
	int start, end, st[2], et[2];
	while (cin >> start, start){
		cin >> st[0] >> st[1];
		cin >> end >> et[0] >> et[1];
		start--; end--;

		bool f = false;
		if (17 <= st[0] && st[0] <= 19){
			if (st[0] == 18) f = true;
			else if ((st[0] == 17 && 30 <= st[1]) || (st[0] == 19 && 30 >= st[1])){
				f = true;
			}
		}
		if (17 <= et[0] && et[0] <= 19){
			if (et[0] == 18) f = true;
			else if ((et[0] == 17 && 30 <= et[1]) || (et[0] == 19 && 30 >= et[1])){
				f = true;
			}
		}

		if (start < end) swap(start, end);
		int k = data[start][end];
		int ret = data[end][start];
		if (40 < k) f = false;

		ret /= 50.0;
		if (f){
			if (ret % 2) ret++;
			ret /= 2;
		}
		cout << (int)(ret * 50) << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
# coding: utf-8

'''
S 1
H 3
H 7
C 12
D 8
'''

cards = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9', 'S10', 'S11', 'S12', 'S13',
'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10', 'H11', 'H12', 'H13',
'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'C10', 'C11', 'C12', 'C13',
'D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'D10', 'D11', 'D12', 'D13']

for _ in range(int(input())):
    suit, number = input().split()
    cards.remove(suit + number)

for trump in cards:
    print(trump[0], trump[1:])




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

int main() {
	priority_queue<int> a;
 	int n,m,i,d;
	long long ans = 0;

	cin >> n >> m;
	for(i=0;i<n;i++) {
		cin >> d;
		a.push(d);
	}
	

	for(i=0;i<m;i++) {
		d = a.top() / 2;
		a.pop();
		a.push(d);
	}

	for(i=0;i<n;i++) {
		ans += a.top();
		a.pop();
	}
	
	cout << ans << endl;

}


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

vector<long long>prime;
int mark[1000100];
void sieve(long long n)
{
	long long limit = sqrt(n*1.)+2;
	prime.push_back(2);
	for(long long i=4;i<=n;i+=2)mark[i] = 2;
	mark[2] = 2;
	for(long long i=3;i<=n;i++){
		if(!mark[i]){
			prime.push_back(i);
			if(i<=limit){
				for(long long j=i*i;j<=n;j+=i*2)mark[j] = i;
			}
		}
	}
}
long long gcd(long long a,long long b)
{
	if(a%b==0)return b;
	return gcd(b,a%b);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	sieve(1000000);
	long long a,b;
	cin >> a >> b;
	long long g = gcd(a,b);
	int ans = 1;
	for(auto it:prime){
		if(it*it>g)break;
		if(g%it==0){
			while(g%it==0){
				g/=it;
			}
			ans++;
		}
	}
	if(g>1)ans++;
	cout << ans <<"\n";
}


Measured memory_bytes: 5368
#include <stdio.h>
void swap_node(int H[], int i, int j){
  int tmp=H[i];
  H[i]=H[j];
  H[j]=tmp;
}
void maxHeapify(int H[], int size, int i){
  int left=2*i, right=2*i+1;
  int largest;
  if((left<=size)&&(H[i]<H[left]))
	largest=left;
  else
	largest=i;
  if((right<=size)&&(H[largest]<H[right]))
	largest=right;
  if(largest!=i){
	swap_node(H, i, largest);
	maxHeapify(H, size, largest);
  }
}
void buildMaxHeap(int H[], int size){
  int i;
  for(i=size/2; i>=1; --i){
	maxHeapify(H, size, i);
  }
}
int main(){
  int heap_size;
  int heap[500005];
  int i;

  scanf("%d", &heap_size);
  for(i=1; i<=heap_size; ++i){
	scanf("%d", &heap[i]);
  }
  //ソート
  buildMaxHeap(heap, heap_size);
  //出力
  for(i=1; i<=heap_size; ++i){
	printf(" %d", heap[i]);
}
  printf("\n");
  return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  
  long long ans = 0;
  ans += N / (A + B) * A;
  ans += min(N % (A + B), A);
  
  cout << ans << endl;
  return 0;
}

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

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;
}

const int MAX = 300000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(long long int n, long long int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  	long long int N, M, K;
  	cin >> N >> M >> K;
  
  	COMinit();
  	long long int count = 0;
  
  	for (long long int i = 0; i <= K; i++){
  		long long int num = M;
  		num = num * modpow(M - 1, N - i - 1, 998244353) % 998244353;
  		num = num * COM(N - 1, i);
      	count += num;
      	count %= 998244353;
    }
  
  	cout << count << endl;
}

Measured memory_bytes: 10668
import java.util.*;
import java.io.*;

public class Main {
	
	public void solve() throws IOException {
		int h, w;
		while( (h = nextInt()) != 0 | (w = nextInt()) != 0 ){
			char[][] rect = new char[h][w];
			for(int i = 0; i < h; i++){
				rect[i] = nextToken().toCharArray();
			}
			int[][] data = new int[h+2][w+2];
			for(int i = 1; i <= h; i++){
				for(int j = 1; j <= w; j++){
					if( rect[i-1][j-1] == '.' ){
						data[i][j] = data[i][j-1] + 1;
					}
				}
			}		
			int max = 0;
			for(int i = 1; i <= w; i++){
				int[] count = new int[w+1];
				int min = w+1;
				for(int j = 1; j <= h; j++){
					if( data[j][i] > 0 ){
						for(int k = 1; k <= data[j][i]; k++){
							count[k]++;			
					/*		if( count[k]*k > max ){
								writer.print(count[k]*k + " at " + j + ", " + i + ", " + k + "  ");
							}				*/
							max = Math.max(count[k]*k, max);
						}
						for(int k = data[j][i]+1; k <= w; k++){
							if( count[k] == 0 ){
								break;
							}
							count[k] = 0;
						} 						
					} else {
						for(int k = 1; k <= w; k++){
							if( count[k] == 0 ){
								break;
							}
							count[k] = 0;
						}
					}
				}						
			}		
		//	writer.println();	
			writer.println(max);			
		}
		writer.flush();
	}
	public static void main (String args[]) throws IOException{
		new Main().run();
	}
	
	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;
	
	public void run() throws IOException{
		try{
			reader = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
	public int nextInt() throws IOException{
		return Integer.parseInt(nextToken());
	}		
	public String nextToken() throws IOException{
		while( tokenizer == null || !tokenizer.hasMoreTokens() ){
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}

Measured memory_bytes: 15000
#include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>

using namespace std;


bool check(string inp){
    stringstream words(inp);
    string word;
    while(getline(words, word, ' ')){
        if(word=="the"||word=="this"||word=="that"||word=="the."||word=="this."||word=="that.")
            return true;
    }
    return false;
}

int main(){
    string input;
    while(getline(cin,input)){
        for(int i=0;i<26;i++){
            for(int j=0;j<input.length();j++){
                if(isalpha(input[j])){
                    input[j]++;
                    if(input[j]>'z') input[j]='a';
                }
            }
            if(check(input)){
                break;
            }
        }
        cout << input << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
int main(){
    int n,y,i,j,k,f=0;
    scanf("%d %d",&n,&y);
    for(i=0;i<=n;i++)for(j=0;j<=n;j++){
        k=n-i-j;
        if(i+j<=n && i*10000+j*5000+k*1000==y){
            f=1;
            printf("%d %d %d",i,j,k);
            return 0;
        }
    }
    if(!f) printf("-1 -1 -1");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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; }

const long long INF = 1LL << 60;

int main(){
  string s; cin >> s;
  char color = s[0];
  int n = s.size();

  int cnt = 0;
  REP(i, 1, n-1){
    if(s[i] != color){
      cnt++;
      color = s[i];
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define LL long long

using namespace std;

int main()
{
    LL a, b;
    cin >> a >> b;

    LL x;
    cin >> x;

    LL ans=0;

    ans+=(b/x);
    ans-=(a/x);

    if(a%x==0)
        ans++;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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 ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int N; cin >> N;
    string s; cin >> s;

    vector<int> pos[10];
    rep(i, N) pos[s[i]-'0'].push_back(i);

    int ans = 0;
    rep(i, 10) rep(j, 10) rep(k, 10) {
        if(pos[i].size() == 0) continue;
        int cur = pos[i][0];
        ++cur;
        auto itr = lower_bound(pos[j].begin(), pos[j].end(), cur);
        if(itr == pos[j].end()) continue;
        cur = *itr;
        ++cur;
        itr = lower_bound(pos[k].begin(), pos[k].end(), cur);
        if(itr == pos[k].end()) continue;
        ++ans;
    }
    cout << ans << endl;

    
    return 0;
}

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

int main(){
  int n,t,a;
  cin >> n >> t >> a;
  vector<long> h(n+1);
  h[n]=1000000;
  
  int i,j=n;
  for(i=0; i<n; i++){
    cin >> h[i];
    h[i]=abs((t-a)*1000-h[i]*6);
    if(h[i]<h[j]){
      j=i;
    }
  }
  cout << j+1 << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>

int getbn( std::string s[], int h, int w, int i, int j )
{
	int cnt = 0;
	for( int x = i - 1; x <= i + 1; x++ ) {
		for( int y = j - 1; y <= j + 1; y++ ) {
			if( x < 0 or y < 0 or x >= h or y >= w ) {
				continue;
			}
			if( s[ x ][ y ] == '#' ) {
				cnt += 1;
			}
		}
	}

	return cnt;
}

int main()
{
	int h, w;
	std::cin >> h >> w;

	std::string s[ 50 ];

	for( int i = 0; i < h; i++ ) {
		std::cin >> s[ i ];
	}

	for( int i = 0; i < h; i++ ) {
		for( int j = 0; j < w; j++ ) {
			char d;
			if( s[ i ][ j ] == '#' ) {
				d = '#';
			}
			else {
				int n = getbn( s, h, w, i, j );
				d = '0' + n;
			}
			std::cout << d;
		}
		std::cout << std::endl;
	}

	return 0;
}


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

int main(void) {
	int A, B;
	cin >> A >> B;

	int add = A + B;
	int sub = A - B;
	int mul = A * B;
	int ans = max(max(add, sub), mul);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    B[i] = B[i-1]+A[i-1]
C = {}
for i in range(N+1):
    b = B[i]
    if b not in C:
        C[b]=0
    C[b] += 1
cnt = 0
for b in C:
    n = C[b]
    if n>=2:
        cnt += (n*(n-1))//2
print(cnt)

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


int main() {
  string S;
  cin >> S;
  
  rep(i, S.size()) {
    rep(j, i) {
      if(S[i] == S[j]) {
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" <<endl;
}


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

int main() {
    int N, x; cin >> N >> x;
    int S = 2 * N - 1;
    if (x == 1 || x == S) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for (int i = 0; i < S; i++) {
        cout << (i - N + x + S) % S + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1536