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

const int MAX = 2e3 + 10;

typedef long long ll;

int main()
{
  	int left[MAX][MAX],right[MAX][MAX],up[MAX][MAX],down[MAX][MAX];
  	char a[MAX][MAX];

  	int m,n; cin>>m>>n;

  	for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) cin>>a[i][j];

  	for(int i=1;i<=m;i++){
  		for(int j=1;j<=n;j++){
  			if(a[i][j]=='#') left[i][j]=0;
  			else left[i][j] = 1 + left[i][j-1];
  		}
  	}	

  	for(int j=1;j<=n;j++){
  		for(int i=1;i<=m;i++){
  			if(a[i][j]=='#') up[i][j]=0;
  			else up[i][j] = 1 + up[i-1][j];
  		}
  	}

  	for(int i=1;i<=m;i++){
  		for(int j=n;j>0;j--){
  			if(a[i][j]=='#') right[i][j]=0;
  			else right[i][j] = 1 + right[i][j+1];
  		}
  	}

  	for(int j=1;j<=n;j++){
  		for(int i=m;i>0;i--){
  			if(a[i][j]=='#') down[i][j]=0;
  			else down[i][j] = 1 + down[i+1][j];
  		}
  	}

  	int ans=0;

  	for(int i=1;i<=m;i++){
  		for(int j=1;j<=n;j++){
  			int t = left[i][j]+right[i][j]+up[i][j]+down[i][j]-3;
  			ans = max(ans,t);
  		}
  	}	

  	cout<<ans;


}

Measured memory_bytes: 67328
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e3 + 6, M = 1e9 + 7;
ll x[N][N], n, d;
ll sq(ll a)
{
    return (a * a);
}
ll check(ll i, ll j)
{
    ll s = 0, r;
    for (ll k = 0; k < d; k++)
        s += sq(x[i][k] - x[j][k]);
    r = (ll)sqrt(s);
    return (r * r == s);
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll c = 0;
    cin >> n >> d;
    for (ll i = 0; i < n; i++)
        for (ll j = 0; j < d; j++)
            cin >> x[i][j];
    for (ll i = 0; i < n; i++)
        for (ll j = i + 1; j < n; j++)
            c += check(i, j);
    cout << c;
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N, x; scanf("%d%d",&N,&x);
  // N段目は必ず奇数
  int M = 2 * N - 1;
  if((M + 1) / 2 == x) {
    puts("Yes");
    for(int i=0; i<M; i++) {
      printf("%d\n", i + 1);
    }
    return 0;
  }
  else {
    if(x == 1 || x == M) {
      puts("No");
    }
    else {
      puts("Yes");
      if(N == 2) {
        cout << "1\n2\n3\n";
        return 0;
      }
      deque<int> vs1 = {x-2,x,x+1,x-1};
      deque<int> vs2 = {x+2,x-1,x,x+1};
      bool ok1 = 1;
      for(auto e: vs1) if(e <= 0) ok1 = 0;
      if(ok1) {
        bool flag = 1;
        for(int i=1; i<=M; i++) {
          if(x-2==i||x==i||x+1==i||x-1==i) continue;
          if(flag) vs1.push_back(i);
          else vs1.push_front(i);
          flag ^= 1;
        }
        for(auto e: vs1) cout << e << endl;
      }
      else {
        bool flag = 1;
        for(int i=1; i<=M; i++) {
          if(x+2==i||x-1==i||x==i||x+1==i) continue;
          if(flag) vs2.push_back(i);
          else vs2.push_front(i);
          flag ^= 1;
        }
        for(auto e: vs2) cout << e << endl;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <utility>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
const lli inf = 1e18;
typedef pair<lli, lli> pll;

int main(){
    char k[5];
    cin >> k[0] >> k[1] >> k[2] >> k[3];
    for(int i=0; i<3; i++){
        if(k[i]==k[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR (int x) {
	if (x ==1)
		return false;
	if (x == 2)
		return true;
	if (x%2==0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}

using namespace std;
#pragma endregion
signed main() {
	int N, ans=0,x,same=1;
	cin >> N;
	vector <int> a(N);
	rep(i, N)
		cin >> a[i];
	rep(i, N - 1) {
		if (a[i] == a[i + 1])
			same++;
		else {
			ans += same / 2;
			same = 1;
		}
	}
	ans += same / 2;
	cout  << ans;
}

Measured memory_bytes: 256
#include <stdio.h> 
int main(void)
{
int i, j, k, n, m, l, f[128][128], s[128][128];
long a[128][128] = {{0}};
 
scanf("%d %d %d",&n,&m,&l);
 
for(i = 1; i <= n; i++){
for(j = 1; j <= m; j++){
scanf("%d",&f[i][j]);
}
}
 
for(i = 1; i <= m; i++){
for(j = 1; j <= l; j++){
scanf("%d",&s[i][j]);
}
}
 
for(i =1; i <= n; i++){
for(j = 1; j <= l; j++){
for(k =1; k <= m; k++){
a[i][j] += f[i][k] * s[k][j];
}
}
}
 
for(i = 1; i <= n; i++){
for(j = 1; j <= l; j++){
printf("%ld",a[i][j]);
if(j != l)
printf(" ");
}
printf("\n");
}
 
return 0;
}

Measured memory_bytes: 852
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 510000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


int n, q;
string s;
int l[100005], r[100005];
int cnt[100005];

int main() {

	cin >> n >> q >> s;
	rep(i, q) {
		cin >> l[i] >> r[i];
		l[i]--;
		r[i]--;
	}

	rep(i, n) {
		if (i != 0)cnt[i] += cnt[i - 1];
		if (i != n - 1 && s[i + 1] == 'C' && s[i] == 'A') {
			cnt[i]++;
		}
	}

	rep(i, q) {
		cout << cnt[r[i] - 1] - cnt[l[i] - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
N=gets.to_i
path=Array.new(N+1){Array.new}
distance=Hash.new
(N-1).times do
    a,b,c=gets.split.map(&:to_i)
    path[a] << b
    path[b] << a
    distance[[a,b]]=c
    distance[[b,a]]=c
end

Q,K=gets.split.map(&:to_i)

len=Array.new(N+1,-1)
stack=[[nil,K]]

until stack.empty?
    cur=stack.shift
    next if len[cur[1]]!=-1
    if cur[1]==K
        len[K]=0
    else
        len[cur[1]]=len[cur[0]]+distance[[cur[0],cur[1]]]
    end
    path[cur[1]].each do |n|
        stack << [cur[1],n]
    end
end

Q.times do |i|
    x,y=gets.split.map(&:to_i)
    puts len[x]+len[y]
end


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

int main() {
	int A,B;
	cin >> A>> B;
  cout << (A*B%2==0 ? "No" : "Yes") << endl;
}

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    string s;
    cin >> s;
    vector<P> v;
    for (char c : s) {
        int tar = (c - '0');
        if (v.empty()) {
            v.emplace_back(tar, 1);
            continue;
        }

        if (v.back().first == tar) {
            v.back().second++;
        } else {
            v.emplace_back(tar, 1);
        }
    }

    int sum = 0;
    int cnt0 = 0;
    int idx = 0;
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
        if (v[i].first == 0) {
            cnt0++;
            if (cnt0 > K) {
                sum -= v[idx].second;
                idx++;
                if (v[idx-1].first == 1) {
                    sum -= v[idx].second;
                    idx++;
                }
                cnt0--;
            }
        }
        sum += v[i].second;
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int x,y,k;
    cin>>x>>y;
    
    if(x<y){
        k=x;
        x=y;
        y=k;
    }
    while(y!=0){
    x=x%y;
    k=x;
    x=y;
    y=k;
    
    }
    
    cout<<x<<endl;
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>

using namespace std;

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  if (S == T.substr(0, T.length() - 1)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }

    var tmp = mutableListOf<Int>()
    var num = 1
    var isForward = true
    var ans = mutableListOf<String>()

    aa.forEach { a ->
        repeat(a) {
            tmp.add(num)
            if (tmp.size % w == 0) {
                if (isForward) {
                    ans.add(tmp.joinToString(separator = " "))
                } else {
                    ans.add(tmp.reversed().joinToString(separator = " "))
                }
                tmp = mutableListOf()
                isForward = !isForward
            }
        }
        num++
    }

    println(ans.joinToString(separator = System.lineSeparator()))
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

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

template<typename T>
void cmpmax(T* reference, T value) {
	*reference = max(*reference, value);
}

template<typename T>
void cmpmin(T* reference, T value) {
	*reference = min(*reference, value);
}

const ll mod = 1000000007;

static const ll INF = 1e15;

int main() {
	ll a;
	cin >> a;
	string s;
	cin >> s;
	ll lb = 0;
	lb += 100 * (s[0] - '0');
	lb += 10 * (s[2] - '0');
	lb += 1 * (s[3] - '0');
	ll m = a * lb;
	cout << m / 100 << endl;
	return 0;
}
	


Measured memory_bytes: 3624
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 5 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 
    int a , b , k;

    cin>>a>>b>>k;

    bint ans;
    for(int i=1000;i>=0 and k;--i){
        if(a%i==0 and b%i==0){
            k--;
            ans = i;
        }
    }
    cout<<ans<<endl;




    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("bin","r",stdin);
    freopen("bout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;

int n;
vector< pair<int, int> > v;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j < i; j++) {
            if (n % 2 == 0) {
                if (i + j != n + 1) v.push_back(make_pair(i, j));
            } else {
                if (i + j != n && !(i == n && j == n)) v.push_back(make_pair(i, j));
            }
        }
    }

    printf("%d\n", v.size());
    for (int i = 0; i < v.size(); i++) {
        printf("%d %d\n", v[i].X, v[i].Y);
    }
    return 0;
}


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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e11;

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string s, t;
    cin >> t;
    s = "." + t;

    vector<int> b;  // black in [0..i]
    for (int i = 0, bn = 0; i <= n; ++i) {
        if (s[i] == '#') {
            ++bn;
        }
        b.push_back(bn);
    }

    if (b[n] == n) {
        cout << 0 << endl;
        return 0;
    }
    
    vector<int> a;  // [0..i]: .  [i+1..n-1]: #
    for (int i = 0; i <= n; ++i) {
        a.push_back(b[i] + n - i - b[n] + b[i]);
    }
    sort(begin(a), end(a));
    cout << a[0] << endl;    

    return 0;
}


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

int main(){
  int n,m;
  int tmp=0;
  int sum=0,ava=0,cou=0;
  while(scanf("%d,%d",&n,&m) != EOF){
    sum += n * m;
    tmp += m;
    cou++;
  }
  ava = (int)(tmp / (double)cou + 0.5);
  cout << sum << endl << ava << endl;
}

Measured memory_bytes: 1200
#include<cstdio>
#include<cstring>
typedef long long ll;
const int N=2010;
const int P=1e9+7;
int n,K;
int f[N][N],g[N][N];
inline ll Pow(ll x,int y) {ll ret=1; for(;y>0;y>>=1,x=x*x%P) if(y&1) ret=ret*x%P; return ret;}
inline int Add(int x,int y) {x+=y; if(x>=P) x-=P; return x;}
int main() {
  scanf("%d %d",&n,&K);
  f[0][0]=1;
  for(int i=2;i<=n;i++) f[1][i]=1;
  for(int i=n;i>=2;i--) g[1][i]=g[1][i+1]+1; 
  for(int i=2;i<K;i++) {
    for(int j=n-i+1;j>=2;j--) {
      f[i][j]=g[i-1][j];
    }
    for(int j=n-i+1;j>=2;j--) {
      g[i][j]=Add(g[i][j+1],f[i][j]);
    }
  }
  ll ans=0;
  for(int i=2;i<=n-K+2;i++) ans=Add(ans,f[K-1][i]);
  if(K==1) ans=1;
  ans=ans*Pow(2,n-K-1)%P;
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 31232
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();

		int g = 0;
		for ( int i=l; i<=r; i++ ) {
			if ( i%d==0 ) g++;
		}

		System.out.println(g);
	}
}


Measured memory_bytes: 35336
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200010;
const ll mod=1e9+7;
int a[N],b[N],n;
int cnta[N],cntb[N];
int ans[N];

int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=1;i<=n;i++) 
        {
            cin>>a[i];
            //cnta[a[i]]++;
        }
        for(int i=1;i<=n;i++)
        {
            cin>>b[i];
            //cntb[b[i]]++;
        }
        reverse(b+1,b+1+n);
        vector<int> p,q;
        int now=0,cnt=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]!=b[i]) continue;
            cnt++;
            p.push_back(i);
            now=b[i];
        }
        for(int i=1;i<=n;i++)
        {
            if(!cnt) break;
            if(a[i]==b[i]) continue;
            if(a[i]!=now&&b[i]!=now)
            {
                cnt--;
                q.push_back(i);
            }
        }
        if(cnt) return cout<<"No\n",0;
        for(int i=0;i<q.size();i++) swap(b[p[i]],b[q[i]]);
        cout<<"Yes\n";
        for(int i=1;i<=n;i++) cout<<b[i]<<' ';
        cout<<'\n';
    }
    return 0;
}

Measured memory_bytes: 5888
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e5 + 111;
     
using namespace std;

ll n, q, k;

struct matrix{
	ll a[55][55];
	matrix() {}
	void read(){
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				cin >> a[i][j];
	}
	void ans(){
		ll h = 0;
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++){
				h += a[i][j];
				h %= mod;
			}
		cout << h;
	}
	void write(){
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= n; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	void ff(){
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				a[i][j] = 0;
		for (int i = 1; i <= n; i++)
			a[i][i] = 1;
	}
	void operator *= (matrix y){
		ll g[55][55];
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= n; j++){
				ll h = 0;
				for (int q = 1; q <= n; q++){
					h += a[i][q] * y.a[q][j];
					h %= mod;
				}
				g[i][j] = h;
			}
		}
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n; j++)
				a[i][j] = g[i][j];
	}

};

matrix madpow(matrix x, ll b){
	matrix res;
	res.ff();
	while (b){
		if (b & 1)
			res *= x;
		x *= x;
		b >>= 1;
	}
	return res;
}

void solve(){            
	string s;

	cin >> s;

	vector <char> v;

	for (int i = 0; i < sz(s); i++){
		if (s[i] == 'B' && !v.empty())
			v.pop_back();
		else if (s[i] != 'B')
			v.pb(s[i]);
	}

	for (auto i : v)
		cout << i;
}

main(){
    boost;
	                 	
	q = 1;

	while (q--){
		solve();
	}
}


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

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

  cin >> s >> t;
  cin >> a >> b;
  cin >> u;

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

  printf("%d %d", a, b);
}


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

#define INF ((1LL << 31) - 1)

int n;
string s;
map<char, int> mp, tmp;

int main() {
    cin >> n;

    for (char c = 'a'; c <= 'z'; ++c) mp[c] = INF;

    while (n--) {
        cin >> s;

        int size_ = s.size();
        tmp.clear();
        for (int i = 0; i < size_; ++i) {
            tmp[s[i]]++;
        }
        for (char c = 'a'; c <= 'z'; ++c) {
            mp[c] = min(mp[c], tmp[c]);
        }
    }

    string t = "";

    for (char c = 'a'; c <= 'z'; ++c) {
        while (mp[c]--) {
            t += c;
        }
    }

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

    cout << t << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i = (s);i<(int)(n);i++)

int main(){
  int n;
  cin >> n;
  int k = n/100;
  int l = k*111;
  if(n%111 == 0)cout << n << endl;
  else if(n < l)cout << l << endl;
  else cout << l + 111 << endl;
}

Measured memory_bytes: 3524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    private static long[] dp;
    private static long cost(int current, int[] arr, int k){
        if(current >= arr.length) return Long.MAX_VALUE;
        if(current == arr.length - 1) return 0;
        if(dp[current] != -1) return dp[current];
        long ans = Long.MAX_VALUE;
        for(int i = 1; i <= k; i++){
            long x = cost(current + i, arr, k);
            if(x != Long.MAX_VALUE) x += Math.abs(arr[current] - arr[current + i]);
            ans = Math.min(ans, x);
        }
        dp[current] = ans;
        return dp[current];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        // code goes here
        int[] in = nextIntArray(br, 2);
        int n = in[0];
        int k = in[1];
        int[] arr = nextIntArray(br, n);
        dp = new long[n];
        Arrays.fill(dp, -1);
        sb.append(cost(0, arr, k));
        System.out.print(sb.toString());
    }

    private static int nextInt(BufferedReader br) throws IOException{
        return Integer.parseInt(br.readLine());
    }

    private static int[] nextIntArray(BufferedReader br, int n) throws IOException{
        StringTokenizer st = new StringTokenizer(br.readLine());
        int[] arr = new int[n];
        for(int i = 0; i < n; i++){
            arr[i] = Integer.parseInt(st.nextToken());
        }
        return arr;
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}

Measured memory_bytes: 56324
#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)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

vector<int> G[200000];
vector<int> V;

void dfs(int v, int p) {
    for(int u : G[v]) {
        if(u==p) continue;
        V[u] += V[v];
        dfs(u, v);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    REP(i,n-1) {
        int a,b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    V.resize(n);
    REP(i,q) {
        int p,x; cin >> p >> x; p--;
        V[p] += x;
    }
    dfs(0,-1);
    REP(i,n) {
        if(i==n-1) cout << V[i] << endl;
        else cout << V[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 23552
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    S = list(input())
    R = set()
    G = set()
    B = set()

    def MIN(a, b):
        if a > b:
            return b
        else:
            return a
    def MAX(a, b):
        if a > b:
            return a
        else:
            return b

    for i, s in enumerate(S):
        if s == 'R':
            R.add(i)
        elif s == 'G':
            G.add(i)
        else:
            B.add(i)

    b_len = len(B)
    ans = 0
    for r in R:
        for g in G:
            v1 = MIN(r, g)
            v2 = MAX(r, g)
            rg_diff = v2 - v1
            ans += b_len
            if v2 + rg_diff in B:
                ans -= 1
            if v1 - rg_diff in B:
                ans -= 1
            if (r + g) % 2 == 0 and (r + g) // 2 in B:
                ans -= 1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 74436
<?php

class Dice
{
  public $top = 0;
  public $bottom = 0;
  public $north = 0;
  public $east = 0;
  public $south = 0;
  public $west = 0;

  public function toNorth()
  {
    $t = $this->top;
    $this->top = $this->south;
    $this->south = $this->bottom;
    $this->bottom = $this->north;
    $this->north = $t;
  }

  public function toEast()
  {
    $t = $this->top;
    $this->top = $this->west;
    $this->west = $this->bottom;
    $this->bottom = $this->east;
    $this->east = $t;
  }

  public function toSouth()
  {
    $t = $this->top;
    $this->top = $this->north;
    $this->north = $this->bottom;
    $this->bottom = $this->south;
    $this->south = $t;
  }

  public function toWest()
  {
    $t = $this->top;
    $this->top = $this->east;
    $this->east = $this->bottom;
    $this->bottom = $this->west;
    $this->west = $t;
  }

  public function spin()
  {
    $n = $this->north;
    $this->north = $this->west;
    $this->west = $this->south;
    $this->south = $this->east;
    $this->east = $n;
  }

  public function toBottom()
  {
    $this->toNorth();
    $this->toNorth();
  }

  public function toTop($x)
  {
    if ($x == $this->north) $this->toSouth();
    elseif ($x == $this->east) $this->toWest();
    elseif ($x == $this->south) $this->toNorth();
    elseif ($x == $this->west) $this->toEast();
    elseif ($x == $this->bottom) $this->toBottom();
  }
}

$n1 = explode(" ", trim(fgets(STDIN)));
$n2 = explode(" ", trim(fgets(STDIN)));

$dice1 = getDice($n1);
$dice2 = getDice($n2);

sort($n1);
sort($n2);

if ($n1 != $n2) {
  echo "No\n";
  return;
}

$dice2->toTop($dice1->top);
while ($dice1->south != $dice2->south) $dice2->spin();

if ($dice1->north == $dice2->north
  && $dice1->east == $dice2->east
  && $dice1->west == $dice2->west)
  echo "Yes\n";
else
  echo "No\n";

function getDice($n)
{
  $dice = new Dice();
  $dice->top = $n[0];
  $dice->south = $n[1];
  $dice->east = $n[2];
  $dice->west = $n[3];
  $dice->north = $n[4];
  $dice->bottom = $n[5];
  return $dice;
}



Measured memory_bytes: 9348
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
using lll= __int128;
void chmin(map<ll,ll>&mp,ll v,lll x){
  if(v<0)return;
  if(mp.count(v))chmin(mp[v],x);
  else mp[v]=x;
}
void solve(){
  ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;
  map<ll,ll>mp;
  mp[n]=0;
  auto itr=mp.begin();
  while(1){
    ll v=itr->fi;
    if(itr->se>=3*INF)continue;
    if(v==1)break;
    rep(i,-1,2)if((v+i)%2==0)chmin(mp,(v+i)/2,itr->se+d*abs(i)+a);
    rep(i,-2,3)if((v+i)%3==0)chmin(mp,(v+i)/3,itr->se+d*abs(i)+b);
    rep(i,-4,5)if((v+i)%5==0)chmin(mp,(v+i)/5,itr->se+d*abs(i)+c);
    if(itr==mp.begin())break;
    itr--;
  }
  ll res=5*INF;
  for(auto z:mp){
    if(z.fi==0)continue;
    if(LLONG_MAX/z.fi<=d)continue;
    chmin(res,z.fi*d+z.se);
  }
  cout<<res<<endl;
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll t;cin>>t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 4444
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

ll gcd(ll a, ll b) {
    while (b) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    int n, z = 0;
    string s;
    cin >> n >> s;
    for (int i = 2; i < s.length(); i++) if (s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C') z++;
    cout << z;
}


Measured memory_bytes: 3548
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


public class Program
{
    public static void Main(string[] args)
    {
        var s = myRead.readIntArray();
        var ans = (s[0] > s[1]) ? "safe" : "unsafe";
        WriteLine(ans);
    }
}
public static class myRead
{
    public static int readInt() { return int.Parse(ReadLine()); }
    public static long readLong() { return long.Parse(ReadLine()); }
    public static string reatStr() { return ReadLine(); }
    public static int[] readIntArray() { return ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] readLongArray() { return ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] readStrArray() { return ReadLine().Split(' '); }
}


public static class MyMath
{
    public static long Factorical(long n)
    { return n <= 1 ? 1L : n * Factorical(n - 1); }
    public static long Permutation(long n, long m)
    { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
    public static long Combination(long n, long m)
    { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
    public static long Gcd(long n, long m)
    { return n % m == 0 ? m : Gcd(m, n % m); }
    public static long Lcm(long n, long m)
    { return n * m / Gcd(n, m); }
    public static long Pow(long n, long m)
    { return m == 0 ? 1L : m == 1 ? n : n * Pow(n, m - 1); }
}




Measured memory_bytes: 28196
def modinv(val, mod):
    b, u, v = mod, 1, 0
    while b:
        t = val // b
        val = val - t * b
        val, b = b, val
        u = u - t * v
        u, v = v, u
    u = u % mod
    return u


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
total = 0
for item in a:
    total = (total + item) % mod

total = (total * total) % mod

for item in a:
    total = (total - (item * item)) % mod

print(total * modinv(2, mod) % mod)


Measured memory_bytes: 31520
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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 io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll a, b;
    cin >>a >>b;
    ll r = 1;
    
    if (b == 1) {
        mes(0);
        re0;
    }
    
    while(true) {
        if (b <= a*r-(r-1)) {
            break;
        }
        r++;
    }
    
    mes(r);
    

}


Measured memory_bytes: 3608
#include<stdio.h>
int raid(int a,int b,int c,int d)
    {
        if(a+b+c+d==7)
            {printf("%d+%d+%d+%d=7\n",a,b,c,d);}
        else if(a+b+c-d==7)
            {printf("%d+%d+%d-%d=7\n",a,b,c,d);}
        else if(a+b-c-d==7)
            {printf("%d+%d-%d-%d=7\n",a,b,c,d);}
        else if(a+b-c+d==7)
            {printf("%d+%d-%d+%d=7\n",a,b,c,d);}
        else if(a-b-c-d==7)
            {printf("%d-%d-%d-%d=7\n",a,b,c,d);}
        else if(a-b-c+d==7)
            {printf("%d-%d-%d+%d=7\n",a,b,c,d);}
        else if(a-b+c+d==7)
            {printf("%d-%d+%d+%d=7\n",a,b,c,d);}
        else if(a-b+c-d==7)
            {printf("%d-%d+%d-%d=7\n",a,b,c,d);}
    }
int main()
{
    int a,b,c,d,true=1;
    scanf("%d",&a);
    if(true)
    {
        d=a%10;
        a/=10;
    }
    if(true)
    {
        c=a%10;
        a/=10;
    }
    if(true)
    {
        b=a%10;
        a/=10;
    }
    raid(a,b,c,d);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head=1, tail, n;

void enqueue(P x){
  Q[tail] = x;
  if(tail != LEN){
    tail++;
  }else{
    tail = 1;
  }
}

P dequeue(){
  P x;
  x = Q[head];
  if(head != LEN){
    head++;
  }else{
    head=1;
  }
  return x;
}


int main(){
  int elaps = 0, c, min;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  tail=n+1;

  while(head != tail){
    u = dequeue();

    if(q<u.t){
      elaps += q;
      u.t -= q;
      enqueue(u);
    }else{
      elaps += u.t;
      u.t = 0;
      printf("%s %d\n", u.name,elaps);
    }

  }

  return 0;
}

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

int main () {
    string s;
    cin >> s;
    int sum=0;
    
    for (int i =0; i < 4; i++) {
        if (s[i] == '+') sum ++;
        else sum --; 
    }

    cout << sum << endl;

    return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}


int ng[500];
int dp[500];

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int x;
    cin >> x;
    if(x >= 400 && x <= 599) print(8);
    if(x >= 600 && x <= 799) print(7);
    if(x >= 800 && x <= 999) print(6);
    if(x >= 1000 && x <= 1199) print(5);
    if(x >= 1200 && x <= 1399) print(4);
    if(x >= 1400 && x <= 1599) print(3);
    if(x >= 1600 && x <= 1799) print(2);
    if(x >= 1800 && x <= 1999) print(1);

    

}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,n) for(ll i=n-1;i>=0;i--)
#define rloop(i,a,b) for(ll i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll n,m,k;
  cin>>n>>m>>k;
  ll a[n],b[m];
  fo(i,n)
  cin>>a[i];
  fo(i,m)
  cin>>b[i];
  ll x[n],y[m];
  x[0]=a[0];y[0]=b[0];
  for(ll i=1;i<n;i++)
    x[i]=x[i-1]+a[i];
  for(ll i=1;i<m;i++)
    y[i]=y[i-1]+b[i];
  ll ans=upper_bound(y,y+m,k)-y;
  for(ll i=0;i<n;i++)
  {
    if(x[i]<=k)
    {
      ll p=upper_bound(y,y+m,k-x[i])-y;
      ans=max(ans,i+1+p);
    }
  }
  ll q=upper_bound(x,x+n,k)-x;
  ans=max(ans,q);
  for(ll i=0;i<m;i++)
  {
    if(y[i]<=k)
    {
      ll p=upper_bound(x,x+n,k-y[i])-x;
      ans=max(ans,i+1+p);
    }
  }
  cout<<ans;
  return 0;
}

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

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

const int mod = 1e9 + 7;
const int inf = INT_MAX;

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

    string s;
    cin >> s;

    int sum = 0;
    for (char ch : s) {
        sum = (sum + ch - '0') % 9;
    }

    cout << (sum % 9 ? "No\n" : "Yes\n");
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n/2-1 << endl;
    }
    else{
        cout << n/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void){
  int n;
  std::cin >> n;

  bool hoge = false;
  for(int i=1; i<10; i++){
    for(int j=1; j<10; j++){
      if(i*j == n) hoge = true;
    }
  }
  if(hoge) std::cout << "Yes" << std::endl;
  else     std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for(int& x : a) {
    cin >> x;
  }
  sort(a.begin(), a.end());
  long long answer = 0;
  for(int i = 0; i < n - k; ++i) {
    answer += a[i];
  }
  cout << answer << endl;
}

Measured memory_bytes: 1024
def main():
    N = int(input())
    A = list(map(int, input().split()))
    m = 1000
    sell = False
    buyp = A[0]
    sellp = None
    for i in range(1, N):
        if (not sell) and (buyp > A[i]):
            buyp = A[i]
        elif (not sell):
            sell = True
            sellp = A[i]
        if sell and (sellp < A[i]):
            sellp = A[i]
        elif sell:
            s = m // buyp
            m = s * sellp + (m % buyp)
            buyp = A[i]
            sell = False
    return m
print(main())


Measured memory_bytes: 62056
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
	vector<pair<ll,ll>> res;
	for(ll p = 2;p*p<=n;p++){
		if(n%p !=0)continue;
		int num = 0;
		while(n%p == 0){
			num++;
			n/=p;
		}
		res.push_back(make_pair(p,num));
	}
	if(n!=1)res.push_back(make_pair(n,1));
	return res;
}

int main() {
	int N,M;
	cin >> N >> M;
    // 前処理
    COMinit();
	auto vec = prime_factorize(M);
	ll res = 1;
	for(auto pa: vec){
		int num = pa.second;
		ll  tmp = COM(num+N-1,N-1);
		res = (res * tmp) % MOD;
	}
	cout << res << endl;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    vector<string> v={"Sunny","Cloudy","Rainy"};
    rep(i,3){
        if (S==v[i]) cout << v[(i+1)%3] << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for (register int i=(a);i<=(b);i++)
#define For(i,a,b) for (register int i=(a);i>=(b);i--)
#define mem(i,j) memset(i,j,sizeof(i))
#define GO(u) for (register int j=f[u];j!=-1;j=nxt[j])
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define MP make_pair
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int V=1e6+5;
const int mod=998244353;
int n,a[N],ans=0,mx=0,sgm=0;
int pr[V],vis[V],miu[V],s[V],cnt[V],v[V],inv[V];
inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') {x=(x<<1)+(x<<3)+c-'0';c=getchar();}
	return f*x;
}
inline void write(int x)
{
	if (x<0) putchar('-'),x=-x;
	if (x>9) write(x/10);
	putchar(x%10+'0');
	return;
}
inline int qpow(int x,int y)
{
	int ret=1;
	while (y)
	{
		if (y&1) ret=1LL*ret*x%mod;
		y>>=1;
		x=1LL*x*x%mod;
	}
	return ret;
}
inline void init()
{
	miu[1]=1;
	FOR(i,2,mx)
	{
		if (!vis[i]) pr[++pr[0]]=i,miu[i]=-1;
		for (register int j=1;j<=pr[0]&&pr[j]*i<=mx;j++)
		{
			vis[i*pr[j]]=1;
			if (i%pr[j]==0) break;
			miu[i*pr[j]]=-miu[i];
		}
	}
	FOR(i,1,mx) inv[i]=qpow(i,mod-2);
	FOR(i,1,mx) miu[i]=(1LL*miu[i]+mod)%mod;
	FOR(i,1,mx) 
		for (register int j=1;j*i<=mx;j++) 
			s[j*i]=(1LL*s[j*i]+1LL*miu[i]*inv[j]%mod*v[j*i]%mod*v[j*i]%mod)%mod;
	return;
}
int main()
{
//	freopen("data.in","r",stdin);
	n=read();
	FOR(i,1,n) a[i]=read(),mx=max(mx,a[i]),cnt[a[i]]++,sgm=(sgm+a[i])%mod;
	FOR(i,1,mx) 
		for (register int j=1;j*i<=mx;j++) v[i]=(1LL*v[i]+1LL*cnt[j*i]*i%mod*j%mod)%mod;
	init();
	FOR(i,1,mx) ans=(1LL*ans+s[i])%mod;
	ans=(ans-sgm+mod)%mod;
	ans=1LL*ans*qpow(2,mod-2)%mod;
	write(ans);putchar('\n');
	return 0;
}

Measured memory_bytes: 25600
#include <cstdio>
#include <algorithm>

const int MAXN = 100005;

int a[MAXN];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    std::sort(a, a + n);

    int sg = 0;
    for (int i = 1; i <= n; i++) if ((a[i] - a[i - 1]) % 2) {
        sg ^= n - i + 1;
    }

    puts(sg ? "first" : "second");
    
    return 0;
}

Measured memory_bytes: 512