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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

lli fn2(lli h, lli w, lli z)
{
  lli x = (h / 2) * w;
  lli y = ((h + 1) / 2) * w;
  return max({x, y, z}) - min({x, y, z});
}

lli fn(lli h, lli w)
{
  lli mn = 1LL << 60;
  for (int i = 1; i < h; ++i) {
    lli a = fn2(h - i, w, i * w);
    lli b = fn2(w, h - i, i * w);
    setmin(mn, min(a, b));
  }
  return mn;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int h, w;
  while (cin >> h >> w) {
    cout << min(fn(h, w), fn(w, h)) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int w, h;
int sly, slx, sry, srx;
string s[1000];
string t[1000];
bool f[60][60][60][60];

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };

bool is_area(int y, int x) {
	return y >= 0 && y < h&&x >= 0 && x < w;
}

bool solve() {
	bool res = false;
	queue<pair<P, P>> que;
	que.push({ { sly,slx },{ sry,srx } });
	while (!que.empty()) {
		pair<P, P> pp = que.front();
		que.pop();
		ll ly = pp.first.first, lx = pp.first.second,
			ry = pp.second.first, rx = pp.second.second;
		if (f[ly][lx][ry][rx])continue;
		f[ly][lx][ry][rx] = 1;
		rep(i, 4) {
			ll nly = min((ll)h, max((ll)0, ly + dy[i])),
				nry = min((ll)h, max((ll)0, ry + dy[i])),
				nlx = min((ll)w, max((ll)0, lx + dx[i])),
				nrx = min((ll)w, max((ll)0, rx + dx[i]));
			if (is_area(nly, nlx) && is_area(nry, nrx)) {
				if (s[nly][nlx] != t[nry][nrx]) {
					if (s[nly][nlx] == '%' || t[nry][nrx] == '%')continue;
					if (s[nly][nlx] == '#') {
						if (!f[ly][lx][nry][nrx]) {
							que.push({ { ly, lx },{ nry, nrx } });
						}
					}
					else if (t[nry][nrx] == '#') {
						if (!f[nly][nlx][ry][rx]) {
							que.push({ { nly, nlx },{ ry, rx } });
						}
					}
				}
				else {
					if (s[nly][nlx] == '%')res = true;
					else if (s[nly][nlx] == '.') {
						if (!f[nly][nlx][nry][nrx]) {
							que.push({ { nly, nlx },{ nry, nrx } });
						}
					}
				}
			}
		}
	}
	return res;
}

int main() {
	while (cin >> w >> h&&w + h) {
		rep(i, 60)rep(j, 60)rep(k, 60)rep(l, 60) {
			f[i][j][k][l] = 0;
		}
		rep(i, h) {
			cin >> s[i] >> t[i];
			reverse(ALL(t[i]));
		}
		rep(i, h) {
			rep(j, w) {
				if (s[i][j] == 'L') {
					sly = i, slx = j;
					s[i][j] = '.';
				}
				if (t[i][j] == 'R') {
					sry = i, srx = j;
					t[i][j] = '.';
				}
			}
		}
		if (solve())cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 19076
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

function<void(int,int)> tensi_no_3p=[&](int v,int d){
};

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	ll N;
	cin >> N;
	vector<ll> A(N), cum(N + 1);
	rep(i, N) cin >> A[i];
	rep(i, N) cum[i + 1] = A[i] + cum[i];
	map<ll, ll> app;
	rep(i, N + 1) app[cum[i]]++;
	ll ans = 0;
	for (auto &&a : app) {
		ans += (ll)a.second * (a.second - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 15872
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
ll longinf=1ll<<60;
int inf=1<<29;

ll N,M;
ll A[100002];
ll B[100002];
ll S[100002];
map<ll,ll> mp;


int main(){
    cin>>N>>M;
    rep1(i,N){
        cin>>A[i];
    }
    S[0]=0;
    B[0]=0;
    rep1(i,N){
        S[i]=S[i-1]+A[i];
        B[i]=S[i]%M;
    }
    rep0(i,N+1){
        mp[B[i]]++;
    }
    ll ans=0;
    rep0(i,N+1){
        if(mp[B[i]]>0){
            ans+=((mp[B[i]]*(mp[B[i]]-1))/2);
            mp[B[i]]=-1;
        }
    }
    cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6528
a = list(input())
b = []
for i,j in enumerate(a):
    if j == str("0"):
        b += str("0")
    elif j == str("1"):
        b += str("1")
    elif j == str("B"):
        if not b:
            pass
        else:
            del b[len(b)-1]
        
print("".join(b))

Measured memory_bytes: 8992
h,w = map(int,input().split())
n = int(input())
A = list(map(int,input().split()))
area = [[0]*w for i in range(h)]
cnt = 1
inv = 1
for i in range(h):
    for j in range(w):
        if inv ==1:
            area[i][j] = str(cnt)
        else:
            area[i][-j-1] = str(cnt)
        if A[cnt-1] != 1:
            A[cnt-1] -=1
        else:
            cnt+=1
    inv *= -1
for i in range(h):
    print(" ".join(area[i]))


Measured memory_bytes: 3700
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
ans = 0

if n % 2 == 0:
    c5 = 0
    c2 = 0
    for i in range(30,0,-1):
        c5 += i*(n//(2*5**i) - n//(2*5**(i+1)))
    for i in range(60,0,-1):
        c2 += i*(n//(2**i) - n//(2**(i+1)))
    ans = min(c5, c2)

print(ans)

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

using namespace std;

int main() {
	int n;
	char s[51];
	cin >> n >> s;
	int len = strlen(s);
	int ct=0;
	for (int i=0; i<len-2; i++) {
		if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ct ++;
	}
	cout << ct;
}


Measured memory_bytes: 256
def main():
    h,w = map(int, input().split())
    maze = [input() for _ in range(h)]
    dp = [[1] * w for _ in range(h)]
    for i,s in enumerate(maze):
        for j,t in enumerate(s):
            if t == '#':
                dp[i][j] = 0
            elif i == 0 and j == 0:
                dp[i][j] == 1
            elif i == 0:
                dp[i][j] = dp[i][j-1]
            elif j == 0:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = dp[i-1][j] + dp[i][j-1]
    ans = dp[h-1][w-1] % (10**9+7)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 208620
def get_prods
  sums = [1]
  1.upto(N_MAX) do
    sums << (sums[-1] * 2) % MOD
  end
  sums
end

def classify(fishes)
  ab0 = 0
  a0 = []
  b0 = []
  prod_minus = []
  prod_plus = []

  fishes.each do |fish|
    if fish[0].zero? && fish[1].zero?
      ab0 += 1
      next
    elsif fish[0].zero?
      a0 << fish
      next
    elsif fish[1].zero?
      b0 << fish
      next
    end

    gcd = fish[0].gcd(fish[1])
    fish.map! { |f| f / gcd }
    if fish[0] * fish[1] < 0
      fish.map!(&:abs)
      prod_minus << fish.reverse
    else
      fish.map!(&:abs)
      prod_plus << fish
    end
  end
  [ab0, a0, b0, prod_minus, prod_plus]
end

MOD = 10**9 + 7
N_MAX = 2 * (10**5)
MINUS = 10**6

prods = get_prods

N = gets.chomp.to_i
fishes = readlines.map { |line| line.chomp.split.map(&:to_i) }

ab0, a0, b0, prod_minus, prod_plus = classify(fishes)

hash = Hash.new(0)
hash[[0, 0]] = a0.size + b0.size * MINUS

prod_plus.each { |a| hash[a] += 1 }
prod_minus.each { |a| hash[a] += MINUS }

ans = 1

hash.values.each do |a|
  plus = a % MINUS
  minus = a / MINUS
  ans = (ans * (prods[plus] + prods[minus] - 1)) % MOD
end

puts (ans - 1 + ab0) % MOD

Measured memory_bytes: 64880
#include <bits/stdc++.h>
using namespace std;
long long n,m,i,j,l[200005],r[200005],mil[200005][19],mir[200005][19],x,y,aa[200005],d,lg[200005],ans;
long long fndl(long long x){if (l[x]==x) return x;return l[x]=fndl(l[x]);}
long long fndr(long long x){if (r[x]==x) return x;return r[x]=fndr(r[x]);}
struct f
{
	long long x,id;
}a[200005];
bool cmp(f x,f y){return x.x<y.x;}
void merge(long long x,long long y)
{
	if (x>y) swap(x,y);
	l[fndl(y)]=fndl(x);
	r[fndr(x)]=fndr(y);
}
long long ql(long long x,long long y)
{
	if (x>y) return 1ll<<60;
	long long k=lg[y-x+1];
	return min(mil[x][k],mil[y-(1<<k)+1][k]);
}
long long qr(long long x,long long y)
{
	if (x>y) return 1ll<<60;
	long long k=lg[y-x+1];
	return min(mir[x][k],mir[y-(1<<k)+1][k]);
}
bool isb(long long x,long long y)
{
	long long f=min(ql(1,fndl(x)-1)+qr(fndl(x),fndr(x)),qr(fndr(x)+1,n)+ql(fndl(x),fndr(x)));
	if (f<y) return 0;
	if (f==y) return 1;
	if (f>y) exit(-1);
}
void solve(long long x)
{
	long long i,j;
	for (i=fndl(x)-1;i>=1;i=fndl(i)-1)
	{
		long long d=ql(fndl(i),fndr(i))+qr(fndl(x),fndr(x));
		if (isb(i,d))
		{
			merge(i,x);
			ans+=d;
		}
		else break;
	}
	for (i=fndr(x)+1;i<=n;i=fndr(i)+1)
	{
		long long d=qr(fndl(i),fndr(i))+ql(fndl(x),fndr(x));
		if (isb(i,d))
		{
			merge(i,x);
			ans+=d;
		}
		else break;
	}
}
int main()
{
	scanf("%lld%lld",&n,&m);
	lg[1]=0;
	for (i=2;i<=n;i++) lg[i]=lg[i/2]+1; 
	for (i=1;i<=n;i++) 
	{
		scanf("%lld",&aa[i]);
		a[i].x=aa[i];
		a[i].id=i;
		mil[i][0]=aa[i]-i*m;
		mir[i][0]=aa[i]+i*m;
	}
	for (j=1;(1<<j)<=n;j++)
	{
		for (i=1;i+(1<<j)-1<=n;i++)
		{
			mil[i][j]=min(mil[i][j-1],mil[i+(1<<(j-1))][j-1]);
			mir[i][j]=min(mir[i][j-1],mir[i+(1<<(j-1))][j-1]);
		}
	}
	sort(a+1,a+n+1,cmp);
	for (i=1;i<=n;i++) l[i]=r[i]=i;
	for (i=1;i<=n;i++) solve(a[i].id);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 72064
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

class rmq_seg{
    const int MAX_SEG;
    int seg_len;
    vector<int> segtree;
    public:
        rmq_seg(int N, int def) : MAX_SEG(10000000), segtree(MAX_SEG), seg_len(1){
            while(seg_len < N)seg_len *= 2;
            rep(i,MAX_SEG)segtree[i] = def;
        }

        void update(int l, int r, int k){
        	l += seg_len-1;
        	r += seg_len-1;
        	while(l<r){
        		if(l % 2 == 1){segtree[l] = max(segtree[l], k); ++l;}
        		l /= 2;
        		if(r % 2 == 1){segtree[r-1] = max(segtree[r-1], k); --r;}
        		r /= 2;
        	}
        }

        int get(int k){
            k += seg_len-1;
            int res = -1;
            while(k > 0){
                res = max(res, segtree[k]);
                k /= 2;
            }
            return res;
        }
};

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i,N)cin >> a[i];
    rmq_seg seg(8000000, 0);
    vector<int> ans(N);
    rep(i,N){
        ans[i] = seg.get(a[i]+1) + 1;
        seg.update(max(1, a[i] - K + 1), a[i] + K + 2, ans[i]);
        //cout << line << endl;
        //rep(i,10){cout << seg.get(i+1) << ' '; cout << endl;}
    }
	int res = 0;
	rep(i,N)res = max(res, ans[i]);
    cout << res << endl;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        a.at(i)--;
    }
    for(int i=0;i<n;i++){
        cin >> b.at(i);
    }
    for(int i=0;i<n-1;i++){
        cin >> c.at(i);
    }
    int ans=b.at(a.at(0));
    //cout << ans << endl;
    for(int i=1;i<n;i++){
        ans += b.at(a.at(i));
        if(a.at(i)==a.at(i-1)+1) ans += c.at(a.at(i-1));
        //cout << "ans=" << ans << endl;
    }    
    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma region Header
#define _CRT_SECURE_NO_WARNINGS
#define FOR(i,s, e) for(int i = s; i<e; ++i)
#define rFOR(i,s, e) for(int i=s; i>=e; --i)
#define loop(len) for(int i=0; i<len; ++i)
#define rloop(len) for(int i=len-1; i>=0; --i)
#define iPair pair<int,int>
#define LPair pair<ll,ll>
#define vecP(t,t2) vector<pair<t,t2>>
#define uoMP(t, t2) unordered_map<t, t2>
#define pb push_back
#define pp pop_back
#define beg_end(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define MrN ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long  ll;
typedef long double  ld;
#include<bits/stdc++.h>
using namespace std;
#pragma endregion

ll n, w;
const ll Size = 1e6 + 5;
ll DP[Size], sum_values, ans;

int main() {
	MrN;
	//freopen("input.txt", "r", stdin);
	cin >> n >> w;

	vector<int> values(n), weights(n);

	loop(n)
		cin >> weights[i] >> values[i];

	loop(n)
		sum_values += values[i];

	loop(Size)
		DP[i] = INT_MAX;

	DP[0] = 0;

	loop(n){
		rFOR(j, sum_values - values[i], 0)
			DP[j + values[i]] = min(DP[j+ values[i]], DP[j] + weights[i]);
	}

	loop(Size)
		if(DP[i] <= w)
			ans = max(ans, (ll) i);


	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 11464
#include<bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define mer make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pair<int,int>,int> piii;
typedef pair<int,pair<int,int> > ipii;
typedef pair<pii,pii> pi4;
const int vbi=999999999;

/*void cin_bin(){
	char bin[10000];
	gets(bin);
}*/

vector<int> jz10_2(int a){
	vector<int> ans;
	while(a!=0){
		ans.pb(a%2);
		a/=2;
	}
	reverse(ans.begin(),ans.end());
	return ans;
}

int main(){
	//my English name is Veex
	//clock_t start1=clock();
	int n,k;
	cin>>n>>k;
	int b=(n-1)*(n-2)/2;
	if(k>b){
		cout<<-1;
		return 0;
	}
	int m=n-1;
	int sum=b-k;
	m+=sum;
	cout<<m<<endl;
	for(int i=2;i<=n;i++)
		cout<<1<<' '<<i<<endl;
	for(int i=2;i<n&&sum;i++)
		for(int j=i+1;j<=n&&sum;j++){
			cout<<i<<' '<<j<<endl;
			sum--;
		}
	//cout<<endl<<((double)(clock()-start1)/CLOCKS_PER_SEC);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int h,w;std::cin>>h>>w;
    std::vector<std::vector<int>>grid(h,std::vector<int>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            char c;std::cin>>c;
            grid.at(i).at(j)=c=='#';
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(!grid.at(i).at(j))continue;
            if(0<i&&grid.at(i-1).at(j))continue;
            if(i<h-1&&grid.at(i+1).at(j))continue;
            if(0<j&&grid.at(i).at(j-1))continue;
            if(j<w-1&&grid.at(i).at(j+1))continue;
            std::cout<<"No"<<std::endl;
            exit(0);
        }
    }
    std::cout<<"Yes"<<std::endl;
}

Measured memory_bytes: 256
n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())
  
def ans(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = ans(i + 1, m) or ans(i + 1, m - A[i])
    return res
          
for j in range(0, q):
    if ans(0, m[j]):
        print "yes"
    else:
        print"no"

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

int main(){
    int n;
    cin >> n;
    double ans = 0;
    for(int i = 0; i < n; i++)
    {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") {
            ans += x;
        }
        else
        {
            ans += x*380000.0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <math.h>
# include <time.h>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define MAXN 250
# define eps 1e-3
# define MAXM 500005
# define MOD 1000000007
# define INF 1000000000
# define MIN(a,b) (a)>(b)?(b):(a)
# define MAX(a,b) (a)<(b)?(b):(a)
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
typedef long long LL;
typedef unsigned long long ULL;

int main()
{
    char a[1000],b[1000],c[1000];
    cin>>a>>b>>c;
    printf("%c%c%c",a[0]-32,b[0]-32,c[0]-32);
    return 0;
}






















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

using namespace std;

int main(){

    // It's one of two elements though right? 

    // So I think we need to sort these ... we do ... 
    // Is it just one of two values?

    // Do we need to do the sum like maths is fun ... ? No because we are always removing one so always be odd. 

    // 6
    // 5 5 4 4 3 3
    // 3 3 4 4 5 5
    // 4 4 4 4 4 4
    


    // needs to maintain original indexes ...
    // vector< vector<int> > indexes 


    // 4

    // 2 4 4 3

    // 2 3 4 4

    // 4 3 3 4

    // 4 4 3 3 


    // 

    int n;
    cin >> n;

    map< int, vector<int> > indexes;
    
    int original[n];
    int nums[n];
    
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
        original[i] = nums[i];
    }

    sort(nums, nums + n);

    for (int i = 0; i < n; i++) {
        indexes[nums[i]].push_back(i + 1);
    }

    int med1 = nums[(n / 2) - 1];
    int med2 = nums[(n / 2)];

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

        int org_num = original[i];
        int org_indx = indexes[original[i]][0];
        indexes[original[i]].erase(indexes[original[i]].begin());

        // cout << " i : " << i + 1 << " n : " << n << " (n / 2) + 1 : " << (n / 2) + 1 << " (n / 2) : " << (n / 2) << endl; 
        // cout << " original[i] : " << org_num << " org_indx : " << org_indx << endl;

        if (org_indx == (n / 2) + 1){
            cout << med1 << endl;
        }
        else if (org_indx == (n / 2)){
            cout << med2 << endl;
        }
        else if (org_indx < (n / 2) + 1){
            cout << med2 << endl;
        } else {
            cout << med1 << endl;
        }

    }


    return 0;
}

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

int main(){
	string s;
	cin >> s;
	vector<bool> a(26,true);
	for(char c : s) {
		if(a[c-'a'] == false) {
			cout << "no" << endl;
			return 0;
		}
		a[c-'a'] = false;
	}
	
	printf("yes\n");
}


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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(2e3) + 17;

int n;
ll x;
ll a[MAXN], res[MAXN];

bool read() {
    if (!(cin >> n >> x))
        return false;

    forn (i, n)
        cin >> a[i];

    return true;
}

void solve() {
    for (int i = 0; i < n; ++i) {
        auto cur = a[i];
        res[0] += a[i];

        for (int j = 1; j < n; ++j)
            res[j] += cur = min(cur, a[(i - j + n) % n]);
    }

    ll ans = INF * INF;

    forn (i, n)
        ans = min(ans, i * x + res[i]);

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    srand(time(nullptr));
    
#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	int R = rei();
	int G = rei();
	int B = rei();
	int N = rei();
	int ans = 0;
	for(int i=0;i<=N;i++){
		for(int j=0;j<=N;j++){
			int c = R*i + G*j;
			if(N >= c && (N-c) % B == 0){
				ans++;
			}
		}
	}
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
set<int> st;
map<int,vector<int>> graph;
void dfs(int i){
    //printf("inserting %d\n",i);
    if(graph[i].size()==0) return;
    //printf("inserting %d\n",i);
    if(st.count(i)==0){
        st.insert(i);
        for(int j=0;j<graph[i].size();j++){
            dfs(graph[i][j]);
        }
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        //printf("%d %d\n",a,b);
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    long long int count=0;
    for(int i=1;i<=n;i++){
        if(st.count(i)==0){
            count++;
            //printf("count=%d\n",count);
            dfs(i);      
        }
    }
    printf("%lld\n",count-1);
    return 0;
}

Measured memory_bytes: 20880
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque, defaultdict
from fractions import gcd
from functools import reduce
from itertools import groupby, combinations
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return list(map(lambda x: x + d, A))
def ldec(A, d=1): return list(map(lambda x: x - d, A))

S = s1()
T = s1()

m = 10**6
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            cnt += 1
    if m > cnt:
        m = cnt

print(m)


Measured memory_bytes: 72968
N = int(input())
li = [input() for i in range(N)]
liM = []
liA = []
liR = []
liC = []
liH = []
for i in range(N):
  if li[i][0] == 'M':
    liM.append(li[i])
  elif li[i][0] == 'A':
    liA.append(li[i])
  elif li[i][0] == 'R':
    liR.append(li[i])
  elif li[i][0] == 'C':
    liC.append(li[i])
  elif li[i][0] == 'H':
    liH.append(li[i])
M = len(liM)
A = len(liA)
R = len(liR)
C = len(liC)
H = len(liH)
ans = M*(A*(R+C+H)+R*(C+H)+C*H) + A*(R*(C+H)+C*H) + R*C*H
print(ans)

Measured memory_bytes: 10772
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long A = GetLong();
		long B = GetLong();
		long C = GetLong();
		WriteLine(Min(B / A, C));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27392
/*
  ある通貨について、時刻 t における価格 Rt (t=0,1,2,,,n−1)が入力として与えられ、その価格の差 Rj−Ri (ただし、j>i とする) の最大値を求めるプログラム
*/
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i, n, num, max, min;

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

  min = num;
  for( i = 1; i<n; i++ )
    {
      scanf("%d", &num);
      if( i == 1 )
	max = num - min;
      if( max < num - min )
	max = num - min;
      if( min > num )
	min = num;
    }
  
  printf("%d\n", max);

  return 0;
}



Measured memory_bytes: 2144
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
	int r, g, b, s;
	cin >> r >> g >> b;
	s = r * 100 + g * 10 + b;
	cout << (s % 4 == 0 ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();

    let mut v: Vec<isize> = vec![0; 3];
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let u: Vec<isize> = s.trim().split(' ').map(|x| x.parse().unwrap()).collect();
        let t = u[0] - v[0];
        let d = (u[1] - v[1] + u[2] - v[2]).abs();
        if t < d || (t - d) % 2 == 1 {println!("No"); return;}
        v = u;
    }
    println!("Yes");
}



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

int main() {
    int N; cin >> N;
    map<int, int> prime;
    for (int i = 2; i <= N; i++) {
        int n = i, j = 2;
        while (n > 1) {
            if (n % j == 0) {
                prime[j]++;
                n /= j;
            } else {
                j++;
            }
        }
    }
    int a = 0, b = 0, c = 0, d = 0, e = 0;
    for (pair<int, int> x : prime) {
        if (x.second >=  2) a++;
        if (x.second >=  4) b++;
        if (x.second >= 14) c++;
        if (x.second >= 24) d++;
        if (x.second >= 74) e++;
    }
    cout << b * (b-1) * (a - 2) / 2 + c * (b - 1) + d * (a - 1) + e << endl;

}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

string s;

signed main() {
    cin >> s;
    for(auto _ : s) cout << "x";
    cout << endl;
}




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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 10000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

string s;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    int n = s.size();
    string tmp;
    rep(i, 4) tmp += s[i];
    if (tmp == "YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

N = int(input())
#N, M = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]

def n2a(n):
    return chr(n - 1 + ord("a")) if n else "z"
    
answer = ""
while N:
    answer += n2a(N % 26)
    N -= 1
    N //= 26
print(answer[::-1])

Measured memory_bytes: 65476
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string s, t;

int main() {
    cin >> s >> t;
    
    bool flg = true;
    vector<char> salp(26, '.');
    vector<char> talp(26, '.');
    for(int i = 0; i < s.length(); ++i) {
        char ss = s.at(i); char tt = t.at(i);
        int sint = ss - 'a';
        int tint = tt - 'a';

        if(salp.at(sint) != '.' || talp.at(tint) != '.') {
            // cout << "s " << salp.at(sint) << " t " << talp.at(tint) << endl;
            if(salp.at(sint) != tt || talp.at(tint) != ss) {
                flg = false;
                break;
            }
        }
        salp.at(sint) = tt;
        talp.at(tint) = ss;
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 776
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int D = inpt[0];
        int N = inpt[1];

        int num = 1;
        for (int i = 0; i < D; i++)
        {
            num = num * 100;
        }

        int ans = 0;

        for (int i = 0; i < N; i++)
        {
            ans += num;
        }
        if(N == 100) {
            ans += num;
        }
        Console.WriteLine(ans);
    }


    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"
 
 
 
 
 
2 85
 
 
";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    double ans = 0;
	int n;
	double x;
	string u;
	cin >> n;
	REP(i,n){
		cin >> x >> u;
		if(u[0] == 'J') ans += x;
		else ans += x * 380000.0;
	}
    cout << ans << endl;
}

Measured memory_bytes: 256
H, W, A, B = map(int, input().split())
answer = 0
mod = 1000000007
factorial = [1]
for n in range(1, H+W):
    factorial.append(factorial[n-1]*n%mod)
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y//2) ** 2 % mod
    else:
        a = power(x, y//2) ** 2
        return a * x % mod
inverseFactorial = [0] * (H+W)
inverseFactorial[H+W-1] = power(factorial[H+W-1], mod-2)
for n in range(H+W-2, -1, -1):
    inverseFactorial[n] = inverseFactorial[n+1] * (n+1) % mod
def combi(n, m):
    return factorial[n] * inverseFactorial[m] *inverseFactorial[n-m]%mod

for i in range(B+1, W+1):
    answer = (answer + combi(H-A-2+i, i-1)*combi(A+W-i-1,W-i)) % mod
print(answer)

Measured memory_bytes: 18988
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

const long MOD = 998244353;

int main()
{
    long a,b,c,d;
    cin >> a >> b >> c >> d;
    long dp[c+1][d+1];
    dp[a][b] = 1;
    for (long i = a; i < c; i++)
    {
        dp[i+1][b] = dp[i][b] % MOD * b % MOD;
    }
    for (long j = b; j < d; j++)
    {
        dp[a][j+1] = dp[a][j] % MOD * a % MOD;
    }

    for (long i = a; i < c; i++)
    {
        for (long j = b; j < d; j++)
        {
            dp[i+1][j+1] = ( (dp[i][j+1] * (j+1) + dp[i+1][j] * (i+1))%MOD - (dp[i][j] * (i*j))%MOD + MOD ) % MOD;
        }
    }
    cout << dp[c][d] << endl;
}


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

void solve(char* cs){
    cout << cs[0] - '0' + cs[1] - '0' + cs[2] - '0' << endl;
}
 
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    char cs[3];
    scanf("%s", cs);
    solve(cs);
    return 0;
}


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

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;
using veb = vector<bool>;
using qul = queue<ll>;

void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

int binary_search(ll x, vel a){
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin() ;
    } else {
        return -1;
    }

}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

int main() {
    string S;
    ll count = 0;
    cin >> S;
    if(S == "SSS"){
        cout << 0 << endl;
    } else if(S == "RSS" || S == "SRS" || S == "SSR" || S == "RSR"){
        cout << 1 << endl;
    } else if(S == "RRR") {
        cout << 3 << endl;
    } else {
        cout << 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
// D - Practical Skill Test
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,n) for(int i=0;i<(n);i++)

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

	vi HH(H*W+1), WW(H*W+1), DD(H*W+1);

	rp(h,H){
		rp(w,W){
			int a; cin>>a;
			HH[a] = h+1;
			WW[a] = w+1;
			DD[a] = 0;
		}
	}

	for(int pre=1; pre<H*W; ++pre){
		int now = pre + D;
		if(now > H*W) break;
		int hb = HH[pre], wb = WW[pre], d = DD[pre];
		int ha = HH[now], wa = WW[now];
		d += abs(hb-ha) + abs(wb-wa);
		DD[now] = d;
	}

	int Q; cin>>Q;
	while(Q--){
		int l,r; cin>>l>>r;
		int dl = DD[l], dr = DD[r];
		cout<< dr - dl <<endl;
	}
}

Measured memory_bytes: 2176
import sys
input = sys.stdin.readline

def main():
    N=int(input())

    tax_free = int(N / 1.08)
    tax_free_2 = tax_free + 1

    result = tax_free if int(tax_free*1.08) == N else (tax_free_2 if int(tax_free_2*1.08) == N else ":(")
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,int> pi;
typedef tuple<int,int,int> piii;
const int INF=10000000;
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define all(x) (x).begin(), (x).end()


const int N = 1000000;  
  
int n,m,k; // array size 
  
// Max size of tree 
ll tree[2 * N]; 
  
// function to build the tree 
void build( ll arr[])  {  
    // insert leaf nodes in tree 
    for (int i=0; i<n; i++)     
        tree[n+i] = arr[i]; 
      
    // build the tree by calculating parents 
    for (int i = n - 1; i > 0; --i)      
        tree[i] = tree[i<<1] + tree[i<<1 | 1];     
} 
  
// function to update a tree node 
void updateTreeNode(int p, int value) {  
    // set value at position p 
    tree[p+n] = value; 
    p = p+n; 
      
    // move upward and update parents 
    for (int i=p; i > 1; i >>= 1) 
        tree[i>>1] = tree[i] + tree[i^1]; 
} 
  
// function to get sum on interval [l, r) 
int query(int l, int r) {  
    int res = 0; 
      
    // loop to find the sum in the range 
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) 
    { 
        if (l&1)  
            res += tree[l++]; 
      
        if (r&1)  
            res += tree[--r]; 
    } 
      
    return res; 
} 
  

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> m >> k;
  vector<ll> temp(m+1);
  vector<ll> x(m);
  vector<ll> rs(m+1);

  for (int i=0; i<m; i++){
    cin >> x[i];
    x[i]-=k;
  }

  for (int i=0; i<m; i++){
    rs[i+1]=rs[i]+x[i];
    temp[i+1]=temp[i]+x[i];
  }


  // for(ll i: temp) cout<<i<<" ";
  // cout<<endl; 

  sort(temp.begin(),temp.end());

  // for (ll i: temp) cout<<i<<" ";
  // cout<<endl; 

  map<ll,int> pointer;
  int idx=0;
  for (ll i: temp){
    if (pointer.find(i)==pointer.end()){
      pointer[i]=idx;
      idx++;
    }
  }




  ll a[idx+1];
  ll b[idx+1];
  for (int i=0; i<idx+1; i++){
    a[i]=0;
    b[i]=0;
  }



  build(a);
  n=sizeof(a)/sizeof(a[0]);



  ll ans=0;
  for (ll i: rs){
    int index=pointer[i];
    ans+=query(0,index+1);
    //cout<<i<<" "<<ans<<endl;
    
    updateTreeNode(index,b[index]+1);
    b[index]++;



  }

  cout<<ans<<endl;


  






} 


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

using namespace std;

const int N = 5005;
const int md = 1e9 + 7;

int add(int x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
  if (x < 0) {
    x += md;
  }
  return x;
}

inline void sadd(int &x, int y) { x = add(x, y); }

int dp[2][N][N];
int pref[2][N][N];
int sum[2][N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, A, B;
  cin >> n >> A >> B;
  if (A > B) swap(A, B);
  dp[0][0][0] = dp[1][0][0] = 1;
  pref[0][0][0] = pref[1][0][0] = 1;
  sum[0][0] = sum[1][0] = 1;
  for (int i = 1; i <= n; i++) {
    sum[0][i] = sum[0][i - 1];
    sum[1][i] = sum[1][i - 1];
    for (int j = 0; j < min(i + 1, B); j++) {
      if (j >= A) {
        dp[0][i][j] = pref[1][i - j][i - A];
      }
      if (j == 0) {
        dp[0][i][j] = add(sum[1][i - 1], i >= A ? -sum[1][i - A] : 0);
      }
      dp[1][i][j] = pref[0][i - j][i - 1];
      sadd(sum[0][i], dp[0][i][j]);
      sadd(sum[1][i], dp[1][i][j]);
    }
    for (int t : {0, 1}) {
      for (int d = 0; d <= i; d++) {
        pref[t][d][i] = add(pref[t][d][i - 1], dp[t][i][i - d]);
      }
    }
  }
  int res = 1;
  for (int i = 0; i < n; i++) {
    sadd(res, res);
  }
  for (int r = 0; r < B; r++) {
    sadd(res, -dp[0][n][r]);
    sadd(res, -dp[1][n][r]);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 270780
def main():
    _ = int(input())
    D = [int(i) for i in input().split()]
    ans = 0
    cnt = [0]*24
    from collections import Counter
    c = Counter(D)
    cnt[0] = 1
    s = [0]*13
    for k, v in c.items():
        if v >= 3:
            ans = 0
            return print(ans)
        elif k == 0 or k == 12:
            cnt[k] += v
        elif v >= 2:
            cnt[k] += 1
            cnt[24 - k] += 1
        else:
            s[k] += 1
    if any(c >= 2 for c in cnt):
        return print(0)
    for bit in range(1 << 11):
        cur = cnt[:]
        for i in range(11):
            if s[i+1]:
                if bit & (1 << i):
                    cur[24 - (i+1)] += 1
                else:
                    cur[i+1] += 1
        pre = 0
        mi = 24
        for i, ne in enumerate(cur[1:] + [1], start=1):
            if ne:
                if i - pre < mi:
                    mi = i - pre
                pre = i
        ans = max(ans, mi)
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 998244353;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}
ll n,m,k;
vector<ll> fact,inv;

ll f(ll a,ll b, ll p){  // a^b mod pを求める
	if (b == 0)return 1;
	else if (b % 2 == 0){
		ll d = f(a,b/2,p);  //a^b = a^(2k) = (a^k)^2  k = b / 2
		return d * d % mod;
	}else{
		return a * f(a,b-1,p) % mod;
	}
}

void init(ll n){
	fact.resize(n+1,1);
	inv.resize(n+1,1);
	for(int i = 2; i <= n; i++)  //　nまでの階乗を求める
		fact[i] = fact[i-1] * i % mod;
	for(int i = 2; i <= n; i++)  //a^(-1) mod p = a^(p-2) mod p  ここをもう少し早くできるぽい
		inv[i] = f(fact[i],mod-2,mod) % mod;
}

ll comb(ll n,ll k){  //n_C_k
	if (n < k) return 0;
	return (fact[n] * inv[k] % mod) * inv[n-k] % mod;
}

ll f(ll k){
	ll ret=1;
	ret *= m;
	ret *= comb(n-1,k);
	ret %= mod;
	ret *= power(m-1, n-1-k);
	ret %= mod;
	return ret;
}

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

	init(n+1);
	ll ans=0;
	rep(i,k+1){
		ans += f(i);
		ans%=mod;
	}

	cout<<ans<<endl;

	return 0;
}

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

#define int long long
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

/*
ifstream ifs("in.txt");
ofstream ofs("out.txt");
#define cin ifs
#define cout ofs
//*/
int a, b;
signed main() {
    cin >> a >> b;
    if (b >= a)
        cout << a << endl;
    else
        cout << a - 1 << endl;
}

Measured memory_bytes: 256