akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  rep(i, n) cin >> a[i];

  double sum = 0;
  rep(i, n) sum += (1/a[i]);
  cout<<setprecision(10)<< (1/sum) <<endl;
}


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

using namespace std;

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

    int i;

    vector<int> a(n);

    long long ans;

    cin >> a[0];
    ans = a[0];

    for (i = 1; i < n; i++)
    {
        cin >> a[i];
        ans = ans ^ a[i];
    }

    int j;

    for (i = 0; i < n; i++)
    {
        cout << (ans ^ a[i]) << " ";
    }
}

Measured memory_bytes: 3884
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード(アルファベット順,bits/stdc++.hは使わない派閥)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


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

    ll num = N%K;
    if(num>K/2)
        num = K-num;

    cout<<num<<endl;

    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

int main(void) {
    Int n;
    cin >> n;
    VI h(n);
    for (Int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    bool result = true;
    for (Int i = n - 2; i >= 0; --i) {
        if (h[i] <= h[i + 1]) {
        } else if (h[i] == h[i + 1] + 1) {
            h[i]--;
        } else {
            result = false;
        }
    }
    if (result) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3988
#include <iostream>

using namespace std;

int main()
{
    int w, h;
    
    do
    {
        cin  >> w >> h;
        
        if(w == 0 && h == 0)
            break;
        
        else
            for(int i = 0; i < w; i++)
            {
                for(int c = 0; c < h; c++)
                    cout << '#';
                    
                cout << endl;
            }
        
        cout << endl;
    }while(true);

    return 0;
}

Measured memory_bytes: 3068
#include<stdio.h>
int main(void){
    char s[11];
    char t[12];
    int i=0, check=0;
    scanf("%s", s);
    scanf("%s", t);
    while(s[i]){
        if(s[i]!=t[i]){
            check=1;
        }
        i++;
    }
    if(check==0){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;

}

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

int main(void)
{

    int N;

    cin >> N;

	int x = N/7;
	bool buy = false;

	for(int i=0; i<=x; i++){
		int Na = N - 7 * i;
			if (Na%4 ==0){
				buy = true;
				break;
			}
	}

	if(buy) {
			printf("Yes");
	} else {
		printf("No");
	}
		
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007

int main(){
    string s;
    cin>>s;
    int n=s.length();
    int L=0;
    int max=0;
    rep(i,n){
        if(s[i]=='A'||s[i]=='G'||s[i]=='T'||s[i]=='C'){
            L++;
        }
        else{
            if(L>=max){
                max=L;
            }
            L=0;
        }
    }
    if(L>=max){
        max=L;
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
c = [[0, 0, 0] for _ in range(3)]
for i in range(3):
    c[i] = list(map(int, input().split()))

for a1 in range(min(c[0])+1):
    b = [c[0][0] - a1, c[0][1] - a1, c[0][2] - a1]
    if c[1][0] - b[0] == c[1][1] - b[1] == c[1][2] - b[2]:
        if c[2][0] - b[0] == c[2][1] - b[1] == c[2][2] - b[2]:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 61656
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 110

int main(){
  int n,a,x[SIZE];
  ll ans[51][51*51] = {};
  
  scanf("%d%d",&n,&a);
  for(int i=0;i<n;i++) scanf("%d",x+i);

  ans[0][0] = 1;

  for(int i=0;i<n;i++){

    for(int k=n-1;k>=0;k--){
      for(int j=n*50;j>=0;j--){
        ans[k+1][j+x[i]] += ans[k][j];
      }
    }
  }

  ll sum = 0;
  
  for(int i=1;i<=n;i++){
    sum += ans[i][i*a];
  }

  printf("%lld\n",sum);
  
  return 0;
}


Measured memory_bytes: 1280
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGreatOceanView solver = new BGreatOceanView();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGreatOceanView {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);
            int[] pre = a.clone();
            int ans = 1;
            for (int i = 1; i < n; ++i) {
                pre[i] = Math.max(pre[i], pre[i - 1]);
                if (pre[i] == a[i]) ++ans;
            }
            out.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n - 1; ++i) {
    int a;
    cin >> a;
    v[a - 1]++;
  }
  for (auto e : v) {
    cout << e << endl;
  }
  return 0;
}


Measured memory_bytes: 4064
// /*
// power code taken from geeks for geeks
// */
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>
#define MAX_SIZE 100000000


using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}


struct p_str{
    ll a, b;
};

void solve(){
    ll h, w;
    cin >> h >> w;
    char a[h][w];
    for(ll i = 0; i < h; i++) {
        for(ll j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }

    ll dp[h][w];
    memset(dp, 0, sizeof(dp));
    for(ll i = 0; i < h; i++) {
        if(a[i][0] == '#') {
            break;
        }
        dp[i][0] = 1;
    }
    for(ll i = 0; i < w; i++) {
        if(a[0][i] == '#') {
            break;
        }
        dp[0][i] = 1;
    }
    for(ll i = 1; i < h; i++) {
        for(ll j = 1; j < w; j++) {
            if(a[i][j] == '#') {
                continue;
            }
            ll t = dp[i-1][j] + dp[i][j-1];
            t = modulo(t);
            dp[i][j] = t;
        }
    }

    ll ans = dp[h - 1][w - 1];
    cout << ans << endl;
}   



int main(){




    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    



    ll t=1;


    // cin>>t;
    


    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 12392
#include<stdio.h>

int main()
{
	int S;
	while (1)
	{
		scanf("%d", &S);
		if (0 <= S&&S <= 86400)
			break;
	}
	printf("%d:%d:%d\n", S / 3600, (S % 3600) / 60, (S % 60));
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll n,sum1=0,sum2=0,ans=1e18;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        sum1 += a[i];
    }
    rep(i,n){
        sum2 += a[i];
        ans = min(ans, abs(sum1 - sum2*2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
	int i,j,N,a[4][13],d;
	char c;
	scanf("%d",&N);
	for(i=0;i<4;i++)for(j=0;j<13;j++)a[i][j]=1;
	for(i=0;i<N;i++){
		getchar();
		scanf("%c %d",&c,&d);
		if(c=='S')a[0][d-1]=0;
		else if(c=='H')a[1][d-1]=0;
		else if(c=='C')a[2][d-1]=0;
		else a[3][d-1]=0;
	}
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(i==0&&a[i][j])printf("S %d\n",j+1);
			else if(i==1&&a[i][j])printf("H %d\n",j+1);
			else if(i==2&&a[i][j])printf("C %d\n",j+1);
			else if(i==3&&a[i][j])printf("D %d\n",j+1);
		}
	}
	return 0;
}

Measured memory_bytes: 600
sa = list(reversed(list(input())))
sb = list(reversed(list(input())))
sc = list(reversed(list(input())))
t = sa.pop()
while True:
    if t == 'a':
        if not sa:
            winner = 'A'
            break
        t = sa.pop()
    elif t == 'b':
        if not sb:
            winner = 'B'
            break
        t = sb.pop()
    else:
        if not sc:
            winner = 'C'
            break
        t = sc.pop()
print(winner)

Measured memory_bytes: 3064
import java.util.Scanner;
class Main
 {
   public static void main(String[] args)
      {
      Scanner S = new Scanner(System.in);
      int a = S.nextInt();
      int b = S.nextInt();
      if(a == b){
      System.out.println("a == b");
              }
      else if (a>b){
      System.out.println("a > b");
                    }
      else {
      System.out.println("a < b");
            }
      }
 }


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

int main() {
  string s,t;
  cin >> s >> t;
  bool a=true;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
      a=false;
    }
  }
  if(a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
const ll p=1000000007;
int main(){
  int n,kk;
  cin >> n >> kk;
  string s;
  cin >> s;
  int ans=0;
  int r=0,l=0;
  int k[n];
  rep(i,n)k[i]=0;
  rep(i,n-1){
    if(s[i]=='1'&&s[i+1]=='0')k[i]=1;
    else if(s[i]!=s[i+1])k[i]=-1;
  }
  int cnt=0;
  if(s[0]=='0')cnt++;
  rep(i,n){
    while(r<n-1){
      if(cnt==kk&&k[r]==1)break;
      if(k[r]==1)cnt++;
      r++;
    }
    ans=max(ans,r-l+1);
    if(k[l]==-1)cnt--;
    l++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	ll n, k, q;
	cin >> n >> k >> q;
	vector<int>answered(q);
	rep(i, q)cin >> answered[i];

	vector<ll>point(n, k - q);
	rep(i, q) {
		point[answered[i] - 1]++;
	}

	rep(i, n) {
		if (0 < point[i]) {
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

    ll ans = 0;
    while (true) {
        ll max_index = max_element(a.begin(), a.end()) - a.begin();
        if (a[max_index] < N) {
            break;
        }

        ll diff = a[max_index] - (N - 1);
        ll num = (diff + N - 1) / N;
        ans += num;
        a[max_index] -= num * N;
        for (ll i = 0; i < N; i++) {
            if (i == max_index) {
                continue;
            }
            a[i] += num;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
char p[101000];
int i, n, C[300];
long long res, Mod = 1000000007;
int main() {
	scanf("%d", &n);
	int pv = 0;
	scanf("%s", p);
	for (i = 0; p[i]; i++) {
		C[p[i]]++;
	}
	long long res = 1;
	for (i = 'a'; i <= 'z'; i++) {
		res = res * (C[i] + 1) % Mod;
	}
	res = (res + Mod - 1) % Mod;
	printf("%lld\n", res);
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = [[] for i in range(9)]
L[2] = [[1, 2], [2, 1]]
for i in range(3, 9):
  for j in range(i):
    for l in L[i-1]:
      k = list(l)
      k.insert(j, i)
      L[i].append(k)
  L[i].sort()
#print(L)
p = L[N].index(P)
q = L[N].index(Q)
print(abs(p-q))

Measured memory_bytes: 10740
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    string CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    ll N; cin >> N;
    string S; cin >> S;
    REP (i, S.size()) {
        cout << CHARS[((ll(S[i])-65)+N) % 26];
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <random>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B, K;
    cin >> A >> B >> K;
    vector<int> v;
    for (int i = A; i < min(A + K, B + 1); ++i) {
        v.emplace_back(i);
    }
    
    for (int i = max(B - K + 1, min(A + K, B + 1)); i < B + 1; ++i) {
        v.emplace_back(i);
    }
    for (auto &i : v) {
        cout << i << endl;
    }
    
    return 0;
}

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

#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);

int main()
{
    int n;
    cin>>n;string s,t;
    cin>>s>>t;
string ans;
    rep(i,n){
	  ans.push_back(s[i]);
	ans.push_back(t[i]);  
    }
    cout<<ans<<endl;
    return 0;
}

/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


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

int main() {
    uint64_t N, K, R, S, P;
    std::string T;
    std::cin >> N >> K >> R >> S >> P >> T;

    uint64_t max = 0;
    std::vector<char> history;
    for (size_t i = 0; i < T.size(); ++i) {
        const char c = T[i];
        if (i < K) {
            if (c == 'r') {
                max += P;
                history.push_back('p');
            } else if (c == 's') {
                max += R;
                history.push_back('r');
            } else if (c == 'p') {
                max += S;
                history.push_back('s');
            }
        } else {
            if (c == 'r') {
                if (history[i-K] == 'p') {
                    if ((i + K) < N  && T[i + K] != 's') {
                        history.push_back('r');
                    } else {
                        history.push_back('s');
                    }

                } else {
                    max += P;
                    history.push_back('p');
                }
            } else if (c == 's') {
                if (history[i-K] == 'r') {
                    if ((i + K) < N  && T[i + K] != 'p') {
                        history.push_back('s');
                    } else {
                        history.push_back('p');
                    }

                } else {
                    max += R;
                    history.push_back('r');
                }
            } else if (c == 'p') {
                if (history[i-K] == 's') {
                    if ((i + K) < N  && T[i + K] != 'r') {
                        history.push_back('p');
                    } else {
                        history.push_back('r');
                    }

                } else {
                    max += S;
                    history.push_back('s');
                }
            }
        }
    }

    std::cout << max << std::endl;
    
    return 0;
}


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

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); 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 pb push_back

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<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

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

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    map<ll, int> mp;
    mp[0] = 1;
    ll sum = 0;
    ll res = 0;
    for (int i = 0; i < N; i++) {
      ll A;
      cin >> A;
      sum += A;
      res += mp[sum];
      ++mp[sum];
    }
    cout << res << endl;
  }
  return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    ll a, b;
    cin >> a >> b;

    if ( a > 0 ) cout << "Positive\n";
    // else if ( b >= 0 or a == 0 ) cout << "Zero\n";
    else if ( b < 0 ) cout << ((b - a + 1) & 1 ? "Negative\n" : "Positive\n");
    else cout << "Zero\n";

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for(int x = 1; x <= n; x += 2) {
        int cnt = 0;
        for(int p = 1; p <= x; ++p) {
            cnt += (x % p == 0);
        }
        ans += cnt == 8;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

/*
n
a1 ... an

n 100
ai 4800

1
400
800
1200
1600
2000
2400
2800
3200 free
 */

int n;
int num[9];

int main(){
  cin >> n;
  REP(i,n){
    int a;
    cin>>a;
    if(a>=3200)
      num[8]++;
    else
      num[a/400]++;
  }

  int n1=0;
  REP(i,8){
    if(num[i] > 0)
      n1++;
  }

  int min_n = n1==0 ? 1 : n1;
  int max_n = n1 + num[8];
  
  cout << min_n << " " << max_n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <array>

int main()
{
  int A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;

  // don't buy C
  int ret_ab = A * X + B * Y;

  // mixture of A, B, C
  int c = std::min(X, Y);
  int a = std::max(0, X - c);
  int b = std::max(0, Y - c);
  int ret_abc = a*A + b*B + 2*c*C;

  // all C
  int ret_c = 2 * std::max(X, Y) * C;

  std::array<int, 3> candidates = {ret_ab, ret_abc, ret_c};
  auto ret = std::min_element(candidates.begin(),
                              candidates.end());

  std::cout << *ret << std::endl;
  return 0;
}


Measured memory_bytes: 3588
module simple;import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto B = N.iota.map!(i => tuple(i, A[i])).array;
    B.sort!"a[1] > b[1]";

    auto rbt = new RedBlackTree!int;
    long ans = 0;

    foreach (i; 0..N) {
        auto idx = B[i][0];
        auto a = B[i][1];
        auto lb1 = rbt.lowerBound(idx);
        auto ub1 = rbt.upperBound(idx);
        auto l1 = lb1.empty ? -1 : lb1.back;
        auto r1 = ub1.empty ? N : ub1.front;
        auto lb2 = rbt.lowerBound(l1);
        auto ub2 = rbt.upperBound(r1);
        auto l2 = lb2.empty ? -1 : lb2.back;
        auto r2 = ub2.empty ? N : ub2.front;

        if (lb1.empty && ub1.empty) {

        } else {
            ans += a * (r2 - r1) * (idx - l1);
            ans += a * (l1 - l2) * (r1 - idx);
        }

        rbt.insert(idx);
    }

    ans.writeln;
}

Measured memory_bytes: 8052
#include <iostream>
#include <string>

using namespace std;

int count = 0;
int N;


//文字列sに3，5，7が一回以上現れるかどうか
bool check(string s){
  bool flag3 = false, flag5 = false, flag7 = false;
  for(int i=0; i<s.size(); i++){
    if(s[i] == '3')
      flag3 = true;
    else if(s[i] == '5')
      flag5 = true;
    else
      flag7 = true;
  }
  //現れていない文字があれば，論理積は0になる
  return (flag3 & flag5 & flag7);
}

void solve(string s){
  //受け取った文字が10桁以上なら終了
   //受け取った文字がNより大きくても終了
  int num = atoi(s.c_str() );
  if( s.size()>=10 || N<num )
    return ;
  else{
    //3，5，7が全部あるかチェック
    if(check(s) )
      count++;
  }
  
  string s1 = s, s2 = s, s3 = s;
  //3，5，7を順に追加して木を作っていく
  s1.push_back('3');
  s2.push_back('5');
  s3.push_back('7');
  solve(s1);
  solve(s2);
  solve(s3);
}


int main(){
  cin >> N;
  //入力終わり

  string S = "";
  solve(S);
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 256
/* 0 -> Top
 * 1 -> S
 * 2 -> E
 * 3 -> W
 * 4 -> N
 * 5 -> Down
 */

#include <iostream>
using namespace std;

int numbers[6];
int tmpNumber;

void changeDirection(int a, int b) {
	if (a == 0) {
		if (b == 1) {
			tmpNumber = numbers[2];
		} else if (b == 2) {
			tmpNumber = numbers[4];
		} else if (b == 4) {
			tmpNumber = numbers[3];
		} else if (b == 3) {
			tmpNumber = numbers[1];
		}
	}
	else if (a == 5) {
		if (b == 1) {
			tmpNumber = numbers[3];
		} else if (b == 3) {
			tmpNumber = numbers[4];
		} else if (b == 4) {
			tmpNumber = numbers[2];
		} else if (b == 2) {
			tmpNumber = numbers[1];
		}
	}

	else if (a == 1) {
		if (b == 0) {
			tmpNumber = numbers[3];
		} else if (b == 3) {
			tmpNumber = numbers[5];
		} else if (b == 5) {
			tmpNumber = numbers[2];
		} else if (b == 2) {
			tmpNumber = numbers[0];
		}
	}
	else if (a == 4) {
		if (b == 0) {
			tmpNumber = numbers[2];
		} else if (b == 2) {
			tmpNumber = numbers[5];
		} else if (b == 5) {
			tmpNumber = numbers[3];
		} else if (b == 3) {
			tmpNumber = numbers[0];
		}
	}

	else if (a == 2) {
		if (b == 1) {
			tmpNumber = numbers[5];
		} else if (b == 5) {
			tmpNumber = numbers[4];
		} else if (b == 4) {
			tmpNumber = numbers[0];
		} else if (b == 0) {
			tmpNumber = numbers[1];
		}
	}
	else if (a == 3) {
		if (b == 1) {
			tmpNumber = numbers[0];
		} else if (b == 0) {
			tmpNumber = numbers[4];
		} else if (b == 4) {
			tmpNumber = numbers[5];
		} else if (b == 5) {
			tmpNumber = numbers[1];
		}
	}
}

int main(int argc, char const* argv[])
{
	for (int i=0; i<6; i++) {
		cin >> numbers[i];
	}

	int questions, a, b;
	cin >> questions;
	for (int i=0; i<questions; i++) {
		cin >> a >> b;
		for (int j=0; j<6; j++) {
			for (int k=0; k<6; k++) {
				if (numbers[j]==a && numbers[k]==b) {
					changeDirection(j, k);
				}
			}
		}
		cout << tmpNumber << endl;
	}
	return 0;
}


Measured memory_bytes: 1160
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      k: usize,
      _a: [usize; n]
   }
   let ans = if n == k { 1 } else { (n - k - 1) / (k - 1) + 2 };
   println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
int main()
{
    int n,i;
    char c[10000],f;
    scanf("%d",&n);
    scanf("%c",&f);
    scanf("%s",&c);

    for(i=0;i<strlen(c);i++)
    {
        int p=c[i];
        if(p+n>=65&&p+n<=90) printf("%c",p+n);
        else
        {
            int q=p+n;
            printf("%c",q-26);
        }
    }

}



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

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < (int)k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

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

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

set<vector<int> > st;
vector<int> p[1000];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i, n) {
    	rep(j, 3) {
    		int a;
    		cin >> a;
    		p[i].push_back(a);
    	}
    	sort(p[i].begin(), p[i].end());
    	st.insert(p[i]);
    }
    cout << n - st.size() << endl;
    return 0;
}

Measured memory_bytes: 3332
X = int(input())

for A in range(-1000, 1000):
  t = A**5-X
  if t>=0:
    t = int(t**0.2)
  else:
    t = int(-(-t)**0.2)
  for B in range(t-1, t+2):
    if A**5-B**5==X:
      print(A, B)
      exit(0)


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

int n, w[300], dp[300][300], dp2[300][300];

int main() {

	while (true) {

		cin >> n;
		if (n == 0)break;

		for (int i = 0; i < n; i++) {
			cin >> w[i];
		}

		for (int i = 0; i < n - 1; i++) {
			if (abs(w[i] - w[i + 1]) <= 1) {
				dp[i][i + 1] = 2;
			}
		}

		for (int i = 3; i < n; i += 2) {//区間の大きさ
			for (int j = 0; j < n - i; j++) {
				//両端の計算
				if (abs(w[j] - w[j + i]) <= 1 && dp[j + 1][j + i - 1] > 0) {
					dp[j][j + i] = dp[j + 1][j + i - 1] + 2;
				}
				for (int k = j + 1; k < j + i; k += 2) {
					//jからkを中間とした長i+1区間を取り出せるかどうか

					if (dp[j][k] > 0 && dp[k + 1][j + i] > 0) {
						dp[j][j + i] = max(dp[j][j + i], dp[j][k] + dp[k + 1][j + i]);
					}
				}
			}
		}

		//区間での取り出せる個数の最大を計算
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < n - i; j++) {
				//dpの方の取り出せる数を先に入れる
				dp2[j][j + i] = dp[j][j + i];

				for (int k = j; k < j + i; k++) {
					//jからkを中間とした長i+1区間の取り出せる個数の最大

					//ここが間違っている
					dp2[j][j + i] = max(dp2[j][j + i], dp2[j][k] + dp2[k + 1][j + i]);
					//dp2[j][j + i] = max(dp2[j][j + i], dp2[j][k] + dp[k + 1][j + i]);
					//dp2[j][j + i] = max(dp2[j][j + i], dp[j][k] + dp2[k + 1][j + i]);
					//dp2[j][j + i] = max(dp2[j][j + i], dp[j][k] + dp[k + 1][j + i]);
				}
			}
		}

		cout << dp2[0][n - 1] << endl;

		/*for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cout << dp[i][j] << " ";
			}
			cout << endl;
		}*/

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = dp2[i][j] = 0;
			}
		}
	}
}


Measured memory_bytes: 3816
#include <stdio.h>

#define N 8

void print(void);
void backtrack(int);

int a[N][N] = {{}};
int row[N] = {};
int l[15] = {};
int r[15] = {};
int s[N] = {};

int main(){


  int i,j,r,c,k;


  scanf("%d",&k);

  for(i = 0;i < k;i++){
    scanf("%d%d",&r,&c);
    a[r][c] = 1;
  }
  backtrack(0);
}

void backtrack(int i){
  int j;

  if(i == N){
    print();
    return;
  }

  for(j = 0;j < N;j++){
    if(s[j] == 1 || l[i + j] == 1 || r[i - j + N - 1] == 1) continue;

    row[i] = j;
    l[i + j] = r[i - j + N - 1] = s[j] = 1;

    backtrack(i + 1);

    row[i] = s[j] = l[i + j] = r[i - j + N - 1] = 0;

  }

}

void print(){

  int i,j;

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(a[i][j] == 1){
        if(row[i] != j) {
          return;
        }
      }
    }
  }
  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}

Measured memory_bytes: 2644
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B&lang=jp

"""
import sys
from sys import stdin
from collections import namedtuple
input = stdin.readline


def shortest_path(es, V, s):
    count = 0
    d = [float('inf')] * V
    d[s] = 0

    while True:
        update = False
        count += 1

        if count > V:
            return None

        for e in es:
            if d[e.f] != float('inf') and d[e.t] > d[e.f] + e.c:
                d[e.t] = d[e.f] + e.c
                update = True
        if update is False:
            break

    for i, dist in enumerate(d):
        if dist == float('inf'):
            d[i] = 'INF'
    return d


edge = namedtuple('edge', ['f', 't', 'c'])
def main(args):
    V, E, r = map(int, input().split())
    es = []
    for _ in range(E):
        s, t, d = map(int, input().split())
        es.append(edge(s, t, d))

    result = shortest_path(es, V, r)

    if result is None:
        print('NEGATIVE CYCLE')
    else:
        print('\n'.join(map(str, result)))


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 8412
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  int i,j;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  j=1;
  for(i=0;i<n;i++){
    if(a[i]==j)j++;
  }
  if(j==1)cout<<-1;
  else cout<<n+1-j;
}


Measured memory_bytes: 1024
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
d=(10**5+100)*[0]
res=sum(A)
for x in A:
    d[x]+=1
for i in range(Q):
    b,c=map(int,input().split())
    res+=d[b]*(c-b)
    d[c]+=d[b]
    d[b]=0
    print(res)

Measured memory_bytes: 20964
#include <iostream>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
  int A, B, C;
  cin >> A >> B >> C;
  if (A==B && B==C) {
    cout << "Yes" << endl;
  }else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
n, k = (int(i) for i in input().split())
 
def win_num(f, k):
    i = 0
    F = f
    while F<k:
        F = f
        F = F*(2**i)
        i += 1
    if i == 0:
        return i
    else:
        return i - 1

ls = []
for f in range(n):
    wn = win_num(f+1, k)
    ls.append((1/n) * (1/2)**wn)
print(sum(ls))

Measured memory_bytes: 6296
#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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  vector<int> a(n);
  vector<vector<int> > x(n), y(n);
  rep(i, n) {
    int m; cin >> m;
    a[i] = m;
    rep(j, m) {
      int xn, yn;
      cin >> xn >> yn;
      x[i].emplace_back(xn); y[i].emplace_back(yn);
      --x[i][j];
    }
  }

  int ans= 0;
  rep(i, 1<<n) {
    vector<bool> v(n);
    rep(j, n) {
      v[j] = i>>j&1;
    }

    bool flag = 1;
    vector<int> tf(n, -1);
    rep(j, n) {
      if(tf[j] == -1) tf[j] = v[j];
      else if(tf[j] ^ v[j]) {
	flag = 0;
	break;
      }
    }

    rep(j, n) {
      if(!v[j]) continue;
      rep(k, a[j]) {
	if(tf[x[j][k]] != -1) {
	  if(tf[x[j][k]] ^ y[j][k]) {
	    flag = 0;
	    break;
	  }
	} else tf[x[j][k]] = y[j][k];
      }
      
      if(!flag) {
	break;
      }
    }

    int cnt = 0;
    if(flag)
      rep(j, n) cnt += v[j];
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
k, n = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
ans = a[-1] - a[0]
(1..n-1).each do |i|
    sa = (a[i-1] + k) - a[i]
     ans = [ans,sa].min
end
puts ans

Measured memory_bytes: 20612
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] linesp = new String[line.length()];
        linesp=line.split(" ");
        
        ArrayList<Integer> figure = new ArrayList<Integer>();
        int save1=0;
        int save2=0;
        
        for(int i=0;i<linesp.length;i++){       	
        	switch(linesp[i]){
        	case "+":save1=figure.get(figure.size()-1);
					 figure.remove(figure.size()-1);
					 save2=figure.get(figure.size()-1);
				     figure.remove(figure.size()-1);
				     figure.add(save1+save2);
      		break;
        	case "-":save1=figure.get(figure.size()-1);
					 figure.remove(figure.size()-1);
					 save2=figure.get(figure.size()-1);
					 figure.remove(figure.size()-1);
					 figure.add(save2-save1);
    		break;        	
        	case "*":save1=figure.get(figure.size()-1);
			 		 figure.remove(figure.size()-1);
			 		 save2=figure.get(figure.size()-1);
			 		 figure.remove(figure.size()-1);
			 		 figure.add(save1*save2);
        	break;
        	default:figure.add(Integer.parseInt(linesp[i]));
    			break;
        	}
        }
        
        System.out.println(figure.get(0));
        
    }   
}

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

using namespace std;

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

	vector<int> L(N);

	for (int n=0; n<N; n++){
		cin >> L[n];
	}

	vector<int>::iterator iter = max_element(L.begin(), L.end());
	size_t max_id = distance(L.begin(), iter);

	int max_L = L[max_id];
	L.erase(iter);

	int other_sum = 0;

	for (int l=0; l<N-1; l++){
		other_sum += L[l];
	}

	if (max_L < other_sum){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}

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

using namespace std;

const int N = 1e5 + 5;

int n, m, ans;
int red[N], cur[N];

int main() {
    int x, y;
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cur[i] = 1;
    red[1] = 1;
    for(int i = 1; i <= m; i++) {
        cin >> x >> y;
        cur[x] --, cur[y] ++;
        if(red[x] == 1) red[y] = 1;
        if(cur[x] == 0 && red[x] == 1) red[x] = 0;
    }
    for(int i = 1; i <= n; i++) ans += red[i];
    cout << ans << endl;
    return 0;
}
//08:41:20

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

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

LL K,A,B;
LL f(LL K){
	if(K<A+1){
		return K+1;
	}
	K-=A+1;
	LL r=B;
	r+=(B-A)*(K/2);
	r+=K%2;
	return r;
}
int main() {
	cin >> K >> A >> B;
	cout << max(K+1,f(K)) << endl;
	return 0;
}



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

int main()
{
    int def=100, count=1, i=0;
    vector<int> H(def), W(def);

    cin>>H[i]>>W[i];

    while (i < def)
    {
        if(H[i]==0&W[i]==0)
            break;
        
        if (++i==def*count)
        {
            count++;
            H.resize(def*count);
            W.resize(def*count);
        }

        cin>>H[i]>>W[i];
    }

    for (int n = 0; n < i; n++)
    {   
        for (int j = 0; j < H[n]; j++)
        {
            for (int k = 0; k < W[n]; k++)
            {
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    
    return 0;
}


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

int main(){
    ll k; cin>>k;
    queue<ll>q;
    rep(i,9){
        q.push(i+1);
    }
    for(ll i=1;;i++){
        ll a=q.front();
        q.pop();
        if(i==k){
            cout<<a<<endl;
            return 0;
        }
        else{
            for(int j=a%10-1;j<=a%10+1;j++){
                if(j<0||j>=10)continue;
                q.push(a*10+j);
            }
        }
    }
}








































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

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

const long long INF = 1LL << 60;

int main(){
  char c;
  cin >> c;

  if(c == 'a') cout << "vowel" << endl;
  else if(c == 'e') cout << "vowel" << endl;
  else if(c == 'i') cout << "vowel" << endl;
  else if(c == 'o') cout << "vowel" << endl;
  else if(c == 'u') cout << "vowel" << endl;
  else cout << "consonant" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>//方針：異なる物の数＝＝N-同じ数
using namespace std;

int main() {
  int N;
  cin >> N;
  int d[N];
  
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
//sortしたい
  for(int s=0;s<N;s++){
    for(int t=s+1;t<N;t++){
      if(d[t]<d[s]){
      	int k = d[s];
          d[s]= d[t];
          d[t]= k;
      }
    }
  }//小さい順にソートできた
  int k = 0;
  for(int s=0;s<N-1;s++){
    if(d[s]==d[s+1])
      k++;
  }
  
	cout << N-k << endl;
        
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/
	ll r,d;
	cin>>r>>d;
	ll s=(d*2)+1;
	if(r%s==0)
		cout<<r/s;
	else
		cout<<(r/s)+1;
	//cout<<r*r*3;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
int main () {
	int x = read (), y = read ();
	cout << x + y / 2 << endl;
	return 0;
}

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

using namespace std;

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

    vector<int> x(n), sx(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        sx[i] = x[i];
    }
    sort(sx.begin(), sx.end());
    int m1 = sx[n / 2 - 1];
    int m2 = sx[n / 2];
    for (int i = 0; i < n; i++) {
        if (x[i] <= m1)
            cout << m2 << endl;
        else
            cout << m1 << endl;
    }
}


Measured memory_bytes: 3712
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    private static final int MAX = 101;
    
    public static void main(String[] args) {
        int[] ary = new int[MAX];
        setValue(ary);
        printMode(ary, getMaxValue(ary));
    }
    
    public static void setValue(int[] ary) {
        while(scn.hasNextInt()) {
            ary[scn.nextInt()]++;
        }
    }
    
    public static int getMaxValue(int[] ary) {
        int[] buf = Arrays.copyOf(ary, ary.length);
        Arrays.sort(buf);
        return buf[ary.length - 1];
    }
    
    public static void printMode(int[] ary, int max) {
        for(int i = 1; i < ary.length; i++) {
            if(ary[i] == max) {
                System.out.println(i);
            }
        }
    }
}

Measured memory_bytes: 26372
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String S = in.next();
		    S = S.replaceAll("eraser",  "-");
	        S = S.replaceAll("erase",   "-");
	        S = S.replaceAll("dreamer", "-");
	        S = S.replaceAll("dream",   "-");
	        S = S.replaceAll("-", "");
	        if (S.length() == 0) {
	            System.out.println("YES");
	        }else{
	            System.out.println("NO");
			}
		}
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}


Measured memory_bytes: 31188
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){
  int N; cin >> N;
  int ans = 0;
  int num_A = 0;
  int num_B = 0;
  int num_AB = 0;
  rep(i, N){
    string s; cin >> s;
    rep(j, s.size()-1){
      if (s[j] == 'A' && s[j+1] == 'B')ans++;
    }
    if (s[0] == 'B' && s[s.size()-1] != 'A') num_B++;
    if (s[s.size()-1] == 'A' && s[0] != 'B') num_A++;
    if (s[0] == 'B' && s[s.size()-1] == 'A') num_AB++;
  }
  int add;
  if (num_AB == 0) add = min(num_A, num_B);
  else if (num_A + num_B > 0) add = num_AB + min(num_A, num_B);
  else if (num_A + num_B == 0) add = num_AB - 1;
  cout << ans + add << endl;
}

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

using namespace std;

int main() {
    int N;
    string S;
    int K;

    cin >> N >> S >> K;

    for (int i = 0; i < N; i++)
        if (S[i] != S[K - 1])
            S[i] = '*';

    cout << S << endl;

    return 0;
}



Measured memory_bytes: 256