akhauriyash/Code-Regression huggingface dataset:
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N, M, C;
    cin >> N >> M >> C;
    vector<ll> B;
    rep (i, M) {
        ll b;
        cin >> b;
        B.pb(b);
    }
    ll ans = 0;
    rep (i, N) {
        ll s = C;
        rep (j, M) {
            ll a;
            cin >> a;
            s += B[j] * a;
        }
        if (s > 0) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		String s = sc.next();
		String t = sc.next();
		for(int i = 0 ; i < n ; i++){
			ou.print(s.charAt(i) + "" + t.charAt(i));
		}
		ou.print("\n");
		ou.flush();
    }
}

Measured memory_bytes: 38708
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

class Dice{
private:
    int l[7][7] = {}; 
public:
    int x,y,z;
    int top,front,bottom,back,right,left;
    Dice(int t,int f){
        l[1][2] = 4; l[1][3] = 2; l[1][4] = 5; l[1][5] = 3;
        l[2][3] = 6; l[2][4] = 1; l[2][6] = 4; l[3][5] = 6; l[3][6] = 2;
        l[4][5] = 1; l[4][6] = 5; l[5][6] = 3;
        top = t; front = f;
        if(t<f) left = l[t][f];
        else left = 7-l[f][t];
        bottom = 7-top; back = 7-front; right = 7-left;
    }
    int num(int d){
        if(d==0) return front;
        if(d==1) return right;
        if(d==2) return back;
        if(d==3) return left;
    }
    void roll(int d){
        int buf;
        if(d==0){//手前
            buf=top;top=back;back=bottom;bottom=front;front=buf;x--;
        }else if(d==1){//右
            buf=top;top=left;left=bottom;bottom=right;right=buf;z++;
        }else if(d==2){//後
            buf=top;top=front;front=bottom;bottom=back;back=buf;x++;
        }else if(d==3){//左
            buf=top;top=right;right=bottom;bottom=left;left=buf;z--;
        }
        y--;
    }
};

int dp[110][110][7][7] = {};

struct state{
    int x,y,top,front;
};

vec<int> dx = {1,0,-1,0},dy = {0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W;
    cin >> H >> W;
    auto in = [&](int x,int y){
        return 0<=x && x<H && 0<=y && y<W;
    };
    vvec<char> F(H,vec<char>(W));
    for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin >> F[i][j];
    queue<state> Q;
    Q.push({0,0,1,2});
    dp[0][0][1][2] = 1;
    while(!Q.empty()){
        state now = Q.front(); Q.pop();
        Dice D(now.top,now.front);
        for(int k=0;k<4;k++){
            int nx = now.x+dx[k],ny = now.y+dy[k];
            if(!in(nx,ny)) continue;
            Dice D(now.top,now.front);
            int n = F[nx][ny]-'0';
            D.roll(k);
            if(n!=D.bottom) continue;
            if(!dp[nx][ny][D.top][D.front]){
                dp[nx][ny][D.top][D.front] = 1;
                Q.push({nx,ny,D.top,D.front});
            }
        }
    }
    bool ok = false;
    for(int i=1;i<7;i++) for(int j=1;j<7;j++) ok |= dp[H-1][W-1][i][j];
    cout << (ok? "YES\n":"NO\n");
}


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

int a[1<<20][2];
int ans[1<<20];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < 1 << n; i++) {
		cin >> a[i][0];
		a[i][1] = -1;
	}
	auto relax = [&](int &x, int &y, int x1, int y1) {
		if (x < x1) {
			y = x;
			x = x1;
		} else if (y < x1) {
			y = x1;
		}
		if (x < y1) {
			y = x;
			x = y1;
		} else if (y < y1) {
			y = y1;
		}
	};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 1 << n; j++) {
			if (j >> i & 1) {
				relax(a[j][0], a[j][1], a[j - (1 << i)][0], a[j - (1 << i)][1]);
			}
		}
	}
	for (int i = 1; i < 1 << n; i++) {
		ans[i] = max(ans[i], a[i][0] + a[i][1]);
		if (i + 1 < 1 << n) ans[i + 1] = max(ans[i + 1], ans[i]);
		cout << ans[i] << '\n';
	}
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  vector<int> v(5);
  int sum = 0, minN = 0;
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    if (i == 0)
      minN = v[i];
    else if (v[i] % 10 != 0) {
      if (minN % 10 < v[i] % 10)
        sum += ((v[i] + 9) / 10) * 10;
      else {
        sum += ((minN + 9) / 10) * 10;
        minN = v[i];
      }
    } else
      sum += ((v[i] + 9) / 10) * 10;
  }
  cout << sum + minN << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int a=n/100;
        int b=n/10%10;
        int c=n%10;
        int s=c*100+b*10+a;
        if(s==n)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
A, B, K = map(int, input().split())
if B - A - K*2 < 0:
    for i in range(A,B+1):
        print(i)

else:
    for i in range(A,A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)

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

int main() {
	string S;cin>>S;
	if(S.size()==3){
		char a,b;
		a=S[0];
		b=S[2];
		S[2]=a;
		S[0]=b;
	}
	cout<<S<<endl;
}

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

typedef long long ll;
typedef long double lld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
typedef pair<ll, ll> pll;
typedef pair<ll, pair<ll, ll>> plll;

void solve()
{
  ll n, d;
  cin >> n >> d;
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    ll a, b;
    cin >> a >> b;
    if (a * a + b * b <= d * d)
      ans++;
  }
  cout << ans << endl;
  return;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  // int t;
  // cin >> t;
  // for (int i = 0; i < t; i++)
  // {
  //   solve();
  // }
  solve();
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define mp make_pair
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;

//********************************************
//Error tracking
#define show(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

vector<string> split(const string& s, char c) {
    vector<string> v;
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        v.emplace_back(x);
    return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}
//********************************************

const int NMAX = 205;

int n;
char s[NMAX],t[NMAX],ans[NMAX];

int main()
{
    int i,j;

   // freopen("input","r",stdin);
   // freopen("output","w",stdout);
    cin.sync_with_stdio(false);

    cin >> n >> (s + 1) >> (t + 1);
    for (i = 1; i <= n; i++)
    {
        int ok = 1,k;
        for (j = i, k = 1; j <= n; j++,k++)
            if (s[j] != t[k])
                ok = 0;
        if (ok) {cout << (n + i - 1) << "\n"; return 0;}
    }

    cout << (2*n) << "\n";
    return 0;   
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll d[444][444],dp[444][444];
int a[444],b[444];

int main(void){
	int k,i,j,n,c;
	ll tmp;
	for(i=0; i<=400; ++i){
		d[0][i] = 1ll;
	}
	for(i=0; i<400; ++i){
		for(j=0; j<=400; ++j){
			d[i+1][j] = d[i][j]*j%MOD;
		}
	}
	for(i=0; i<=400; ++i){
		for(j=0; j<400; ++j){
			d[i][j+1] += d[i][j];
			d[i][j+1] %= MOD;
		}
	}
	cin >> n >> c;
	dp[0][0] = 1ll;
	for(i=0; i<n; ++i){
		cin >> a[i]; --a[i];
	}
	for(i=0; i<n; ++i){
		cin >> b[i];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<=c; ++j){
			for(k=0; k<=j; ++k){
				tmp = d[k][b[i]];
				add_mod(tmp,MOD-d[k][a[i]]);
				add_mod(dp[i+1][j],dp[i][j-k]*tmp%MOD);
			}
		}
	}
	cout << dp[n][c] << endl;
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    string s;
    while(cin>>s){
        char check[]={'K','I','H','B','R'};
        int i=0,cnt=0;
        string ans="YES";
        for(char c:s){
            if(i==5){
                if(c=='A') cnt++;
                else ans="NO";
                if(cnt>1) ans="NO";
            }else{
                if(c==check[i]){
                    i++;
                    cnt=0;
                }else if(c=='A'){
                    cnt++;
                    if(i==1||i==2||cnt>1){
                        ans="NO";
                    }
                }else{
                    ans="NO";
                }
            }
        }
        if(i!=5) ans="NO";
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;

int main() {
    double r, h, S;
    cin >> r;
    h = 2 * r * M_PI;
    S = r * r * M_PI;
    printf("%.6lf %.6lf\n", S, h);
    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

typedef long long ll;

const int mod = 1000000007;

string s;
int cnt[26];

ll inv(vector<int> &a) {
    int n = a.size();
    if (n == 1) {
        return 0;
    }
    vector<int> b, c;
    forn (i, n / 2) {
        b.pb(a[i]);
    }
    forn (i, n / 2 + n % 2) {
        c.pb(a[i + n / 2]);
    }
    ll ans = inv(b) + inv(c);
    int j = 0;
    a.clear();
    int cur = 0;
    forn (i, n / 2) {
        while (j < n / 2 + n % 2 && c[j] < b[i]) {
            a.pb(c[j]);
            ++j;
            ++cur;
        }
        a.pb(b[i]);
        ans += cur;
    }
    while (j < n / 2 + n % 2) {
        a.pb(c[j]);
        ++j;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> s;
    int n = s.size();
    forn (i, s.size()) {
        s[i] -= 'a';
    }
    vector<int> a[26], b[26];
    int cc = 0;
    int ind = -1;
    forn (i, 26) {
        forn (j, s.size()) {
            if (s[j] == i) {
                a[i].pb(j);
            }
        }
        if (a[i].size() % 2) {
            cc++;
            ind = i;
            if (cc == 2) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    vector<pair<int, int> > res;
    forn (i, n) {
        ++cnt[s[i]];
        if (cnt[s[i]] > a[s[i]].size() / 2) {
            continue;
        }
        res.pb(mp(s[i], cnt[s[i]] - 1));
    }
    forn (i, res.size()) {
        b[res[i].fs].pb(i);
    }
    if (ind != -1) {
        b[ind].pb(n / 2);
    }
    forn (i, res.size()) {
        b[res[res.size() - 1 - i].fs].pb(n / 2 + n % 2 + i);
    }
    forn (i, 26) {
        cnt[i] = 0;
    }
    vector<int> p;
    forn (i, n) {
        p.pb(b[s[i]][cnt[s[i]]++]);
//        cerr << p.back() << " ";
    }
    cout << inv(p) << endl;
    return 0;
}


Measured memory_bytes: 5644
fun main(args: Array<String>) {
    val mod = 1000000007
    val (N, K) = readIntList()
    var ans = 0L


    val count = (K..N step K).count().toLong()
    val count2 = if(K %2 == 0) (K/2..N step K).count().toLong() else 0L
    println(count*count*count + count2*count2*count2)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 38476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

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

Measured memory_bytes: 1792
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[20][20];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}
ll dp[20500];
int main() {
	cin >> n;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	ll res = 0;
	for (ll i = 2;; i *= 2) {
		bool flg = 1;
		rep(j, n) {
			if (a[j] % i != 0) {
				flg = 0;
				break;
			}
		}
		if (flg)++res;
		else break;
	}
	cout << res << endl;
}



Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_cum = [0]
B_cum = [0]
for i in range(N):
    A_cum.append(A[i] + A_cum[i])
for i in range(M):
    B_cum.append(B[i] + B_cum[i])
    
book = 0
j = M
for i in range(N+1):
    if A_cum[i] > K:
        break
    while A_cum[i] + B_cum[j] > K:
        j -= 1
    book = max(book, i+j)
    
print(book)

Measured memory_bytes: 47476
/**
 * AtCoder
 * AGC031F
 * Accepted
 * Time: 54ms
 * Memory: 2432k
 */
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;
 
int n, m, q, N, Mod, g;
vector<int> uf;
vector<int> A, B, C;
vector<boolean> f[2];
 
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int _abs(int x) {
    return x < 0 ? -x : x;
}
 
int find(int x) {
    return uf[x] == x ? x : (uf[x] = find(uf[x]));
}
void unit(int x, int y) {
    x = find(x), y = find(y);
    (x ^ y) && (uf[x] = y);
}
 
void init(vector<boolean>& f, int r) {
    f.resize(Mod, false);
    while (!f[r]) {
        f[r] = true;
        r = 4 * r % Mod;
    }
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> q >> Mod;
    uf.resize(N = 6 * n);
    A.resize(m);
    B.resize(m);
    C.resize(m);
    for (int i = 0; i < m; i++) {
        cin >> A[i] >> B[i] >> C[i];
        if (i) {
            g = gcd(g, _abs(C[i] - C[0]));
        }
    }
    if (!g)
        g = Mod;
    Mod = gcd(3 * g, Mod);
    int R = C[0] % g;
    for (int i = 0; i < N; i++)
        uf[i] = i;
    for (int i = 0; i < m; i++) {
        --A[i], --B[i], C[i] = (C[i] - R) / g;
        for (int k = 0; k < 3; k++) {
            for (int r = 0; r < 2; r++) {
                int cs = (k << 1) | r;
                int ns = (((k << 1) + C[i]) % 3) << 1 | (r ^ 1);
                unit(A[i] * 6 + cs, B[i] * 6 + ns);
                unit(A[i] * 6 + ns, B[i] * 6 + cs);
            }
        }
    }
    init(f[0], R);
    init(f[1], R * 2 % Mod);
    while (q--) {
        int s, t, r;
        cin >> s >> t >> r;
        boolean res = false;
        --s, --t;
        for (int k = 0; k < 3; k++) {
            int nv = (r + R - k * g) % Mod;
            (nv < 0) && (nv += Mod);
            for (int p = 0; p < 2; p++) {
                if (find(t * 6) == find(s * 6 + k * 2 + p)) {
                    res = res || f[p][nv];
                }
            }
        }
        cout << ((res) ? ("YES") : ("NO")) << '\n';
    }
    return 0;
}

Measured memory_bytes: 2432
n,k=map(int,input().split())
r,s,p=map(int,input().split())
w=list(input())
l=[]#出す手1r2s3p
ans=0
for i in range(k):
  if w[i]=="r":
    l.append(3)
    ans+=p
  elif w[i]=="s":
    l.append(1)
    ans+=r
  else:
    l.append(2)
    ans+=s
for i in range(k,n):
  if w[i]=="r":
    if l[i-k]==3:
      l.append(0)
    else:
      l.append(3)
      ans+=p
  elif w[i]=="s":
    if l[i-k]==1:
      l.append(0)
    else:
      l.append(1)
      ans+=r
  else:
    if l[i-k]==2:
      l.append(0)
    else:
      l.append(2)
      ans+=s
print(ans)

Measured memory_bytes: 4796
#include<stdio.h>
int main()
{
    int  A,B,C,count=0;
    scanf("%d%d%d",&A,&B,&C);
 
    if((A==B&&A!=C&&B!=C)||(B==C&&B!=A&&C!=A)||(C==A&&C!=B&&A!=B))
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
 
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define reps(i,j,k) for(int i = j;i < k; ++i)
#define rep(i,j) reps(i,0,j)
#define fr first
#define sc second
const int dy[] = {1,0,-1,0};
const int dx[] = {0,1,0,-1};
typedef pair<int,int> Pii;
Pii stage[1010][1010]; // height , score
Pii center;
/*

basic = {T,S,E,N,W,B}



*/
void moveE(int *array){
	int sub[6];
	int idx[] = {4,1,0,3,5,2};
	rep(i,6){
		sub[i] = array[idx[i]];
	}
	rep(i,6){
		array[i] = sub[i];
	}
	return ;
}

void moveN(int *array){
	int sub[6];
	int idx[] = {1,5,2,0,4,3};
	rep(i,6){
		sub[i] = array[idx[i]];
	}
	rep(i,6){
		array[i] = sub[i];
	}
	return ;
}

void moveS(int *array){
	int sub[6];
	int idx[] = {3,0,2,5,4,1};
	rep(i,6){
		sub[i] = array[idx[i]];
	}
	rep(i,6){
		array[i] = sub[i];
	}
	return ;
}

void moveW(int *array){
	int sub[6];
	int idx[] = {2,1,5,3,0,4};
	rep(i,6){
		sub[i] = array[idx[i]];
	}
	rep(i,6){
		array[i] = sub[i];
	}
	return ;
}

void drop(int *state){
	Pii c = center;
	while(true){
		int ma = -1 * 1e9;
		int f = -1;
		if(stage[c.fr][c.sc].sc == 0){
			stage[c.fr][c.sc].fr = state[0];
			stage[c.fr][c.sc].sc = 1;
			break;
		}
		rep(i,4){
			int ny = c.fr + dy[i];
			int nx = c.sc + dx[i];
			if(state[i+1] >= 4 && stage[ny][nx].sc < stage[c.fr][c.sc].sc){
				if(state[i+1] > ma){
					ma = state[i+1];
					f = i;
				}
			}
		}
		if(f != -1){
			c.fr = c.fr + dy[f];
			c.sc = c.sc + dx[f];
			if(f == 0){
				moveS(state);
			}
			else if(f == 1){
				moveE(state);
			}
			else if(f == 2){
				moveN(state);
			}
			else{
				moveW(state);
			}
		}
		else{
			stage[c.fr][c.sc].sc++;
			stage[c.fr][c.sc].fr = state[0];
			break;
		}
	}
	return ;
}

int main(){
	center = Pii(300,300);
	int N;
	while(scanf("%d",&N),N){
		rep(i,1010){
			rep(j,1010){
				stage[i][j].fr = 0;
				stage[i][j].sc = 0;
			}
		}
		
		rep(i,N){
			int t,f;
			scanf("%d%d",&t,&f);
			int state[6];
			state[0] = t;
			state[1] = f;
			state[3] = 7-f;
			state[5] = 7-t;
			if(state[0]==1){
				if(state[1]==2)state[2]=3;
				if(state[1]==3)state[2]=5;
				if(state[1]==5)state[2]=4;
				if(state[1]==4)state[2]=2;
			}
			else if(state[0]==6){
				if(state[1]==2)state[2]=4;
				if(state[1]==3)state[2]=2;
				if(state[1]==5)state[2]=3;
				if(state[1]==4)state[2]=5;
			}
			else if(state[0]==2){
				if(state[1]==1)state[2]=4;
				if(state[1]==3)state[2]=1;
				if(state[1]==4)state[2]=6;
				if(state[1]==6)state[2]=3;
			}
			else if(state[0]==5){
				if(state[1]==1)state[2]=3;
				if(state[1]==3)state[2]=6;
				if(state[1]==4)state[2]=1;
				if(state[1]==6)state[2]=4;
			}
			else if(state[0]==4){
				if(state[1]==1)state[2]=5;
				if(state[1]==5)state[2]=6;
				if(state[1]==2)state[2]=1;
				if(state[1]==6)state[2]=2;
			}
			else if(state[0]==3){
				if(state[1]==1)state[2]=2;
				if(state[1]==5)state[2]=1;
				if(state[1]==2)state[2]=6;
				if(state[1]==6)state[2]=5;
			}
			state[4]=7-state[2];
			drop(state);
			/*rep(i,6){
				printf("%d ",state[i]);
			}
			puts("");*/
		}
		
		int ans[7] = {0};
		rep(i,1010){
			rep(j,1010){
				ans[stage[i][j].fr]++;
			}
		}
		reps(i,1,7){
			printf("%d%c",ans[i],i==6?'\n':' ');
		}
	}
	return 0;
}

Measured memory_bytes: 9156
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll > P;
typedef pair<P,ll>Q;


int main(void){
    string s;
    cin>>s;
    ll n = s.length();
    ll ans = n*(n-1)/2;
    map<char,ll>m;
    for(int i=0;i<n;i++)m[s[i]]++;
    for(auto itr = m.begin();itr!=m.end();++itr){
        ll num = itr->second;
        ans-=num*(num-1)/2;
    }
    cout<<ans+1<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1'000'000'000;
vector<ll> neg, pos;
ll zero_cnt;
ll get_negative(ll num) {
    ll cnt = 0;
    for (auto &val: neg) {
        ll pr = num / val;
        if (pr * val >= num) ++pr;
        cnt += pos.end() - lower_bound(pos.begin(), pos.end(), pr);
    }
    return cnt;
}
ll get_positive(ll num) {
    ll cnt = (ll)pos.size() * (ll)neg.size() + zero_cnt * (pos.size() + neg.size()) + zero_cnt * (zero_cnt - 1) / 2;
    for (int i = 1; i < neg.size(); ++i) {
        ll pr = (num - neg[i] - 1) / neg[i];
        auto ptr = upper_bound(neg.begin(), neg.begin() + i, pr);
        cnt += neg.begin() + i - ptr;
    }
    for (int i = 1; i < pos.size(); ++i) {
        ll pr = (num + pos[i] - 1) / pos[i];
        auto ptr = lower_bound(pos.begin(), pos.begin() + i, pr);
        cnt += ptr - pos.begin();
    }
    return cnt;
}
inline ll get_count(ll num) {
    if (num == 0) return (ll)neg.size() * (ll)pos.size();
    else if (num < 0) return get_negative(num);
    return get_positive(num);
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    ll n, k; cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        ll tmp; cin >> tmp;
        if (tmp < 0) neg.push_back(tmp);
        else if (tmp == 0) ++zero_cnt;
        else pos.push_back(tmp);
    }
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());
    ll left = -(INF * INF), right = INF * INF;
    while (left <= right) {
        ll mid = (left + right) / 2;
        ll cnt = get_count(mid);
        if (mid == left || mid == right) break;
        else if (cnt >= k) right = mid;
        else left = mid; 
    }
    cout << (get_count(left) >= k? right: left) << '\n';
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);++v)
#define FORE(x,c) for(auto &x:c)
#define FOR(v,a,n) for(int v=a;v<(int)(n);++v)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=((int)(n)-1);v>=0;--v)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9; const long long INFLL=1e18;
template<class T> ostream& operator << (ostream &os, const vector<T> &v) {
    ITR(i,v) os<<*i<<(i==end(v)-1?"":"\n"); return os; }
template<class T> istream& operator >> (istream &is, vector<T> &v) {
    ITR(i,v) is>>*i; return is; }
//------------------------------------------------------------------------------

vl get(int m,int n) {
    vl ret;
    for(int i=m; i>0; i--) {
        if(n>=i) {
            n-=i;
            ret.push_back(i);
        }
        if(n==0) break;
    }
    return ret;
}
signed main() {
    ll N;
    cin>>N;
    ll left=0,med,right=1e7+1;
    while(true) {
        med=(left+right)/2;
        if((med*med+med)/2 < N && N <= (med*med+3*med+3)/2) {
            vl ans=get(med+1,N);
            cout<<ans<<endl;
            return 0;
        }
        if(N > (med*med+3*med+3)/2) {
            left=med;
        }
        if((med*med+med)/2 >= N) {
            right=med;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
  
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> vec(n);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    vec.at(a-1)++;
    vec.at(b-1)++;
  }
   rep(i,n) {
    cout << vec.at(i) << endl;
   }
}

Measured memory_bytes: 256
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    int num = 1;

    while(num < b) {
        ans++;
        num += a -1;
    }
    cout << ans << endl;

}

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

int main(){
//srandom((unsigned long)time(NULL));

long long h;
cin>>h;
long long cnt=0;
//3
//1 1
//0 1
//0 0
long long pdc=1;
long long ans=1;
if(h>1){
while(pdc<h){
  cnt++;
  pdc*=2;
  ans+=pdc;
  if(h==pdc){
    cout<<ans<<endl;
    return 0;
  }
}
//cout<<"pdc="<<pdc<<endl;
cout<<ans/2<<endl;
return 0;
}
cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
vector<int> v;
int main(){
    int n,ans;
    cin>>n;
    for(register int i=1;i<=n;++i){
        int x;
        cin>>x;
        if(m[x]==0)v.push_back(x);
        m[x]++;
    }
    for(register int i=0;i<v.size();++i)if(m[v[i]]>=v[i])ans+=m[v[i]]-v[i]; else ans+=m[v[i]];
    cout<<ans;
    return 0;
}

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

int main(){
  int H,W,i,j;

  while(1){
    scanf("%d %d",&H,&W);
    if(H == 0 && W == 0){
      break;
    }

    for(i = 0;i < H;i++){

      for(j = 0;j < W;j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

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

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

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;
const ll INF = 1LL << 60;

int N, K;
vector<ll> H, DP;

inline void input() {
	cin >> N >> K;
	H.resize(N);
	DP.resize(N);
	rep(i, N) cin >> H.at(i);
	rep(i, N) DP.at(i) = INF;
	DP.at(0) = 0;
}

inline void Main() {
  // code
  input();

  rep(i, N) {
  	repi(j, 1, K+1) {
  		if(0 <= i+j && i+j < N)
  			chmin(
  				DP.at(i+j),
  				DP.at(i) + abs(H.at(i) - H.at(i+j))
  			);
  	}
  }

  cout << DP.at(N-1) << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  sort(ALL(a));
  int ans = 0, now = a.front(), num = 1;
  FOR(i, 1, n) {
    if (now != a[i]) {
      if (num & 1) ++ans;
      now = a[i];
      num = 1;
    } else ++num;
  }
  if (num & 1) ++ans;
  cout << ans << '\n';
  return 0;
}


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

int main(){
  int n; cin >> n;
  string s; cin >> s;
  long long r=0, g=0, b=0;
  for(int i = 0; i < n; i++){
  	if(s[i]=='R') r++;
  	else if(s[i]=='G') g++;
  	else b++;
  }
  long long ans = r*g*b;
  
  for(int i = 0; i < n-2; i++){
  for(int j = 1; i+j+j < n; j++){
  	if(s[i]!=s[i+j] && s[i]!=s[i+j+j] && s[i+j]!=s[i+j+j]) ans--;
  }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <string>
#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;

const int MOD=1e9+7;
const int INF=1e10;
const int MAX_N = 1123456;
bool isPrime[MAX_N];
void e(){
  REP(i,MAX_N){
    isPrime[i]=true;
  }
  isPrime[0]=isPrime[1]=false;
  REP(i,MAX_N){
    if(isPrime[i]){
      for(int j = i+i;j<MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
}
bool Is_Prime(int n){
  return isPrime[n];
}
int dp[100005];
signed main(){
  e();
  int n;
  cin>>n;
  vector<int> q(n);
  REP(i,n)cin>>q[i];
  if(Is_Prime(q[0]))dp[0]=1;
  REP(i,n){
    //cout<<dp[i]<<endl;
    if(i+2<n&&q[i]<q[i+2]&&Is_Prime(q[i+2])){
      dp[i+2]+=dp[i];
      dp[i+2]%=MOD;
    }
    if(i+1<n&&q[i]<q[i+1]&&Is_Prime(q[i+1])){
      dp[i+1]+=dp[i];
      dp[i+1]%=MOD;
    }
  }
  cout<<(dp[n-1]+dp[n-2])%MOD<<endl;
  return 0;
}



Measured memory_bytes: 5556
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=(a>b)?(a):(b);
#define chmin(a, b) (a)=(a<b)?(a):(b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PL;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  ll x;
  cin >> x;
  ll a=x/500;
  x-=a*500;
  ll b=x/5;
  
  pt(a*1000+b*5);
  
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a); i < (b); ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1); i >= (b); --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,b)
#define PR1(i,n) PER1(i,n,1)
#define DO(n) RP(__i,n)
template<class T,class U>
bool cmax(T & a, const U & b) {return a < b ? a = b, 1 : 0;}
template<class T,class U>
bool cmin(T & a, const U & b) {return b < a ? a = b, 1 : 0;}

// data type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second

// STL container
typedef vector<int> vi;
typedef vector<ll> vll;
#define SZ(a) ((int)(a).size())
#define ALL(a) begin(a), end(a)
#define CLR(a) (a).clear()
#define BK(a) ((a).back())
#define FT(a) ((a).front())
#define DB(a) (a).pop_back()
#define DF(a) (a).pop_front()
#define PB push_back
#define EB emplace_back

/* I gave you my heart and then you turned around. */
void _BG(const char * s) {cerr<<s<<endl;};
template<class T, class ... TT>
void _BG(const char * s,T a, TT...b)
{
	for (int c = 0; *s && (c || *s != ','); ++s) {
		cerr<<*s;
		for (char x : "([{") c += *s == x;
		for (char x : ")]}") c -= *s == x;
	}
	cerr<<" = "<<a;
	if (sizeof...(b)) {
		cerr<<", ";
        ++s;
    }
    _BG(s,b...);
}
#ifdef PR3PONY
#define BG(...) do { \
	cerr << __PRETTY_FUNCTION__ << ':' << __LINE__ << ": "; \
	_BG(#__VA_ARGS__,__VA_ARGS__); \
} while(0)
#else
#define BG(...)
#endif

/* Reading input is now 20% cooler! */
bool RD() {return 1;}
bool RD(char & a) {return scanf(" %c", &a) == 1;}
bool RD(char * a) {return scanf("%s", a) == 1;}
bool RD(double & a) {return scanf("%lf", &a) == 1;}
bool RD(int & a) {return scanf("%d", &a) == 1;}
bool RD(ll & a) {return scanf("%lld", &a) == 1;}

template<class T, class ... TT>
bool RD(T & a, TT & ... b) {return RD(a) && RD(b...);}

/* Do princesses dream of magic sheep? */
#define DR(T,...) T __VA_ARGS__; RD(__VA_ARGS__)
#define RI(...) DR(int,__VA_ARGS__)

/* For it's time for you to fulfill your output. */
void PT(const char & a) {putchar(a);}
void PT(char const * const & a) {fputs(a, stdout);}
void PT(const double & a) {printf("%.16f", a);}
void PT(const int & a) {printf("%d", a);}
void PT(const ll & a) {printf("%lld", a);}

/* The line will last forever! */
template<char s = ' ', char e = '\n'>
void PL() {if (e) PT(e);}
template<char s = ' ', char e = '\n', class T, class ... TT>
void PL(const T & a, const TT & ... b)
{PT(a); if (sizeof...(b) && s) PT(s); PL<s,e>(b...);}

/* Good Luck && Have Fun ! */
int main()
{
    RI(n,x);
    vector<int> a(n),b(n);
    for (int & t : a)
        cin >> t;
    sort(ALL(a));
    int ans = 0;
    RP(i,n) {
        b[i] = i  == n-1 ? x : min(x,a[i]);
        x -= b[i];
        ans += b[i] == a[i];
    }
    PL(ans);
}


Measured memory_bytes: 256
s = input()
d = []
i = 0
while i < len(s)-1:
    if s[i] == 'B' and s[i+1] == 'C':
        d.append('D')
        i += 2
    else:
        d.append(s[i])
        i += 1
ans = 0
x = 0
for i in range(len(d)):
    if d[i] == 'A':
        x += 1
    elif d[i] == 'D':
        ans += x
    else:
        x = 0
print(ans)

Measured memory_bytes: 10716
import math

n = int(input())
x = list(map(int, input().split()))

s = 0
for i in range(len(x)):
    s += x[i]

s /= len(x)

s = math.floor(s)

m1 = 0
m2 = 0

for i in range(len(x)):
    m1 += math.pow(x[i] - s,2)
    m2 += math.pow(x[i] - s - 1,2)

print(int(min(m1, m2)))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a,b;
cin>>a>>b;
int ans=0;
queue<int> q;
q.push(1);
while(!q.empty()){
    if(q.size()>=b)
        break;
    q.pop();
    ans++;
    for(int i=0;i<a;i++)
        q.push(1);



}
cout<<ans<<endl;
}













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

int main() {
    string str, com, p;
    int q, a, b;

    cin >> str >> q;
    rep(t,q) {
        cin >> com >> a >> b;
        if (com == "print") {
            cout << str.substr(a, b-a+1) << endl;
        } else if (com == "reverse") {
            string tmp = str.substr(a, b-a+1);
            int n = tmp.size();
            rep(i,n) str[i+a] = tmp[n-i-1];
        } else if (com == "replace") {
            cin >> p;
            str = str.replace(a, b-a+1, p);
        }
    }
}


Measured memory_bytes: 3224
// inputに入力データ全体が入る
function Main(input) {
  
    var inp = input.split(" ");
    var a = parseInt(inp[0]);
    var b = parseInt(inp[1]);
    var c = parseInt(inp[2]);
    var d = parseInt(inp[3]);

    var L = a + b;
    var R = c + d;
    if ( L === R ) {
      console.log('%s', 'Balanced');
    } else if ( L > R ) {
      console.log('%s', 'Left');
    } else if ( L < R ) {
      console.log('%s', 'Right');
    }

  }
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  

Measured memory_bytes: 21064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
    // top を加算してからその位置へ挿入
    S[++top] = x;
}

int pop() {
    top--;
    // top が指していた要素を返す
    return S[top+1];
}

int main() {
    int a, b;
    top = 0; // 初期
    char s[100]; // 文字列で入力を受け取る
    while (scanf("%s", s) != EOF ) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a-b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m; cin >> m;
  vector<ll> D(m), C(m);
  ll ans = 0;
  ll cur = 0;
  rep(i, m) {
    cin >> D[i] >> C[i];
    ll sum = D[i]*C[i];
    ll carry = sum/9-(sum%9==0);
    ll rem = (sum%9==0 ? 9 : sum%9);
    ans += C[i]-(i==0)+carry;
    cur += rem;
    if(cur > 9) {
      ans++;
      cur -= 9;
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 6364
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
double factorial(int n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

double dist(pair<int,int> a,pair<int,int> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(9);
    }
} All_init;


int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll>p(n);
    vector<double>a(n,0);
    for(ll i=0;i<n;i++){
        cin>>p[i];
    }
    for(ll i=0;i<n;i++){
        if(p[i]%2==0){
            p[i]/=2;
            a[i]+=0.5;
            a[i]+=p[i];
        //    cout<<a[i]<<endl;
        }
        else if(p[i]%2!=0){
            p[i]/=2;
            p[i]++;
            a[i]=p[i];
        //    cout<<a[i]<<endl;
        }
    }
    if(n==1){
        cout<<a[0]<<endl;
        exit(0);
    }
    double q=0;
    double ans=0.0;
    vector<double>sum(n,0.0);
    for(ll i=0;i<n;i++){
        //cout<<a[i]<<endl;
        q+=a[i];
        sum[i]=q;
        //cout<<sum[i]<<endl;
    }
    if(n==k){
        cout<<sum[n-1]<<endl;
        exit(0);
    }
    for(ll i=0;i<n-k;i++){
        ans=max(ans,(double)(sum[i+k]-sum[i]));
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main()
{
	// 入力
	uint64_t num;
	cin >> num;

	uint64_t cnt = 1;

	while( num > 0 )
	{
		num /= 2;
		cnt *= 2;
	}

	// 出力
	cout << cnt -1 << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e5+5;

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

    ll N;
    cin >> N;

    string a = "";

    for(char i='A'; i<='Z'; i++)
    {
        a += i;
    }

    for(char i='A'; i<='Z'; i++)
    {
        a += i;
    }

    string S;
    cin >> S;

    ll len = sz(S);

    for(ll i=0; i<len; i++)
    {
        cout << a[S[i]-'A'+N];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
program road_to_millionaire
  implicit none
  integer :: n, i, k = 1, m = 2
  integer(8) :: x = 1000, a(80) = 0, b(80) = 0
  logical :: f1, f2
  read(*,*) n
  read(*,*) a(1:n)
  do while (k <= n - 1 .and. a(k) >= a(k + 1))
    k = k + 1
  end do
  if (k == n) then
    write(*,'(i0)') 1000
    stop
  end if
  b(1) = a(k)
  b(2) = a(k + 1)
  do i = k + 2, n
    f1 = b(m - 1) < b(m) .and. b(m) <= a(i)
    f2 = b(m - 1) > b(m) .and. b(m) >= a(i)
    if (.not.(f1 .or. f2)) m = m + 1
    b(m) = a(i)
  end do
  do i = 1, m - mod(m, 2), 2
    x = x / b(i) * b(i + 1) + mod(x, b(i))
  end do
  write(*,'(i0)') x
end program road_to_millionaire

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

int main() {
  int H, W, M;
  cin >> H >> W >> M;
  vector<int> A(H), B(W);
  set<pair<int, int>> object;
  for(int i = 0; i < M; i++) {
    int h, w;
    cin >> h >> w;
    A.at(h - 1)++;
    B.at(w - 1)++;
    object.insert(make_pair(h - 1, w - 1));
  }
  int maxa = 0;
  int maxb = 0;
  for(int i = 0; i < H; i++) {
    maxa = max(maxa, A.at(i));
  }
  for(int i = 0; i < W; i++) {
    maxb = max(maxb, B.at(i));
  }
  vector<int> vecA, vecB;
  for(int i = 0; i < H; i++) {
    if(A.at(i) == maxa) {
      vecA.push_back(i);
    }
  }
  for(int i = 0; i < W; i++) {
    if(B.at(i) == maxb) {
      vecB.push_back(i);
    }
  }
  int64_t la = vecA.size();
  int64_t lb = vecB.size();
  if(la * lb > M) {
    cout << maxa + maxb << endl;
  }
  else {
    for(int i = 0; i < vecA.size(); i++) {
      for(int j = 0; j < vecB.size(); j++) {
        if(!object.count(make_pair(vecA.at(i), vecB.at(j)))) {
          cout << maxa + maxb << endl;
          return 0;
        }
      }
    }
    cout << maxa + maxb - 1 << endl;
  }
}

Measured memory_bytes: 23756
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

N = int(input())
A = list(map(int, input().split()))

## Logic

C = Counter(A)
X = 0
for i in range(10**5):
    X = max(X,C[i]+C[i+1]+C[i+2])
print(X)



Measured memory_bytes: 83264
n,m = map(int, input().split())
if n*n <= m:
  k = n
  while k*k <= m:
    if m%k == 0:
      print(m//k)
      exit()
    k += 1
else:
  n = m//n

k = n
while True:
  if m%k == 0:
    print(k)
    exit()
  k -= 1

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <map>
#include <queue>
#include <vector>
#include <climits>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pos;
const ll MOD = 1000000007,N=100010;
ll n, a[N], ans, dp[N][2];
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		if (i == 1) { dp[i][0] = a[i]; dp[i][1] = -INT_MIN; }
		else {
			dp[i][0] = max(dp[i - 1][0] + a[i], dp[i - 1][1] + a[i]);
			dp[i][1] = max(dp[i - 1][0] - 2 * a[i - 1] - a[i], dp[i - 1][1] + 2 * a[i - 1] - a[i]);
		}
	}
	cout << max(dp[n][0], dp[n][1]) << endl;
	return 0;
}

Measured memory_bytes: 2560
n = list(input())

qtd = 0
ma = 0
let = ['A','C','G','T']

for i in range(len(n)):
    if(n[i] in let):
        qtd+=1
    else:
        ma = max(ma,qtd)
        qtd = 0
ma = max(qtd,ma)
print(ma)



Measured memory_bytes: 3060