akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <list>
#include <chrono>
#include <random>

using namespace std;
typedef long long ll;

int DAYS;
const int TYPES = 26;

vector<int> c;
vector<vector<ll>> s;

ll point;
vector<ll> penalty;

chrono::system_clock::time_point startTime, endTime;
mt19937 engine(random_device{}());

void simulate(vector<int> &t) {
    vector<int> last(TYPES, -1);
    point = 0, penalty.assign(TYPES, 0);
    for (int i = 0; i < DAYS; i++) {
        point += s[i][t[i]], last[t[i]] = i;
        for (int j = 0; j < TYPES; j++) {
            penalty[j] += c[j] * (i - last[j]);
        }
    }
}

void update(vector<int> &t, int x, int y) {
    int lastx = -1, lasty = -1;
    penalty[x] = 0, penalty[y] = 0;
    for (int i = 0; i < DAYS; i++) {
        if (t[i] == x)lastx = i;
        if (t[i] == y)lasty = i;

        penalty[x] += c[x] * (i - lastx), penalty[y] += c[y] * (i - lasty);
    }
}

ll scoring() {
    ll ret = point;
    for (auto &x:penalty)ret -= x;
    return ret;
}


ll mod_rnd(ll mod) { return engine() % mod; }

int main() {
    startTime = chrono::system_clock::now();

    cin >> DAYS;
    c.resize(TYPES);
    for (int i = 0; i < TYPES; i++)cin >> c[i];
    s.assign(DAYS, vector<ll>(TYPES));
    for (int i = 0; i < DAYS; i++) {
        for (int j = 0; j < TYPES; j++) {
            cin >> s[i][j];
        }
    }

    vector<int> t(DAYS);
    for (int i = 0; i < DAYS; i++) cin >> t[i], t[i]--;

    simulate(t);

    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
        int d, q;
        cin >> d >> q, d--, q--;
        int old = t[d];

        point -= s[d][old], point += s[d][q];
        t[d] = q;
        update(t, old, q);
        cout << scoring() << endl;
    }

/*
    while (chrono::duration_cast<chrono::milliseconds>(endTime - startTime).count() < 1950) {
        int ope = mod_rnd(10);
        if (ope == 0) {
            int d = -1, q = -1;
            do {
                d = mod_rnd(DAYS), q = mod_rnd(TYPES);
            } while (t[d] == q);

            int old = t[d];
            t[d] = q;
            int changedScore = simulate(t).back();

            if (currentScore < changedScore)currentScore = changedScore;
            else t[d] = old;
        } else {
            int x = -1, y = -1;
            do {
                x = mod_rnd(DAYS), y = mod_rnd(DAYS);
            } while (x == y);

            swap(t[x], t[y]);
            int changedScore = simulate(t).back();

            if (currentScore < changedScore)currentScore = changedScore;
            else swap(t[x], t[y]);
        }
        endTime = chrono::system_clock::now();
    }


    for (auto &x:t)cout << x + 1 << endl;
    cout << currentScore << endl;*/
    return 0;
}

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

int main(){
  int H,N;
  cin >>H>>N;
  vector<int> A(N);
  for (int i =0;i<N;i++){
    cin >>A.at(i);
  }
  int sum= 0;
  for (int i =0;i<N;i++){
    sum += A.at(i);
  }
  if (sum >= H){
    cout << "Yes"<<endl;
  }
  else{
    cout << "No" <<endl;
  }
}


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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

void debug_out() {
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


int main() {
    FAST

    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(k>0) {
        if (k > a) {
            ans += a;
            k -= a;
        } else {
            ans+=k;
            k=0;

        }
    }
    if(k>0) {
        if (k > b) {
            k -= b;
        } else {
           k=0;
        }
    }
    if(k>0) {
        if (k > c) {
            ans += -c;
            k -= c;
        } else {
            ans-=k;
             k=0;
        }
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <algorithm>
#define P 1000000007
#define M 400010

using namespace std;

typedef long long ll;

int n, C[M];

ll F[M], tot[M];

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &C[i]);
    tot[C[1]] = 1;
    C[n + 1] = -1;
    for(int i = 2; i <= n + 1; i++) if(C[i] != C[i - 1]) {
        int k = C[i - 1];
        ll ans = tot[k];
        if(i == n + 1) {
            printf("%lld\n", (ans % P + P) % P);
            return 0;
        }
        tot[C[i]] = (tot[C[i]] + ans) % P;
    }
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>

using namespace std;

typedef long long in;

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> img(h);
    for(int i=0;i<h;i++)
        cin >> img[i];
    for(int i=0;i<h;i++){
        cout << img[i]<< endl << img[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
s = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=True)

for cs in s:
    for ct in t:
        if cs < ct:
            print('Yes')
            exit()

if len(s) < len(t) and len(set(s)) == 1 and len(set(t)) == 1:
    print('Yes')
else:
    print('No')


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

const int N = 105;
int in[N * N], C[N][N];

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    for (int i = 1; i <= q; ++i) cin >> in[i];

    queue< pair<int, int> > qu;
    for (int i = 1; i <= n; ++i) {
        if (i & 1) for (int j = m; j >= 1; j--) qu.emplace(i, j);
        else for (int j = 1; j <= m; ++j) qu.emplace(i, j);
    }

    for (int i = 1; i <= q; ++i) {
        int k = in[i];
        while (k--) {
            C[qu.front().first][qu.front().second] = i;
            qu.pop();
        }
    }

    for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) printf("%d%c", C[i][j], " \n"[j == m]);
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int t = in.nextInt();
		int a = in.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = in.nextInt();
		}
		double min = Double.MAX_VALUE;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			double diff = Math.abs(a - (t - h[i] * 0.006));
			if (min > diff) {
				min = diff;
				ans = i + 1;
			}
		}
		System.out.println(ans);
		in.close();
	}
}

Measured memory_bytes: 22096
H, N  = map(int, input().split())
# hitpoint H
# waza N
As = [] # damage
Bs = [] # MP comsumptions
for i in range(N):
    a,b = map(int, input().split())
    As.append(a)
    Bs.append(b)

"""
dp[i][j] = i番目までの魔法を見たとき、ダメージがちょうどjになる最小値
"""
INF = 10**10
M = 21000
dp = [[INF]*M for i in range(N+1)]
dp[0][0] = 0
for i,(a,b) in enumerate(zip(As,Bs)):
    dp[i+1][:] = dp[i][:]
    for j in range(H):        
        dp[i+1][j+a] = min(dp[i][j+a], dp[i+1][j]+b)
        # print(i,j,"ab",a,b,"dp",dp[i][j],dp[i][j+1],dp[i][j]+b)
print(min(dp[N][H:]))


Measured memory_bytes: 237480
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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() {
  ll n,m;
  cin >> n >> m;
  ll ans;
  if(m<=n*2) ans = m/2;
  else ans = n+(m-n*2)/4;
  cout << ans << endl;
}


Measured memory_bytes: 256
while True:
	n = int(input())
	m = int(input())
	if n==0 and m==0: break
	A = [list(map(int, input().split())) for _ in range(m)]
	A.sort()
	B, C = set(), set()  #友達リスト
	C = set()  #友達の友達リスト
	for i in range(len(A)):
		if A[i][0]==1: B.add(A[i][1])
	for i in range(len(A)):
		if A[i][0]==1: continue
		if A[i][0] in B: C.add(A[i][1])
		if A[i][1] in B: C.add(A[i][0])
#	print((B|C))
	print(len(B|C))



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

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll hoge = (B / C) - ((A - 1) / C);
    ll huga = (B / D) - ((A - 1) / D);
    ll piyo = (B / lcm(C, D)) - ((A - 1) / lcm(C, D));
    cout << (B - A + 1) - (hoge + huga - piyo) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 100005;
LL arr[MAXN];
int n, res;
unordered_map<LL, int> mp;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", arr + i);
		LL x = arr[i], y = 1, z = 1, s;
		for (int j = 2; (LL)j * j * j <= x; j++) if (x % j == 0) {
			int c = 0;
			while (x % j == 0) x /= j, ++c;
			c %= 3;
			for (int a = 0; a < c; a++) y *= j;
			c = (3 - c) % 3;
			for (int a = 0; a < c; a++) {
				z *= j;
				if (z > 1e11) { ++res; goto finish; }
			}
		}
		s = round(sqrt(x));
		y *= x;
		if (s * s == x) { if (1e11 / s < z) { ++res; goto finish; } z *= s; }
		else if (1e11 / x / x < z) { ++res; goto finish; }
		else z *= x * x;
		if (y == z && mp[z]) continue;
		if (mp[y] >= mp[z]) ++res;
		finish: ++mp[y];
	}
	printf("%d\n", res);
	return 0;
}

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

int main() {
  char s;
  int a,b;
  cin >>a>>s>>b;
  if (s=='+') {
    cout<<a+b<<endl;
  }
  else{
    cout<<a-b<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VI a(26,50);
    REP(i,n){
        string s;
        cin >> s;
        VI b(26);
        REP(j,s.length()){
            b[s[j]-'a']++;
        }
        REP(j,26){
            a[j] = min(a[j], b[j]);
        }
    }
    string ans;
    REP(i,26){
        REP(j,a[i]){
            ans += ('a' + i);
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <array>
#define llt long long int

using namespace std;
int main()
{
    int n;

    cin >> n;
    array<int, 250> a;

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

    int cnt = 0;

    while (true)
    {
        for (int i = 0; i < n; i++)
        {
            if (a[i] % 2 == 0)
            {
                a[i] /= 2;
            }
            else
            {
                cout << cnt << endl;
                return 0;
            }
        }
        cnt++;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;

int main() {
    int x;

    for (int i = 0; i < 5; ++i) {
        cin >> x;
        if (x == 0) {
            cout << (i + 1) << endl;
        }
    }
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))
p = [] 
s = [0 for i in range(n)]
for i in range(n):
    q = 0
    k = n-i
    for j in range(2,n+1):
        if k*j <= n:
            q = (q+s[k*j-1])%2
        else:
            break
    if (a[k-1]+q)%2 == 1:
        s[k-1] = 1
        p.append(k)
print(len(p))
for i in range(len(p)):
    print(p[i],end=' ')

Measured memory_bytes: 70620
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MAX 100000
typedef long long ll;
typedef pair<ll,int> P;

int main(){
  int N,D;
  cin>>N>>D;
  D=D*2+1;
  cout<<(N+D-1)/D<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
    int N; cin >> N;
    vector<int> A(N), B(N), D, M;
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    //cout << A[0] << endl;

    int pass = 0;
    for(int i = 0; i < N; i++){
        int a = A[i];
        int b = B[i];
        if(a < b){
            D.push_back(b - a);
            //cout << "d" << endl;
            //M[i] = 0;
        }
        else if(a > b){
            M.push_back(a - b);
            //cout << "m" << endl;
            //D[i] = 0;
            //pass++;
        }
        //else cout << 0 << endl;
    }
    sort(D.begin(), D.end());
    sort(M.rbegin(), M.rend());
    queue<int> QD, QM;
    for(int i = 0; i < D.size(); i++) QD.push(D[i]);
    for(int i = 0; i < M.size(); i++) QM.push(M[i]);
    //cout << QD.size() << endl;
    //cout << QM.size() << endl;

    
    if(QD.empty()){
        cout << 0 << endl;
        return 0;
    }

    if(QM.empty()){
        //cout << "q" << endl;
        cout << -1 << endl;
        return 0;
    }
    //cout << 1 << endl;
    int m_past = 0;
    while(!QM.empty()){
        if(QD.empty()) break;
        int m = QM.front(); QM.pop(); pass++;
        m = m + m_past;
        //cout << m_past << endl;
        //cout << "m " << m << endl;
        while(!QD.empty()){
            int d = QD.front();
            //cout << "d " << d << endl;
            if(m - d >= 0){
                m = m - d;
                pass++;
                QD.pop();
            }
            else{
                //cout << m << " " << d << endl;
                m_past = m;
                break;
            }

        }
    }
    //cout << QD.size() << endl;
    //cout << QM.size() << endl;
    if(!QD.empty()) cout << -1 << endl;
    else cout << pass << endl;
}

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

int main(){
  int N,k,ans=0;
  double ave=0;
  cin >> N;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin >> a[i];
    ave+=a[i];
  }
  ave/=N;
  
  k=ave;
  if(ave-k>=0.5){
    k=ave+1;
  }
  
  for(int i=0; i<N; i++){
    ans+=(a[i]-k)*(a[i]-k);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}



///////////////////////////

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

	vector<ll> A(N + 1), B(N + 1), C(N + 1);

	repn(i, N) cin >> A[i];
	repn(i, N) cin >> B[i];
	repn(i, N) cin >> C[i];

	sort(++B.begin(), B.end());
	sort(++C.begin(), C.end());

	vector<ll>bc(N + 1);

	repn(i, N) {
		auto itr = upper_bound(++C.begin(), C.end(), B[i]);
		bc[i] = distance(itr, C.end());
	}

	vector<ll> sum(N + 2);

	sum[N+1] = 0;

	for (int i = N; i > 0; i--) {
		sum[i] = sum[i + 1] + bc[i];
	}

	ll ans = 0;

	repn(i, N) {
		auto itr = upper_bound(++B.begin(), B.end(), A[i]);
		ll j = distance(B.begin(), itr);
		ans += sum[j];
	}

	cout << ans;

}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif
#define out(v) cout<<v<<"\n"
#define _overload3(_1,_2,_3,name,...) name
#define _all1(a) (a).begin(),(a).end()
#define _all2(a,n) (a),(a)+n
#define all(...) _overload3(__VA_ARGS__,42,_all2,_all1,)(__VA_ARGS__)
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

vector<vector<pii>> edge;
int ans;
vector<int> ans_v;
vector<bool> visited;
void dfs(int s, int par_color) {
  // 親の色と違う色をつける
  int color = 0;
  if (color == par_color)
    ++color;
  if (visited[s])
    return;
  visited[s] = true;
  for (const auto& e : edge[s]) {
    if (visited[e.first])
      continue;
    dfs(e.first, color);
    ans_v[e.second] = color;
    ++color;
    if (color == par_color)
      ++color;
  }
}
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N; cin >> N;

  edge.resize(N);
  visited.resize(N, false);
  ans_v.resize(N-1);

  int a[N-1], b[N-1];
  rep(i, N-1) {
    cin >> a[i] >> b[i];
    --a[i];
    --b[i];
    edge[a[i]].emplace_back(b[i], i);
    edge[b[i]].emplace_back(a[i], i);
  }
  rep(i, N) {
    ans = max(ans, (int)edge[i].size());
  }
  cout << ans << endl;

  dfs(0, -1);
  rep(i, N-1) {
    cout << ans_v[i]+1 << endl;
  }

  return 0;
}


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

int main(void){
    char S[10], T[11];
    int b = 0, i = 0;
    scanf("%s", S);
    
    for(i = 0; S[i]!='\0';++i);
    scanf("%s", T);
    
    for(int j = 0; j < i; j++){
        if(S[j] != T[j]) b+= 1;
    }
    
    if(b == 0) printf("Yes\n");
    else printf("No\n");
    
    return 0;

}

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

int main() {
  int sx,sy,tx,ty; cin >>sx >>sy >>tx >>ty;
  string ans = "";
  int subx = tx-sx, suby = ty-sy;
  for (int i=0; i<suby; i++) ans += "U";
  for (int i=0; i<subx; i++) ans += "R";
  for (int i=0; i<suby; i++) ans += "D";
  for (int i=0; i<subx; i++) ans += "L";
  /*.__,
    |  |
    |  |
    ,__.
  */
  subx++; suby++;
  ans += "L";
  for (int i=0; i<suby; i++) ans += "U";
  for (int i=0; i<subx; i++) ans += "R";
  ans += "DR";
  for (int i=0; i<suby; i++) ans += "D";
  for (int i=0; i<subx; i++) ans += "L";
  ans += "U";
  /*.___.
    |.__,.
    ||  ||
    ||  ||
    .,__.|
     .___.
  */
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin>>a;
  if(a.at(0)=='S'){cout<<"Cloudy"<<endl;}
  else if(a.at(0)=='C'){cout<<"Rainy"<<endl;}
  else if(a.at(0)=='R'){cout<<"Sunny"<<endl;}
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;

int main(){
    int N,h[110],ans;
    ans=0;
    map<int,int> mp;
    cin >>N;
    rep(i,N) cin >>h[i];
    h[N]=0;
    for(int i=1;i<101;i++){
        rep(j,N){
            if(h[j] >=i &&h[j+1] <i) mp[i]++;
        }
    }
    for(int i=1;i<101;i++){
        ans +=mp[i];
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long  n;
	cin>>n;
    int res=0;
    for(int i=n;i;i/=10){
        res+=i%10;
    }
    if(n%res==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  string s, t;
  cin >> s >> t;

  ll ans = 0;

  rep(i, ll(s.size())) {
    if (s[i] != t[i]) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3820
a=[]
for i in range(3):
    a.append(int(input()))
x=int(input())
ans=0

for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):
            if i*500+j*100+k*50==x:
                ans+=1
print(ans)

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

#define rep(i, n) for(int i=0; i<n; i++)

int main() {
    int n; cin >> n;
    vector<int> h(n); rep(i, n) cin >> h[i];
    int cnt = 0, ch = h[0];
    rep(i, n){
        if(ch <= h[i]) cnt++;
        ch = max(ch, h[i]);
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const [N, A, B] = lines[0].split(" ").map(v=>v-0);
    const list = lines[1].split("");
    const map = [];
    let go = 0;
    let go2=0;
    list.forEach((v,i)=>{
        map[i] = false;
        if(go < A+B){
            if(v==="a"){
                go++;
                map[i] = true;
            }else if(v==="b" && go2 < B){
                go++;
                go2++;
                map[i] = true;
            }
        }
    });
    console.log(map.map(v=>v?"Yes":"No").join("\n"));
});


Measured memory_bytes: 41028
#include<iostream>
using namespace std;
int main(){
    while(true){
        int H,W;
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int y=0;y<H;++y){
            for(int x=0;x<W;++x){
                if((y%2==0)!=(x%2==0)){
                    cout<<".";
                }else{
                    cout<<"#";
                }
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3080
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scan.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < q; i++) {
			if (Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		
		System.out.println(ans);
		
		scan.close();
		
	}

}

Measured memory_bytes: 74304
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
inline int mex(unordered_set<int> st)
{
    int m = 0;
    while (st.find(m) != st.end())
    {
        m += 1;
    }
    return m;
}
inline int calculateGrundy(int n)
{
    if (n == 1)
        return 0;
    unordered_set<int> mexi;
    for (int i = 1; i <= sqrt(n); i += 1)
    {
        if (n % i == 0)
        {
            if (n / i != n)
                mexi.insert(calculateGrundy(n / i));
            mexi.insert(calculateGrundy(i));
        }
    }
    return mex(mexi);
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    string s;
    ll n;
    cin >> n;
    ll happy = 0;
    happy += (n / 500)*1000;
    n -= (n / 500) * 500;
    happy += (n / 5) * 5;
    cout << happy;
    return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();

    let mut ans = None;
    for c in b'a'..b'z' + 1 {
        let c = char::from(c);
        if !s.contains(&c) {
            ans = Some(c.to_string());
            break;
        }
    }
    println!("{}", ans.unwrap_or("None".to_string()));
}


Measured memory_bytes: 4352
import sys
from collections import deque

input = sys.stdin.readline

def main():
    N = int(input())
    A = []
    for _ in range(N):
        A.append(int(input()))
    A.sort()
    if N%2 == 0:
        Bp = A[N//2:]
        Bm = A[:N//2]
        ans = 2*sum(Bp) - min(Bp) - 2*sum(Bm) + max(Bm)
    else:
        Bp = A[N//2+1:]
        Bm = A[:N//2+1]
        cnt = 2*sum(Bp) - 2*sum(Bm) + sum(Bm[-2:])

        Cp = A[N//2:]
        Cm = A[:N//2]
        ans = max(cnt, 2*sum(Cp) - sum(Cp[:2]) - 2*sum(Cm))

    print(ans)
        
if __name__ == "__main__":
    main()


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

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

    bool isAC[n] = {};
    int ac = 0;
    int wa = 0;
    int _wa[n] = {};

    for(int i = 0; i < m; i++) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(!isAC[p] && s == "WA") _wa[p]++;
        if(!isAC[p] && s == "AC") {
            ac++;
            isAC[p] = true;
        }
    }

    for(int i = 0; i < n; i++) {
        if(!isAC[i]) _wa[i] = 0; 
    }

    wa = accumulate(_wa, _wa + n, 0);

    cout << ac << ' ' << wa << endl;

    return 0;
}

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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll, ll>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for(auto &z: v)
#define sps << ' '
#define sp << ' ' << 
# define M_PI   3.14159265358979323846
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
ll u, r, l, d;

bool check(ll x, ll y){
  if(x >= l and x <= r and y >= u and y <= d) return false;
  else return true;
}

int main()
{
  boost;
  ll tt = 1, w, h, i, j;
  bool poss = false;

  ll sum = 0LL;
  string s;

  // cin >> tt;

  for(int _ = 1; _ <= tt; _++){
    // cout << "Case #" << _ << ": ";
    cin >> r;
    
    cout << setprecision(9) << 2*r*M_PI << nl;
  }

  return 0;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100002;
int n,m,q,i,l1,l2,r1,r2;
ll a[N],b[N],x;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline ll rd(){
    ll x=0,fl=1;char ch=gc();
    for (;ch<48||ch>57;ch=gc())if(ch=='-')fl=-1;
    for (;48<=ch&&ch<=57;ch=gc())x=(x<<3)+(x<<1)+(ch^48);
    return x*fl;
}
inline void wri(ll a){if(a<0)a=-a,putchar('-');if(a>=10)wri(a/10);putchar(a%10|48);}
inline void wln(ll a){wri(a);puts("");}
int main(){
	n=rd(),m=rd(),q=rd();
	a[0]=b[0]=-1e18,a[n+1]=b[m+1]=1e18;
	for (i=1;i<=n;i++) a[i]=rd();
	sort(a+1,a+n+1);
	for (i=1;i<=m;i++) b[i]=rd();
	sort(b+1,b+m+1);
	n++,m++;
	for (;q--;){
		x=rd(),r1=lower_bound(a,a+n+1,x)-a,l1=r1-1;
		r2=lower_bound(b,b+m+1,x)-b,l2=r2-1;
//		if (x==2000) printf("%lld %lld %lld %lld\n",a[l1],a[r1],b[l2],b[r2]);
		wln(min(min(min(x-b[l2]+a[r1]-b[l2],b[r2]-x+b[r2]-a[l1]),min(x-a[l1]+b[r2]-a[l1],a[r1]-x+a[r1]-b[l2])),
		min(x-min(a[l1],b[l2]),max(a[r1],b[r2])-x)));
	}
}

Measured memory_bytes: 2944
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

typedef long long ll;
const int MAXN = 1e5 + 10;
int N, S;
int x[MAXN]; ll p[MAXN];
ll ans;

int main() {
    register int i, l, r, last;
    scanf( "%d%d", &N, &S );
    for( i = 1; i <= N; ++i )
        scanf( "%d%lld", x + i, p + i );
    l = 1, r = N, last = 0;
    while( x[l] <= S && x[r] >= S ) {
        if( p[l] >= p[r] )
            p[l] += p[r], ans += ( x[r] - x[l] ) * ( last != 1 ), last = 1, --r;
        else
            p[r] += p[l], ans += ( x[r] - x[l] ) * ( last != 2 ), last = 2, ++l;
    }
    if( l <= r ) {
        if( x[l] <= S ) ans += S - x[l];
        else ans += x[r] - S;
    }
    printf( "%lld\n", ans );
    return 0;
}

Measured memory_bytes: 1408
N,K=map(int,input().split())
A = list(map(int,input().split()))
val_memo = {}
for i in range(N):
    if A[i] in val_memo:
        val_memo[A[i]] += 1
    else:
        val_memo[A[i]] = 1

val_memo = sorted(val_memo.items(), key=lambda x: x[0])
total = N-val_memo[0][1]
if total%(K-1):
    print(total//(K-1)+1)
else:
    print(total//(K-1))

Measured memory_bytes: 92092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll dp[105][10];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll h,w,k;cin>>h>>w>>k;
    dp[0][0]=1;
    for(ll i=0;i<h;i++){
        for(ll j=0;j<w;j++){
            for(ll k=0;k<1ll<<(w-1);k++){
                bool f=1;
                for(ll l=0;l<w-2;l++){
                    if(((k>>l)&1)&&((k>>(l+1))&1))f=0;
                }
                if(!f)continue;
                if(j>=1 && ((k>>(j-1))&1))dp[i+1][j-1]+=dp[i][j],dp[i+1][j-1]%=mod;
                else if(j<=w-2&&((k>>j)&1))dp[i+1][j+1]+=dp[i][j],dp[i+1][j+1]%=mod;
                else dp[i+1][j]+=dp[i][j],dp[i+1][j]%=mod;
            }
        }
    }
    cout<<dp[h][k-1];
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int check(ll n,ll x){
	while(n%x==0) n/=x;
	if(n%x==1) return 1;return 0;
}
int main(){fast;
	ll n,i,c=1,s=1;cin>>n;
	if(n<3) return cout<<"1\n",0;
	for(i=2;i*i<=n-1;i++) if((n-1)%i==0&&(n-1)/i-i) c+=2; else if((n-1)%i==0) c++;
	for(i=2;i*i<=n;i++){
		if(n%i==0&&n/i-i){
			if(check(n,i)) s++;
			if(check(n,n/i)) s++;
		}else if(n%i==0&&check(n,i)) s++;
	}cout<<s+c<<endl;
}


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

int main() {
    string s;
    cin >> s;

    int min = s.size(), max = -1;
    for (int i = 0; i < s.size(); i++) {
        if (s.at(i) == 'A' && i < min) min = i;
        if (s.at(i) == 'Z' && i > max) max = i;
    }

    cout << max - min +1 << endl;

    return 0;
}


Measured memory_bytes: 3784
N = int(input())
A_int_list = list(map(int, input().split()))

ans = 0
sum_A = sum(A_int_list)

for i in range(len(A_int_list)):
    sum_A -= A_int_list[i]
    ans += A_int_list[i] * sum_A


print(ans % (10 ** 9 + 7))


Measured memory_bytes: 31428
n = int(input())
trump_list = [[0 for i in range(13)] for j in range(4)]
for cardnum in range(n):
    x = [i for i in input().split()]
    x[1] = int(x[1])
    if x[0] == 'S':
        trump_list[0][x[1] - 1] = 1
    elif x[0] == 'H':
        trump_list[1][x[1] - 1] = 1
    elif x[0] == 'C':
        trump_list[2][x[1] - 1] = 1
    elif x[0] == 'D':
        trump_list[3][x[1] - 1] = 1

for art in range(4):
    if art == 0:
        art_kind = 'S'
    elif art == 1:
        art_kind = 'H'
    elif art == 2:
        art_kind = 'C'
    elif art == 3:
        art_kind = 'D'
    for number in range(13):
        if trump_list[art][number] == 0:
            print(art_kind,number+1)



Measured memory_bytes: 5616
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<ll, ll> P;
int main()
{
  ll H, W, N; cin >> H >> W >> N;
  map<P, int> MAP;
  int vy[9] = {0, -1, -1, 0, 1, 1, 1, 0, -1};
  int vx[9] = {0, 0, 1, 1, 1, 0, -1, -1, -1};
  FOR(i,0,N) {
    ll y, x; cin >> y >> x;
    y--;x--;
    FOR(j,0,9) {
      ll ny = y + vy[j];
      ll nx = x + vx[j];
      if(ny <= 0 || ny >= H - 1 || nx <= 0 || nx >= W - 1) continue;
      MAP[P(ny, nx)]++;
    }
  }
  ll ans[10]; CLR(ans);
  for(auto itr = MAP.begin(); itr != MAP.end(); itr++) {
    ans[itr->second]++;
  }
  ans[0] = (H - 2) * (W - 2);
  FOR(i,1,10) ans[0] -= ans[i];
  FOR(i,0,10) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 56448
#include <iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a>0) cout << "Positive" << endl;
  else if(a<=0 && b>=0) cout << "Zero" << endl;
  else{
    if(a%2==b%2) cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }
  return 0;
}

Measured memory_bytes: 3640
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 自作プログラムテスト
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            string[] reader_I = ReadLine().Split(' ');
            string S = reader_I[0];
            string T = reader_I[1];
            string NewStr = "";

            for (int loop = 0; loop < N; loop++) 
            {
                NewStr += S.Substring(loop, 1) + T.Substring(loop, 1);
            }

            WriteLine(NewStr);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	char s1[15],s2[15];
	cin>>s1>>s2;int l=strlen(s1);
	for(int i=0;i<l;++i)
	{
		if(s1[i]!=s2[i])
		{
			cout<<"No";
			return 0;
		}
	}cout<<"Yes";
}

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

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    for (int i = x1; i < x2; i++) cout << "R";
    for (int i = y1; i < y2; i++) cout << "U";
    //cout << "L";
    for (int i = x1; i < x2; i++) cout << "L";
    for (int i = y1; i < y2; i++) cout << "D";

    cout << "D";
    for (int i = x1; i <= x2; i++) cout << "R";
    for (int i = y1; i <= y2; i++) cout << "U";
    cout << "L";
    cout << "U";
    for (int i = x1; i <= x2; i++) cout << "L";
    for (int i = y1; i <= y2; i++) cout << "D";
    cout << "R";
}


Measured memory_bytes: 256
import scala.math.{min,max}

object Main {
  val sc = new java.util.Scanner(System.in)
  def classify(p: Seq[Int]) = {
    if(p.max == 100 || p.take(2).sum >= 180 || p.sum >= 240) {
      "A"
    } else if(p.sum >= 210 || (p.sum >= 150 && p.take(2).max >= 80)) {
      "B"
    } else {
      "C"
    }
  }
  def main(args: Array[String]) {
    while(true) {
      val n = sc.nextInt
      if(n == 0) return

      for(_ <- 1 to n) {
        val p = Seq(sc.nextInt, sc.nextInt, sc.nextInt)
        println(classify(p))
      }
    }
  }
}

Measured memory_bytes: 57332
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll ar[200007],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnt;
ll br[200007];
string s,s1,s2;

int main()
{
    ll test;
    cin>>s>>s1;
    cin>>a>>b;
    cin>>s2;
    if(s2==s)
        cout<<a-1<<" "<<b;
    else if(s2==s1)
        cout<<a<<" "<<b-1;
    else
        cout<<a<<" "<<b;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s,t;

int main(){
	cin>>s>>t;
	n=s.size();
	bool B=0;
	for(int i=0;i<n;i++){
		if(s==t) B=1;
		s=s.substr(1,n-1)+s[0];
	}
	cout<<(B?"Yes":"No")<<endl;
}

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

int main() {
int A,B;
cin >> A >> B;
int ans;
if (A==1&&B==2) ans=3;
if (A==1&&B==3) ans=2;
if (A==2&&B==1) ans=3;
if (A==2&&B==3) ans=1;
if (A==3&&B==1) ans=2;
if (A==3&&B==2) ans=1;
cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int H = Integer.parseInt(sc.next());
		int W = Integer.parseInt(sc.next());
		String s[][] = new String[H][W];
		for(int i = 0; i < H; i++) {
			String temp = sc.next();
			for(int j = 0; j < W; j++) {
				s[i][j] = temp.substring(j, j + 1);
			}
		}
		
		//boolean flag = true;
		int dx[] = {-1, 1, 0, 0};
		int dy[] = {0, 0, 1, -1};
		for(int i = 0; i < H; i++) {
			outside : for(int j = 0; j < W; j++) {
				if(s[i][j].equals("#")) {
					boolean tempFlag = false;
					inside : for(int k = 0; k < 4; k++) {
						if(i == 0 && k == 3) continue inside;
						if(i == H - 1 && k == 2) continue inside;
						if(j == 0 && k == 0) continue inside;
						if(j == W - 1 && k == 1) continue inside;
						if(s[i + dy[k]][j + dx[k]].equals("#")) {
							tempFlag = true;
							continue outside;
						}
					}
					if(!tempFlag) {
						System.out.println("No");
						return;
					}
				}
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  priority_queue<int> que[6];
  FOR(i,0,n){
      string s;
      cin >> s;
      que[s.length()].push(stoi(s));
      if(que[s.length()].size() == 5) que[s.length()].pop();
  }
  vector<int> v;
  FOR(i,0,6){
      while(!que[i].empty()){
          v.push_back(que[i].top());
          que[i].pop();
      }
  }
  n = v.size();
  vector<int> w;
  FOR(i,0,n){
    FOR(j,0,n){
      if(i == j) continue;
      string s = to_string(v[i]);
      string t = to_string(v[j]);
      w.push_back(stoi(s+t));
    }
  }
  sort(w.begin(), w.end());
  cout<<w[2]<<endl;
}


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

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

    int n, a , b;
    cin >> n >> a >> b;
    int x = n * a;
    if(x < b)
        cout << x;
    else
        cout << b;

    return 0;
}


Measured memory_bytes: 3628
#[macro_export]
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)*}
    };
}

#[doc(hidden)]
#[macro_export]
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)*}
    };
}

#[doc(hidden)]
#[macro_export]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BTreeMap;

fn main() {
    input!{
        n: usize,
        m: usize,
        a: [usize; n],
    }

    let mut mm = BTreeMap::new();
    let mut sum = 0;
    mm.insert(0, 1);
    for &x in a.iter() {
        sum += x;
        *mm.entry(sum % m).or_insert(0) += 1;
    }
    let total = sum;
    let mut ans: usize = *mm.entry(sum % m).or_insert(0);
    for &x in a.iter().rev() {
        *mm.entry(sum % m).or_insert(0) -= 1;
        sum -= x;
        ans += *mm.entry(sum % m).or_insert(0);
    }

    println!("{}", ans - n - 1);
}


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))

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

	INT* buka = new int[N];

	memset(buka, 0, sizeof(int) * N);

	for (int i = 1; i < N; ++i) {
		int tmp;
		cin >> tmp;
		buka[tmp-1] += 1;
	}

	for (int i = 0; i < N; ++i) {
		cout << buka[i] << endl;
	}

	delete[] buka;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  set<char> used;
  string ans = "None";
  for (char c:s) used.insert(c);
  for (char i = 'a'; i <='z'; i++) {
    if (used.count(i)) continue;
    else{
      ans = i;
      break;
    }
  }
  cout << ans <<endl; 
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	string s;
	cin >> s;
	for (int i = 0; s[i] != '\0'; i +=2) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
	int n, m;
	cin >> n >> m;
	char a[n][n];
	char b[m][m];


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

	bool ans=1;

	for(int i=0; i<=n-m; i++){
		for(int j=0; j<=n-m; j++){
			ans=1;
			for(int k=0; k<m; k++){
				for(int p=0; p<m; p++){
					if(a[i+k][j+p]!=b[k][p]){
						ans=0;
						k=n;
						break;
					}
				}
			}
			if(ans==1){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <map>
#include <cmath>
#include <cstdio>

typedef long long LL;

const int MAXN = 1e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MAX( const _T a, const _T b )
{
	return a > b ? a : b;
}

std :: map<LL, int> mp;

LL a[MAXN], oppo[MAXN];
LL pw2[MAXN], pw3[MAXN];

int prime[MAXN], pn;
int N;

bool isPrime[MAXN];

void EulerSieve( const int siz )
{
	for( int i = 2 ; i <= siz ; i ++ )
	{
		if( ! isPrime[i] ) prime[++ pn] = i;
		for( int j = 1 ; j <= pn && 1ll * i * prime[j] <= siz ; j ++ )
		{
			isPrime[i * prime[j]] = true;
			if( ! ( i % prime[j] ) ) break;
		}
	}
	for( int i = 1 ; i <= pn ; i ++ )
		pw2[i] = 1ll * prime[i] * prime[i], pw3[i] = 1ll * pw2[i] * prime[i];
}

int main()
{
	bool flg = false;
	read( N ); EulerSieve( 3000 );
	for( int i = 1 ; i <= N ; i ++ ) 
	{
		read( a[i] );
		for( int k = 1 ; k <= pn && pw3[k] <= a[i] ; k ++ )
			while( ! ( a[i] % pw3[k] ) )
				a[i] /= pw3[k];
		if( a[i] == 1 ) flg = true, mp[a[i]] = -1;
		else
		{
			mp[a[i]] ++;
			LL tmp = a[i];
			int tot = 0, indx; LL rest = 1;
			for( int k = 1 ; k <= pn && prime[k] <= tmp ; k ++ )
				if( ! ( tmp % prime[k] ))
				{
					tot ++, indx = 0;
					while( ! ( tmp % prime[k] ) )
						indx ++, tmp /= prime[k];
					if( indx & 1 ) rest = 1ll * rest * pw2[k];
					else rest = 1ll * rest * prime[k];
				}
			int t = sqrt( tmp );
			if( 1ll * t * t == tmp ) oppo[i] = 1ll * t * rest;
			else oppo[i] = ( tmp <= 1e5 ? rest * tmp * tmp : 0 );
		}
	}
	int ans = 0;
	for( int i = 1 ; i <= N ; i ++ )
		if( ~ mp[a[i]] )
			ans += MAX( mp[a[i]], mp[oppo[i]] ),
			mp[a[i]] = mp[oppo[i]] = -1;
	write( ans + flg ), putchar( '\n' );
	return 0;
}

Measured memory_bytes: 14916