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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define Si size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define Em empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define Fi first
#define Se second
#define Pi acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>

void FAST();
LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);









int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    char c;
    cin >> c;
    if(c == 'A')
    {
        cout << 'T';
    }
    else if(c == 'T')
    {
        cout << 'A';
    }
    else if(c == 'C')
    {
        cout << 'G';
    }
    else
    {
        cout << 'C';
    }
    return 0;
}







void FAST()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll 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
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int x; cin >> x;
  if(x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3628
//=======Includes=======||
#include <iostream>     //
#include <cmath>        //
#include <cstdio>       //
#include <cstring>      //
#include <utility>      //
#include <cstdlib>      //
#include <cassert>      //
#include <ctime>        //
#include <sstream>      //
#include <algorithm>    //
#include <functional>   //
#include <numeric>      //
#include <string>       //
#include <vector>       //
#include <queue>        //
#include <stack>        //
#include <map>          //
#include <set>          //
#include <iomanip>      //
//======================||

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
#define ll long long
#define ld long double

int main()
{
	fastio();
	int n, m;
	cin >> n >> m;
	vector<vector<char>> A(n, vector<char>(m));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> A[i][j];
		}
	}
	//vector<vector<int>> B;
	for (int i = 0; i < n; i++)
	{
		int count = 0;
		for (int j = 0; j < m; j++)
		{
			if (A[i][j] == '.')
			{
				count++;
			}
		}
		if (count == m)
		{
			A.erase(A.begin() + i);
			i--;
			n--;
		}
	}
	for (int i = 0; i < m; i++)
	{
		int count = 0;
		for (int j = 0; j < n; j++)
		{
			if (A[j][i] == '.')
			{
				count++;
			}
		}
		
		if (count == n)
		{
			for (int j=0;j<n;j++)
			{
				A[j].erase(A[j].begin() + i);
			}
			m--;
			i--;
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cout << A[i][j] << "";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atcorder_BeginnerContest_125
{
    class Program
    {

        static void Main(string[] args)
        {

            int cnt = int.Parse(Console.ReadLine());
            int[] vRow = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] cRow = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int ret = 0;
            for (int i = 0; i < cnt; i++)
            {
                if (cRow[i] < vRow[i])
                {
                    ret += vRow[i] - cRow[i];
                }
            }

            Console.WriteLine(ret);

        }

    }
}



Measured memory_bytes: 11092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(ll i=0;i<(n);++i)
//#define all(a) (a).begin(),(a).end()
using namespace std;
//using Graph = vector<vector<int>>;
typedef long long ll;
//const int mod= 1e+9+7;

int main(){
    int n; cin>>n;
    ll ans =0;
    vector<int>l(n);
    rep(i,n)cin>>l[i];
    sort(l.begin(),l.end());
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            int a=lower_bound(l.begin(),l.end(),l[i]+l[j])-l.begin();
            ans+=a-(j+1);
        }
    }
    cout<<ans<<endl;
    }


Measured memory_bytes: 256
#include<stdio.h>
main(void)
{
  int i,n,m;
  for(i=1;;i++){
    scanf("%d %d",&n,&m);
    if(n==0 && m==0)break;
    if(n>m)printf("%d %d\n",m,n);
    else printf("%d %d\n",n,m);
  }
  return 0;
}



Measured memory_bytes: 2104
package main

import (
	"fmt"
)

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

	n := len(s)
	a := make([]int, n+1)
	b := make([]int, n+1)
	for i := 0; i < n; i++ {
		if s[i] == '<' {
			a[i+1] = a[i] + 1
		}
		if s[n-i-1] == '>' {
			b[n-i-1] = b[n-i] + 1
		}
	}

	ans := 0
	for i := 0; i < len(a); i++ {
		ans += max(a[i], b[i])
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 12160
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(int i=0;i<n;++i)
#define rep(j,n) for(int j=0;j<n;++j)
#define REP(i,n) for(int i=1;i<=n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define len(s)   ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef vector<pair<int ,int> >vepa;
typedef set<char>se;
typedef map<ll,ll> mpp;
const ll N=1e5,OO=1e14;
const int di[]={1,-1,0,0};
const int dj[]={0,0,1,-1};
ll TC,n,k,a,b,c,cnt,ans,sum,mx,mn,arr[N];
bool f,vis[N];
int main(){
     IOS;
     string s;
     cin>>n>>s;
     ll cntR=0,cntW=0;
     rep(i,n)
     {
         (s[i]=='R'?cntR++:cntW++);
     }
     rep(i,n)
     {
         if(i+1<=cntR)
         {
             if(s[i]=='W')a++;
         }else
         {
            if(s[i]=='R')b++;
         }
     }
     if(b>=a)b-=a;
     else a-=b;
     a+=b;
     cout<<min({cntR,cntW,a});

go;
}


Measured memory_bytes: 3756
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (h, w, n) = scan!(usize, usize, usize);
    let mut m: HashMap<_, _> = [(0, (h - 3 + 1) * (w - 3 + 1))].iter().cloned().collect();
    let mut m1: HashMap<(usize, usize), bool> = HashMap::new();

    for _ in 0..n {
        let (mut x, mut y) = scan!(usize, usize);
        x -= 1;
        y -= 1;
        for i in 0..3 {
            for j in 0..3 {
                if x >= i && x < h + i && y >= j && y < w + j {
                    let (s, t) = (x - i, y - j);
                    if s + 2 < h && t + 2 < w {
                        let mut num = 0;
                        for u in 0..3 {
                            for v in 0..3 {
                                if let Some(_) = m1.get(&(s + u, t + v)) {
                                    num += 1;
                                }
                            }
                        }
                        {
                            let v = m.entry(num).or_insert(0);
                            *v -= 1;
                        }
                        {
                            let v = m.entry(num + 1).or_insert(0);
                            *v += 1;
                        }
                    }
                }
            }
        }
        m1.entry((x, y)).or_insert(true);
    }

    for i in 0..10 {
        let v = m.entry(i).or_insert(0);
        println!("{}", v)
    }
}


Measured memory_bytes: 11436
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    int co = 26LL;
    int cnt = 1;
    while(n > co) {
        n -= co;
        ++ cnt;
        co *= 26LL;
    }
    n --;
    string ans = "";
    vector<int> a(cnt, 0);
    int cur = cnt - 1;
    while(n != 0) {
        a[cur] = n % 26;
        cur --;
        n /= 26; 
    }
    rep(i, cnt) {
        ans += (char)('a' + a[i]);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3652
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN4(a,b,c,d);
  int data = min(b,d) - max(a,c);
  if(data >= 0) OUT(data);
  else OUT(0);
}

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

int main(int argc, char** argv){
	int a,b,c_degree;
	double c_radian;

	// Input
	scanf("%d%d%d",&a,&b,&c_degree);
	
	// Convert Degree -> Radian
	c_radian = c_degree * M_PI / 180.0;
	
	// S
	printf("%f\n", a * b * 0.5 * sin(c_radian));

	// L
	printf("%f\n", a + b + sqrt( a * a + b * b - 2 * a * b * cos(c_radian) ));

	// h
	printf("%f\n", b * sin(c_radian) );

	return 0;
}

Measured memory_bytes: 636
#include<stdio.h>

int main() {
	int n, m, p = 0;
	scanf("%d %d", &n, &m);
	if (n != 0) {
		p = p + (n*(n - 1))/2;
	}
	if (m != 0) {
		p = p + (m*(m - 1))/2;
	}
	printf("%d", p);
}

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

int main(){
    int n;
    cin >> n;
    vector<int> t(n+1,0);
    vector<int> x(n+1,0);
    vector<int> y(n+1,0);
    rep(i, n) cin >> t.at(i+1) >> x.at(i+1) >> y.at(i+1);

    string ans = "Yes";
    rep(i, n) {
        int dist = abs(x.at(i+1) - x.at(i)) + abs(y.at(i+1) - y.at(i));
        int time = t.at(i+1)-t.at(i);
        if(dist > time) ans = "No";
        if(dist%2 != time%2) ans = "No"; //パリティ
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define LL  long long int 
#define Pi 3.14159265358979;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a, b, v, w, t;
	int kyori = 0,idouryou=0;
	int i = 0, j = 0,k = 0;//ループ用配列
	int ans = 0;

	cin >> a >> v >> b >> w >> t;

	if ((a - b) > 0)ans = a - b;
	else ans = b - a;

	idouryou = v - w;
	if (idouryou <= 0) {
		cout << "NO" << "\n";
		return 0;
	}
	else {
		rep(i, t) {
			ans = ans - idouryou;
			if (ans <= 0) {
				cout << "YES" << "\n";
				return 0;
			}
		}
		cout << "NO" << "\n";
	}
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n;
  cin>>n;
  vector<int>vec(n);
  int sum=0;
  rep(i,n) {
    cin>>vec.at(i);
    sum+=vec.at(i);
  }
  unsort(vec);
  sum-=vec.at(0);
  if(vec.at(0)<sum) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};

int main(){
    int N; cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    int mx = 0,mx2 = 0;
    for (int i = 0; i < N-1; i++){
        if (a[i] == a[i+1]){
            mx2 = mx;
            mx = a[i];
            i++;
        }
    }
    cout << (long long)mx * mx2 << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<climits>
using namespace std;

int main() {
  int N;
  int x=-1;
  int y=-1;
  int z=-1;
  long Y;
  int tmp=0;
  int ans=0;
  int cnt=0;

  cin >> N;

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

  sort(d.begin(), d.end());
  
  for(int i = 0; i < N; i++){
    //cout << i << "th d -> " << d[i] ;
    if(tmp < d[i]){
      cnt++;
      tmp = d[i];
      //cout << "  cnt++ !!" ; 
    }
    cout << endl;
  }
  
  
  cout << cnt  << endl;
}


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


long long gcd(long long a, long long b){
  while (a && b){
    (a < b) ? b %= a : a %= b;
  }
  return a + b;
}


int main(){
  long long A, B;
  cin >> A >> B;
  cout << A * B / gcd(A, B) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define call(x) (x).cbegin(), (x).cend()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
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; }
const int INF = INT_MAX;
const int MOD = 1000000007;
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

int main() {
    int H, W;
    cin >> H >> W;
    vs field(H);
    rep(y, H) {
        cin >> field[y];
    }

    vvi dist(H, vi(W, -1));
    queue<int> qy, qx;
    rep(y, H) {
        rep(x, W) {
            if (field[y][x] == '#') {
                qy.push(y); qx.push(x);
                dist[y][x] = 0;
            }
        }
    }
    while (!qy.empty()) {
        int y = qy.front(), x = qx.front();
        qy.pop(); qx.pop();
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
            if (dist[ny][nx] != -1) continue;
            if (field[ny][nx] == '#') continue;
            dist[ny][nx] = dist[y][x] + 1;
            qy.push(ny); qx.push(nx);
        }
    }

    int ans = 0;
    rep(y, H) {
        rep(x, W) {
            chmax(ans, dist[y][x]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 13440
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def check(x):
    n=x.bit_length()
    for i in range(n-1):
        if((x>>i)&1 and (x>>(i+1))&1):
            return False
    return True

def resolve():
    H,W,K=map(int,input().split())
    K-=1
    dp=[0]*W
    dp[0]=1
    for _ in range(H):
        ndp=[0]*W
        # 各 2^(W-1)通りの線の引き方から、dpの遷移先を考える
        for V in range(2**(W-1)):
            if(not check(V)): continue
            for w in range(W):
                if(w<W-1 and (V>>w)&1): # 右に線があるとき
                    ndp[w+1]+=dp[w]
                    ndp[w+1]%=MOD
                elif(w>0 and (V>>(w-1))&1): # 左に線があるとき
                    ndp[w-1]+=dp[w]
                    ndp[w-1]%=MOD
                else: # 双方に線がないとき
                    ndp[w]+=dp[w]
                    ndp[w]%=MOD
        dp=ndp
    print(dp[K])
resolve()

Measured memory_bytes: 43740
#include <iostream>
#define N 3
using namespace std;


int main(){
    int l, i=0, a[N], min;
    while(cin>>l){
        a[i] = l;
        i++;
    }

    min = a[0] + a[1];
    if(a[2]+a[1] < min) min = a[2]+a[1];
    if(a[0]+a[2] < min) min = a[0]+a[2];
    if(a[1]+a[2] < min) min = a[1]+a[2];
    if(a[2]+a[0] < min) min = a[2]+a[0];
    if(a[1]+a[0] < min) min = a[1]+a[0];
    
    cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define max(X) *max_element(all(X))
#define min(X) *min_element(all(X))
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  ll N,T;
  cin >> N >> T;
  ll min = 1001;
  rep(i,0,N){
    ll c,t;
    cin >> c >> t;
    if(c<min && t<=T) min = c;
  }

  if(min <= 1000) print(min);
  else print("TLE");

  return 0;
}


Measured memory_bytes: 256
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
a,b=gsmi

puts a*b

Measured memory_bytes: 14340
#include<bits/stdc++.h>
#include <time.h>
using namespace std;
#include <math.h>
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
//clock_t tStart = clock();
//printf("Time taken: %.9fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define maxn 200001
 
#define ll long long int
 vector<int> wav;
 int m;vector<int> q;
 //int dp[22][11][1002]
 
int main(){
	int k;cin>>k;
	vector<int> mod;
	long long int a=1;
	if(k%7==0){
		k/=7;
	}
	for(int i=0;i<=k;i++){
		mod.push_back(a);
		a=a*10;
		a=a%k;
	}
	long long int ans=0;
	int pos=-1;
	for(int i=0;i<mod.size();i++){
		int x=mod[i];
		ans+=x;
		ans=ans%k;
		if(ans==0){
			pos=i+1;
			break;
		}
	}
	cout<<pos<<endl;
 
}


Measured memory_bytes: 7464
#include<stdio.h>
int main(void){
	int time;
	int hour;
	int minute;
	int second;
	scanf("%d",&time);
	hour = time / 3600;
	minute = (time - (hour * 3600)) / 60;
	second = time - hour * 3600 - minute * 60;
	printf("%d:%d:%d\n",hour,minute,second);
	return 0;
	}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

struct second_order {
    bool operator()(const pair<int,int>& x, const pair<int,int>& y) const {
        return x.second > y.second;
    }
};

int main() {
    int n; cin >> n;
    vector<vector<int>> f(n, vector<int>(10));
    rep(i, n) rep(j, 10) cin >> f[i][j];
    vector<vector<int>> p(n, vector<int>(11));
    rep(i, n) rep(j, 11) cin >> p[i][j];

    int ans = -INT_MAX;

    // 全ての営業時間の組み合わせごとの利益率を求める
    // 開始が0じゃないことに注意(1つも営業しないのはNGなので)
    for (int bit = 1; bit < (1<<10); ++bit) {
        int tmp = 0;
        vector<int> c(n,0);
        rep(i, 10) {
            if (bit & (1<<i)) {
                //この時間に営業する場合
                rep(j, n) {
                    // 同じ時間に営業してればカウント
                    if(f[j][i] == 1) c[j]++;
                }
            }
        }
        // 利益率を求める
        rep(j, n) tmp += p[j][c[j]];
        chmax(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = l[0], B = l[1], C = l[2];

            var odd = new bool[3];
            var oddCount = 0;
            for (var i = 0; i < 3; i++)
            {
                if (l[i] % 2 == 1)
                {
                    odd[i] = true;
                    oddCount++;
                }
            }

            var total = 0;
            if (oddCount == 1)
            {
                if (!odd[0]) A++;
                if (!odd[1]) B++;
                if (!odd[2]) C++;
                total++;
            }
            else if (oddCount == 2)
            {
                if (odd[0]) A++;
                if (odd[1]) B++;
                if (odd[2]) C++;
                total++;
            }

            var max = Math.Max(A, Math.Max(B, C));

            if (A != max) total += (max - A) / 2;
            if (B != max) total += (max - B) / 2;
            if (C != max) total += (max - C) / 2;

            Console.WriteLine(total);
        }
    }
}


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

#define ll long long
#define ld long double
#define IOS; ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;


int main() {
    IOS;
    ll n;
    cin >> n;
    ll chk=n%10;
    if(chk==2 || chk==5 || chk==7 || chk==9 || chk==4)
    {
        cout << "hon";
    }
    else if(chk==0 || chk==1 || chk==6 || chk==8)
    {
        cout << "pon";
    }
    else if(chk==3)
    {
        cout << "bon";
    }
    return 0;
}

Measured memory_bytes: 3612
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
//https://www.hustyx.com/cpp/5/ -- reference
#define N 100005
int a[N];

int main(){
	//input
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	memset(a,0,N);
	int n,t,l,r;
	scanf("%d %d",&n,&t);
	for(int i = 0; i<n; i++){
		scanf("%d %d",&l,&r);
		a[l]++;
		a[r]--;
	}
	//preprocess in the array
	int max = 0;
	int count = 0;
	for(int i = 0; i<N; i++){
		count += a[i];
		if(max<count) max = count;
	}
	printf("%d\n",max);
	//printf("wei");
	return 0;
}


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

const int N=50;
long long A[N],dp[N+1][N*N+1]; 
int main() {
  int n,x;
  cin >> n >> x;
  for ( int i=0; i<n; i++ ) cin >> A[i];
  dp[0][0]=1;
  int sum=0;
  for ( int i=0; i<n; i++ ) {
    for ( int j=i; ~j; j-- ) {
      for ( int k=sum; ~k; k-- ) {
        if  ( k+A[i]<=N*N ) dp[j+1][k+A[i]]+=dp[j][k];
      }
    }
    sum+=A[i];
  }
  long long ans=0;
  for ( int i=1; i<=n; i++ ) {
    ans+=dp[i][x*i];
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4404
// SeeAlso: https://atcoder.jp/contests/abc121/tasks/abc121_b

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 20

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

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

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


int N, M, C;
int B[MAX];

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

    REP(i, M) {
        cin >> B[i];
    }

    int ans = 0;
    REP(i, N) {
        int temp = C;
        REP(j, M) {
            int a;
            cin >> a;
            temp += B[j] * a;
        }

        if (temp > 0) {

            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll mod = 1000000007;
  ll N;
  cin >> N;
  vector<ll> T(N);
  vector<ll> A(N);
  for (ll i = 0; i < N; ++i)
  {
    cin >> T.at(i);
  }
  for (ll i = 0; i < N; ++i)
  {
    cin >> A.at(i);
  }
  vector<ll> low(N);
  for (ll i = 0; i < N; ++i)
  {
    low.at(i) = min(A.at(i), T.at(i));
  }
  vector<bool> revealed(N, false);
  revealed.at(0) = true;
  if (A.at(0) < T.at(0))
  {
    cout << 0 << endl;
    return 0;
  }
  for (ll i = 1; i < N; ++i)
  {
    if (T.at(i) != T.at(i - 1))
    {
      if (A.at(i) < T.at(i))
      {
        cout << 0 << endl;
        return 0;
      }
      revealed.at(i) = true;
    }
  }

  revealed.at(N - 1) = true;
  if (T.at(N - 1) < A.at(N - 1))
  {
    cout << 0 << endl;
    return 0;
  }
  for (ll i = N - 2; i >= 0; --i)
  {
    if (A.at(i) != A.at(i + 1))
    {
      if (T.at(i) < A.at(i))
      {
        cout << 0 << endl;
        return 0;
      }
      revealed.at(i) = true;
    }
  }

  ll ans = 1;
  for (ll i = 0; i < N; ++i)
  {
    if (revealed.at(i))
    {
      continue;
    }
    ans = (ans * low.at(i)) % mod;
  }
  cout << ans << endl;

}


Measured memory_bytes: 2560
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int r, c, k; cin >> r >> c >> k;
    static int a[3030][3030];
    rep(i, k) {
        int x, y, v; cin >> x >> y >> v;
        -- x, -- y;
        //mp[P{x, y}] = v;
        a[x][y] = v;
    }
    static int dp[3030][3030][4];
    //rep(i, 3030) rep(j, 3030) rep(k, 4) dp[i][j][k] = -INF;
    dp[0][0][0] = 0;
    rep(i, r) {
        rep(j, c) {
            rep(k, 4) {
                if(k < 3) {
                    chmax(dp[i + 1][j][0], dp[i][j][k]);
                    chmax(dp[i][j + 1][k], dp[i][j][k]);
                    if(a[i][j] > 0) chmax(dp[i + 1][j][0], dp[i][j][k] + a[i][j]);
                    if(a[i][j] > 0) chmax(dp[i][j + 1][k + 1], dp[i][j][k] + a[i][j]);
                } else {
                    chmax(dp[i + 1][j][0], dp[i][j][k]);
                    chmax(dp[i][j + 1][k], dp[i][j][k]);
                }
            }
        }
    }
    if(a[r - 1][c - 1] > 0) {
        per(k, 3) {
            chmax(dp[r - 1][c - 1][k + 1], dp[r - 1][c - 1][k] + a[r - 1][c - 1]);
        }
    }
    cout << *max_element(dp[r - 1][c - 1], dp[r - 1][c - 1] + 5) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 358412
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
double dp[310][310][310];
ll n;
double calc(ll i,ll j,ll k){
  double tmp=0;
  if(dp[i][j][k]>=0){
    return dp[i][j][k];
  }
  if(i==j&&j==k&&i==0) return 0.000;
  if(i>0) tmp += calc(i-1,j,k)*i;
  if(j>0) tmp += calc(i+1,j-1,k)*j;
  if(k>0) tmp += calc(i,j+1,k-1)*k;
  tmp += n;
  tmp *= 1.0/(i+j+k);

  return dp[i][j][k] = tmp;
}
signed main(){
  cin >> n;
  ll a[n],on,tw,th;
  on=tw=th=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]==1) on++;
    else if(a[i]==2) tw++;
    else th++;
  }
  fill(dp[0][0],dp[310][0],-1.0);
  printf("%.15lf\n",calc(on,tw,th));
}


Measured memory_bytes: 233088
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: usize = read();
    let k: usize = read();
    let mut ans: usize = 0;
    let mut av: Vec<i64> = vec![0; n + 1];
    av[0] = -1;

    for _ in 0..k {
        let d: usize = read();
        let a: Vec<usize> = read_n(d);
        for i in a {
            av[i] += 1;
        }
    }

    ans = av.iter().filter(|&x| *x == 0).count();
    println!("{}", ans);

}


Measured memory_bytes: 2108
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        int max = p[0];
        int sum = p[0];
        for (int i = 1; i < n; i++) {
            if (max < p[i])
                max = p[i];
            sum += p[i];
        }
        System.out.println(sum - max + max / 2);
    }
}

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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

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

int max_rectangle(const vector<int>& vec) {
	int rtn = 0;
	stack<pii> stk;
	auto calstk = [&](int ps, int ht){
		int t = ps;
		for( ;!stk.empty() && stk.top().second >= ht; stk.pop()){
			t = stk.top().first;
			rtn = max(rtn, (ps-t) * stk.top().second);
		}
		if(ht >0) stk.push(pii(t, ht));
	};
	rep(i, sz(vec)){
		calstk(i, vec[i]);
	}
	calstk(sz(vec), 0);
	return rtn;
}


int main()
{
	int h,w;
	while(cin >>h >>w){
		if(h==0 && w==0) break;
		vector<vector<int>> fl(h+1, vector<int>(w+1));
		rep(i,h) rep(j,w){
			char ch; cin >>ch;
			if(ch =='*') fl[i][j] = 0;
			else fl[i][j] = i? fl[i-1][j] +1 : 1;
		}
		//for(auto xl: fl){for(auto x :xl) printf("%d ",x); puts("");}
		int ans =0;
		
		rep(i,h){
			ans = max(ans, max_rectangle(fl[i]));
		}
		cout << ans <<"\n";
	}
	
	return 0;
}

Measured memory_bytes: 3928
a, b, c, d, e, f = map(int, input().split())

water = [False]*(f+1)
suger = [False]*(f+1)

for i in range(0, f+1, a*100):
  water[i] = True
for i in range(f+1):
  if (i == 0 or water[i]) and i+b*100 <= f:
    water[i+b*100] = True
  
for i in range(0, f+1, c):
  suger[i] = True
for i in range(f+1):
  if (i == 0 or suger[i]) and i+d <= f:
    suger[i+d] = True

ans_w, ans_s = a*100, 0
for i in range(f+1):
  if water[i] == False:
    continue
  for j in range(f, -1, -1):
    if suger[j] == False or j*(100+e) > (j+i)*e or j+i > f:
      continue
    if j*(ans_w+ans_s) > (j+i)*ans_s:
      ans_w, ans_s = i, j
    break
print(ans_w+ans_s, ans_s)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
    int x, y, z, temp;
    scanf("%d%d%d", &x, &y, &z);
    temp = y+z;
    int ans = x / temp;
    // 如果最后的间隙少于z 那么最后一个位置不能座
    if(x - ans*temp < z) ans--;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
template<class T>vector<T> inarr(int s,int e, T init){
	vector<T> v;T x;
	for(int i=0;i<s;++i)v.push_back(init);
	for(int i=s;i<e;++i){cin>>x;v.push_back(x);}
	return v;
}

ll N,M;
vl A;

bool check(ll x){
	ll count = 0;
	rp(i,0,N) count += N - (lower_bound(all(A), x-A[i]) - A.begin());
	return count < M; // (x 以上の和 < M個)?
}

ll solve(){
	sort(all(A));

	// ll ng = 0, ok = 2*A[N-1];
	ll ng = 2*A[0], ok = 2*A[N-1]+1; // [l.r)=[ng,ok)
	while(abs(ok-ng)>1){ // binary search
		ll mid = (ok + ng) / 2;
		if(check(mid)) ok = mid; // (x=mid 以上の和 < M個)? ok=mid: ng=mid
		else ng = mid;
	}

	// ng=x-1, ok=x

	vl csum(N+1); rp(i,0,N) csum[i+1] = csum[i] + A[i]; // 累積和A

	ll ans = 0;
	rp(i,0,N){
		ll pos = upper_bound(all(A), ng-A[i]) - A.begin();
		ll count = N - pos;
		ans += count * A[i] + (csum[N] - csum[pos]);
		M -= count;
	}
	ans += M * ng;
	return ans;
}


int main(){
	cin>>N>>M;
	A = inarr<ll>(0,N,0);
	cout<< solve() <<endl;
}


Measured memory_bytes: 1908
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N, M;
	cin >> N >> M;
	vector<int>X(M);
	int ans = 0;
	for (int i = 0; i < M; i++)
	{
		cin >> X[i];
	}
	if (M == 1) {
		cout << 0 << endl;
		return 0;
	}
	else {
		sort(X.begin(), X.end());
		vector<int>diff(M);
		for (int i = 1; i < M; i++)
		{
			diff[i] = X[i] - X[i - 1];
		}
		int diffsum = 0;
		sort(diff.rbegin(), diff.rend());
		for (int i = N - 1; i < M; i++)
		{
			diffsum += diff[i];
		}
		cout << diffsum << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<=n;i++)
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;


/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
    vector<int> a(5);
    int k;
    REP(i,5){
        cin >> a[i];
    }
    cin >> k;
    for(int i = 0; i < 5;i++){
        for(int j = i + 1; j <=4 ;j++){
            if(a[j] - a[i] > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;

/**
 * Created by ylc265 on 10/16/15.
 */
public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tk = new StringTokenizer(in.readLine());
        StringBuilder sb = new StringBuilder();
        int max = 0;
        String maxString = "";
        int maxCount = 0;
        HashMap<String, Integer> mp = new HashMap<String, Integer>();
        while (tk.hasMoreTokens()) {
            String word = tk.nextToken();
            if (word.length() > max) {
                max = word.length();
                maxString = word;
            }
            int value = 1;
            if (mp.containsKey(word)) {
                value += mp.get(word);
                if (maxCount < value) {
                    maxCount = value;
                }
            }
            mp.put(word, value);
        }
        for (String key : mp.keySet()) {
            if (mp.get(key) == maxCount) {
                sb.append(key).append(' ');
                break;
            }
        }
        sb.append(maxString).append('\n');
        System.out.print(sb);

    }
}

Measured memory_bytes: 24180
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"

	"github.com/emirpasic/gods/trees/redblacktree"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	h := getNextInt(scanner)
	w := getNextInt(scanner)

	rbt := redblacktree.NewWithIntComparator()
	rbt2 := redblacktree.NewWithIntComparator()
	for i := 0; i < w; i++ {
		rbt.Put(i, i)
	}
	rbt2.Put(0, w)

	for i := 0; i < h; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner)
		x := -1
		for node, ok := rbt.Ceiling(a); ok && node.Key.(int) <= b; node, ok = rbt.Ceiling(a) {
			k := node.Key.(int)
			v := node.Value.(int)
			rbt.Remove(k)
			if x < v {
				x = v
			}
			old, _ := rbt2.Get(k - v)
			if old.(int) == 1 {
				rbt2.Remove(k - v)
			} else {
				rbt2.Put(k-v, old.(int)-1)
			}
		}
		if b < w && x != -1 {
			old, found := rbt.Get(b)
			if found && old.(int) > x {
				x = old.(int)
			}
			rbt.Put(b, x)
			old, found = rbt2.Get(b - x)
			if found {
				rbt2.Put(b-x, old.(int)+1)
			} else {
				rbt2.Put(b-x, 1)
			}
		}
		if rbt2.Empty() {
			fmt.Fprintln(writer, -1)
			continue
		}
		fmt.Fprintln(writer, rbt2.Left().Key.(int)+i+1)
	}
}


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

int main() {
	int A, B;
	cin >> A >> B;
	
	if(A%3 == 0 || B%3 == 0 || (A+B)%3 == 0)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;
	
	
	return 0;
}

Measured memory_bytes: 256