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

int main() {
  int N; cin >> N;
  vector<int> p(3*N);
  for (int i=0; i<3*N; i++) cin >> p[i];
  sort(p.begin(), p.end(), greater<int>());
  long sum=0;
  for (int i=1; i<2*N; i+=2) sum += p[i];
  cout << sum << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int l[100005][26];

int32_t main()
{
	IO_OP;
	memset(l, 0xff, sizeof l);
	string s, t;
	cin >> s >> t;
	for(int i=s.size()-1;i>=0;i--) {
		for(int j=0;j<26;j++)
			l[i][j] = l[i+1][j];
		l[i][s[i]-'a'] = i;
	}	
	for(char c:t) {
		if(l[0][c-'a'] == -1) {
			cout << -1 << endl;
			return 0;
		}
	}
	int lb = 0, ans = 0;

	for(int i=0;i<t.size();i++) {
		int c = t[i] - 'a';
		if(lb >= s.size()) lb = 0;
		if(l[lb][c] != -1) {
			ans += l[lb][c] - lb + 1;
			lb = l[lb][c] + 1;
			continue;
		}
		ans += s.size() - lb;
		lb = 0;
		i--;
	}
	cout << ans << endl;
	
}



Measured memory_bytes: 20944
#include <stdio.h>

int main(void)
{
	int a1;
	int a2;
	int a3;
	char conma;
	int tyouhoukei = 0;
	int hisigata = 0;
	
	while (scanf("%d %c %d %c %d", &a1, &conma, &a2, &conma, &a3) != EOF){
		if ((a1 * a1) + (a2 * a2) == a3 * a3){
			tyouhoukei++;
		}
		else if (a1 == a2){
			hisigata++;
		}
	}
	printf("%d\n%d\n", tyouhoukei, hisigata);
	
	return 0;
}

Measured memory_bytes: 596
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define inf 2248012
#define mp make_pair
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 3e2+3; //AREGLAAAAAAAAR!!!!

int a[MAXN][MAXN];
int esta[MAXN],sport[MAXN];
int main(){ 
	int n,m;
	rii(n,m);
	FOR(i,0,n) FOR(j,0,m) ri(a[i][j]);
	int ans=300;
	FOR(i,0,m){
		FOR(p,0,n){
			FOR(s,0,m){
				if(!esta[a[p][s]]){
					sport[a[p][s]]++;
					break;
				}
			}
		}
		int pm=0;
		FOR(i,0,m) if(sport[i+1]>sport[pm]) pm=i+1;
		esta[pm]=1;
		ans=min(sport[pm],ans);
		FOR(i,0,m) sport[i+1]=0;
	} 
	printf("%d\n",ans);

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int W,H,N;
vector<P> t;
map<int,int> mp;
vector<int> X;

int main(){
  cin>>W>>H>>N;
  t.resize(N);
  
  int ans=0;
  
  for(int i=0;i<N;i++){
    int x,y;
    cin>>x>>y;
    t[i]=P(x,y);
    mp[x]=max(mp[x],y);
    X.push_back(x);
    ans=max(ans,y);
  }
  
  sort(X.begin(),X.end());
  X.erase( unique( X.begin(), X.end() ), X.end() );

  vector<int> u(X.size()+1);
  
  u[X.size()]=0;
  for(int i= (int)X.size()-1;i>=0;i--){
    u[i]=max(u[i+1],mp[ X[i] ]);
  }
    
  for(int i=0;i<(int)X.size();i++){
    ans=min(ans, X[i]+u[i+1]);
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 9156
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <functional>

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

void solve()
{
	int m;
	while(cin >> m, m)
	{
		cin.ignore();
		vector< vector<int> > Point(m); 
		vector<P> Data;
		for(int i = 0; i < m; ++i)
		{
			string s;
			getline(cin, s);
			string temp;
			for(int j = 0; j < s.size(); ++j)
			{
				if('0' <= s[j] && s[j] <= '9')
				{
					temp += s[j];
				}
				else
				{
					stringstream ss;
					int d;
					ss << temp;
					ss >> d;
					Point[i].push_back(d);
					temp = "";
				}
			}
			stringstream ss;
			int d;
			ss << temp;
			ss >> d;
			Point[i].push_back(d);
			Point[i].push_back(0);
			Point[i].push_back(0);

			int sum = 0;
			int strike = 0;
			bool spare = false;
			bool first = true;
			int frame = 1;
			for(int j = 1; j < Point[i].size() - 2; ++j)
			{
				if(Point[i][j] == 10)
				{
					strike = 2;
					sum += 10 + Point[i][j + 1] + Point[i][j + 2];
				}
				else if(Point[i][j] + Point[i][j + 1] == 10)
				{
					spare = true;
					sum += 10 + Point[i][j + 2];
					++j;
				}
				else
				{
					sum += Point[i][j] + Point[i][j + 1];
					++j;
				}
				++frame;
				if(frame == 11)
				{
					break;
				}
			}
			P p;
			p.first = -sum;
			p.second = Point[i][0];
			Data.push_back(p);
		}
		sort(Data.begin(), Data.end());
		for(int i = 0; i < Data.size(); ++i)
		{
			cout << Data[i].second << " " << -Data[i].first << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

// 400012- 128


void oneCase() {
    int x, y, z;
    cin >> x >> y >> z;
    x -= z;
    cout << x / (y + z) << "\n";
}

int main() {
//    std::ios::sync_with_stdio(false);
//    std::cin.tie(nullptr);

    int t = 1;
//    cin >> t;
    while (t--) {
       oneCase();
    }

    return 0;
}


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

int main(){
	int ans;
	
	int n,a,b;
	cin >> n >> a >> b;
	
	ans = min(n*a, b);

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = input()
S = input()
N = int(N)
S_list = list(S)
flg = 0

for i in range(N):
    if flg == 0:
        if S_list[i] == ('x'):
            flg = 1
    elif S_list[i] == ('o'):
        flg = 0
    elif S_list[i] == ('x'):
        flg = 2
        break

if i == N-1:
    if flg < 2:
        i = N

print(i)

Measured memory_bytes: 8548
#include <bits/stdc++.h>
using namespace std;
 
bool chkx(vector<int> a,int x);

int main() {
  char a;
  cin >> a;
  if(isupper(a)){
    cout << 'A' << endl;
  }else {
    cout << 'a' << endl;
  }
}


Measured memory_bytes: 3632
N = int(input())
S = input()
d = [0] * (N+1)
s = [0] * (N+1)
for i, c in enumerate(S):
    if c=="#":
        s[i + 1] = s[i] + 1
        d[i+1] = d[i]
    else:
        s[i + 1] = s[i]
        d[i + 1] = d[i] + 1
#print(s, d)
ans = float("inf")
ddd = d[-1]
for ss, dd in zip(s[:-1],d[1:]):
    ans = min(ans, ss+(ddd-dd))

print(ans)


Measured memory_bytes: 15912
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
int main() {
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(c-a) <= d)
        cout << "Yes";
    else if (abs(a-b) <=d && abs(b-c) <= d)
        cout <<"Yes";
    else
        cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using GraphI = vector<vector<int>>;
using GraphC = vector<vector<char>>;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  int m = 0, tot = 0;
  rep(i, 0, N) {
    cin >> L[i];
    m = max(m, L[i]);
    tot += L[i];
  }

  tot -= m;
  if (m < tot)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

using namespace std;





int main() {
 int a;
  cin>>a;
  int d=1;
  int y=0;
  for(int i=1;i<a+1;i++)
  {
  for(int j=3;j<i+1;j=j+2)
  {
  if(i%j==0){
  d=d+1;
    while(i%j!=0)  i=i/j;
  }

  
  }
      if(d==8)
  {
  y=y+1;
   
  }
     d=1;
  }
  cout<<y;
}




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

int main() {
  int N;
  int64_t a = 2, b = 1, c = 1;
  cin >> N;
  for (int i= 1; i < N; i++) {
    b = b + a;
    a = c;
    c = b;
  }
  cout << b << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
#define MAX 10000000

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll sum=0;
    ll tmp=0;
    int count=0;
    
    rep(i,n){
        if(a[i]<0)count++;
        a[i]=abs(a[i]);
        sum+=a[i];
    }
    ssort(a);
    if(count%2==0){
        cout << sum << endl;
    }else{
        cout << sum-2*a[0] << endl;
    }
}

Measured memory_bytes: 4052
#include <stdio.h>

int main(void)
{
	int W,H,x,y,r,Error=0;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if(x+r <= W){
		if(y+r <= H){
			if(x-r >= 0){
				if(y-r >= 0){
					printf("Yes\n");
				}
				else{
					Error = 1;
				}
			}
			else{
				Error = 1;
			}
		}
		else{
			Error = 1;
		}
	}
	else{
		Error = 1;
	}
	
	if(Error == 1){
		printf("No\n");
	}
	else{}
	
	return 0;
}

Measured memory_bytes: 580
#include<stdio.h>
#include<iostream>
#include<string.h>
#include <iomanip>
#include<math.h>
#include<queue>
#include<vector>
#include<algorithm>
#define Max (int)450
#define MAX2 (int)1e5+5
#define MOD ((int)1e9+7)
using namespace std;



int main(){
	char s[4];
	scanf("%s",s);
	int a = (s[0]-'0')*10+(s[1]-'0');
	int b = (s[2]-'0')*10+(s[3]-'0');
	int f1 = 1, f2 = 1;
	if(a < 1 || a > 12)
		f1 = 0;
	if(b < 1 || b > 12)
		f2 = 0;

	if(f1 == 0 && f2 == 0)
		printf("NA\n");
	else if(f1 == 1 && f2 == 1)
		printf("AMBIGUOUS\n");
	else if(f1 == 1)
		printf("MMYY\n");
	else
		printf("YYMM\n");
	return 0;
}



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

int main() {
 string S,T;
 int A, B;
 string U;
 cin >>S>>T>>A>>B>>U;
 if(U==S) {
   A--;
 }
 else {
   B--;
 }

 cout<<A <<" "<<B;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


int main(){
  
  int l;
  cin>>l;
  bool used[20][20]={};
  vector<int> cost[20][20];
  int msb;
  for(int i=19;i>=0;i--){
    if((l>>i) & 1){
      msb = i;
      break;
    }
  }
  int n=1;
  int m=0;
  for(int i=msb;i>=1;i--){
    REP(j,20){
      REP(k,20){
        if(!used[j][k])continue;
        for(int& c:cost[j][k]){
          c *= 2;
        }
      }
    }
    n++;
    used[n-2][n-1] = true;
    m += 2;
    cost[n-2][n-1].push_back(0);
    cost[n-2][n-1].push_back(1);
    if((l>>(i-1)) & 1){
      //n++;
      //used[n-2][n-1] = true;
      used[0][n-1] = true;
      m++;
      //cost[n-2][n-1].push_back(0);
      cost[0][n-1].push_back((l>>(i-1))-1);
    }
  }
    
  cout<<n<<' '<<m<<endl;
  REP(i,20){
    REP(j,20){
      if(used[i][j]){
        for(int c:cost[i][j]){
          cout<<i+1<<' '<<j+1<<' '<<c<<endl;
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vl a(n),b(n);
	rep(i,n)cin>>a[i]>>b[i];
	vector<pll> v(n);
	rep(i,n) v[i]=pll(a[i]+b[i],i);
	sort(all(v),greater<pll>());
	ll ans=0;
	bool pr=true;
	rep(i,n){
		ans+=(pr?a[v[i].sc]:-b[v[i].sc]);
		pr=!pr;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 3456
// AFTER EDITORIAL

// NOTE: Integer in exact up to 2^53
// (uint32 * uint32) % uint32
const mul_mod = (x, y, m) => {
  const xl = x & 0xffff;
  const xh = x >>> 16;
  const yl = y & 0xffff;
  const yh = y >>> 16;
  const z1 = (((xh * yh) * 2 ** 16) % m) * 2 ** 16;
  const z2 = (xh * yl + xl * yh) * 2 ** 16;
  const z3 = xl * yl;
  return (z1 + z2 + z3) % m;
};

const fastExp = (base, exp, modulo) => {
  let result = 1;
  let base_exp = base;
  while (exp > 0) {
    if (exp & 1) {
      result = mul_mod(result, base_exp, modulo);
    }
    base_exp = mul_mod(base_exp, base_exp, modulo);
    exp = exp >> 1;
  }
  return result;
};

const makeFactorials = (n, modulo) => {
  const a = new Uint32Array(n + 1);
  const a_inv = new Uint32Array(n + 1);
  let k = 1;
  let k_inv = 1;
  a[0] = 1;
  a_inv[0] = 1;
  for (let i = 1; i <= n; i++) {
    const i_inv = fastExp(i, modulo - 2, modulo); // Inverse in Zp*
    k = mul_mod(k, i, modulo);
    k_inv = mul_mod(k_inv, i_inv, modulo);
    a[i] = k;
    a_inv[i] = k_inv;
  }
  return [a, a_inv];
};

const solve = (N, M, debug = 0) => {
  const modulo = 10 ** 9 + 7; // Prime
  const _XX = (x, y) => mul_mod(x, y, modulo);
  const [f, f_inv] = makeFactorials(M, modulo);

  if (debug) {
    for (let i = 0; i < f.length; i++) {
      console.log(i, f[i], f_inv[i], _XX(f[i], f_inv[i]));
    }
  }

  //
  // By inclusion-exclusion principle for the predicates Qi = { (A, B) | Ai = Bi }
  //   ¬⋁_i |Qi| = \sum_I (-1)^|I| |⋀_{i∈I} Qi|
  //             = \sum_k (-1)^k binom(N,k) |Q_I|
  //   where
  //      Q_I = ⋀_{i∈I} Qi = { (A, B) | ∀i ∈ I. Ai = Bi }
  //     |Q_I| = P(M, k) (P(M-k, N-k))^2
  //
  let result = 0;
  for (let k = 0; k <= N; k++) {
    const x = _XX(f[N], _XX(f_inv[N - k], f_inv[k]));
    const y = _XX(f[M], f_inv[M - k]);
    const z = _XX(f[M - k], f_inv[M - N]);
    const w = _XX(z, z);
    const xyw = _XX(x, _XX(y, w));
    if (k % 2) {
      result += modulo - xyw;
    } else {
      result += xyw;
    }
    result %= modulo;
  }
  return result;
};

const main = async (istr, ostr) => {
  const readline = require('readline');
  const it = readline.createInterface({input: istr})[Symbol.asyncIterator]();
  const getLine = async () => (await it.next()).value;
  const getMany = async () => (await getLine()).split(' ');

  const [N, M] = (await getMany()).map(Number);
  const result = solve(N, M);
  ostr.write(`${result}\n`);
};

if (require.main === module) {
  main(process.stdin, process.stdout);
}


Measured memory_bytes: 37964
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {

	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if(r <= x && r <= y && x+r <= W && y+r <= H) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 1160
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n;
    ll ans=0;
    cin>>n;
    vector<ll> l(n);
    rep(i,n) cin>>l[i];
    sort(l.begin(),l.end(),greater<ll>());
    rep(i,n){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]>=l[j]+l[k]) break;
                if((l[i]<l[j]+l[k]) && (l[j]<l[i]+l[k]) && (l[k]<l[i]+l[j])) ans++;
            }
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;
int main(){
    string s;
    cin >> s;
    int count = 0;
    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'S'){
            count = 0;
        }
        else
        {
            count++;
            ans = count;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3624
N, K = map(int,input().split())
H = list(map(int,input().split()))
costs = [float('inf') for _ in range(N)]
costs[0] = 0
for i in range(N):
  for j in range(1,K+1):
    if i-j<0: continue
    costs[i] = min(costs[i], costs[i-j]+abs(H[i]-H[i-j]))
print(costs[-1])

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

using namespace std;
const int N = 2e5, INF = 0x3f3f3f3f3f;

int a[2][N + 5], pos[N + 5], d[2][N][32];

void RMQ_init(int n, int v) {
	for(int i = 1; i <= n; i ++) d[v][i][0] = a[v][i];
	for(int j = 1; (1 << j) <= n; j ++)
		for(int i = 1; i + (1 << j) - 1 <= n; i ++)
			d[v][i][j] = min(d[v][i][j - 1], d[v][i + (1 << (j - 1))][j - 1]);
}

int RMQ(int a, int b, int v) {
	int k = 0;
	while((1 << (k + 1)) <= b - a + 1) k ++;
	return min(d[v][a][k], d[v][b - (1 << k) + 1][k]);
}

struct node {
	int x, L, R;
	bool operator < (const node& A) const {
		return x > A.x; // 注意是 > 号 
	}
};

int main() {
	int n, x;
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) {
		scanf("%d", &x);
		a[i & 1][i] = x;
		a[(i & 1) ^ 1][i] = INF;
		pos[x] = i;
	}
	RMQ_init(n, 0); RMQ_init(n, 1);
	priority_queue<node> Q;
	x = RMQ(1, n, 1);
	Q.push({x, 1, n});
	while(!Q.empty()) {
		node x = Q.top(); Q.pop();
		int v1 = x.x, v2 = RMQ(pos[x.x] + 1, x.R, (pos[x.x] & 1) ^ 1);
		printf("%d %d ", v1, v2);
		v1 = pos[v1], v2 = pos[v2];
		if(x.L != v1) Q.push({RMQ(x.L, v1 - 1, x.L & 1), x.L, v1 - 1});
		if(v1 + 1 != v2) Q.push({RMQ(v1 + 1, v2 - 1, (v1 + 1) & 1), v1 + 1, v2 - 1});
		if(v2 != x.R) Q.push({RMQ(v2 + 1, x.R, (v2 + 1) & 1), v2 + 1, x.R});
	}
	printf("\n");
	return 0;
}

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

#define ll long long
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf (int)(1e18)
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(p) p.begin(), p.end()
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define sz(x) (int)x.size()
#define PI 3.14159265
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void run()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
void solution()
{
    int n, m, t;
    cin >> n >> m >> t;
    set<pair<int, int>> s;
    vi a(n + 1, 0), b(m + 1, 0);
    rep(i, 0, t)
    {
        int x, y;
        cin >> x >> y;
        s.insert({x, y});
        a[x]++;
        b[y]++;
    }

    int maX = *max_element(all(a));
    int maY = *max_element(all(b));
    int ans = maX + maY;
    vector<int> x, y;
    for (int i = 1; i <= n; i++)
    {
        if (a[i] == maX)
        {
            x.pb(i);
        }
    }
    for (int i = 1; i <= m; i++)
    {
        if (b[i] == maY)
        {
            y.pb(i);
        }
    }
    for (auto X : x)
    {
        for (auto Y : y)
        {
            if (s.count({X, Y}) == 0)
            {
                cout << (ans) << endl;
                return;
            }
        }
    }
    ans--;
    cout << ans << endl;
    return;
}
int32_t main()
{
    run();
    solution();
    return 0;
}

Measured memory_bytes: 35064
N,M=map(int,input().split())
A=list(input() for _ in range(N))
B=list(input() for _ in range(M))
ans="No"
for y in range(N-M+1):
    for x in range(N-M+1):
        if A[y][x:x+M]==B[0]:
            cond=True
            for i in range(M):
                if A[y+i][x:x+M]!=B[i]:
                    cond=False
                    break
            if cond:
                ans="Yes"
                break
    if ans=="Yes":
        break
print(ans)

Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws java.lang.Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader((System.in)));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int x = Integer.parseInt(st.nextToken());
        int y = Integer.parseInt(st.nextToken());
        int z = Integer.parseInt(st.nextToken());
        int temp = x;
        x = y;
        y = temp;
        temp = x;
        x = z;
        z = temp;
        System.out.println(x + " " + y + " " + z);
//        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
//        bw.write("\n");
//        bw.close();
    }

}

Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) cin>>v
#define OUT(v) cout<<v<<endl


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

  LL sum = 0;
  FOR(k, K, N)
    sum += N-k;

  FOR(t, K+1, N+1) {
    FOR(s, t+1, N+1) {
      if (s % t >= K) {
        int x = min(t - (s % t), (N - s + 1));
        sum += x;
        s += x - 1;
      } else
        s += K - (s % t) - 1;
    }
  }
  OUT(sum);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;

int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if(a%2==0 ||b%2==0 ||c%2==0 ){
    cout<<0<<endl;
  }
  else{
   ll d= max(a,max(b,c));
  ll e=min(a,min(b,c));
   ll f=a+b+c-d-e;
    cout<<e*f<<endl;
  }
}

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

using namespace std;

const int N = 3e6 + 6, mod = 998244353;

long long powmod(long long b, long long p) {
  long long r = 1;
  for (; p; p >>= 1, b = b * b % mod)
    if (p & 1)
      r = r * b % mod;
  return r;
}

int fact[N], inv[N];

long long C(int n, int k) {
  if (n < 0 || k < 0 || n < k)
    return 0;
  return (1LL * fact[n] * inv[k] % mod) * inv[n-k] % mod;
}

int main() {
  fact[0] = inv[0] = 1;
  for (int i = 1; i < N; ++i) {
    fact[i] = 1LL * i * fact[i-1] % mod;
  }
  inv[N-1] = powmod(fact[N-1], mod-2);
  for (int i = N-2; i > 0; --i) {
    inv[i] = 1LL * (i+1) * inv[i+1] % mod;
  }
  int n, m;
  scanf("%d %d", &n, &m);
  long long ans = C(m * 3 + n-1, n-1);
  for (int i = 2 * m + 1; i <= 3 * m; ++i) {
    int sisa = 3 * m - i;
    long long cur = 1LL * C(sisa + n-2, n-2) * n % mod;
    ans = (ans - cur) % mod;
  }
  for (int i = m+1; i <= n; ++i) {
    int sisa = 3 * m - i;
    if (sisa & 1) continue;
    sisa /= 2;
    long long cur = 1LL * C(n, i) * C(sisa + n-1, n-1) % mod;
    ans = (ans - cur) % mod;
  }
  if (ans < 0)
    ans += mod;
  printf("%lld\n", ans);
  return 0;
}


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

int main() {
    int a,b;cin>>a>>b;
    int c=a+b;
    int d=a-b;
    int e=a*b;
    cout<<max(max(c,d),e)<<endl;
}

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

using namespace std;

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

	vector<int> first;
	vector<bool> flight(N, false);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;

		if (b == N - 1) flight[a] = true;
		if (a == 0) first.push_back(b);
	}

	for (int i : first) {
		if (flight[i]) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

	cout << "IMPOSSIBLE" << endl;

	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
#define MOD 1000000007ll // prime
// How to devide :
// ModInt a(6ll);
// ModInt b(2ll);
// a *= b.exp(MOD-2ll);  -> a/=b;  result: a = 3
struct ModInt{
	ll val;
	ModInt():val(0ll){}
	ModInt(ll v):val(((v%MOD)+MOD)%MOD){}
	ModInt exp(ll y)const{
		if(!y)return ModInt(1ll);
		ModInt a = exp(y/2ll);
		a *= a;
		if(y&1)a*=(*this);
		return a;
	}
	bool operator==(const ModInt& x)const{return val==x.val;}
	inline bool operator!=(const ModInt& x)const{return !(*this==x);}
	bool operator<(const ModInt& x)const{return val<x.val;}
	bool operator>(const ModInt& x)const{return val>x.val;}
	inline bool operator>=(const ModInt& x)const{return !(*this<x);}
	inline bool operator<=(const ModInt& x)const{return !(*this>x);}
	ModInt& operator+=(const ModInt& x){if((val+=x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator-=(const ModInt& x){if((val+=MOD-x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator*=(const ModInt& x){(val*=x.val)%=MOD;return *this;}
	ModInt operator+(const ModInt& x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt& x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt& x)const{return ModInt(*this)*=x;}
};
istream& operator>>(istream&i,ModInt&x){i>>x.val;return i;}
ostream& operator<<(ostream&o,const ModInt&x){o<<x.val;return o;}
ModInt pow(ModInt a,ll x){
	ModInt res = ModInt(1ll);
	while(x){
		if(x&1)res *= a;
		x >>= 1;
		a = a*a;
	}
	return res;
}
const int SIZE = 100100;
ModInt inv[SIZE+10],fac[SIZE+10],facinv[SIZE+10];
// notice: 0C0 = 1 
ModInt nCr(int n,int r){
	assert(!(n<r));
	assert(!(n<0||r<0));
	return fac[n]*facinv[r]*facinv[n-r];
}
void init(){
	fac[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)fac[i]=fac[i-1]*ModInt(i);
	inv[1]=ModInt(1ll);
	for(int i=2;i<=SIZE;i++)inv[i]=ModInt(0ll)-ModInt(MOD/i)*inv[MOD%i];
	facinv[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)facinv[i]=facinv[i-1]*inv[i];
	return;
}
int N;
vector<int> g[100100];
ModInt dp[100100][2];
ModInt rec(int v,int p,int c){
	ModInt ret = ModInt(1ll);
	if(dp[v][c]!=ModInt(-1ll))return dp[v][c];
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]==p)continue;
		int u = g[v][i];
		if(c==0)ret *= rec(u,v,!c);
		else ret *= (rec(u,v,c)+rec(u,v,!c));
	}
	return dp[v][c]=ret;
}
int main(){
	init();
	scanf("%d",&N);
	for(int i=1;i<N;i++){
		int x,y;
		cin >> x >> y;
		x--;y--;
		g[x].pb(y);
		g[y].pb(x);
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<2;j++){
			dp[i][j]=ModInt(-1ll);
		}
	}
	cout << rec(0,-1,0)+rec(0,-1,1) << endl;
    return 0;
}


Measured memory_bytes: 19328
// C++ program to find Excel 
// column name from a given 
// column number 
#include <bits/stdc++.h> 
#define MAX 50 
using namespace std; 

// Function to print Excel column name for a given column number 
void printString(long long int n) 
{ 
	char str[MAX]; // To store result (Excel column name) 
	long long int i = 0; // To store current index in str which is result 

	while (n > 0) { 
		// Find remainder 
		long long int rem = n % 26; 

		// If remainder is 0, then a 'Z' must be there in output 
		if (rem == 0) { 
			str[i++] = 'z'; 
			n = (n / 26) - 1; 
		} 
		else // If remainder is non-zero 
		{ 
			str[i++] = (rem - 1) + 'a'; 
			n = n / 26; 
		} 
	} 
	str[i] = '\0'; 

	// Reverse the string and print result 
	reverse(str, str + strlen(str)); 
	cout << str << endl; 

	return; 
} 

// Driver program to test above function 
int main() 
{ 
		   //   #ifndef ONLINE_JUDGE
	    //  // for getting input from input.txt
	    //  freopen("input.txt", "r", stdin);
	    //  // for writing output to output.txt
	    //  freopen("output.txt", "w", stdout);
	    // #endif
	long long int n;
	cin>>n;
	printString(n); 
	// printString(51); 
	// printString(52); 
	// printString(80); 
	// printString(676); 
	// printString(702); 
	// printString(705); 
	return 0; 
} 


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

int F[100];
int main() {
  F[0] = 1;
  F[1] = 1;

  for (int i = 2; i < 45; ++i) {
    F[i] = F[i-2] + F[i-1];
  }

  int N;
  cin >> N;
  cout << F[N]<<endl;
}

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

typedef long long ll;

int main(){
    ll k,s[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    scanf("%lld",&k);
    printf("%lld",s[k-1]);
    return 0;
}

Measured memory_bytes: 2120
//AtCoder Beginner Contest 063 B
#include <iostream>
#include <string>

using namespace std;

int main() {
	string str;
	cin >> str;
	
	///////////文字がすべて異なればyes//////////////////////////
	for (int i = 0; i < str.length(); i++) {
		for (int j = i+1; j < str.length(); j++) {
			if (str[i] == str[j]) { //同じ文字があれば抜ける
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;

	return 0;
}

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

using namespace std;

int main() {
    long a, b;
    cin >> a >> b;
    b++;
    long d=1, ar=0, br=0, sum=0;
    while (b > 0) {
        ar += (a % 2) * d; br += (b % 2) * d;
        a /= 2; b /= 2;
        long ones = (b - a) * d + max(br-d, 0l) - max(ar-d, 0l);
        sum += (ones % 2) * d;
        d *= 2;
        // cerr << ar << ' ' << br << ' ' << ones << ' ' << d << '\n';
    }
    cout << sum << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(b/a,c)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<vector <int> > people(n, vector<int>(2)), checkpoints(m, vector<int>(2));
    
    for(int i = 0; i < n; i++){
        cin >> people[i][0] >> people[i][1];
    }
    for(int i = 0; i < m; i++){
        cin >> checkpoints[i][0] >> checkpoints[i][1];
    }
    for(int i=0; i<n; i++){
        vector<vector <int> > dist(m, vector<int>(2));
        for(int j=0; j<m; j++){
            dist[j][0]=abs(people[i][0]-checkpoints[j][0])+abs(people[i][1]-checkpoints[j][1]);
            dist[j][1]=j+1;
        }
        sort(dist.begin(), dist.end());
        cout << dist[0][1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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

    ll a[256] = {};

    rep(i,n){
        a[(int)s[i]]++;
    }

    ll ans = 1;
    rep(i,256){
        ans *= a[i]+1;
        ans = ans % 1000000007;
    }

    ans = ans-1;
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
int main(void){
    int n, w[100]={}, s, t, u=1000;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &w[i]);
    }
    for(int i=0; i<n; i++){
        s=0, t=0;
        for(int j=0; j<i; j++){
            s+=w[j];
        }
        for(int j=i; j<n; j++){
            t+=w[j];
        }
        if(fabs(s-t)<u){
            u=fabs(s-t);
        }
    }
    printf("%d", u);
    return 0;
    
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
#include<queue>
#include<cmath>
#include<numeric>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<iomanip>
#include<functional>
#include<bitset>

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

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin>>s;
    int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
    s="";
    int ansbit;
    for(int bit=0;bit<(1<<3);++bit){
        int ans = a;
        ((bit & (1<<0))? ans+=b:ans-=b);
        ((bit & (1<<1))? ans+=c:ans-=c);
        ((bit & (1<<2))? ans+=d:ans-=d);
        if(ans==7) ansbit = bit;
    }
    s.push_back(a+'0');
    ((ansbit & (1<<0))? s.push_back('+'):s.push_back('-'));
    s.push_back(b+'0');
    ((ansbit & (1<<1))? s.push_back('+'):s.push_back('-'));
    s.push_back(c+'0');
    ((ansbit & (1<<2))? s.push_back('+'):s.push_back('-'));
    s.push_back(d+'0');
    s.push_back('=');s.push_back('7');
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
			
int main(){
	int n, tp = 0, hp = 0;
	string tw, hw;
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		cin >> tw >> hw;
		if(tw.length() < hw.length()){
			tw += '0';
		}
		else if(tw.length() > hw.length()){
			hw += '0';
		}
		if(tw == hw){
			tp++;
			hp++;
		}
		for(int j = 0; j < max(tw.length(), hw.length()); j++){
			if(tw[j] > hw[j]){
				tp += 3;
				break;
			}
			else if(tw[j] < hw[j]){
				hp += 3;
				break;
			}
		}
	}
	
	cout << tp << ' ' << hp << endl;
	
	return 0;
}

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

int pow(int n){

        int ans = 1;
        for(int i=0;i<n;i++){
            ans *= 10;
        }
    return ans;

}

int main()
{
    int H,A;
    cin >> H >>A;

    int ans;

    ans = H / A;

    if(H%A != 0){
        cout << ans+1 << endl;
    }else{
        cout << ans <<endl;
    }

    return 0;

}

Measured memory_bytes: 256
import numpy as np
N = int(input())
p_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
dp = np.zeros([N, len(p_list)], dtype=int)
for i in range(2, N+1):
    for j in range(len(p_list)):
        x = p_list[j]
        power = 0
        while i%(x**(power+1)) == 0:
            power += 1
        dp[i-1, j] = dp[i-2, j] + power
factors = dp[-1]
num_g3 = len([1 for x in factors if x >= 2])
num_g5 = len([1 for x in factors if x >= 4])
num_g15 = len([1 for x in factors if x >= 14])
num_g25 = len([1 for x in factors if x >= 24])
num_g75 = len([1 for x in factors if x >= 74])
ans = 0
if num_g3 >= 3 and num_g5 >= 2:
    add = (num_g5*(num_g5-1))//2 * (num_g3-2)
    ans += add
if num_g15 >= 1:
    add = num_g15 * (num_g5-1)
    ans += add
if num_g25 >= 1:
    add = num_g25 * (num_g3-1)
    ans += add
if num_g75 >= 1:
    ans += num_g75
print(ans)

Measured memory_bytes: 12416
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for j in B:
    OK = -1
    NG = N
    while abs(OK-NG) > 1:
        mid = (OK + NG) // 2
        if A[mid] < j:
            OK = mid
        else:
            NG = mid
    A_ko = OK
    #print(OK)
        
    NG = -1
    OK = N
    while abs(NG-OK) > 1:
        mid = (NG + OK) // 2
        if C[mid] > j:
            OK = mid
        else:
            NG = mid
    
    C_ko = N - OK
    #print(C_ko)
    ans += (A_ko+1)*C_ko

print(ans)

Measured memory_bytes: 23328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);

            int l = (m + 1) / 2;
            int r = m / 2;

            for (int i = 1; i <= l; ++i)
            {
                Console.Write(i);
                Console.Write(" ");
                Console.WriteLine(2 * l - (i - 1));
            }
            for (int i = 1; i <= r; ++i)
            {
                Console.Write(i + 2 * l);
                Console.Write(" ");
                Console.WriteLine(2 * m + 1 - (i - 1));
            }
        }
    }
}


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

int main() {
    int N, K;
    cin >> N >> K;
    vector<double> E(N);
    vector<double> dp(N);
    for (int i = 0; i < N; i++)
    {
        int p;
        cin >> p;
        E[i] = double(1+p)/2.0;
    }
    dp[0] = E[0];
    for (int i = 1; i < N; i++)
    {
        dp[i] = dp[i-1] + E[i];
    }
    double tmax = dp[K-1];
    for (int i = 1; i < N-K+1; i++)
    {
        double total = dp[i+K-1] - dp[i-1];
        tmax = max(tmax, total);
    }

    printf("%lf\n", tmax);
}

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

int main() {
	long long int a, b, k ,d ,e, f;
	cin >> a;
	cin >> b;
	cin >> k;
	if (a + b <= k) {
		e = 0;
		f = 0;
	}
	else if (a < k) {
		d = k - a;
		f = b - d;
		e = 0;
	}
	else {
		e = a - k;
		f = b;
	}
	cout << e << " " <<f;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

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

    vector<string> dp[20];
    dp[1] = {"a"};
    for (int i = 1; i < n; i++) {
        for (int j = 0; j <= i; j++) {
            vector<int> p;
            int cnt = 0;
            for (int k = 0; k <= i; k++) {
                if (k < j) {
                    p.push_back(1);
                    cnt++;
                }
                else {
                    p.push_back(0);
                }
            }
            sort(all(p));
            do {
                if (p[0] != 0) continue;
                if (cnt == 0) {
                    string s;
                    for (int k = 0; k <= i; k++) s += 'a';
                    dp[i + 1].push_back(s);
                    continue;
                }
                //cerr << p[0] << p[1] << cnt << " ";
                for (auto u: dp[cnt]) {
                    string s;
                    int idx = 0;
                    for (int k = 0; k <= i; k++) {
                        if (p[k] == 0) s += 'a';
                        else {
                            s += char(u[idx] + 1);
                            idx++;
                        }
                    }
                    dp[i + 1].push_back(s);
                    //cerr << s << " ";
                }
                //cerr << endl;
            } while (next_permutation(all(p)));
        }
    }
    sort(all(dp[n]));
    for (auto i : dp[n]) cout << i << endl;
}

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

using namespace std;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) (int)a.size()
#define fi first
#define se second
#define ar array
#define forn(i, n) for(int i = 0; i < n ; ++i)


typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int > pii;
typedef vector<pii> vpi;
const ll MOD =1e9+7;

void solve(){
	int n, W; cin >> n >> W;
	int w[n],v[n];
	int s = 0;
	forn(i, n)
		cin >> w[i] >> v[i] , s+= v[i];
	vector<ll> dp(s+1,1e18L+10);
	dp[0] =0;
	forn(i, n)
		for(int j= s; j >= v[i] ; --j)
			dp[j] = min(dp[j],dp[j-v[i]]+w[i]);
	int ans =0;
	forn(i, s+1)
		if(dp[i] <= W)
			ans=max(ans,i);
	cout << ans;
}
int main(){
	int t=1;
	//cin >> t;
	while(t--){
		solve();
		cout <<'\n';
	}
}


Measured memory_bytes: 3940
M,D=map(int,input().split())

cn=0
for m in range(1,M+1):
    for d in range(1,D+1):
        d10=d//10
        d1=d-d10*10
        if d1>1 and d10>1 and m==d1*d10:
            cn+=1

print(cn)
    

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<list>
#include<climits>
#include<sstream>
#define endl '\n'
#define ll long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define mod 1000000007
#define mod1 998244353
#define PI acos(-1)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    int n;
    cin>>n;
    if(n%10==3)
      cout<<"bon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8)
      cout<<"pon";
    else
      cout<<"hon";
    return 0;
}

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

int main(){
    int n,l;
    cin >> n;
    vector<int> vec(n);
    int i = 0;
    while(cin >> l){
        vec[i] = l;
        i++;
    }
    long min = *min_element(vec.begin(),vec.end());
    long max = *max_element(vec.begin(),vec.end());
    long long sum = accumulate(vec.begin(),vec.end(),0LL);
    cout << min << " " << max << " " << sum << endl;
}


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

int main(){
  string s;
  cin >> s;
  
  for(int i=0;i<3;i++){
    if(s.at(i) == '1'){
      s.at(i) = '9';
    }else if(s.at(i) == '9'){
      s.at(i) = '1';
    }
  }
  
  cout << s <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string a,b;
  cin>>a>>b;
  a=a+b;
  int n=0;
  rep(i,a.size())n=n*10+a[i]-'0';
  i=1;
  while(i*i<=n)
    if(i*i==n){
      cout<<"Yes"<<endl;
      return 0;
    }else i++;
  cout<<"No"<<endl;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

#define ALL(v) v.begin(), v.end()


int64_t N, X, T;

int main() {
  std::cout << std::fixed << std::setprecision(20);

  cin >> N >> X >> T;

  int64_t ans = 0;
  ans = (N/X)*T;
  if(N%X != 0){
    ans += T;
  }

  cout << ans << endl;

}

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

def main():
    w, a, b = map(int, input().split())

    if a < a+w < b:
        print(b - (a + w))
    elif a <= b <= a + w or a <= b + w <= a + w:
        print(0)
    elif b + w < a:
        print(a - (b + w))

        


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060