akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <iostream>
#include <queue>
#include <stack>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <cctype>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

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;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using umap = unordered_map<T, U>;
template<class T> using uset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

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

int main() {
	ios_base::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	vi X(N); rep(i, N) cin >> X[i];
	int ans = INF;
	rep(i, N - K + 1) {
		int left = X[i];
		int right = X[i + K - 1];
		if (left < 0) {
			if (right < 0) CHMIN(ans, -left);
			else CHMIN(ans, min(right, -left) * 2 + max(right, -left));
		}
		else {
			CHMIN(ans, right);
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n;
LL a, b;
LL h[N];

bool check(LL x)
{
	LL cnt = 0;
	for (int i = 0; i < n; i ++ )
		cnt += (max(0LL, h[i] - x * b) + a - b - 1) / (a - b);
	return cnt <= x;
}

int main()
{
	scanf("%d%lld%dll", &n, &a, &b);
	for (int i = 0; i < n; i ++ ) scanf("%lld", &h[i]);
	
	int l = 1, r = 0x3f3f3f3f;
	while (l < r)
	{
		int mid = l + r >> 1;
		if (check(mid)) r = mid;
		else l = mid + 1;
	}
	
	printf("%d\n", r);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int N =  2 * 1e3 + 100;
bool was[N] ;
int  a[N] , n  , X ;	
int lvl1 , lvl2;
main(){
	cin >> n;
	n *= 2;
	for(int i = 1 ; i <=  n ; i++){
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	//reverse(a + 1 , a + 1 + n );
	
	for(int i = 1 ; i < n ; i += 2){
		lvl1 += min(a[i] , a[i + 1]);
	}
	cout << lvl1 ;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const int mod = 1000000007;

double dp[3010][3010];

int main(){
	int n, m;
	cin >> n >> m;
	int t = 1900 * m + 100 * (n-m);
	cout << t * pow(2,m) << endl;
	return 0;
}


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

typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 5;
ll fast_pow(ll a, ll b){
	ll ret = 1;
	for(;b;b>>=1){
		if(b&1) ret = ret * a % mod;
		a = a * a % mod;
	}
	return ret;
}
ll inv(ll a){return fast_pow(a, mod-2);}
ll n, a, b;
ll calc(ll x, ll y){
	ll ret = 1;
	ll inv_ret = 1;
	for(ll i=0;i<y;i++) ret = ret * (n - i) % mod;
	for(ll i=1;i<=y;i++) inv_ret = inv_ret * i % mod;
	return ret * inv(inv_ret) % mod;
}
int main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	ll ret = fast_pow(2, n) - 1;
	ret = (ret - calc(n, a) - calc(n, b)) % mod;
	ret = (ret + mod) % mod;
	printf("%lld\n", ret);
	return 0;
}

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

int main(){
  long long n,k,b=0,c=0,ans=0,mod=1000000007;
  cin>>n>>k;
  vector<long long> a(n);
  rep(i,n)cin>>a.at(i);
  rep(i,n){
    for(int j=i;j<n;j++){
      if(a.at(i)>a.at(j))b++;
    }
    rep(j,i){
      if(a.at(i)>a.at(j))c++;
    }
    ans+=(k*(k+1)/2)%mod*(b+c);
    ans-=c*k;
    ans+=mod*2000;
    ans%=mod;
    b=0;c=0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;


int main(){
	ll A,B,N,M; cin >> A >> B >> N;

	if(B <= N){
		cout << ((A * (B-1))/B) - (A * ((B -1) / B)) << endl;
	}
	else{
		cout << ((A * N)/B) - (A * (N / B)) << endl;
	}
	}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
#define pb push_back
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)
cout << fixed << setprecision(2) << 3.14 << endl; //3.1

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

  ll n, m=0, count=0, ans=0,ans2;
  string s;
  ll a,b;

  cin >> a >> b;
  cin >> n;
  if(n>b){
    if(b==1) ans=0;
    else{
      while(m<n){
        m+=b;
      }
      m-=b;
      m--;
      ans2= a*n/b;
      ans2-= a*(n/b);
      chmax(ans,ans2);
      n--;
      ans2= a*n/b;
      ans2-= a*(n/b);
      chmax(ans,ans2);
      ans2= a*m/b;
      ans2-= a*(m/b);
      chmax(ans,ans2);
    }
  }
  else if(n==b){
    n--;
    ans2= a*n/b;
    ans2-= a*(n/b);
    chmax(ans,ans2);
  }
  else if(n<b){
    ans2= a*n/b;
      ans2-= a*(n/b);
      chmax(ans,ans2);
  }

  if(a==1) ans=0;
  if(b==1) ans=0;
  if(n==1) ans = a/b;


  cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	int M,N;
	cin >> N >> M;
	vector<string> A(N), B(M);
	rep(i,N) cin >> A[i];
	rep(i,M) cin >> B[i];
	rep(i, N-M+1) rep(j, N-M+1) {
		bool flag = true;
		rep(k,M) {
			rep(l,M) {
				if (A[i + k][j + l] != B[k][l]) {
					flag = false;
					break;
				}
				if (k == M - 1 && l == M - 1)
				{
					cout << "Yes" << endl;
					return 0;
				}
			}
			if(!flag) break;
		}
	}
	cout << "No" << endl;
	return 0;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  while(1){
    int i=0;
    long long int n;
    scanf("%lld",&n);
    if(n==0){
      break;
    }
    while(n!=1){
      if(n%2==0){
	n=n/2;
      }
      else{
	n=n*3+1;
      }
      i++;
    }
    printf("%d\n",i);
  }
  return 0;
}

Measured memory_bytes: 600
import Control.Monad
import Data.List
main = do
  [n] <- map read . words <$> getLine :: IO [Int]
  if n==1
  then
    putStrLn "Hello World"
  else do
    [a]<- map read . words <$> getLine
    [b] <- map read . words <$> getLine
    print $ a+b

Measured memory_bytes: 508
#include <cstdio>
const int MAXQ = 1E5+5;
int  psum[MAXQ]{ };
int	S[MAXQ]{ };
int l, Q, r;

void init()
{
	S[0] = S[1] = 1;
	for(int i = 2; i < MAXQ; ++i) if(!S[i])
		for(int j = i; j < MAXQ; j += i)
			S[j] = i;
	for(int i = 3; i < MAXQ-1; ++i)
		psum[i] = psum[i-1] + ((S[i] == i) && (S[i+1] == (i+1)>>1));
}

int main()
{
	init();
	scanf("%d", &Q);
	for(int _ = 0; _ < Q; ++_)
	{
		scanf("%d%d", &l, &r);
		printf("%d\n", psum[r]-psum[l-1]);
	}
	return 0;
}

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

using namespace std;

int main() {
    int n, a;
    cin >> n >> a;
    int cards[n];
    int total = 0;
    for (int i = 0; i < n; i++) {
        cin >> cards[i];
        total += cards[i];
    }
    long long dp[n + 1][n + 1][total + 1];
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= total; k++) {
                dp[i][j][k] = 0;
            }
        }
    }
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= total; k++) {
                if (k - cards[i - 1] >= 0 && j > 0) {
                    dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - cards[i - 1]];
                } else {
                    dp[i][j][k] = dp[i - 1][j][k];
                }
            }
        }
    }
    long long count = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= total; j++) {
            if (a * i == j) {
                count += dp[n][i][j];
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 51072
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<utility>
#include<string.h>
#include<queue>
#include<stack>
using namespace std;

typedef long long ll; 
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(void)
{
    char s[105]={};
    char t[105]={};
    scanf("%s\n%s",s,t);
    int len=strlen(s);
    int ju=0;
    REP(i,len)
    {
        ju=1;
        REP(k,len)
        {
            if(s[k]!=t[k+i-len*(k+i>=len)])
            {
                ju=0;
                break;
            }
        }
        if(ju==1)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int i;
    int counter = 0;
    for(i = 0; i < N; i++){
        if(S[i] == 'R'){
            counter++;
        }
    }
    if(2*counter > N){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;
int main(void)
{
    int d, a;
    double x, y, r = 90.0;
    while (scanf("%d,%d", &d, &a))
    {
        if (d == 0 && a == 0)
        {
            break;
        }

        x += d * cos(r * M_PI / 180);
        y += d * sin(r * M_PI / 180);
        r -= a;
    }
    printf("%d\n%d\n", (int)x, (int)y);
    return 0;
}



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

template <typename T>
vector<T> make_vector(size_t sz)
{
	return vector<T>(sz);
}

template <typename T, typename... U>
auto make_vector(size_t sz, U... tail)
{
	return vector<decltype(make_vector<T>(tail...))>(sz, make_vector<T>(tail...));
}

template <typename T>
void fill_vector(vector<T> &vec, T init)
{
	fill(vec.begin(), vec.end(), init);
}

template <typename T, typename U>
void fill_vector(vector<U> &vec, T init)
{
	for_each(vec.begin(), vec.end(), [&](auto &itr) {
		fill_vector(itr, init);
	});
}

int main()
{
	int n;
	cin >> n;
	vector<int> as(n);
	for (auto &a : as)
	{
		cin >> a;
	}

	auto dp = make_vector<long double>(n + 1, n + 1, n + 1);
	fill_vector<long double>(dp, 0);

	auto f = [&](auto &g, int i, int j, int k) {
		if ((i == 0) && (j == 0) && (k == 0))
		{
			return (long double)(0);
		}
		if (dp[i][j][k])
		{
			return dp[i][j][k];
		}
		dp[i][j][k] += n;
		if (i)
		{
			dp[i][j][k] += i * g(g, i - 1, j, k);
		}
		if (j)
		{
			dp[i][j][k] += j * g(g, i + 1, j - 1, k);
		}
		if (k)
		{
			dp[i][j][k] += k * g(g, i, j + 1, k - 1);
		}
		dp[i][j][k] /= (i + j + k);
		return dp[i][j][k];
	};

	f(f, count(as.begin(), as.end(), 1), count(as.begin(), as.end(), 2), count(as.begin(), as.end(), 3));

	cout << fixed << setprecision(20) << dp[count(as.begin(), as.end(), 1)][count(as.begin(), as.end(), 2)][count(as.begin(), as.end(), 3)] << endl;

	return 0;
}

Measured memory_bytes: 431360
k = int(input())


if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    exc = 0
    for i in range(1, 10 ** 8):
        exc = exc * 10 + 7
        exc = exc % k
        if exc % k == 0:
            ans = i
            break
    print(ans)

Measured memory_bytes: 9052
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

//素因数分解
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> res;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n = n / i;
		}
	}
	if (n != 1) {
		res[n] = 1;
	}
	return res;
}

//拡張ユークリッドの互除法
//ax+by=gcd(a, b)の特殊解を計算
//返り値はgcd(a, b)
ll extgcd(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = (a >= 0) ? 1 : -1;
		y = 0;
		return abs(a);
	}
	else {
		ll res = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
		return res;
	}
}


//xとmは互いに素であるとする
//法mにおけるaの逆元とはab%m=1なる唯一のb<m
//逆元（拡張ユークリッド）
//ax+my=1なる(x, y)が求まればax%m=(1-my)%m=1よりb=x
ll mod_inverse(ll a, ll m) {
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

//順列
//nPk mod MODを返す
//f[i]はi!（階乗）mod MODを指す
vector<ll> f(100100, 0);

ll P(ll n, ll k) {
	if (n < k) return 0;
	return (f[n] * mod_inverse(f[n - k], MOD)) % MOD;
}


//組合せ
//nCk mod MODを返す
ll C(ll n, ll k) {
	if (n < 0) return 0;
	return (P(n, k) * mod_inverse(f[k], MOD)) % MOD;
}

signed main() {
	ll n, m;

	cin >> n >> m;

	f[0] = 1;
	FOR(i, 1, 100100) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	ll ans = 1;

	for (auto p : prime_factor(m)) {
		ans *= C(p.second + n - 1, p.second);
		ans %= MOD;
	}

	cout << ans << endl;
}

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

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
typedef long long int ll;
typedef long double ld;

int main() {
	Boost();

	int n, z, w;
	cin >> n >> z >> w;

	vector < int > v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

	int ans = abs(w - v[n - 1]);
	if (n > 1) {
		ans = max(ans, abs(v[n - 1] - v[n - 2]));
	}

	cout << ans;
	return 0;
}

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

using namespace std;

int dp1[100005];
int least[100005];
int n;

int dp(int m){
    if (m == 2)return abs(least[2] - least[0]);
    if (m == 1)return abs(least[1] - least[0]);
    if (dp1[m] > -1) return dp1[m];
    return dp1[m] = min(abs(least[m]-least[m-1])+dp(m-1), abs(least[m]-least[m-2])+dp(m-2));
}


int main()
{

    cin >> n;
    for (int i = 0 ; i < n ; i++){
            scanf("%d", &least[i]);
            dp1[i] = -1;
    }

    cout<<dp(n-1)<<endl;


    return 0;
}


Measured memory_bytes: 2560
function Main(input) {
		let out = 0;
		switch(input.trim()) {
			case 'SSS':
				break;
			case 'SRS':
			case 'RSR':
			case 'RSS':
			case 'SSR':
				out = 1;
				break;
			case 'RRS':
			case 'SRR':
				out = 2;
				break;
			case 'RRR':
				out = 3;
				break;
		}
		console.log(out);
};
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29688
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using P = pair<ll, ll>;

ll m[20][20];

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

struct node
{
    public: ll x;
    public: ll y;

    node(ll xx, ll yy)
    {
        x = xx;
        y = yy;
    }
};

int main(){
    string s,t;
    ll a, b;
    string u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if(u == s)
    {
        a--;
    }
    else
    {
        b--;
    }
    

    cout << a << " " << b << endl;
    return 0;
}

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

namespace AtCoder
{
	public class ABC
	{
		//private const int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start();
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			int r = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			double ans = Math.PI * 2 * r;
			Console.WriteLine(ans);



			Console.Out.Flush();
			System.Diagnostics.Debug.WriteLine(stopwatch.Elapsed);
		}
	}
}


Measured memory_bytes: 27608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9

int w[100+1], v[100+1];
ll dp[101][100001];

int main() {
	int N, W;
	cin >> N >> W;
	for (int i = 1; i <= N; i++) cin >> w[i] >> v[i];

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= W; j++) {
			if (i == 0) dp[i][j] = 0;
			else if (j - w[i] < 0) dp[i][j] = dp[i - 1][j];
			else dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
		}
	}

	cout << dp[N][W] << endl;

	return 0;
}

Measured memory_bytes: 79104
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int N;
	while(scanf("%d",&N) != EOF){

		if(N%2 == 1){
			printf("%d\n",(int)(2*pow(3,N/2)-1));
		}else{
			printf("%d\n",(int)((2*pow(3,(N-1)/2)-2)/4*6+2));
		}
	}

	return 0;
}

Measured memory_bytes: 3240
while True:
    a, op, b = input().split()
    a, b = int(a), int(b)
    if op == '*':
        print(a * b)
    elif op == '+':
        print(a + b)
    elif op == '/':
        print(a // b)
    elif op == '-':
        print(a - b)
    else:
        break


Measured memory_bytes: 5600
#include<stdio.h>
int main()
{
    int h,a,i=0;
    scanf("%d%d",&h,&a);
    if(h%a==0)
        printf("%d",h/a);
    else if(h%a!=0)
        printf("%d",(h/a)+1);
    else if(a>h)
        printf("1");

    return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nfs ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,a,b) for(i=a;i>=b;i--)
#define m_p make_pair
#define p_b push_back
#define MOD 1000000007
#define pl pair<ll,ll>

int main()
{

    nfs;
    ll n,k;
    cin >> n >> k;
    ll arr[n] = {0};
    ll i;
    ll cnt[60] = {0 };

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

        cin >> arr[i] ;
        ll yo = 60 ;
        while(yo--)
        {

            ll one = 1;
            if((one<<yo)&arr[i])
            {

                cnt[yo]++;
            }
        }

    }
    for(i=0;i<60;i++)
    {
        if(cnt[i] > (n-cnt[i]))
        {

            cnt[i] = 0;
        }
        else

        cnt[i] = n- cnt[i];

    }
    vector <ll> hehe;
    for(i=0;i<60;i++)
    {

        hehe.p_b(i);
    }
    ll j;
    ll so_far = 0;
    for(i=0;i<60;i++)
    {


        ll temp =(ll)( cnt[hehe[i]] * pow(2,hehe[i])) ;
        //cout << temp << endl;
        ll cur = i;
        for(j=i+1;j<60;j++)
        {
            ll yayay = (ll)(cnt[hehe[j]] * pow(2,hehe[j]));
           // cout << yayay << endl;

            if(yayay > temp)
            {

                temp = yayay;
                cur = j;
            }
            else if(yayay == temp)
            {
                cur = min(cur,j);

            }

        }

        //cout << cur << endl;
        //cout << "ho" << endl;

        swap(hehe[i],hehe[cur]);
        ll one = 1;
        if(cnt[hehe[i]]==0)
        {

            continue;
        }
        if((so_far|(one<<hehe[i]))<= k)
        {
           // cout <<"chomsky normal form: " << hehe[i] << endl;

            so_far |= (one << hehe[i]);

        }

    }
    //cout << so_far << endl;

    ll ans = 0;
    for(i=0;i<n;i++)
    {

        ans += so_far^arr[i];

    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
import Control.Applicative
import Control.Monad
import Data.List

makeExistCards :: String -> [[String]]
makeExistCards = (map words) . lines

main = do
    lines <- getContents
    let cards = [[x, (show y)] | x <- ["S", "H", "C", "D"], y <- [1..13]]
        existCards = makeExistCards lines
        noExistCards = foldr (\x acc -> delete x acc) cards existCards    

    mapM_ putStrLn $ map unwords noExistCards


Measured memory_bytes: 3656
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			Path[] paths = new Path[m];
			IntStream.range(0, m).forEach(
					// 最長距離を計算するため、距離をマイナスにする
					i -> paths[i] = new Path(scanner.nextInt() - 1, scanner.nextInt() - 1, -scanner.nextLong()));
			long[] distances = new long[n];
			if (bellmanFord(paths, 0, n, distances)) {
				System.out.println("inf");
			} else {
				System.out.println(-distances[n - 1]);
			}
		}
	}

	/**
	 * https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/ を参考に作成
	 * 
	 * @param paths     ノード間の連結パス一覧の配列
	 * @param src       開始ノード
	 * @param n         ノードの数
	 * @param distances 開始ノードから各ノードへの最短距離の配列
	 * @return グラフにはループが含まれているかどうか
	 */
	private static boolean bellmanFord(final Path[] paths, final int src, final int n, final long[] distances) {
		Arrays.fill(distances, Long.MAX_VALUE);
		distances[src] = 0;

		IntStream.range(1, n).forEach(i -> IntStream.range(0, paths.length).forEach(j -> {
			int from = paths[j].from, to = paths[j].to;
			long cost = paths[j].cost;
			if (distances[from] != Long.MAX_VALUE && distances[from] + cost < distances[to]) {
				distances[to] = distances[from] + cost;
			}
		}));

		// マイナスのループが含まれているかどうかを判定
		// 解説に参考して作成
		boolean[] negative = new boolean[n];
		Arrays.fill(negative, false);
		IntStream.range(0, n).forEach(i -> IntStream.range(0, paths.length).forEach(j -> {
			int from = paths[j].from, to = paths[j].to;
			if (distances[from] != Long.MAX_VALUE && distances[from] + paths[j].cost < distances[to]) {
				distances[to] = distances[from] + paths[j].cost;
				negative[to] = true;
			}
			if (negative[from]) {
				negative[to] = true;
			}
		}));
		return negative[n - 1];
	}

	/**
	 * ノード間の一つのパスを表すクラス
	 */
	private static class Path implements Comparable<Path> {
		/** 開始ノード */
		int from;
		/** 終了ノード */
		int to;
		/** 移動コスト */
		long cost;

		Path(int from, int to, long cost) {
			super();
			this.from = from;
			this.to = to;
			this.cost = cost;
		}

		@Override
		public int compareTo(Path path) {
			long costDiff = this.cost - path.cost;
			return (costDiff > 0) ? 1 : (costDiff < 0) ? -1 : 0;
		}
	}
}


Measured memory_bytes: 31696
#include<iostream>
using namespace std;
int main(){
	string s;
	cin >> s;
	string D="dream";
	string E="erase";
	bool ans=true;
	for(int i=0;i<s.length();i++){
		if(s.length()-i<5){
			ans=false;
		}else if(s[i]=='e'){
			for(int j=0;j<5;j++){
				if(E[j]!=s[i+j]) ans=false;
			}
			i+=4;
			if(i<s.length()-1 && s[i+1]=='r') i++;
		}else if(s[i]=='d'){
			for(int j=0;j<5;j++){
				if(D[j]!=s[i+j]) ans=false;
			}
			i+=4;
			if(s.length()-i==3){
				if(s[i+1]=='e' && s[i+2]=='r') i+=2;
			}else if(s.length()-i>3){
				if(s[i+1]=='e' && s[i+2]=='r' && s[i+3]!='a') i+=2;
			}
		}else{
			ans=false;
		}
		if(!ans) break;
	}
	if(ans) cout << "YES" << endl;
	else cout << "NO" << endl;
}


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

typedef pair<int, int> P;

map<P, int> py2idx;
vector<P> pys;

vector<P> ans(100000);
int main() {
  int n, m; cin >> n >> m;
  rep(i, m) {
    int p, y; cin >> p >> y;
    P py = P(p, y);
    pys.push_back(py);
    py2idx[py] = i;
  }
  sort(pys.begin(), pys.end());
  int prev_p = -1;
  int first = 0, last = 1;
  for (P py: pys) {
    int p = py.first;
    if (p == prev_p) {
      last += 1;
    } else {
      first = p;
      last = 1;
    }
    ans[py2idx[py]] = P(first, last);
    prev_p = p;
  }
  rep(i, m) {
    printf("%06d%06d\n", ans[i].first, ans[i].second);
  }
  return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

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

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// ここに処理を記述

	int N;
	cin >> N;

	string S;
	cin >> S;

	REP(i,S.size()){
		S[i] += N;
		if(S[i] > 'Z'){
			S[i] -= 26;
		}
	}

	cout << S << "\n";

return 0;
}

Measured memory_bytes: 256
num = []
i = 0
roop = gets.to_i

while i < roop
	a = gets
	num = []
	num = a.split(nil)
	num = num.map{|n| n.to_i}
	num.sort!

	if (num[2]**2) == ((num[1]**2) + (num[0]**2))
		puts "YES"
	else
		puts "NO"
	end

	i = i + 1
end

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

ll euclidean_gcd(ll a, ll b) {
	while(1) {
		if(a < b) swap(a, b);
		if(!b) break;
		a %= b;
	}
	return a;
}

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

	ll A,B;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	vector<int> given;

	cin >> A >> B;

	cout << (A*B)/euclidean_gcd(A,B) << endl;
	
	return 0;
}



Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j,ans=0;
	cin>>n;
	map<ll,ll>m;
	for(i=0;i<n;i++){
		cin>>j;
		m[j]++;
		ans+=j;
	}
	ll q;
	cin>>q;
	while(q--){
		ll b,c;
		cin>>b>>c;
		m[c]+=m[b];
		ans+=(c-b)*m[b];
		m[b]=0;
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 9564
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;

int n, A[MAX], s;
int B[MAX], T[VMAX+1];

int solve() {
    int ans = 0;
    
    bool V[MAX];
    for (int i=0; i<n; i++) {
        B[i] = A[i];
        V[i] = false;
    }
    sort(B, B+n);
    for (int i=0; i<n; i++) T[B[i]] = i;
    for (int i=0; i<n; i++) {
        if (V[i]) continue;
        int cur = i;
        int S = 0;
        int m = VMAX;
        int an = 0;
        while(1) {
            V[cur] = true;
            an++;
            int v = A[cur];
            m = min(m, v);
            S += v;
            cur = T[v];
            if (V[cur]) break;
        }
        ans += min(S + (an-2) * m, m + S + (an+1) * s);
    }
    
    return ans;
}

int main() {
    cin >> n;
    s = VMAX;
    for (int i=0; i<n; i++) {
        cin >> A[i];
        s = min(s, A[i]);
    }
    
    int ans = solve();
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3180
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    h, w = i_map()
    str_list = s_row_str(h)

    for i in range(h+2):
        if i == 0 or i == h+1:
            print('#'*(w+2))
            continue
        print('#', end='')
        print(*str_list[i-1],end='')
        print('#')

if __name__ == '__main__':
    main()


Measured memory_bytes: 77140
/******* all required header files *******/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;

/*****All definitions*******/
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define mp make_pair
#define ll long long int
#define pb push_back
#define F first
#define S second
/***************************/

int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	long double a, b;
	cin>>a>>b;
	cout<<int64_t(a*b);
	return 0;
}


Measured memory_bytes: 3748
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, a, b, c);
    int M = max({a, b, c});
    if ((3 * M) % 2 == (a + b + c) % 2) {
        print((3 * M - (a + b + c)) / 2);
    } else {
        print((3 * (M + 1) - (a + b + c)) / 2);
    }
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#include <atcoder/all>

using namespace atcoder;

// #define int long long

void solve() {
	int n, q; cin >> n >> q;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    fenwick_tree<ll> fw(n);
    rep(i, n) {
        fw.add(i, a[i] * 1LL);
    }
    rep(_, q) {
        int t; cin >> t;
        if(t == 0) {
            int p, x; cin >> p >> x;
            fw.add(p, x * 1LL);
        } else {
            int l, r; cin >> l >> r;
            cout << fw.sum(l, r) << endl;
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 10184
/**
 * author: BueVonHun 🐼🎋
 * More Info: https://github.com/Bue-von-hon
**/

#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>

typedef long long ll;
using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define m_p make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define X first
#define Y second

template <class T> T _min(T a,T b){return (a<b ? a : b);}
template <class T> T _max(T a,T b){return (a>b ? a : b);}
template<class T> void read(T& x) {cin >> x;}

int tc;
int main(void) {
    fast_cin();

    string s,t;
    cin >> s >> t;
    int ssz = s.size();
    int tsz = t.size();
    int sol = tsz, cnt;
    for (int i = 0; i < ssz-tsz+1; i++) {
        cnt=0;
        for (int j = 0; j < tsz; j++) {
            if (t[j]!=s[i+j]) cnt++;
        }
        if (sol > cnt) sol=cnt;
    }
    cout << sol;
    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

ll N;
char S[5050];

ll ln[5050],aa[5050];
ll i, j, k, ans;

ll calc(ll b){
    ll i = 1;
    ll j = 0;
    ll ret = 0;
    while(i+b<N){
        aa[i] = 0;
        if(i+ln[i-j]<j+ln[j]){
            ln[i] = ln[i - j];
            if(ret<min(i,ln[i])){
                ret = min(i, ln[i]);
            }
        }else{
            ll k = j + ln[i] - i > 0 ? j + ln[i] - i : 0;
            while(i+k+b<N&&S[k+b]==S[i+k+b])
                k++;
            ln[i] = k;
            if(ret<min(i,ln[i])){
                ret = min(i, ln[i]);
            }
            j = i;
        }
        i++;
        aa[i] = 0b101010;
    }
    return ret;
}
int main(){
    scanf("%lld%s", &N, S);
    fornum(i,0,N){
        ll a = calc(i);
        if(ans<a)
            ans = a;
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} 

#include <iomanip>

template<typename T>
vector<T> Compress(vector<T> &x){
    vector<T> y = x, c;
    sort(ALL(y));
    auto e = unique(ALL(y));
    for(T i: x) c.push_back(lower_bound(y.begin(), e, i) - y.begin());
    return c;
}

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

int N, M; cin >> N >> M;
VI P(M), Y(M); 
VVI comp(N+1);
rep(i, 0, M) {
    cin >> P[i] >> Y[i];
    comp[P[i]].push_back(Y[i]);
}
rep(i, 1, N+1) comp[i] = Compress(comp[i]);
VI n(N+1, 0);
cout << std::setfill('0');
for(int p: P){
    cout << std::setw(6) << p;
    cout << std::setw(6) << comp[p][n[p]] + 1 << "\n";
    ++n[p];
}

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 9344
#include <iostream>
#include <vector>
#include <list>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <iomanip>
#include <queue>
#include <map>
int main()
{
 
	int n; 
	std::cin >> n;

	std::vector<int> p(n);
	for(int i=0; i<n; i++){
		std::cin >> p[i];
	}
	
	int count = 0;
	for(int i=0;i<n;i++){
		if(p[i] != i+1) count++;
	}

	if(count <= 2){
		std::cout << "YES" << std::endl;
	}else{
		std::cout << "NO" << std::endl;
	}
}

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

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

struct edge { int to, cost; edge(int to, int cost) : to(to), cost(cost) {} };
typedef vector<edge> edges;

edges G[3010];
int d[100010];

void dijkstra(int s)
{
    priority_queue<pii, vpii, greater<pii> > pq;
    d[s] = 0;
    pq.push(pii(0, s));
    
    while (pq.size()) {
        pii p = pq.top(); pq.pop();

        int v = p.scd;

        if (d[v] < p.fst) continue;

        for (edge &e : G[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pq.push(pii(d[e.to], e.to));
            }
        }
    }
}

signed main()
{
    omajinai;

    int N, M, K; cin >> N >> M >> K;

    fill_n(d, N + 1, inf);

    rep(i, M) {
        int a, b, l; cin >> a >> b >> l;
        a--, b--;

        G[a].PB(edge(b, l));
        G[b].PB(edge(a, l));
    }

    rep(i, K) {
        int s; cin >> s;
        s--;
        dijkstra(s);
    }

    int ma = -1;

    rep(i, N) {
        for (edge &e : G[i]) {
            ma = max(ma, (int)(d[i] + round(1. * (d[e.to] - d[i] + e.cost) / 2)));
        }
    }

    cout << ma << endl;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long N, std::string S){
    int ans=1;
    char now=S[0];
    REP(i,1,N){
        if(S[i]!=now){
            ans++;
            now=S[i];
        }
    }
    cout<<ans<<endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main(){
    ll a,b,c,d,n,A,B,C,E;
    cin>>a>>b>>c>>d;
    n=b-a+1;
    ll buf=a%c;
    A=((b/c)-(a/c)+1);
    if(buf!=0)A--;
    B=((b/d)-(a/d)+1);
    E=(c*d)/gcd(c,d);
    C=((b/E)-(a/E)+1);
    cout<<n-(abs(A+B)-C)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n,k;
  cin>>n>>k;
  vec p(n);
  vector<double>r(n);
  rep(i,n) {
    cin>>p[i];
    r[i]=(p[i]+1.0)/2.0;
  }
  double sum=0.0,s=0.0;
  queue<double>q;
  rep(i,n){
    s+=r[i];
    q.push(r[i]);
    if(q.size()>k){
      s-=q.front();
      q.pop();
    }
    if(q.size()==k){
      sum=max(s,sum);
    }
  }
  cout<<fixed<<setprecision(10)<<sum<<endl;
}

Measured memory_bytes: 4224