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

using namespace std;

int a[512][512];

inline int getSum(int h1, int w1, int h2, int w2)
{
    return (a[h2][w2] - (h1 ? a[h1 - 1][w2] : 0) - (w1 ? a[h2][w1 - 1] : 0) + (h1 && w1 ? a[h1 - 1][w1 - 1] : 0));
}

int main()
{
    int n;
    
    scanf("%d", &n);
    
    int ans = -1001;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            scanf("%d", &a[i][j]);
            if (i) a[i][j] += a[i - 1][j];
            if (j) a[i][j] += a[i][j - 1];
            if (i && j) a[i][j] -= a[i - 1][j - 1];
        }
    }
    
    for (int h1 = 0; h1 < n; h1++){
        for (int h2 = h1; h2 < n; h2++){
            int pmax = 0;
            for (int w = 0; w < n; w++){
                int tmp = getSum(h1, w, h2, w);
                ans = max(ans, tmp + pmax);
                pmax = max(pmax + getSum(h1, w, h1, w) + (h2 != h1 ? getSum(h2, w, h2, w) : 0), tmp);
            }
        }
    }
    
    printf("%d\n", ans);
    
    return (0);
}

Measured memory_bytes: 1788
fn main() {
    let k: i32 = read();
    let s: i32 = read();

    let mut ans = 0;
    for a in 0..k + 1 {
        for b in 0..k + 1 {
            let c = s - (a + b);
            if c >= 0 && c <= k {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .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")
}


Measured memory_bytes: 4352
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

const int MAX = 200010;//設定して

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

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

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

  ll n;cin>>n;
  V<ll> v(n);rep(i,0,n)cin>>v[i];
  ll emp=1,sta=0,ans=1,pre=0;

  rep(i,0,n){
    emp+=v[i]-pre-1;
    sta++;
    if(i==n-1){
      ans*=fac[sta];
      ans%=mod;
    }else if(emp+1==sta){
      ans*=sta;
      ans%=mod;
      emp++;
      sta--;
    }
    pre=v[i];
    cerr<<ans<<ENDL;
  }

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 5760
#include <stdio.h>
#include<math.h>
#include <string.h>
#include <ctype.h>

int main(){
char x,y;
int a[3],f;
a[0]=1;
a[1]=0;
a[2]=0;
while(scanf("%c,%c",&x,&y)!=EOF){
if(x=='A'&&y=='B'){
f=a[0];
a[0]=a[1];
a[1]=f;
}
else if(x=='B'&&y=='A'){
f=a[0];
a[0]=a[1];
a[1]=f;
}
else if(x=='A'&&y=='C'){
f=a[0];
a[0]=a[2];
a[2]=f;
}
else if(x=='C'&&y=='A'){
f=a[0];
a[0]=a[2];
a[2]=f;
}
else if(x=='B'&&y=='C'){
f=a[1];
a[1]=a[2];
a[2]=f;
}
else if(x=='C'&&y=='B'){
f=a[1];
a[1]=a[2];
a[2]=f;
}
}
for(f=0;f<3;f++){
if(a[f]!=0){
if(f==0){
printf("A\n");
}
else if(f==1){
printf("B\n");
}
else if(f==2){
printf("C\n");
}
}
}
return 0;
}

Measured memory_bytes: 952
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define bug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i)   
const int mod = 1e9+7;
const int mod1 = 998244353;
const int nax = 3005;
const int inf = 5e18;
int dp[nax][nax][4],grid[nax][nax],r,c,k,R,C,v;
int calc(int y,int x,int streak_y)
 {
  if(y>r || x>c)
     return 0;
  if(dp[y][x][streak_y] == -1)
     {
      int now = 0;
      now = max(now,calc(y+1,x,0));
      now = max(now,calc(y,x+1,streak_y)); 
      if(grid[y][x] != 0 && streak_y<3)
         {
          now = max(now,grid[y][x] + calc(y+1,x,0));
          now = max(now,grid[y][x] + calc(y,x+1,streak_y+1));
         }
      dp[y][x][streak_y]= now;
     }
  return dp[y][x][streak_y];
 }
void solve()
 {
  cin>>r>>c>>k;
  memset(dp,-1,sizeof dp);
  loop(i,0,k)
   {
    cin>>R>>C>>v;
    grid[R][C] = v;
   }
  int ans = calc(1,1,0);
  cout<<ans;
 }
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
     solve();
 // cerr<<END<<1.0*clock()/CLOCKS_PER_SEC;
  return 0;
} 

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

#define pb push_back
const int N = 2111;

vector <int> e[N];

int dfs(int x, int l, int p) {
	if(l == 0) return 1;
	int r = 1;
	for(int i : e[x]) if(i != p)
		r += dfs(i, l - 1, x);
	return r;
}

int main() {
	ios :: sync_with_stdio(0);
	int n, k; cin >> n >> k;
	for(int i = 1; i < n; i ++) {
		int u, v; cin >> u >> v;
		e[u].pb(v); e[v].pb(u);
	}
	int ans = n;
	if(k & 1)
		for(int i = 1; i <= n; i ++)
			for(int j : e[i])
				ans = min(ans, n - dfs(i, k / 2, j) - dfs(j, k / 2, i));
	else
		for(int i = 1; i <= n; i ++)
			ans = min(ans, n - dfs(i, k / 2, 0));
	cout << ans << '\n';
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
ll d[305][305] ;
ll a[610][305] ;
ll b[610][305] ;
ll aa[610] ;
ll bb[610] ;
 int main(){
  ll h, w ; cin>>h>>w ;
 rep(i,610){
   rep(j,305){
     a[i][j]=0 ;
     b[i][j]=0 ;
   }
 }
  rep(i,h){
    rep(j,w){
    char ww ; cin>>ww ;
     if(ww=='#'){
        d[i][j]=1 ;
       ll ee= j-i+305 ;
       ll ff= i+j ;
       rep2(v,i,303) {
         a[ee][v+1]++ ; //vika
         
       }
       rep2(v,i,303) {
         b[ff][v+1]++ ;
         
       }
     } 
     else d[i][j]=0  ;
    }
  }
  rep(i,610){
    aa[i]=a[i][304] ;
    bb[i]=b[i][304] ;
    
  }
  ll ans=0 ;
  rep(i,h){
    rep(j,w){
      if(d[i][j]==1){
        ll now= j-i ;
        ll mow= i+j ;
        rep(r,i){
          // r min i max
          if(r+now>=0&& r+now< w &&d[r][r+now]==1){ 
            ll x= now+2*i-2*r+305 ;
            ll y= now-2*i+2*r+305 ;
            
           if(0<=x && x< 610) ans+= a[x][r+1]-a[x][max(0ll,2*r-i)] ;
           if(0<=y && y<610) ans+= a[y][min(303ll,2*i-r+1)] -a[y][i];
          }
          //cout<<i<<" "<<j<<" "<<ans<<endl ;
          if(0<=mow-r && mow-r <w &&d[r][mow-r]==1){
          ll z= mow+2*i-2*r ;
          ll w= mow-2*i+2*r ;
          if(0<=z && z<610) ans+=b[z][min(303ll,2*i-r+1)] -b[z][i];
          if(0<=w && w<610) ans+=b[w][r+1]-b[w][max(0ll,2*r-i)] ;
          }
          
        }
        //cout<<i<<" "<<j<<" "<<ans<<endl ;
      }
    }
  }
  
  ///
  ll rest = 0 ;
  rep(i,h){
   rep(j,w){
     if(d[i][j]==0 ) continue ;
     rep2(u,j+1,w-1){
       if(d[i][u]==0) continue;
       ll g= (u-j)/2 ;
       if((u-j)%2==0 ){
         if(i-g>=0&& d[i-g][(j+u)/2]==1) rest++ ;
         if(i+g<h&& d[i+g][(j+u)/2]==1) rest++ ;
       }
     }
   //////
    rep2(u,i+1,h-1){
      if(d[u][j]==0) continue ;
      ll g= (u-i)/2 ;
      if((u-i)%2==0){
        if(j-g>=0 && d[(u+i)/2][j-g]==1) rest++ ;
        if(j+g<w && d[(u+i)/2][j+g]==1) rest++  ;
      }
    }
    //
   }
  }
  //cout<< ans<<endl ;
  cout<<ans-rest<<endl ;

  return 0 ;
}


/*
4 4
####
####
####
####
*/

Measured memory_bytes: 7240
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--;
    b--;
    c--;
    d--;
    string line;
    cin >> line;

    bool has_two_rock = false;
    for (int i = a; i <= max(c, d) - 1; i++)
    {
        if (line[i] == '#' && line[i + 1] == '#')
        {
            has_two_rock = true;
        }
    }

    bool has_three_empty = false;
    for (int i = b - 1; i <= d - 1; i++)
    {
        if (line[i] == '.' && line[i + 1] == '.' && line[i + 2] == '.')
        {
            has_three_empty = true;
        }
    }

    if (!has_two_rock && (c < d || has_three_empty))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 640
from collections import Counter

N=int(input())
S=[]
for i in range (N):
	S.append(input())

M=Counter(S)
X=max(M.values())
tmp=[]
for i,j in M.items():
	if j==X:
		tmp.append(i)
ans=sorted(tmp)
for i in range(len(ans)):
	print(ans[i])

Measured memory_bytes: 35572
function Main(input) {
    input = input.trim().split('\n');
    let robj = {
        ac: 0,
        wa: 0,
        tle: 0,
        re: 0
    };
    for(let i=1; i<=parseInt(input[0], 10); i++) {
        switch(input[i]) {
            case 'AC':
                robj.ac += 1;
                break;
            case 'WA':
                robj.wa += 1;
                break;
            case 'TLE':
                robj.tle += 1;
                break;
            case 'RE':
                robj.re += 1;
                break;
        }
    }
    console.log(`AC x ${robj.ac}
WA x ${robj.wa}
TLE x ${robj.tle}
RE x ${robj.re}`);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 37296
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author rahdirigs
 */

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

template <typename T> void add(T& a, T b, int mod) {
	a += b;
	if (a >= mod)
		a -= mod;
}

const int mod = 1e9 + 7;

class TaskO {
public:
	int N;
	vector<vector<int>> a;
	vector<vector<ll>> dp;

	void solve(std::istream& in, std::ostream& out) {
		in >> N;
		a.resize(N, vector<int> (N));
		dp.resize(N, vector<ll> (1 << N, -1));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				in >> a[i][j];
			}
		}
		ll ans = rec(0, (1 << N) - 1);
		out << ans;
	}

	ll rec(int m, int w) {
		if (m == N) {
			if (w == 0) return 1;
			return 0;
		}
		if (dp[m][w] != -1) return dp[m][w];
		ll tot = 0;
		for (int i = 0; i < N; i++) {
			int woman = 1 << i;
			bool yes = false;
			if (woman & w) yes = true;
			if (yes && a[m][i]) add(tot, rec(m + 1, w ^ woman), mod);
		}
		return dp[m][w] = tot;
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	TaskO solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 363812
def solve():
    n = int(input())
    H = list(map(int, input().split()))
    ans = cnt = 0
    for i in range(n - 1):
        if H[i] >= H[i + 1]:
            cnt += 1
        else:
            ans = max(ans, cnt)
            cnt = 0
    print(max(ans, cnt))
solve()


Measured memory_bytes: 14228
import sys
import math
import bisect

def main():
    a, b = map(int, input().split())
    if a == 1:
        a = 14
    if b == 1:
        b = 14
    if a > b:
        print('Alice')
    elif a < b:
        print('Bob')
    else:
        print('Draw')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x; cin >> x;
    if(x < 600) cout << 8 << endl;
    else if(x < 800) cout << 7 << endl;
    else if(x < 1000) cout << 6 << endl;
    else if(x < 1200) cout << 5 << endl;
    else if(x < 1400) cout << 4 << endl;
    else if(x < 1600) cout << 3 << endl;
    else if(x < 1800) cout << 2 << endl;
    else if(x < 2000) cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3636
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

def main():
    n, k = li()
    MOD = 10**9 + 7
    g = [[] for _ in range(n+1)]

    for i in range(n-1):
        a, b = li()
        g[a].append(b)
        g[b].append(a)

    s = 1
    que = deque([s])
    ans = k
    qapp = que.append
    searched = [0]*(n+1)
    searched[s] = 1
    qpop = que.popleft
    cand = k-1

    while len(que):
        temp = 1
        v = qpop()

        for i in g[v]:
            if searched[i]:
                continue

            searched[i] = 1
            temp = temp * cand % MOD
            cand -= 1
            qapp(i)

        ans = ans * temp % MOD
        cand = k - 2

    print(ans % MOD)

if __name__ == "__main__":
    main()

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

int main(){
  string s,t;  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

using namespace std;
typedef long long lint;

const int MOD = 1000000007;
const int INF = 1 << 29;
const double EPS = 1e-9;

class coor {
public:
	int x, y;
};

int main() {

	cin.tie(0);

	int N, M;
	cin >> N >> M;

	vector<coor> student(N), chk_pnt(M);
	FOR(i, 0, N) cin >> student[i].x >> student[i].y;
	FOR(i, 0, M) cin >> chk_pnt[i].x >> chk_pnt[i].y;


	FOR(i, 0, N){

		coor min;
		int dist;
		min.x = INF;

		FOR(j, 0, M) {

			dist = abs(student[i].x - chk_pnt[j].x) + abs(student[i].y - chk_pnt[j].y);
			if (min.x > dist) {
			
				min.x = dist;
				min.y = j + 1;
			}
		}

		cout << min.y << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ctime>
#define ESP 1e-10
using namespace std;
int main() {
	while (true) {
		int H, W; cin >> H >> W;
		if (H == 0 && W == 0) {
			for (int i = 0; i < 100000000; i++) { int j = i; }
			break;
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W;j++) {
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}


}

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

int main() {
  int N =3;
  vector<int> vec(N);

  for (int i=0; i<N; i++) cin >> vec.at(i);

  std::sort(vec.begin(), vec.end());

  if (vec.at(0)+vec.at(1) == vec.at(2))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;
const int N = 123, K = 2e9 + 1 , L = 3e5;

int n, k, m;
string s;
int pr[N];
int sf[N];
char a[N][N];
main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int s , t;
	cin >> s >> t;
	for(int i = 1 ;i <= 50 ; i++)
		for(int j = 1; j <= 100; j++)
			a[i][j] = '.';
	for(int i = 51 ;i <= 100 ; i++)
		for(int j = 1; j <= 100; j++)
			a[i][j] = '#';
	s-- , t--;
	for(int i = 52 ; i <= 100 ; i++){
		for(int j = 2; j <= 99; j++){
			bool ok = 1;
			if(s == 0)	
				break;
			for(int x = i - 1; x <= i + 1; x++)
				for(int y = j - 1; y <= j + 1; y++)
					if(a[x][y] == '.')
						ok = 0;
			if(ok)
				a[i][j] = '.' , s--;
        }
	}
	for(int i = 1 ; i <= 49 ; i++){
		for(int j = 2; j <= 99; j++){
			bool ok = 1;
			if(t == 0)	
				break;
			for(int x = i - 1; x <= i + 1; x++)
				for(int y = j - 1; y <= j + 1; y++)
					if(a[x][y] == '#')
						ok = 0;
			if(ok)
				a[i][j] = '#' , t--;
        }
	}
//	cerr << s << ' ' << t << '\n';
	cout << "100 100\n";
	rep(i , 1, 100){
		rep(j , 1 , 100)
			cout << a[i][j];
		cout << '\n';
	}
			
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI acos(-1)
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cerr<<x<<endl;
#define endl "\n"
#define pb push_back
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int nmax=1e5+10;
const int eps=1e-8;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(10);
    //cout<<fixed;
    //cout.tie(NULL);
    int n;
    cin>>n;

    cout<<n*n*n<<endl;




    return 0;
}


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

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

  	if (N % 2 == 0) cout << N / 2 << endl;
    else cout << N / 2 + 1 << endl;

}


Measured memory_bytes: 256
/* Problem Description:

*/

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;

#define REP(i,a,b) for (int i = (a); i < (b); i++)
#define RREP(i,a,b) for (int i = (a); i > (b); i--)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define TRvi(it, c) for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define inf 0x3f3f3f3f
#define EPS 1e-10
#define PI acos(-1.0)
#define scan(x) scanf("%d",x)
#define ll long long
#define mp make_pair
#define pb push_back
#define sqr(x) ((x)*(x))
#define LSOne(x) x&(-x)
#define debug(x) cout << #x << " " << x << endl;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
   //  freopen("in" , "r" , stdin);
   //  freopen("out" , "w" , stdout);
    #endif
    int n;
    cin >> n;
    int val;
    vector< vector<int> > dp(n+1, vector<int> (3, -inf));
    dp[0][0] = 0, dp[0][1] = 0, dp[0][2] = 0;
    for (int i = 1; i <= n; i++){
      for (int j = 0; j < 3; j++){
        cin >> val;
        for (int k = 0; k < 3; k++){
          if (j != k)
            dp[i][j] = max(dp[i][j], val + dp[i-1][k]);
        }
      }
    }

    cout << max(max(dp[n][0],dp[n][1]), dp[n][2]);
    return 0;
 }


Measured memory_bytes: 5760
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define F0R(i, a) for (int i=0; i<(a); i++)
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

/*2≤N≤10
1≤D≤10
−20≤Xij≤20*/
/// as the ranges are small at max dist can be 10*1600:16000 sqrt=127.

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

    vi squares;
    FOR(i,0,228){
      squares.pb(i*i);
    }

   int n,d;
   cin>>n>>d;
   int arr[n][d];
   FOR(i, 0,n){
      FOR(j,0, d){
          cin>>arr[i][j];
      }
    }
     int ans=0;
     FOR(i,0,n)
     {
         FOR(j,i+1,n)
         {  int dis=0;
             FOR(k,0,d)
             {
                 dis+=(arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
             }
             FOR(k,0,228)
             {
                 if(dis==squares[k])
                    ans++;
             }

         }
     }
     cout<<ans<<endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
ll pown(ll fi,ll se){
  ll ans=1;
  rep(i,se){
    ans*=fi;
  }
  return ans;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}

/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
ll x,y,z;
cin>>x>>y>>z;
ll k;
cin>>k;
vec(a,x);
vec(b,y);
vec(c,z);
a=getv<ll>(x);
b=getv<ll>(y);
c=getv<ll>(z);
vec(d,0);
rep(i,x){
  rep(j,y){
    d.push_back(a[i]+b[j]);
  }
}
sort(all(d));
sort(all(c));
vec(ans,0);
ll cnt=0;
for(int i=0;i<=k-1&&i<=(x*y-1);i++){
  for(int j=0;j<=k-1&&j<=z-1;j++){
    ans.push_back(d[d.size()-1-i]+c[c.size()-1-j]);
    cnt++;
  }
}
sort(all(ans));
rep(i,k){
  op(ans[ans.size()-1-i]);
}
return 0;
}

Measured memory_bytes: 43272
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    else:

        if w % 2 == 0:  # wが偶数のとき
            a = "#." * (w // 2) + "#"
        else:  # wが奇数のとき
            a = "#." * (w // 2) + "#."

        b = a[:-1]
        c = a[1:]

        for i in range(h // 2):
            print(b)
            print(c)

        if h % 2 != 0:  # hが奇数のとき
            print(b)

        print("")


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

int N, M;
int MAX = 1010;
vector<vector<int>>  D(MAX, vector<int>(MAX));
vector<vector<char>> S(MAX, vector<char>(MAX));
vector<int> dx = { 0, 1,  0, -1 };
vector<int> dy = { 1, 0, -1,  0 };
queue<pair<int, int>> Q;

int main()
{
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> S.at(i).at(j);
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (S.at(i).at(j) == '#') {
				Q.push({ i,j });
			}
		}
	}

	int ans = 0;
	while (!Q.empty()) {
		int x, y;
		tie(x, y) = Q.front();
		Q.pop();
		int d = D.at(x).at(y);
		ans = d;
		for (int k = 0; k < 4; k++) {
			int px = x + dx.at(k);
			int py = y + dy.at(k);
			if (px < 0 || px >= N || py < 0 || py >= M) continue;
			if (S.at(px).at(py) == '.') {
				Q.push({ px,py });
				S.at(px).at(py) = '#';
				D.at(px).at(py) = d + 1;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 13456
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int x, y;
  cin >> x >> y;

  if (y % 2 == 0 && y >= 2 * x && y <= 4 * x) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 3636
#!/usr/bin/perl

( my $n = <STDIN> ) =~ s/[\x00-\x20]+$//io;

if( length($n) > 1 and $n !~ /^\d9+$/o ){
  $n =~ /^\d/;
  my $d1 = $&;
  my $d2 = $';
  $n = ( $d1 - 1 ) . ('9' x length($d2));
}
my @a = split('',$n);
my $tot = 0;
$tot += $_ foreach @a;
print "$tot\n";

exit(0);


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  int n,m;
  cin >> n;
  int a[n-1];
  REP(i, n-1) {
    cin>>a[i];
  }

  map<int,int> umap;

  for(int i=1;i<=n;i++){
    umap[i] = 0;
  }

  //   for(auto i : umap){
  //   cout<<i.first<<" "<<i.second<<"\n";
  // }


  cout<<"\n\n\n\n";  

  for(int i=0;i<n-1;i++){
    umap[a[i]]++;
  }

  for(int i= 1;i<=n;i++){
    cout<<umap[i]<<"\n";
  }
  
  


  
  return 0;
}


Measured memory_bytes: 13720
#include<stdio.h>

int main(void){
    int n, x, count;
    scanf("%d %d", &n, &x);
    while(n!=0 || x!=0){
        count = 0;
        for(int i=1; i<=n-2; i++){
            for(int j=i+1; j<=n-1; j++){
                for(int k=j+1; k<=n; k++){
                    count += (i+k+j)==x;
                }
            }
        }
        printf("%d\n", count);
        scanf("%d %d", &n, &x);
    }
}



Measured memory_bytes: 2100
MOD=10**9+7
class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self//value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__())


N = int(input())
A = sorted(map(int, input().split()))
ans = Fp(1)
if N & 1:
    if all(a == (i + 1) // 2 * 2 for i, a in enumerate(A)):
        for i in range(N//2):
            ans *= 2
    else:
        ans = 0
else:
    if all(a == i // 2 * 2 + 1 for i, a in enumerate(A)):
        for i in range(N//2):
            ans *= 2
    else:
        ans = 0
print(ans)

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n;
  cin>>n;
  Int cnt=0;
  for(Int i=0;i<n;i++){
    Int a,b;
    cin>>a>>b;
    if(a==b) cnt++;
    else cnt=0;
    if(cnt==3) drop("Yes");
  }
  drop("No");
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n = 0;
  cin >> n;
  string s;
  int flag = 0;
  for(int i = 0; i < n; i++){
    cin >> s;
    if(s == "Y"){
      flag = 1;
      break;
    }
  }
  if(flag == 0){
    cout << "Three";
  }else{
    cout << "Four";
  }
}
    
    

Measured memory_bytes: 256
N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

A = set(A)
dp = [0] * (N+1)
dp[0] = 1
if 1 in A:
  dp[1] = 0
else:
  dp[1] = 1
mod = 1000000007

for i in range(2,N+1):
  if (dp[i-1] == 0) & (dp[i-2]==0):
    print(0)
    exit()
  elif i in A:
    continue
  else:
    dp[i] = dp[i-1]+dp[i-2]

print(dp[N]%mod)


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

int main(){
  int N, K, l[50];
  cin >> N >> K;
  for (int i=0;i<N;i++) cin >> l[i];
  sort(l, l+N, greater<int>());

  int sum=0;
  for (int i=0;i<K;i++) sum += l[i];

  cout << sum << endl;
}

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

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int K = int.Parse(Console.ReadLine());
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int A = intArray[0];
            int B = intArray[1];
            for(int i = A; i <= B; i++)
            {
                if(i % K == 0)
                {
                    Console.WriteLine("OK");
                    return;
                }
            }
            Console.WriteLine("NG");
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28260
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using ll = int64_t;

int main() {
  int n;
  cin>>n;
  int mx = 0;
  int cnt = 0;
  REP(i,n) {
    int h;
    cin>>h;
    if (h >= mx) {
      ++cnt;
      mx = h;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

int main(){
   vector<int> v;
   v.clear();
   int a;
   
   for(int i=0; i<10; i++){
      cin >> a;
      v.push_back(a);
   }
   
   sort(v.begin(), v.end());
   
   cout << v[9] << endl; 
   cout << v[8] << endl;
   cout << v[7] << endl;
  
   return 0;
}

Measured memory_bytes: 1220
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
//const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll n;
vector<ll> a;
int main(void){
    cin >> n;
    a.resize(n + 1);
    rep(i, n + 1) cin >> a[i];
    bool ok = true;
    if(n == 0){
        if(a[0] != 1){
            cout << -1 << endl;
        } else {
            cout << 1 << endl;
        }
        return 0;
    } else {
        if(a[0] != 0){
            ok = false;
        }
    }
    if(!ok){
        cout << -1 << endl;
        return 0;
    }
    vector<ll> sum(n + 2, 0);
    for(int i = 0; i <= n; i++){
        sum[i + 1] = a[i] + sum[i];
    }
    ll last = a[n];
    ll now = 1;
    ll ans = 1;
    for(ll i = 1; i <= n; i++){
        //cout << now << endl;
        if(now * 2 < a[i]){
            ok = false;
            break;
        }
        ll rest = sum[n + 1] - sum[i];
        ll tmp = now * 2;
        //cout << tmp << " " << rest << endl;
        now = min(tmp, rest);
        //cout << "plus"<< now << endl;
        ans += now;
        now -= a[i];
        //cout << now << endl;
    }
    if(!ok){
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }

}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;

#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
ld solve(ll b, ld p) {
	ld ans;
	if (b==0) ans=0;
	else ans=b/p;
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cout<<fixed<<setprecision(10);
	ll x,pp; cin>>x>>pp;
	ld p=(ld)pp/100.0;
	ll b=x/2;
	if (x&1) {
		ld ans=solve(1,p)+(solve(b,p));
		cout<<ans<<endl;
	}
	else {
		cout<<solve(b,p)<<endl;
	}
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int main(){

  int M[N][N];
  int n,i,j,nood,next,num;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&nood,&next);
    nood--;
    for(j=0;j<next;j++){
      scanf("%d",&num);
      num--;
      M[nood][num]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
int main() 
{
    string s;
  	cin >> s;
    int ans=0;
  	int x=s.size();

    for(int i=0; i<x/2; i++){
      if(s.at(i) != s.at(x-1-i)){
            ans++;
      }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#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)++)

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s,k="";//入力
	int i = 0, j = 0, d = 0, size,kari = 0, old = 0, flag = 0; //内部で使用;
	int ans = 0; //出力

	cin >> s;
	size = s.size();
	rep(i,size) {
		if (s[0] == '0') k.push_back('0');
		else if (s[0] == '1')k.push_back('1');
		else {
			if (k.size() != 0) {
				k.pop_back();
			}
			else;
		}
		s.erase(0, 1);
	}
	

	cout << k << "\n";
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int W, H, N;
const int MAX_N = 1.0e5 + 10;
int x[MAX_N], y[MAX_N], a[MAX_N];

int main() {
    cin >> W >> H >> N;
    for (int i= 0; i < N; i++) {
        cin >> x[i] >> y[i] >> a[i];
    }

    int x_l = 0;
    int x_r = W;
    int y_l = 0;
    int y_h = H;
    for (int i = 0; i < N; i++) {
        if (a[i] == 1) {
            x_l = max(x_l, x[i]);
        }
        else if (a[i] == 2) {
            x_r = min(x_r, x[i]);
        }
        else if (a[i] == 3) {
            y_l = max(y_l, y[i]);
        }
        else {
            y_h = min(y_h, y[i]);
        }
    }

    if (x_l < x_r && y_l < y_h) {
        cout << (x_r - x_l) * (y_h - y_l) << endl;
    }
    else {
        cout << 0 << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
bool del[NN]={};
bool col[NN]={};
char s[NN]={};
int deg[NN]={};
int cuted=0;
int dp[NN]={};
int maxl[NN]={};
vector<int> p[NN]={};
void cut(int x){
	++cuted;
	del[x]=1;
	deg[x]=0;
	for(int i=0;i<p[x].size();++i){
		int cur=p[x][i];
		--deg[cur];
		if(deg[cur]==1&&col[cur])cut(cur);
	}
}
void calc(int x,int fa){
	if(col[x]){
		dp[x]=-1;
		maxl[x]=-1;
	}
	else{
		dp[x]=-1e9;
		maxl[x]=-1e9;
	}
	int v=(col[x]==0?1:-1);
	for(int i=0;i<p[x].size();++i){
		int cur=p[x][i];
		if(cur==fa||del[cur])continue;
		calc(cur,x);
		dp[x]=max(dp[x],dp[cur]);
		dp[x]=max(dp[x],maxl[cur]+1+maxl[x]);
		maxl[x]=max(maxl[cur]+1+v,maxl[x]);
	}
}
int main(){
	//open();
	n=read();
	for(int i=1;i<n;++i){
		int x=read(),y=read();
		p[x].push_back(y);
		p[y].push_back(x);
		++deg[x];
		++deg[y];
	}
	scanf("%s",s+1);
	for(int i=1;i<=n;++i)col[i]=(s[i]=='B');
	for(int i=1;i<=n;++i){
		if(deg[i]==1&&col[i])cut(i);
	}
	if(cuted==n-1){
		for(int i=1;i<=n;++i)if(!del[i]){
			if(col[i])printf("0\n");
			else printf("1\n");
		}
		return 0;
	}
	int ans=(n-cuted-1)*2;
	for(int i=1;i<=n;++i){
		if(!del[i]){
			for(int j=0;j<p[i].size();++j){
				int cur=p[i][j];
				if(!del[cur])col[i]^=1;
			}
			if(!col[i])++ans;
		}
	}
	for(int i=1;i<=n;++i){
		if(!del[i]){
			calc(i,0);
			ans-=dp[i]+1;
			break;
		}
	}
	printf("%d\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 14080
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<4;i++)
	{
		cout<<s.at(i);
	}
	cout<<" ";
	for(int i=4;i<s.size();i++)
	{
		cout<<s.at(i);
	}
  cout<<"\n";
	return 0;
}

Measured memory_bytes: 3096
#include <stdio.h>
#include <string.h>

int main(void){
	int i,ptr,cont,ans=0;
	char s[100001];
	char t[4][7]={"dream","dreamer","erase","eraser"};
	int len[4]={5,7,5,6};

	scanf("%s",s);

	ptr=strlen(s);

	while(ans==0){
		cont=1;
		for(i=0;i<4 && cont==1;i++){
			if(ptr-len[i]>=0){
				if(strncmp(s+ptr-len[i],t[i],len[i])==0){
					ptr-=len[i];
					if(ptr==0){
						ans=1;
					}
					cont=0;
				}
			}
		}
		if(cont==1){
			ans=-1;
		}
	}

	if(ans==1){
		printf("YES");
	}else if(ans==-1){
		printf("NO");
	}

	return 0;

}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  string s="Yes",t="No";
  
  for(int i=0;k+i<n;i++){
    if(a.at(k+i) > a.at(i))
      cout << s << endl;
    else
      cout << t << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3952
#include <stdio.h>
int main(){
  int n,k;
  scanf("%d",&n);
  for(int i = 3;i <= n;i++){
    int x = i;
    int k = 0;
    if(x%3 == 0){ 
      k = 1;
      printf(" %d",i);
    }   
    while(x > 1 && k == 0){ 
      if(x%10 == 3){ 
        k = 1;
        printf(" %d",i);
      }   
      x /= 10; 
    }   
  }
  printf("\n");
}

Measured memory_bytes: 2728
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    char o[100],e[100];
    scanf("%s",o);
    scanf("%s",e);
    for(int i=0;i<strlen(o);i++){
        if(o[i]==0){
            ;
        }else{
            printf("%c",o[i]);
        }
        if(e[i]==0){
            ;
        }else{
            printf("%c",e[i]);
        }
    }
}


Measured memory_bytes: 1640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long X;
  cin >> X;
  int count = 0;
  long long money = 100;
  for(int i = 0; i < 10000; i++) {
    if(money >= X) {
      break;
    }
    count++;
    money *= 1.01;
  }
  cout << count << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
	//r p s - 0 1 2
	int n,k;cin>>n>>k;
	vector<int >pl(n);
	vector<int >nos(n,0);
	int cost[3];
	cin>>cost[0]>>cost[2]>>cost[1]; //r s p
	string s;
	cin>>s;
	//convert rps
	for(int i=0;i<n;i++){
	    if(s[i]=='r')pl[i]=0;
	    else if(s[i]=='p')pl[i]=1;
	    else pl[i]=2;
	}
	//for first k
	int fin=0;
	for(int i=0;i<k;i++)
	    {fin+=cost[(pl[i]+1)%3];nos[i]=1;}
    //cout<<fin<<'\n';
	int prev;
	for(int i=k;i<n;i++){
	    prev = i-k;
	    //nos[i][(pl[i]+1)%3]=cost[(pl[i]+1)%3];
        if((pl[i]+1)%3!=(pl[prev]+1)%3 || nos[prev]==0){
            fin+=cost[(pl[i]+1)%3];nos[i]=1;
        }
	    //cout<<fin<<'\n';
	}
	cout<<fin;
}

Measured memory_bytes: 4312
// Contest No.: nBC177
// Problem No.: E
// Solver:      Jinmin Goh
// Dnte:        20200829

#include <cstring>
#include <iostream>
#include <cstdlib>
#include <list>
#include <array>
#include <atomic>
#include <algorithm>
#include <deque>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <valarray>
#include <vector>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;

int nums[1000010], check[1000010], check2[1000010];
bool tempList[1000001];
vector<int> prime;

int gcd(int a, int b) {
    if(a < b) {
        swap(a, b);
    }
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

int main() {
    
    tempList[0] = true;
    tempList[1] = true;
    for(int i = 2; i <= 1000000; i++) {
        if(!tempList[i]) {
            prime.push_back(i);
            int cnt = i * 2;
            while(cnt <= 1000000) {
                tempList[cnt] = true;
                cnt += i;
            }
        }
    }
    
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &nums[i]);
    }

    sort(nums, nums + n);

    int gcdVal = nums[0];
    for(int i = 0; i < n; i++) {
        if(gcdVal == 1) {
            break;
        }
        gcdVal = gcd(gcdVal, nums[i]);
        
    }

    if(gcdVal != 1) {
        printf("not coprime");
        return 0;
    }

    for(int i = 0; prime[i] <= 1000; i++)
	{
        for(int j = 0; j < n; j++) {
            if(!(nums[j] % prime[i])) {
                check[prime[i]]++;
                if(check[prime[i]] > 1) {
                    printf("setwise coprime");
                    return 0;
                }
                while(!(nums[j] % prime[i])) {
                    nums[j] /= prime[i];
                }
            }
        }
	}

    for(int i = 0; i < n; i++) check2[nums[i]]++;
	for(int i = 2; i <= 1000000; i++) {
		if(check2[i] > 1) {
			printf("setwise coprime");
			return 0;
		}
	}
	
	printf("pairwise coprime");
    return 0;
}

Measured memory_bytes: 9004