akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1<<30
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef pair<double, double> doup;
typedef vector<ll> vec;
typedef vector<vec> mat;
 
int main() {
    ll N, K;
    cin >> N >> K;
    ll x[51], y[51], i, j, k, l, p;
    ll num, xmax=-1000000000, xmin=1000000000, ymax=-1000000000, ymin=1000000000;
    for(i=0; i<N; i++) {
        cin >> x[i] >> y[i];
        xmax=max(xmax, x[i]);
        xmin=min(xmin, x[i]);
        ymax=max(ymax, y[i]);
        ymin=min(ymin, y[i]);
    }
    
    ll ans=(xmax-xmin)*(ymax-ymin);
    for(i=0; i<N; i++) {
        for(j=0; j<N; j++) {
            for(k=0; k<N; k++) {
                for(l=0; l<N; l++) {
                    num=0;
                    for(p=0; p<N; p++) {
                        if(x[i]<=x[p] && x[p]<=x[j] && y[k]<=y[p] && y[p]<=y[l])
                            num++;
                    }
                    if(num>=K)
                        ans=min(ans, (x[j]-x[i])*(y[l]-y[k]));
                }
            }
        }
    }
    
    cout << ans << endl;
}

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

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int,int>> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(),a.end());
  for(int i = 0; i < n; i++){
    if(a[i].second <= t){
      cout << a[i].first << endl;
      return 0;
    }
  }
  cout << "TLE" << endl;
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] vs = Console.ReadLine().Split(' ');
            List<int> v = new List<int>();
            for (var i = 0; i < N; i++)
            {
                v.Add(int.Parse(vs[i]));
            }
            v.Sort();
            double ans = v[0];
            for (var i = 1; i < N; i++)
            {
                ans = (ans+v[i])/2;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] s = sc.next().split("");
		int count = 0;

		for(int i = 0;i < n-2;i++) {
			if(s[i].equals("A")) {
				if(s[i].concat(s[i+1]).concat(s[i+2]).equals("ABC")) {
					count++;
				}
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 21076
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <list>
#include <bitset>
#include <vector>
using namespace std;

#define I64d_OJ

//#ifdef I64d_OJ
//#define LL __int64
//#endif // I64d_OJ
#ifdef I64d_OJ
#define LL long long
#endif // I64d_OJ

typedef unsigned LL ULL;
typedef unsigned uint;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;
typedef vector<int> vi;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-f; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define ls rt<<1
#define rs rt<<1|1
#define MID(a,b) (((LL)(a)+(LL)(b))>>1)
#define absx(a) ((a)<0?-(a):(a))
#define MK(a,b) make_pair(a,b)
#define PB(a) push_back(a)
#define lowbit(x) ((x)&-(x))

#define lc c[x][0]
#define rc c[x][1]

template< typename T >
inline void Max(T &a,T &b){if(a<b) a=b;}
template< typename T>
inline void Min(T &a,T &b){if(a>b) a=b;}

const double pi=(double)acos(-1.0);
const double eps=(double)1e-8;
const int INF = (int) 0x3f3f3f3f;
const int MOD = (int) 1e9+7;
const int MAXN =(int) 2e5+10;
const int MAXM = (int) 3e6+10;

///--------------------START-------------------------
int N;
int a[MAXN];
LL K;
int mark[MAXN];

void work(){
    scanf("%d%lld",&N,&K);
    for(int i=1;i<=N;i++) scanf("%d",&a[i]);
    int cnt=0,cntloop=0,loopstart=-1;
    if(a[1]==1){
        printf("1\n");
        return;
    }
    if(K<=N){
        int i=1;
        while(K--){
            i=a[i];
        }
        printf("%d\n",i);
        return;
    }
    int i=1;
    while(!mark[i]){
        cntloop++;
        mark[i]=cntloop;
        i=a[i];
    }
    loopstart=i;
    K-=mark[loopstart]-1;
    int looplen=cntloop-mark[loopstart]+1;
//    printf("loopstart = %d, looplen = %d\n",loopstart,looplen);
    K=K%looplen;
    int ans=loopstart;
    while(K--){
        ans=a[ans];
    }
    printf("%d\n",ans);
}

///--------------------END-------------------------
int main(){
#ifdef NNever
//freopen("data.in","r",stdin);
///freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}










Measured memory_bytes: 5372
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
#define debug(x) cout << #x << " = " << x << endl;

using namespace std;

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

const int FIELD_SIZE = 10000;

int main(){
	int an, bn, r;
	while(cin >> an >> bn >> r, an|bn){
		vector<vi> ay(FIELD_SIZE);
		rep(i, an){
			int x, y;
			cin >> x >> y;
			ay[x].push_back(y);
		}

		rep(i, FIELD_SIZE) sort(all(ay[i]));

		int R = 4*r;
		int RR = 16*r*r;
		int ans = 0;
		rep(i, bn){
			int bx, by;
			cin >> bx >> by;

			for(int dx = -R; dx <= R; dx++){
				int nx = bx+dx;
				if(nx < 0) dx = -bx, nx = 0;
				if(nx > FIELD_SIZE) break;
				int dy = sqrt((double)RR-dx*dx);
				ans += upper_bound(all(ay[nx]), by+dy) - lower_bound(all(ay[nx]), by-dy);
			}
		}
		cout << ans << endl;
	}


	return 0;
}

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

const int MAX_N = (int)1e5 + 5;
lint P[MAX_N], Q[MAX_N], SP[MAX_N];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    lint W, H;
    cin>>W>>H;
    for(int i=0;i<W;i++) cin>>P[i];
    for(int i=0;i<H;i++) cin>>Q[i];

    sort(P, P+W);
    for(int i=0;i<W;i++) SP[i+1] = SP[i] + P[i];

    lint ans = SP[W];
    for(int i=1;i<=H;i++){
        int idx = distance(P, upper_bound(P, P+W, Q[i-1]));
        ans += SP[idx] + (W-idx+1) * Q[i-1];
    }

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

Measured memory_bytes: 2560
#include <iostream>
#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 n;
    cin >>n;
    vll a(n);
    double r = 0.0;
    rep(i, n) {
        cin >>a[i];
        r += (double)1 / a[i];
    }
    printf("%.12lf", 1/r);

    

}


Measured memory_bytes: 3720
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b=scan.nextInt();
	int c[][]=new int[a][2];
	int d[][]=new int[b][2];
	int m[]=new int[a];
	for(int i=0;i!=a;i++) {
		c[i][0]=scan.nextInt();
		c[i][1]=scan.nextInt();
	}
	for(int i=0;i!=b;i++) {
		d[i][0]=scan.nextInt();
		d[i][1]=scan.nextInt();
	}
	for(int i=0;i!=a;i++) {
		int min=1145148101;
		int C=0;
		for(int j=0;j!=b;j++) {
			int K=0;
			K=Math.abs(c[i][0]-d[j][0])+Math.abs(c[i][1]-d[j][1]);
			if(K<min) {
				min=K;
				C=j+1;
			}
		}
		m[i]=C;
	}
	for(int i=0;i!=a;i++) {
		System.out.println(m[i]);
	}
}
}

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

int main() {
  
  int N , Q;
  string S;
  
  cin >> N >> Q >> S;
  
  vector<bool> buls(N-1);
  vector<int> lefts(N-1);
  
  for (int i = 0; i < N-1 ; i++){
    if (S.at(i)=='A' && S.at(i+1)=='C'){
      buls.at(i) = true;
    }
    else{
      buls.at(i) = false;
    }
  }
  
  
  for (int i = 0; i < N-1 ; i++){
    if (i == 0){
      lefts.at(0) = buls.at(0);
    }
    else{
      lefts.at(i) = lefts.at(i - 1) + buls.at(i);
    }
  }
  
  
  for (int i = 0; i < Q ; i++){
    
    int l, r, ans = 0;
    cin >> l >> r;
    l--;
    r--;
    
    if (l > 0){
    	cout << lefts.at(r-1) - lefts.at(l-1) << endl;
    }
    else{
        cout << lefts.at(r-1) << endl;
    }
    
  }
}


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

int main() {
    int N;
    int Y;
    cin >> N >> Y;
    int res_man = -1, res_gosen = -1, res_sen = -1;
    int total = 0;

    for (int n_man = 0; n_man <= N; ++n_man) {
        for (int n_gosen = 0; n_gosen <= N - n_man; ++n_gosen) {
            int n_sen = N - n_man - n_gosen;
            total = 10000 * n_man + 5000 * n_gosen + 1000 * n_sen;
            if(total == Y) {
                res_man = n_man;
                res_gosen = n_gosen;
                res_sen = n_sen;
            }
        }
    }
    cout << res_man << " " << res_gosen << " " << res_sen << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 500 + 5;
int a[MAX][MAX],n,m,q; 
int main()
{
	cin>>n>>m>>q;
	int maxx = -1,l,r;
	while(m--) {
		scanf("%d%d",&l,&r);
		maxx = max(maxx,r);
		a[l][r]++;
	}
	for(int i = 1; i<=maxx; i++) {
		for(int j = 1; j<=maxx; j++) {
			a[i][j] += a[i][j-1];
		}
	}
	while(q--) {
		ll ans = 0;
		scanf("%d%d",&l,&r);
		for(int i = l; i<=r; i++) {
			ans += a[i][r];
		}
		printf("%lld\n",ans);
	}
	

	return 0 ;
 }


Measured memory_bytes: 1920
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {k: usize};

    let mut buf: Vec<u8> = vec![0, 0, 0];
    println!("{}", dfs(k, 0, &mut buf))
}

fn dfs(k: usize, index: usize, buf: &mut Vec<u8>) -> usize {
    let mut sum = 0;
    if index == 3 {
        // println!("{:?}", buf);
        let d = gcd(buf[0], buf[1]);
        sum += gcd(d, buf[2]) as usize;
    // println!("{}", sum);
    } else {
        for j in 1..k + 1 {
            buf[index] = j as u8;
            sum += dfs(k, index + 1, buf);
        }
    }
    sum
}

fn gcd(a: u8, b: u8) -> u8 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define For(i,a,b) for(int i=a;i>=b;i--)
#define debug
#define MaxL 1000
#define int LL

using namespace std;

int read(){
    char c=getchar(); int flag=1, x=0;
    while(!isdigit(c)){ if(c=='-') flag=-1; c=getchar(); }
    while( isdigit(c)){ x=x*10+(c-'0'); c=getchar(); }
    return flag*x;
}

int n;
int H[MaxL+10];
int Sum[MaxL+10];

signed main(){

    n=read();
    FOR(i,1,n){
        int a=read(); H[a]++;
    }

    FOR(i,1,1002) Sum[i]=Sum[i-1]+H[i];


    int Ans=0;
    //ABC
    FOR(i,1,1000) FOR(j,i+1,1000){
        if(H[i]<=0||H[j]<=0) continue;
        // cout<<"ABC "<<i<<" "<<j<<" "<<min(i+j-1,1000)<<endl;
        // cout<<" "<<( H[i]*H[j]* (Sum[min(1000,i+j-1)]-Sum[j]) )<<endl;
        Ans+=( H[i]*H[j]* (Sum[(int)min(1001ll,i+j-1)]-Sum[j]) );
    }
    //AAB
    FOR(i,1,1000){
        if(H[i]<=1) continue;
        Ans+=( H[i]*(H[i]-1)/2 * (Sum[(int)min(1001ll,i*2-1)]-H[i]) );
    }
    
    //AAA
    FOR(i,1,1000){
        if(H[i]<=2) continue;
        Ans+=( H[i]*(H[i]-1)*(H[i]-2)/6 );
    }

    cout<<Ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  char x=a[0];
  char y=b[0];
  char z=c[0];
  char dif='A'-'a';
  printf("%c%c%c\n",x+dif,y+dif,z+dif);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a;
	b=a;
	reverse(a.begin(),a.end());
	int len=a.length();
	for(int i=0;i<len;++i)
	{
		switch(a[i])
		{
           	case 'q': a[i]='p';break;
         	case 'p': a[i]='q';break;
       	    case 'b': a[i]='d';break;
            case 'd': a[i]='b';break;
		}
	}
	if(b==a)
		cout<<"Yes";
	else
		cout<<"No";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 512
/*https://atcoder.jp/contests/abc172/tasks/abc172_b*/

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

void solve(){
	string s;
	string t;
	cin>>s>>t;
	int count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i]){
			count++;
		}
	}
	cout<<count;
}
		

int main(){
	solve();
}


Measured memory_bytes: 3824
#include<bits/stdc++.h>
#define show(x) cout<<#x" = "<<x<<endl;
#define INF 0x3f3f3f3f
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> iipair;
typedef pair<unsigned,unsigned> uupair;
typedef vector<int> vec;
typedef vector<unsigned> uvec;

ll powerof2(ll n)
{
    n|=(n>>1);
    n|=(n>>2);
    n|=(n>>4);
    n|=(n>>8);
    n|=(n>>16);
    n|=(n>>32);
    return (n+1)>>1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    cout<<(powerof2(n)<<1) - 1;

}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

template<int SZ>
struct SegmentTree {
    int n, st[2*SZ];

    SegmentTree() {
        memset(st, 0, sizeof(st));
    }

    void init(int _n) {
        n = _n;
        for (int i=0; i<2*n; i++)
            st[i] = n - 1;
    }

    int query(int l, int r) {
        int ret = n - 1;
        for (l+=n, r+=n; l<r; l>>=1, r>>=1) {
            if (l&1) ret = min(ret, st[l++]);
            if (r&1) ret = min(ret, st[--r]);
        }
        return ret;
    }

    void update(int p, int val) {
        p += n;
        for (st[p]=min(st[p], val); p>1; p>>=1)
            st[p>>1] = min(st[p], st[p^1]);
    }
};
SegmentTree<200005> stR, stC;

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

    int n, q;
    cin >> n >> q;

    stR.init(n);
    stC.init(n);
    long long ret = (long long) (n - 2) * (n - 2);
    for (int i=0; i<q; i++) {
        int t, x;
        cin >> t >> x;
        x--;
        if (t == 1) {
            int pos = stR.query(x, n);
            DEBUG(t, x, pos)
            ret -= pos - 1;
            stC.update(pos, x);
        } else {
            int pos = stC.query(x, n);
            DEBUG(t, x, pos)
            ret -= pos - 1;
            stR.update(pos, x);
        }
        DEBUG(ret)
    }
    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 6764
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int cume[300001] = {};
  int cumw[300001] = {};
  int n;
  string s;
  cume[0] = 0;
  cumw[0] = 0;
  cin >> n >> s;
  REP(i, n)
  {
    cume[i + 1] = cume[i];
    cumw[i + 1] = cumw[i];
    if (s[i] == 'E')
    {
      cume[i + 1]++;
    }
    else
    {
      cumw[i + 1]++;
    }
  }

  int ans = n;

  REP(i, n)
  {
    int tmp = cume[n] - cume[i + 1];
    tmp += cumw[i];
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3204
from enum import Enum


class Judge(Enum):
    OK        = 1
    END_ODD   = 2
    END_INF   = 3


def judge_cookie(X):
    if X % 2 == 0:
        result = True
    else:
        result = False

    return result


def devide_cookie(X):
    return X//2


def exchange_cookie(A, B, C):
    if judge_cookie(A) and judge_cookie(B) and judge_cookie(C):
        # OK
        AA = devide_cookie(B) + devide_cookie(C)
        BB = devide_cookie(A) + devide_cookie(C)
        CC = devide_cookie(A) + devide_cookie(B)

        if A == AA and B == BB and C == CC:
            result = Judge.END_INF
        else:
            result = Judge.OK

    else:
        # NG
        AA = BB = CC = 0
        result = Judge.END_ODD

    return result, AA, BB, CC


A, B, C = map(int, input().split())

Count = 0
while True:
    J, AA, BB, CC = exchange_cookie(A, B, C)
    if J == Judge.OK:
        Count += 1
        A = AA
        B = BB
        C = CC
    elif J == Judge.END_INF:
        Ans = -1
        break
    else:
        Ans = Count
        break

print(Ans)


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

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

	if (N == M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {

  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){

    cout << "vowel" << endl;

  }

  else {
    cout << "consonant" << endl;
  }


}

  



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    string s;
    cin >> s;
    int n = s.length();
    int ans = 0;
    forn1(i, n){
        if (s[i] != s[i - 1]) ans++;
    }
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <functional>
#include <string>
#include <sstream>
#include <complex>
#include <vector>	// V[i],  push_back(x), pop_back(), insert(index, x), erase(index)	
#include <list>		// push_front(x), push_back(x), pop_front(), pop_back(), insert(index, x)
#include <queue>	// push(x), front(), pop()
#include <deque>
#include <stack>	// push(x), top(), pop()
#include <map>		// M[key],  insert(key, val), erase(key), find(key), 
#include <set>		// insert(key), erase(key), find(key)

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

#define pi 3.141592653589793)
#define mod 1000000007

int N, A[100002], B[100002], C[100002];

void solve() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N; i++) cin >> C[i];

	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);

	long long ans = 0;
	for (int i = 0; i < N; i++) {
		ans += (distance(A, lower_bound(A, A + N, B[i]))) * (-distance(N+C, upper_bound(C, C + N, B[i])));

		////いてれーたを返す、lower_bound() - A
		//ans += (lower_bound(A, A + N, B[i]) - A) * (C + N - upper_bound(C, C + N, B[i]));
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define lli long long int 
#define mod 1000000007
#define GIO ios_base::sync_with_stdio(0);cin.tie(0);


int main()
{ GIO;
  ll a,b;
cin>>a>>b;
cout<<(a-1)*(b-1)<<"\n";
     

return 0;
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


ll N;
ll S;
const ll INF = 1LL << 60;


ll solve() {
    for(ll b = 2; b * b <= N; b++){
        // 普通に計算
        ll n = N;
        ll s = 0;
        while(n != 0){
            s += n % b;
            n /= b;
        }
        if(s == S){
            return b;
        }
    }

    ll opt_b = INF;
    // sqrt(N) より大きい b について計算
    // N / b < sqrt(N) となるので、N / bを決め打ちで計算する
    for(ll n_per_b = 1; n_per_b * n_per_b < N; n_per_b++){
        if(N + n_per_b - S > 0 && (N + n_per_b - S) % n_per_b == 0){
            ll cand_b = (N + n_per_b - S) / n_per_b;
            if(cand_b >= -n_per_b + S){
                if(N%cand_b + N/cand_b == S &&cand_b > 1)
                    opt_b = min(opt_b, cand_b);
            }
        }
    }

    if(N == S) opt_b = min(opt_b, N + 1);

    if(opt_b == INF)
        return -1;
    else
        return opt_b;
}

int main(){

    cin >> N >> S;
    cout << solve() << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        long n,a,b,tmp;
        n=scan.nextLong();
        a=scan.nextLong();
        b=scan.nextLong();
        tmp=n/(a+b);
        tmp*=a;
        if(n%(a+b)<a) tmp+=n%(a+b);
        else tmp+=a;
        System.out.println(tmp);
    }
}

Measured memory_bytes: 23636
#include<stdio.h>

#define n 45

void makeFibonacci(void);

int F[n];

int main()
{
  int a;
  //printf("test1 before func\n");
  makeFibonacci();
  // printf("test3 after func\n");

  scanf("%d", &a);
  printf("%d\n", F[a]);
  return 0;
}

void makeFibonacci(void)
{
  int i;
  
  F[0] = 1;
  F[1] = 1;

  //printf("test2 in func\nn = %d, F[0] = %d, F[1] = %d\n\n", n, F[0], F[1]);

  for(i = 2;i<n;i++)
    {
      //printf("%d\n", i);
      F[i] = F[i-1] + F[i-2];
    }
}



Measured memory_bytes: 2104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int d = sc.nextInt();

		if (d == 0) {
			System.out.println((double) (m - 1) / (double) n);
		} else {
			System.out.println((double) 2 * (n - d) * (m - 1) / (double) Math.pow(n, 2));
		}

		return;
	}
}


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

int note[4][3][10];

int main() {
    int n, b,f,r,v;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        cin>>b>>f>>r>>v;
        note[b-1][f-1][r-1]+=v;
    }
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 10; ++k) cout << ' ' << note[i][j][k];
            cout << endl;
        }
        if (i<3) cout << "####################" << endl;
    }
    return 0;
}



Measured memory_bytes: 3112
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))


def calc_imos(arr):
    imos = [0] * (N + 1)
    for i, a in enumerate(arr):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        imos[l] += 1
        imos[r + 1] -= 1
    imos = list(accumulate(imos))
    return imos[:-1]


for k in range(min(50, K)):
    A = calc_imos(A)
print(*A, sep=' ')

Measured memory_bytes: 233100
import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7


def main():
    H, W, K = map(int, input().split())
    dp = [[0] * W for _ in range(H + 1)]  # 数え上げ問題なので0で初期化する
    dp[0][0] = 1  # 初期条件
    for h in range(H):
        for bit in range(1 << (W - 1)):  # 左ビットシフトで2 ** (W-1)と同じ
            if '11' in bin(bit): continue  # ある頂点から左右方向に棒が伸びているケースはスルー
            for w in range(W):
                # w番目の棒を考える
                if w and bit & (1 << (w - 1)):  # leftを見るので1<<w-1と確認, w=0の時はleftにいけないことに注意する
                    dp[h + 1][w - 1] += dp[h][w] % MOD
                elif bit & (1 << w):  # rightを見るので1<<w確認
                    dp[h + 1][w + 1] += dp[h][w] % MOD
                else:  # down, 左右どちらにもいかない時
                    dp[h + 1][w] += dp[h][w] % MOD
    # for i in dp:
    #     print(*i)
    print(dp[H][K - 1] % MOD)


if __name__ == '__main__':
    main()

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

int a, b;

int main()
{
    cin >> a >> b;
    if(a <= 0 && b >= 0){
        printf("Zero\n");
        return 0;
    }
    if(a > 0 && b > 0){
        printf("Positive\n");
        return 0;
    }
    if((b - a) % 2){
        printf("Positive\n");
    }
    else {
        printf("Negative\n");
    }



    return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = getLine >>= putStrLn . which "yes" "no" . all ( ( == 1 ) . length ) . group . sort


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
  int a, b;
  cin >> a >> b;
  if(a<=8&&b<=8)cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main() {
    int K,S;
    cin >> K >> S;
    int count = 0;
    for (int X = 0; X <= K; ++X) {
        for (int Y = 0; Y <= K; ++Y) {
            int Z = 0;
            Z = S - X - Y;
            if(Z <= K && Z >= 0) count++;
        }
    }
    cout<< count << endl;
    return 0;
}

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

#define _ << " " <<
#define tr(x) cout << #x _ x << endl
#define fi first
#define se second

#ifdef _WIN32
#define LD "%I64d"
#else
#define LD "%ld"
#endif

using namespace std;

typedef long long ll;

const int maxn = 100005;

int n, k;
char s[maxn];

int read() {
    if (scanf("%s", s) < 1) {
        return 0;
    }
    n = strlen(s);
    scanf("%d", &k);
    return 1;
}

void solve() {
    for (int i = 0; i < n; i++) {
        if (s[i] == 'a') continue;
        int steps2a = 'z' - s[i] + 1;
        if (k >= steps2a) {
            k -= steps2a;
            s[i] = 'a';
        }
    }
    s[n - 1] += (k % ('z' - 'a' + 1));
    if (s[n - 1] > 'z') {
        s[n - 1] = 'a' + s[n - 1] - 'z' - 1;
    }
    printf("%s\n", s);
}

int main(int argc, char *argv[]) {
    while (read()) {
        solve();
    }
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {

	nextReader = newScanner()

	N, M := nextFloat64(), nextFloat64()
	// fmt.Println(N, M)
	x := math.Trunc(N*(N-1)/2) + math.Trunc(M*(M-1)/2)

	fmt.Println(x)

}

/* --------------------------------------------------------------------------
 *  std.io
 * ------------------------------------------------------------------------- */
var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

/* --------------------------------------------------------------------------
 *  memo
 * ------------------------------------------------------------------------- */


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

int main() {
  ll n, k;
  cin >> n >> k;
  if(n%k==0) {
    cout << 0 << endl;
    return 0;
  }
  else {
    ll ans = min(n%k,abs(n%k-k));
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;

int main(void){
  int rectangle=0;
  int lozenge=0;
  int x,y,z;
  vector<int> edge;

  while(cin >> x){
	cin.ignore();
	cin >> y;
	cin.ignore();
	cin >> z;
	if(x == y) lozenge++;
	if(x * x + y * y == z * z) rectangle++;
	
  }
  cout << rectangle << endl;
  cout << lozenge << endl;

  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int x[100010], y[100010];
int n, m;
int sumx[100010], sumy[100010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, n) {
        cin >> x[i];
        sumx[i + 1] = (sumx[i + 1] + x[i] + sumx[i]) % mod;
    }
    rep(i, m) {
        cin >> y[i];
        sumy[i + 1] = (sumy[i + 1] + y[i] + sumy[i]) % mod;
    }
    int ansX = 0, ansY = 0;
    rep(i, n - 1) {
        ansX = (ansX + (-x[i] * (n - i - 1)) % mod + (sumx[n] - sumx[i + 1]) % mod + mod) % mod ;
        //cout << -x[i] * (n - i - 1)  <<" " << (sumx[n] - sumx[i + 1]) << endl;
    }
    rep(i, m - 1) {
        ansY = (ansY + (-y[i] * (m - i - 1)) % mod + (sumy[m] - sumy[i + 1]) % mod + mod) % mod;
    }
    cout << (ansX * ansY) % mod << endl;

    return 0;
}


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

signed main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif
  string n;
  cin >> n;
  int res = n[0] - '0' - 1 + ((int) n.size() - 1) * 9;
  int res2 = 0;
  for (char c : n) {
    res2 += c - '0';
  }
  res = max(res, res2);
  cout << res << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int main(){
  int N, M;
  int L[101000];
  int R[101000];
  cin >> N >> M;
  int maxl=0;
  int minr=1000000;
  for(int i=0; i< M; i++){
    cin >> L[i] >> R[i];
    if(maxl < L[i]){
      maxl = L[i];
    }
    if(minr > R[i]){
      minr = R[i];
    }
  }
  cout << max(0, minr - maxl + 1) << endl;
  return 0;
}


Measured memory_bytes: 1024
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


signed main()
{
	fio
	string s;
	cin>>s;
	fo(i,s.size())
	{
		if(s[i]=='7')
		{
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
	printclock;
}

Measured memory_bytes: 3844
n = gets.to_i
a, b, c = 3.times.map { gets.split.map(&:to_i) }

p b.reduce(&:+) + (1..n).reduce(0) { |s, i| a[i] == a[i - 1] + 1 ? s += c[a[i - 1] - 1] : s }


Measured memory_bytes: 1788
import math

N = int(input())

x = 0
y = 0

ans = 10**12 + 1

for n in range(1, math.floor(math.sqrt(N)) + 1):  
  if N % n == 0:
    x = n
    y = math.floor(N / x)

    t = ((x - 1) + (y - 1))

    if ans > t:
      ans = t

print(ans)

Measured memory_bytes: 3188
// 🐋💭  Buy an Integer
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}
// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

func main() {
    let x = readInt()
    
    if x >= 400 && x <= 599 {
        print(8)
        return
    }
    if x >= 600 && x <= 799 {
        print(7)
        return
    }
    if x >= 800 && x <= 999 {
        print(6)
        return
    }
    if x >= 1000 && x <= 1199 {
        print(5)
        return
    }
    if x >= 1200 && x <= 1399 {
        print(4)
        return
    }
    if x >= 1400 && x <= 1599 {
        print(3)
        return
    }
    if x >= 1600 && x <= 1799 {
        print(2)
        return
    }
    print(1)
    return
    
}
main()


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

int main()
{
    int i, j, N;
    cin >> N;
    int c = 0;
    vector<int> X(N);
    for (i = 0; i < N; i++)
    {
        cin >> X.at(i);
    }
    sort(X.begin(), X.end());
    int m = X.at(0);
    int K = X.at(N - 1) - X.at(0) + 1;
    vector<int> S(K);
    for (i = 0; i < K; i++)
    {
        S.at(i) = 0;
    }
    while (1)
    {
        if (m > X.at(N - 1))
        {
            break;
        }
        for (j = 0; j < N; j++)
        {
            S.at(c) += (X.at(j) - m) * (X.at(j) - m);
        }
        m++;
        c++;
    }
    sort(S.begin(), S.end());
    cout << S.at(0) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans,temp;
int main()
{
	cin>>n;
	ans+=n*800;
	while(n>=15)
	{
		n-=15;
		temp+=1;
	}
	ans-=temp*200;
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
def main():
    X = int(input())  # 文字列または整数(一変数)

    for B in range(0, 1000):
        for A in range(B, 1000):
            if A**5 - B**5 == X:
                print(A, B, sep=" ")
                return
            if A**5 + B**5 == X:
                print(A, -B, sep=" ")
                return

if __name__ == '__main__':
    main()



Measured memory_bytes: 9168
ROOM = [[[0]*10 for i in range(3)] for j in range(4)]

N = int(input())
hensu = []
for x in range(N):
    room = [int(e) for e in input().split()]
    ROOM[room[0]-1][room[1]-1][room[2]-1] += room[3]
    
for y in range(len(ROOM)):
    for z in range(len(ROOM[y])):
        print(" " + " ".join(map(str, ROOM[y][z])))
    if y==3:
        break
    else:
        print("####################")


Measured memory_bytes: 5608
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility> //pair
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef vector<vector<int>> Graph;

int main() {
	//入力;
	int R;
	cin >> R;

	if (R < 1200) cout << "ABC";
	else if (R < 2800) cout << "ARC";
	else cout << "AGC";
	cout << endl;
	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,m;
    cin>>n;
    vector<long long> a(n);
    for(long long i=0;i<n;i++){
        cin>>a[i];
    }
    cin>>m;
    vector<long long> b(m);
    for(long long i=0;i<m;i++){
        cin>>b[i];
    }
    cout<<lexicographical_compare(a.begin(),a.end(),b.begin(),b.end())<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

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

    long long h;
    cin >> h;

    ll ans = 0;
    ll cnt = 1;
    while (h > 0) {
        ans += cnt;
        h /= 2;
        cnt *= 2;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int s;
  cin >> s;
  
  int ans = 0;
  ans = ans + s % 10;
  s = s / 10;
  ans = ans + s % 10;
  s = s / 10;
  ans = ans + s % 10;
  
  cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int cnt = 1;
    int temp = h[0];
    for(int i = 1; i < n; ++i) {
        if(temp <= h[i]){
            temp = h[i];
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,f[maxn];
struct node{
	int x,y,id;
}a[maxn];
bool cmp(node a,node b){
	return a.x==b.x?a.y<b.y:a.x<b.x;
}
bool cmp2(node a,node b){
	return a.y==b.y?a.x<b.x:a.y<b.y;
}
inline int find(int x){return f[x]==x?f[x]:f[x]=find(f[x]);}
vector<node> alfa[maxn];
long long ans=0;
int cntx[maxn],cnty[maxn];
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i].x=read();a[i].y=read();a[i].id=i;
		f[i]=i;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<n;i++){
		if(a[i].x==a[i+1].x){
			int x=find(a[i].id),y=find(a[i+1].id);
			if(x!=y){
				f[x]=y;
			}
		}
	}
	sort(a+1,a+1+n,cmp2);
	for(int i=1;i<n;i++){
		if(a[i].y==a[i+1].y){
			int x=find(a[i].id),y=find(a[i+1].id);
			if(x!=y){
				f[x]=y;
			}
		}
	}
	for(int i=1;i<=n;i++)f[i]=find(f[i]);
/*	for(int i=1;i<=n;i++)printf("%d ",f[i]);
	puts("");*/
	for(int i=1;i<=n;i++){
		alfa[f[a[i].id]].push_back(a[i]);
	}
	for(int i=1;i<=n;i++){
		int l=alfa[i].size();
		if(l==0)continue;
		int limx=0,limy=0;
		for(int j=0;j<l;j++){
			cntx[++limx]=alfa[i][j].x;
			cnty[++limy]=alfa[i][j].y;
		}
		sort(cntx+1,cntx+1+limx);
		sort(cnty+1,cnty+1+limy);
		limx=unique(cntx+1,cntx+1+limx)-cntx-1;
		limy=unique(cnty+1,cnty+1+limy)-cnty-1;
		ans=ans+1ll*limx*limy;
	}
	printf("%lld\n",ans-n);
	return 0;
}


Measured memory_bytes: 6260
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7


def main():
    n, m, d = map(int, input().split())
    if d == 0:
        print(1/n * (m-1))
    else:
        ans = 2 * (n - d) / (n * n)
        print(ans*(m-1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9344
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define maxn 100002
using namespace std;
int a[maxn];
main(){
	int N;
	cin >> N;
	for(int i=1;i<=N;i++){
		scanf("%d",a+i);
	}
	int mi = 1e6;
	int ma = 0;
	For(i,1,N){
		mi = min(mi,a[i]);
		ma = max(ma,a[i]);
	}
//	cout << ma << "==" << mi;
	if(ma - mi >1){
		cout << "No";
	}	else	if(ma == mi + 1){
		int slmi = 0;
		For(i,1,N){
			if(a[i]==mi){
				slmi ++;
			}
		}
		int a = slmi;
		int b = N-slmi;
		int k = mi;
		int M = k - (a-1);
//		cout << a;
//		cout << "M =" <<M << "\n";
		if(2*M<=b && M > 0){
			cout << "Yes";
		}	else	{
			cout << "No";
		}
	}	else	{	
		// ma == mi
		int k = ma;
//		cout << k;
		if(k==N-1 || N >=2*k){
			cout << "Yes";
		}	else	{
			cout << "No";
		}
	}
}

Measured memory_bytes: 640
import math as mt
import sys
import bisect
input=sys.stdin.readline
#t=int(input())
t=1
mod=10**9+7
for _ in range(t):
    
    #n=int(input())
    a,b,c,d=map(int,input().split())
    #u1,d1=map(int,input().split())
    #u2,d2=map(int,input().split())
    #l=list(map(int,input().split()))
    
    print(max(b*d,b*c,a*c,a*d))

Measured memory_bytes: 62096
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    ans = 0
    for i, x in enumerate(a, 1):
        if i % 2 == 1 and x % 2 == 1:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61824
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ADD(X, Y) ((X) = ((X) + (Y)%MOD) % MOD)
#define LLINF LLONG_MAX / 3
#define INF 1001001001
#define PI 2*acos(0.0)
#define EPS 1e-10
// #define int long long
#define rep(i, n) for (int i = 0; i < n; ++i)
#define srep(i, s, n) for (int i = s; i < n; ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end() 
#define rall(x) (x).rbegin(),(x).rend() 
#define debug(x) cout<<#x<<" = "<<x<<endl
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> ivec;
typedef vector<ll> llvec;
typedef vector<string> svec;
typedef pair<int, int> pii;


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

    string s;
    cin >> s;

    int state = 0;
    rep(i, s.size()){
        if (state == 0){
            if (s[i] == 'C') state = 1; 
        } else if (state == 1){
            if (s[i] == 'F') state = 2; 
        }
    }

    if (state == 2) cout << "Yes" << endl; 
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256