akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
    using namespace std;
     
    ////////////// Prewritten code follows. Look down for solution. ////////////////
    #define x first
    #define y second
    #define len(x) ((int)(x).size())
    using pii = pair<int, int>;
    using ll = long long;
    using llu = long long unsigned;
    using ld = long double;
     
    const ld EPS = 1e-9;
    inline int cmp(ld x, ld y = 0, ld tol = EPS) {
    	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
    }
     
    const int MOD = 1;
    inline int mod (ll x, int m = MOD) {
    	return (int)(((x%m) + m)%m);
    }
     
    ////////////////////////// Solution starts below. //////////////////////////////
     
    const int N = 3010;
     
    ld dp[N][N];
    int n;
    ld pos[N];
    bool vis[N][N];

    ld solve (int p, int h) {
    	if (p > n)
    		return h > n/2;
    	
    	ld &r = dp[p][h];
    	if (vis[p][h]) return r;
        vis[p][h] = true;
    	return r = pos[p]*solve (p+1, h+1) +  (1-pos[p])*solve (p+1, h);
    }
     
    int main () {
    	memset (dp, -1, sizeof dp);
    	scanf ("%d", &n);
    	for (int i = 1; i <= n; i++)
    		scanf ("%Lf", &pos[i]);
    	printf ("%0.16Lf\n", solve (0, 0));
     
    	return 0;
    }

Measured memory_bytes: 150912
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);

int main(){
  string S;
  cin >> S;
  char a;
  int con[26] = {0};
  map<char, int>p;
  rep(i, S.size()){
    con[S[i] - 'a']++;
  }
  bool can = true;
  rep(i, 26){
    if(!(con[i])){
      can = 0;
      cout << char(i + 'a') << endl;
      break;
    }
  }
  if(can) cout << "None" << endl;
    
}



Measured memory_bytes: 512
from sys import stdin


def f(x, k, d):
    x = abs(x)
    if k == 0:
        return abs(x)

    tmp = x // d

    if tmp > k:
        return abs(x - d * k)
    else:
        x = x - d * tmp
        k = k - tmp
        if k % 2 == 0:
            return abs(x)
        else:
            return abs(x - d)


if __name__ == '__main__':
    X, K, D = [int(x) for x in stdin.readline().rstrip().split()]
    print(f(X, K, D))


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    int H, W, N;
    cin >> H >> W >> N;

    set<pii> st;
    map<pii, int> T;

    rep(i, N) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        st.insert(mp(a, b));
    }

    for (auto p : st) {
        int x, y;
        tie(x, y) = p;
        for (int i = x - 2; i <= x; ++i) {
            for (int j = y - 2; j <= y; ++j) {
                if (i >= 0 && j >= 0 && i + 3 <= H && j + 3 <= W) {
                    T[mp(i, j)]++;
                }
            }
        }
    }
    V<ll> ans(10);
    ans[0] = (ll)(H - 2) * (W - 2) - T.size();
    for (auto pr : T) {
        ans[pr.se]++;
    }
    rep(i, 10) { cout << ans[i] << endl; }

    return 0;
}

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

int main() {
  vector<int> t(365);
  int d;
  vector<int> c(26);
  vector<vector<int>> s(365, vector<int>(26));
  cin >> d;
  vector<int> dectrend(26);
  int cHighCnt = 0;
  rep(i,26) {
    int inc;
    cin >> inc;
    if (inc > 80) {
      dectrend[i] = 1;
      cHighCnt++;
    }
    c[i] = inc;
  }
  rep(i,365) {
    int mx = 0;
    rep(j,26) {
      int ins;
      cin >> ins;
      if (ins > mx) {
        t[i] = j + 1;
        mx = ins;
      }
      s[i][j] = ins;
    }
  }

  vector<int> c2(c.size());
  sort(c.begin(), c.end(), greater<int>());
  rep(i,cHighCnt) {
    rep(j,26) {
      if (c[i] == c2[j]) {
        t[25 - i] = j;
      }
    }
  }

  rep(i,365) {
    cout << t[i] << endl;
  }
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ( A+B > C+D ) {
    cout << "Left" << endl;
  }
  if ( A+B == C+D ) {
    cout << "Balanced" << endl;   
  }
  if ( A+B < C+D ) {
  cout << "Right" << endl;
  }  
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 2017;
char A[MC],B[MC];
int c[MC];
int l[MC],r[MC];
int sl[MC],sr[MC];

int main(){
	scanf("%s %s" , A , B);
	int n = 0;
	bool zeroA = 1 , zeroB = 1;
	while(B[n] != 0){
		if(A[n] == '1') zeroA = 0;
		if(B[n] == '1') zeroB = 0;
		sl[n] = sr[n] = n;
		++n;
	}
	if(zeroB){
		printf("%d\n" , zeroA ? 0 : -1);
		return 0;
	}
	repp(i,0,n) repp(j,0,n) if(A[j] != B[(i+j)%n]) ++c[i];
	repp(i,0,n){
		while(B[(i+n-l[i])%n] == '0') ++l[i];
		while(B[(i+r[i])%n] == '0') ++r[i];
	}
	sort(sl,sl+n,[&](const int p , const int q){return l[p] < l[q];});
	sort(sr,sr+n,[&](const int p , const int q){return r[p] < r[q];});
	int ans = 123456789;
	repp(i,0,n){
		int m = 0;
		int p = n-1;
		ans = min(ans , 2*n-2-i+c[(n-i)%n]);
		repm(j,n-1,i){
			while(l[sl[p]] == j){
				if(A[sl[p]] != B[(sl[p]+n-j+1)%n]) m = max(m , r[sl[p]]);
				--p;
			}
			ans = min(ans , (j-1)*2-i+c[(n-i)%n]+m*2);
		}
	}
	repp(i,0,n){
		int m = 0;
		int p = n-1;
		ans = min(ans , 2*n-2-i+c[i]);
		repm(j,n-1,i){
			while(r[sr[p]] == j){
				if(A[sr[p]] != B[(sr[p]+j-1)%n]) m = max(m , l[sr[p]]);
				--p;
			}
			ans = min(ans , (j-1)*2-i+c[i]+m*2);
		}
	}
	printf("%d\n" , ans);
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
// run : ctrl + c 

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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

   ll h,w;
   cin>>h>>w;
   if(h == 1 || w == 1){
       cout << 1 << endl;
       return 0;
   }
   ll ans = (h+1)/2;
   ll t = (w+1)/2;
   ans *= t;
   t = h/2;
   ll k = w/2;
   t *= k;
   ans += t;
   
   cout << ans << endl;
   
}

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

int main() {
    int n;
    cin >> n;
    int data[n];
    
    for(int i = 0; i < n; i++) {
        cin >> data[n - 1 - i];
    }
    
    for (int i = 0; i < n; i++) {
        cout << data[i];
        if(i == n - 1) {
            break;
        }
        cout << " ";
    }
    
    cout << endl;
    
    
    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> h(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin >> h.at(i);
  }
  int count = 0;
  int ch = 0;
  for(i = 0; i < n; i++)
  {
    if(h.at(i) > 0)
    {
      ch = 1;
      break;
    }
  }
  while(ch == 1)
  {
    for(i = 0; i < n; i++)
    {
      if(i == n-1 && h.at(i) != 0)
      {
        h.at(i)--;
        count++;
      }
      else if(h.at(i) != 0 && h.at(i+1) != 0)
      {
        h.at(i)--;
      }
      else if(h.at(i) != 0 && h.at(i+1) == 0)
      {
        h.at(i)--;
        count++;
      }
    }
    ch = 0;
    for(i = 0; i < n; i++)
    {
      if(h.at(i) > 0)
      {
        ch = 1;
        break;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import math
def resolve():
    
    a,b,h,m=map(int,input().split())
    theta1=(30*h+30*m/60)/360
    theta2=(6*m)/360
    theta=2*math.pi*abs(theta1-theta2)
    ans=a**2+b**2-2*a*b*math.cos(theta)
    print(math.sqrt(ans))

resolve()

Measured memory_bytes: 62412
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N;cin>>N;
    int NN=N;
    int sum=0;
    int d=100000000;
    for(int i=0;i<9;i++){
      int q = N/d;
      sum += q;
      N -= q*d;
      d /= 10;
    }
    
    if(NN%sum==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;


class DICE
{
private:
	void swapMap(string a, string b);
public:
	map<string,int> dice;
	DICE(vector<int> &v);
	~DICE();
	void turnDice(char c);
	void rotateDice(char c);
	void setDice(string s1, string s2, int a, int b);
	void printDice(string s);
};

DICE::DICE(vector<int> &v){
	dice["top"] = v[0];
	dice["front"] = v[1];
	dice["right"] = v[2];
	dice["left"] = v[3];
	dice["back"] = v[4];
	dice["bottom"] = v[5];
}

DICE::~DICE(){
	
}

void DICE::swapMap(string a, string b){
	if(dice.end() == dice.find(a) || dice.end() == dice.find(b)) return;
	int tmp;
	tmp = dice[a];
	dice[a] = dice[b];
	dice[b] = tmp;
}

void DICE::turnDice(char c){
	switch(c){
		case 'N':
			swapMap("top","back");
			swapMap("top","bottom");
			swapMap("top","front");
			break;
		case 'E':
			swapMap("top","right");
			swapMap("top","bottom");
			swapMap("top","left");
			break;
		case 'S':
			swapMap("top","front");
			swapMap("top","bottom");
			swapMap("top","back");
			break;
		case 'W':
			swapMap("top","left");
			swapMap("top","bottom");
			swapMap("top","right");
			break;
		default :
			break;
	}
}

void DICE::rotateDice(char c){
	switch(c){
		case 'R':
			swapMap("front","right");
			swapMap("front","back");
			swapMap("front","left");
			break;
		case 'L':
			swapMap("front","left");
			swapMap("front","back");
			swapMap("front","right");
			break;
		default :
			break;
	}
}

void DICE::setDice(string s1, string s2, int a, int b){
	int cnt = 0;
	while(dice[s1] != a && cnt < 6){
		if(cnt % 2 == 0) this->turnDice('E');
		else this->turnDice('N');
		cnt++;
	}
	cnt = 0;
	while(dice[s2] != b && cnt < 4){
		rotateDice('R');
		cnt++;
	}
}

void DICE::printDice(string s){
	cout << dice[s] << endl;
}

int main(){
	vector<int> v;
	int q;
	for(int i = 0; i < 6; i++){
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	DICE data(v);
	cin >> q;
	for(int i = 0; i < q; i++){
		int a, b;
		cin >> a >> b;
		data.setDice("top","front",a,b);
		data.printDice("right");
	}
}

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

set<ll> S;

void append(ll x){
    if(S.count(x)==0){
        S.insert(x);
    }
}

int all_search(ll n){
    int count = 0;
    for(ll k=2; k<=n; ++k){
      ll temp = n;
      while(temp>1){
          if(temp%k==0){
              temp = temp/k;
          }
          else temp -=k;
      }

      if(temp==1) {
          cout << k << endl;
           count++;
      }
   }
   return count;
}

int main(){
    ll n;
    cin >> n;

    ll sqrtn;
    sqrtn = ceil(sqrt(n));

    vector<P> amari;
    int count=0;
    for(ll i=2;i<=sqrtn+1; ++i){
        ll temp = n;
        count++;
        bool flag=true;
        while(temp>1){
            if(temp%i==0){
                temp = temp/i;
                //if(temp==1) cout<<"2: " << i << endl;
            }
            else{
                if((temp-1)%i==0){
                    //cout << i << endl;
                    break;
                }
                count--;
                flag=false;
                break;
            }

        }
        if(flag) append(i);
        

        if((n-1)%i==0){
            count++;
            //cout <<"3: "<< i << endl;
            append(i);
            if((n-1)/i>sqrtn) {
                append((n-1)/i);
                count++;
                //cout << "4: " << (n-1)/i << endl;
            }
        }
    }
    append(n);
    if(n>2) append(n-1);
    //cout<< "size" << endl;
    cout << S.size() << endl;
    /*
    cout << "ans" << endl;
    for(auto s:S) cout << s << endl;
    
   cout << "tf" << endl;
   cout << (S.size() == all_search(n)) << endl;
    */
}

Measured memory_bytes: 256
#第1回日本最強プログラマー学生選手権-予選-B
n,k = map(int,input().split())
a = list(map(int,input().split()))

EPS = 10**9 + 7

cnt = 0
#リストの中身を見る
for i in range(n-1):
    for j in range(i,n):
        if a[i] > a[j]:
            cnt += 1
        
soto = 0
#リスト外
for i in range(n):
    for j in range(n):
        if a[i] > a[j]:
            soto += 1
            
soto = soto * k * (k-1) // 2

result = cnt * k + soto

print(result % EPS)

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

int main() {
	int N;
	cin >> N;
	vector<int>A(N,0), B(N, 0), C(N, 0);
	for (int i = 0; i < N; i++)  cin >> A[i];
	for (int i = 0; i < N; i++)  cin >> B[i];
	for (int i = 0; i < N-1; i++)  cin >> C[i];
	int before = -1, satisfaction = 0;
	for (int i = 0; i < N; i++) {
		satisfaction += B[A[i] - 1];
		if (before + 1 == A[i]) satisfaction += C[before - 1];
		before = A[i];
	}
	cout << satisfaction << endl;
}


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

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

#define ll  long long  int
#define ld   long double
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define pi 3.14159265358979
//#define goodset tree<pa, null_type, less<pa>, rb_tree_tag, tree_order_statistics_node_update>
//#define FRE freopen("acm.in","r",stdin); freopen("acm.out","w",stdout);

const ll mod = 1e9+7 ;
const ll N = 1e5+5;


int main()
{
    FAST
    ll i,j,k,tc;
    //cin>>tc;
    tc=1;
    while(tc--)
    {
        ll n,x,m;
        cin>>n>>x>>m;

        vector<ll>v;
        map<ll,ll>mp;
        ll ans=0;
        if(n<=1e6)
        {
            ll pres=x;
            for(i=1; i<=n; i++)
            {
                ans+=x;
                x=((x*x)%m);
            }
            cout<<ans<<"\n";
            return 0;
        }

        ll st=-1, siz=-1;
        for(i=1; i<=1e6; i++)
        {
            if(mp.find(x)!=mp.end())
            {
                st=mp[x]-1;
                siz=i-mp[x];
                break;
            }
            else
            {
                ans+=x;
                v.pb(x);
                mp[x]=i;
                x=(x*x)%m;
            }
        }

        ll sum=0;
        ll left=n-(i-1);
        for(i=st; i<st+siz; i++)
            sum+=v[i];

        ll cnt1=left/siz;
        ans+=(cnt1*sum);
        left%=siz;
        for(i=st; i<st+left; i++)
            ans+=v[i];

        cout<<ans<<"\n";




    }

    return 0;
}


Measured memory_bytes: 6720
h,w,k = map(int, input().split())
c = [input() for _ in range(h)]
ans = 0
import itertools
for i in itertools.product([0, 1], repeat=h):
    for j in itertools.product([0, 1], repeat=w):
        cnt = 0
        for y in range(h):
            for x in range(w):
                if i[y] == 0 and j[x] == 0 and c[y][x] == '#':
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define MAXN 1000010
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

struct point{
	int x,y;
	point(){}
	point (int _x,int _y){
		x = _x;
		y = _y;
	}
	point operator+(const point & oth){
		return point(x+oth.x,y+oth.y);
	}
	point operator-(const point &oth){
		return point(x-oth.x,y-oth.y);
	}
};

int dot(point a,point b){
	return a.x*b.x + a.y*b.y;
}
int cross(point a,point b){
	return a.x*b.y - a.y*b.x;
}
int ccw(point a,point b,point c){
	int dir = cross(b-a,c-b);
	return dir<0;//convexo
}
int n,c;
int h[MAXN];
int dp[MAXN];
point line[4*MAXN];
vector<int> M;
vector<int> B;

int f(point a,int x){
	point c(x,1);
	return dot(a,c);
}

void add_line(point nw,int v=1,int l=0,int r = MAXN){
	int m = (l+r)/2;
	bool lef = f(nw,l) < f(line[v],l);
	bool mid = f(nw,m) < f(line[v],m);
	if(mid){
		swap(line[v],nw);
	}
	if(r-l==1){
		return;
	}else if(lef!=mid){
		add_line(nw,2*v,l,m);
	}else{
		add_line(nw,2*v+1,m,r);
	}
}

int get(int x,int v=1,int l=0,int r = MAXN){
	int m = (l+r)/2;
	if(r-l==1){
		return f(line[v],x);
	}else if(x<m){
		return min(f(line[v],x),get(x,2*v,l,m));
	}else{
		return min(f(line[v],x),get(x,2*v + 1 ,m ,r));
	}
}


int32_t main(){
	fastio;
	cin>>n>>c;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	dp[1]=0;
	point a1 (-2*h[1],dp[1]+h[1]*h[1]);
	add_line(a1,1,0,MAXN);
	for(int i=2;i<=n;i++){
		dp[i] = h[i]*h[i]+c;
		dp[i] = min(dp[i],(h[i]*h[i]+c)+get(h[i],1,0,MAXN));
		point nw(-2*h[i],dp[i]+h[i]*h[i]);
		add_line(nw,1,0,MAXN);
	}
	cout<<dp[n]<<endl;
}

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

  double N , M ;
  cin >> N >> M ;
  //vector<int> A(N) ;
  //rep(i,N) cin >> A.at(i) ;
  int count = 0 ;
  cout << N/M <<endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define INF 1000000000
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<string>w(n);
    map<string,bool>m;
    for(int i=0;i<n;i++){
        cin>>w[i];
        
    }
    for(int i=0;i<n;i++){
    if(m[w[i]]==true){
            cout<<"No"<<endl;
            return 0;
        }else{
            m[w[i]]=true;
        }
    }
    for(int i=0;i<n-1;i++){
        if(w[i][w[i].size()-1]!=w[i+1][0]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const double PI = 3.14159265358979;
const ll INF =  1e15 + 7;
const ll MOD = 998244353;
const ll nax = 1010;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		ll a;
		string b;
		cin >> a >> b;
		ll ans = a * (b[0] - '0');
		ans = ans + (a * ((b[2] - '0') * 10 + (b[3] - '0')) / 100);
		cout << ans;
	}
	return 0;
}




















Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm> 
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define y1 abcde
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 2e5 + 15;
int n, k[2], ans[N];
vector <int> g[2][N];
int sz[N], p[N];
bool used[N];
int q[N], ql, qr;
int cnt[N];

int find(int v) {
	if(v == p[v])
		return v;
	return p[v] = find(p[v]);
}

void unio(int a, int b) {
	a = find(a);
	b = find(b);
	if(a != b) {
		if(sz[a] < sz[b])
			swap(a, b);
		p[b] = a;
		sz[a] += sz[b];
	}
}

main() {
	for(int i = 0; i < N; ++i)
		sz[i] = 1, p[i] = i;
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	cin >> n >> k[0] >> k[1];
	for(int j = 0; j < 2; ++j)
		for(int i = 0; i < k[j]; ++i) {
			int u, v;
			cin >> u >> v;
			g[j][u].pb(v);
			g[j][v].pb(u);
			if(j == 1)
				unio(u, v);
		}
	for(int i = 1; i <= n; ++i) {
		if(!used[i]) {
			used[i] = true;
			q[ql = qr = 0] = i;
			vector <int> comp = {};
			while(ql <= qr) {
				int v = q[ql++];
				comp.pb(v);
				++cnt[find(v)];
				for(int to : g[0][v])
					if(!used[to]) {
						used[to] = true;
						q[++qr] = to;
					}
			}
			for(int v : comp)
				ans[v] = cnt[find(v)];
			for(int v : comp) {
				cnt[find(v)] = 0;
			}
		}
	}
	for(int i = 1; i <= n; ++i)
		cout << ans[i] << ' ';
    return 0;
}

Measured memory_bytes: 20096
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 ll mod=1e9+7;

int main(){
    ll n,k;
    cin >> n >> k;
    if(k==0){
        cout << n*n << endl;
        return 0;
    }
    ll ans=0;
    for(ll b=1;b<=n;b++){
        ll p=n/b;
        ll q=n%b;
        ans+=p*max(b-k,0LL)+max(q+1-k,0LL);
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3556
#include<stdio.h>
#define MAX 2000000
#define INFTY (1<<30)
int H,A[MAX+1];

 void maxHeapify(int i){
                        int l,r,largest,temp;
                        l=2*i;
                        r=2*i+1;
                        
                        if(l<=H && A[l]>A[i])largest=l;
                        else largest=i;
                        if(r<=H && A[r]>A[largest])largest=r;

                        if(largest!=i){
                                       temp=A[i];
                                       A[i]=A[largest];
                                       A[largest]=temp;
                                       maxHeapify(largest);
                                       }
                         }

 int extract(){
               int maxv;
               if(H<1)return -INFTY;
               maxv=A[1];
               A[1]=A[H--];
               maxHeapify(1);
               return maxv;
               }

 void increaseKey(int i,int key){
                                 int temp;
                                 if(key<A[i])return;
                                 A[i]=key;
                                 while(i>1 && A[i/2]<A[i]){
                                                           temp=A[i];
                                                           A[i]=A[i/2];
                                                           A[i/2]=temp;
                                                           i=i/2;
                                                           }
                                  }
 
 void insert(int key){
                      H++;
                      A[H]=-INFTY;
                      increaseKey(H,key);
                      }


 int main(){
            int key;
            char com[10];
            while(1){
                     scanf("%s %d",&com,&key);
                     if(com[0]=='i'){
                                     insert(key);
                                     }
                     else if(com[1]=='x'){
                                          printf("%d\n",extract());
                                          }
                     else break;
                     }
           return 0;
           }


                                       


Measured memory_bytes: 5612
#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = list(map(int,input().split()))
N = s[0]
X = s[1]

L = list(map(int,input().split()))

counter = 1
coordinate = 0


for i in range(N):
    coordinate += L[i] #次に跳ねる座標
    if coordinate > X:
         break
    counter += 1


print(counter)


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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;

int main() {
	int d, n;
	cin >> d >> n;

	int ans = 1;
	rep(i, d){
		ans *= 100;
	}

	if(n == 100){
		ans *= (n + 1);
	}else{
		ans *= n;
	}

	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<60)

int s(int n){
    stringstream ss;
    ss<<n;
    string s = ss.str();
    int ret = 0;
    for(char elm:s){
        ret += elm-'0';
    }
    return ret;
}

double f(int n){
    return (double)n/s(n);
}

signed main(){
    int k;
    cin>>k;
    int d = 1;
    int t = 1;
    while(k--){
        cout<<t<<'\n';
        if(f(t+d)>f(t+d*10))d*=10;
        t+=d;
    }
}


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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int left = 0, right = 1;
    int space = 0;
    int totalMeter = 0;
    while (true) {
        if (right == N) {
            totalMeter += A[0] + K - A[N-1];
            space = max(A[0] + K - A[N - 1], space);
            break;
        }
        totalMeter += A[right] - A[left];
        space = max(A[right] - A[left], space);
        right++, left++;
    }
    cout << totalMeter - space << endl;
    return 0;
}

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

int n;
int l[2007];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> l[i];
    }
    sort(l + 1, l + n + 1);
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            ans += lower_bound(l + j + 1, l + n + 1, l[i] + l[j]) - (l + j + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#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()
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;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int mx = 0;
    for (int k = 1; ; ++k) {
        if (k * (k + 1) >= 2 * n) {
            mx = k;
            break;
        }
    }
    for (int i = 1; i <= mx; ++i) {
        if (i != mx * (mx + 1) / 2 - n) cout << i << endl;
    }
}

Measured memory_bytes: 256
n, m, k = map(int, input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0

a = [0]
b = [0]

for i in range(n):
    a.append(a[i] + A[i])

for i in range(m):
    b.append(b[i] + B[i])

j = m

for i in range(n + 1):
    if a[i] > k:
        break
    while a[i] + b[j] > k:
        j -= 1
    else:
        ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47432
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;

int main(){

    //負の値をとる数の偶奇は変わらないので
    //負の値の数が奇数なら絶対値が一番小さいものをマイナスに
    //それ以外は絶対値の和

    int n;
    cin >> n;

    ll abssum = 0;
    ll absmin = LLONG_MAX;

    int minuscount = 0;

    rep(i,n){
        ll tmp;
        cin >> tmp;

        if(tmp < 0) minuscount++;

        abssum = abssum + abs(tmp);
        absmin = min(absmin, abs(tmp));
    }

    if(minuscount % 2 == 0){
        cout << abssum << endl;
    }else{
        cout << abssum - absmin * 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#include<string.h>
#define v vector<int>
#define vpp vector<pair<int,int>>
#define ll long long int
#define ull unsigned long long
#define ld long double
#define f(a,b) for(ll i =a;i<b;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define pb push_back
#define MOD 1000000007
#define ub upper_bound
#define lb lower_bound
ll fast_pow(ll k, ll p)
{
if (p == 0)
        return 1;
 
    ll P = fast_pow(k, p/2);
    P = (P * P) % MOD;
 
    if (p % 2 == 1)
        P = (P * k) % MOD;
 
    return P;
}
ll invmod(ll a,ll m)
{
    return fast_pow(a,m-2);
}

bool isPrime(ll n) 
{ 
   
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
       if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll nextPowerOf2(ll n)
{
    n>>=1;
    ll count = 0;

    if (n && !(n & (n - 1)))
        return n;

    while( n != 0)
    {
        n >>= 1;
        count += 1;
    }

    return 1 << count;
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
  
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 


//////////////////////*********CODE***********/////////////////////
 
int main(){
  int n,m;
  cin>>n>>m;
  int a[n];
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
}
  int c=0;
  for(int i=0;i<n;i++){
      if(a[i]*4*m>=sum){
        c++;
      }
  }
  if(c>=m){
    cout<<"Yes"<<endl;}
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
//
// Created by kinok on 2020/04/19.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>

using namespace std;


#define ll long long
#define rep(t) for(int i=0;i<t;i++)
#define deb(a) cout<<#a<<" : "<<a<<endl
#define debv(v) do{cout<<#v<<" : ";for(auto a:v){cout << a <<" ";} cout<<endl;}while(0);
#define PI 3.141592653589793



void a(){
    int a;
    cin>>a;
    cout<<fixed<<setprecision(8)<<a*2*PI<<endl;
}

void b(){
    ll n,m,total=0,k;
    cin>>n>>m;
    rep(m){
        cin>>k;
        total+=k;
    }
    cout<<(n<total?-1:n-total)<<endl;
}
void c(){

}

void d(){

}

void e(){

}

void f(){

}


int main(){
    a();
  return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  vector<int> b;
  for (int i = 1; i <= N - 1; ++i) {
    int B;
    cin >> B;
    b.push_back(B);
  }
  int64_t result = b[0] + b[b.size() - 1];

  for (size_t i = 0; i < b.size() - 1; ++i) {
    result += min(b[i], b[i + 1]);
  }

  cout << result << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define SPADE 0
#define HEART 1
#define CLUB 2
#define DIAMOND 3

int main(void)
{
    int n;
    int cards[4][14];
    int i, j, number;
    char picture;

    // Initialization
    for (i = 0; i < 4; i++)
    {
        for (j = 0; j < 14; j++)
        {
            cards[i][j] = 0;
        }
    }

    scanf("%d\n", &n);

    for (i = 0; i < n; i++)
    {
        scanf("%c %d\n", &picture, &number);
        // printf("picture = %c number = %d\n", picture, number);
        if (picture == 'S')
            cards[SPADE][number]++;
        else if (picture == 'H')
            cards[HEART][number]++;
        else if (picture == 'C')
            cards[CLUB][number]++;
        else if (picture == 'D')
            cards[DIAMOND][number]++;
    }

    // Chcek if the input was successful
    // for (i = 0; i < 4; i++)
    // {
    //     for (j = 1; j < 14; j++)
    //     {
    //         printf("cards[%d][%d] = %d\n", i, j, cards[i][j]);
    //     }
    // }

    for (i = 0; i < 4; i++)
    {
        for (j = 1; j < 14; j++)
        {
            if (cards[i][j] == 0)
            {
                if (i == SPADE)
                    printf("S %d\n", j);
                else if (i == HEART)
                    printf("H %d\n", j);
                else if (i == CLUB)
                    printf("C %d\n", j);
                else if (i == DIAMOND)
                    printf("D %d\n", j);
            }
        }
    }
    return (0);
}


Measured memory_bytes: 2056
import qualified Data.Map as M
import Control.Monad
 
ix :: Int -> [(Int,Int)] -> Int
ix i [] = 0
ix i ((a,b):xs)
  | i < b = a
  | otherwise = ix (i-b) xs
 
main :: IO ()
main = do
  [n,k] <- map read . words <$> getLine
  is <- replicateM n $ map read . words <$> getLine
  let kon = foldr (\[a,b] m -> M.unionWith (+) m $ M.singleton a b) M.empty is
  print $ ix (k-1) $ M.toAscList kon

Measured memory_bytes: 101756
#include<iostream>

int main(){

  int x,y,temp,r;

  std::cin>>x>>y;

  if(y>x){
    temp=x;
    x=y;
    y=temp;
  }

  r=x%y;
  while(r!=0){
    x=y;
    y=r;
    r=x%y;
}

  std::cout<<y<<"\n";
  return 0;
}



Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int N, K;
int A[100000];
int index1;

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        if (A[i] == 1) {
            index1 = i;
            break;
        }
    }
    int res = (N - 1) / (K - 1);
    if ((N - 1) % (K - 1) != 0) {
        res++;
    }
    cout << res << endl;
}

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

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  string ans = s * t >= d ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <math.h>
int main(void) {
	// your code goes here
	int h,t,a,n,i,save;
	double diff = 99999;
	save=0;
	scanf("%d %d %d", &n, &t, &a);
	for(i=1;i<=n;i++){
		scanf("%d",&h);
		if(diff>fabs(a-(t-(0.006*h)))){
			diff = fabs(a-(t-(0.006*h)));
			save = i;
		}
	}
	
	printf("%d\n",save);
	return 0;
}


Measured memory_bytes: 128
h, w = gets.chomp.split.map(&:to_i)
strs = h.times.map { gets.chomp.chars }
res = Array.new(h).map{Array.new(w, 0)}

h.times do |i|
  w.times do |j|
    if strs[i][j] == '#'
      res[i][j] = '#'
    else
      count = 0
      count += 1 if i!=0 &&  j!=0      && strs[i-1][j-1] == '#'
      count += 1 if i!=0               && strs[i-1][j]   == '#'
      count += 1 if i!=0 &&  j < w-1   && strs[i-1][j+1] == '#'
      count += 1 if          j!=0      && strs[i][j-1]   == '#'
      count += 1 if          j < w-1   && strs[i][j+1]   == '#'
      count += 1 if i < h-1 && j!= 0   && strs[i+1][j-1] == '#'
      count += 1 if i < h-1            && strs[i+1][j]   == '#'
      count += 1 if i < h-1 && j < w-1 && strs[i+1][j+1] == '#'
      res[i][j] = count
    end
  end
end

res.each{ |line| puts line.join }

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll dp[200002],a[200002];
ll INF=1000100010001000100;
int main(){
    int n,m;
    ll k;
    cin>>n>>m>>k;
    rep(i,n) cin>>a[i+1];
    rep(i,n+1) dp[i]=INF;
    dp[0]=0;
    rep(i,n){
        ll mx=0,mn=INF;
        for(int j=1;j+i<=min(n,m+i);++j){
            mn=min(mn,a[j+i]);
            mx=max(mx,a[i+j]);
            dp[i+j]=min(dp[i+j],dp[i]+k+(mx-mn)*j);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 3452
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define ll long long
using namespace std;

vector<ll> nums;
string buf = "";

void gen(int i, int d) {
    if (d < 0 || d > 9 || (!buf.empty() && stoll(buf) > 314159265358))
        return;
    // good digits pass
    if ((d == 0 && buf.size()) || d != 0)
        nums.push_back(stoll(buf));
    if (buf.empty()) {
        for (int j = 1; j <= 9; ++j) {
            buf.push_back(char(j + '0'));
            gen(i + 1, j);
            buf.pop_back();
        }
    } else {
        for (int j = max(0, d - 1); j <= min(9, d + 1); ++j) {
//            if (buf == "0" && j == 0) continue;
            buf.push_back(char(j + '0'));
            gen(i + 1, j);
            buf.pop_back();
        }
    }
}

void solve() {
    int k;
    gen(0, 0);
    sort(nums.begin(), nums.end());
    cin >> k;
    cout << nums[k - 1] << endl;
}

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


Measured memory_bytes: 10604
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n-2):
    for j in range(i+1, (n-1+i)//2+1):
        k = 2*j-i
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1
print(ans)

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

int main(){
  int n, l;
  cin >> n >> l;
  int ans = 0;
  for(int i=l; i<l+n; ++i){
    if(l+n-1 < 0 && i == l+n-1) continue;
    if(l > 0 && i == l) continue;
    ans += i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
vector<int> row[2020],col[2020];
char grid[2020][2020];
int main()
{
	int H,W;
	cin>>H>>W;
	for(int i=0;i<W;i++)
		col[i].push_back(-1);
	for(int i=0;i<H;i++)
	{
		row[i].push_back(-1);
		for(int j=0;j<W;j++)
		{
			cin>>grid[i][j];
			if(grid[i][j]=='#')
				row[i].push_back(j),
				col[j].push_back(i);
		}
		row[i].push_back(W);
	}
	for(int i=0;i<W;i++)
		col[i].push_back(H);
	int ans=0;
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			if(grid[i][j]=='.')
			{
				int r=*lower_bound(row[i].begin(),row[i].end(),j)-*(lower_bound(row[i].begin(),row[i].end(),j)-1)-1;
				int c=*lower_bound(col[j].begin(),col[j].end(),i)-*(lower_bound(col[j].begin(),col[j].end(),i)-1)-1;
				ans=max(ans,r+c-1);
			}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    vector<int> a(3);
    int k;
    
    for(int i=0; i<3; i++){
        cin >> a[i];
    }
    cin >> k;
    
    if(k<=a[0])
        cout << k << endl;
    else if(k<=a[0]+a[1])
        cout << a[0] << endl;
    else
        cout << 2*a[0] + a[1] - k << endl;
    
    return 0;
}


Measured memory_bytes: 3584
N = int(input())
L = list(map(int,input().split()))
L.sort()
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        h_min = j
        h_max = N
        while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
        cnt += h_min - j
print(cnt)

Measured memory_bytes: 73584
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define R cin>>
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

string s;
int p;

int dfs() {
  int ans=0;
  vector<int> v;
  while(s[p]=='[') {
    p++;
    int x=dfs();
    v.pb(x);
  }
  if(s[p]==']') p++;
  if(v.size()) {
    sort(all(v));
    int ans=0;
    rep(i,v.size()/2+1) ans+=v[i];
    return ans;
  }
  while(isdigit(s[p])) {
    ans*=10;
    ans+=s[p++]-'0';
  }
  p++;
  return ans/2+1;
}

int main() {
  int T;
  R T;
  while(T--) {
    R s;
    p=0;
    pr(dfs());
  }
  return 0;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define int long long
const int MOD = 1e9 + 7;
using namespace std;
void solve() {
    int d,t,s;
    cin>>d>>t>>s;
    if(((double)d/s)<=t) cout<<"Yes"<<"\n";
    else cout<<"No"<<"\n";

}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  #ifdef LOCAL_DEFINE
  freopen ("input.txt", "r", stdin);
  freopen ("output.txt", "w", stdout);
  #endif 
  int n;  cin >> n;
  vector <double> dp (n + 1);
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    double p_heads;
    cin >> p_heads;
    for (int j = i + 1; j >= 0; --j) {
      dp[j] = (j == 0 ? 0 : dp[j - 1] * p_heads) + dp[j] * (1 - p_heads);
    }
  }
  double ans = 0;
  for (int heads = 0; heads <= n; ++heads) {
    int tails = n - heads;
    if (tails < heads) {
      ans += dp[heads];
    }
  }
  cout << fixed << setprecision (10) << ans; 
}

Measured memory_bytes: 384
int main(int argc,const char * argv[])
{
    int i,n,a[101];
    
    scanf("%d", &n);
    for (i=0;i<n;i++) {
        scanf("%d", &a[i]);
    }
    
    for (i=n-1;i>=1;i--) {
        printf("%d ", a[i]);
    }
    printf("%d\n", a[0]);
    return 0;
}


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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    ll N,M,K;
    cin >> N >> M >> K;
    vector<ll> A,B;

    A.push_back(0);
    B.push_back(0);

    rep(i,N) {
        ll a;
        cin >> a;
        A.push_back(A[i]+a);
    }
    rep(i,M){
        ll b;
        cin >> b;
        B.push_back(B[i]+b);
    }
    ll amax = upper_bound(A.begin(),A.end(),K) -A.begin();
    amax--;
    ll ans = 0;
    for (ll idxa = amax; idxa>=0; idxa--) {
        ll res = K-A[idxa];
        ll idxb = upper_bound(B.begin(),B.end(),res) - B.begin();
        idxb--;
        ans = max(ans, idxa+idxb);
    }
    cout << ans << endl;
}

Measured memory_bytes: 7964
h = gets.chomp.to_i
w = gets.chomp.to_i
n = gets.chomp.to_i
if h>=w then
  print n/h if n%h == 0
  print n/h+1 if n%h != 0
else
  print n/w if n%w == 0
  print n/w+1 if n%w != 0
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int inf=1000001000;
ll INF=1e18;
ll mod=1000000007;
ll MOD=INF;


int main() {
    int x;
    cin >> x;
    x=1-x;
    cout << x << endl;
}


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

int main() {
	int n, w; cin >> n >> w;
	vector<int>wg(n), vl(n);
	for (int i = 0; i < n; i++) {
		cin >> wg[i] >> vl[i];
	}
	long long x = wg[0];
	for (auto&& xx : wg)xx -= x;

	vector<vector<vector<long long>>>dp(n + 1, vector<vector<long long>>(200, vector<long long>(n + 1, 0)));
	for (int i = 0; i < n; i++)for (int j = 0; j < 200; j++)for (int k = 0; k < i + 1; k++) {
		dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
		if (j >= wg[i])dp[i + 1][j][k + 1] = max(dp[i + 1][j][k + 1], dp[i][j - wg[i]][k] + vl[i]);
	}
	long long ans = 0;
	for (int i = 0; i < 200; i++)for (int j = 0; j < n + 1; j++) {
		if (i + j * x <= w) {
			ans = max(ans, dp[n][i][j]);
		}
	}
	cout << ans << endl;

	return 0;
}

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

const int M = 15;
int mx[M][M];
int n;

int main () {
    while (scanf("%d", &n) == 1) {
        memset(mx, -1, sizeof(mx));
        for (int i = 0; i < n; i++) {
            int m;
            scanf("%d", &m);
            while (m--) {
                int x, y;
                scanf("%d %d", &x, &y);
                x--;
                mx[i][x] = y;
            }
        }
        int res = 0;
        for (int b = 0; b < (1 << n); b++) {
            int nb = 0;
            for (int ib = 0; ib < n; ib++)
                if (b >> ib & 1) nb++;

            int isValid = 1;
            for (int ib = 0; ib < n; ib++)
                if (b >> ib & 1) 
                    for (int jb = 0; jb < n; jb++)
                        if (mx[ib][jb] != -1)
                            isValid &= mx[ib][jb] == (b >> jb & 1);

            if (isValid) res = max(res, nb);
        }
        printf("%d\n", res);
    } 
    return 0;    
}



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

using namespace std;

#define ll long long


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

    int a;
    cin >> a;
    
    int n;
    cin >> n;
    
    ll sum = 0;
    
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sum += x;
    }
    
    cout << (sum >= a ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256