akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

const int MAX_N = 100000;
const int INF = 1111111111;

class Point {
public:
    int x, y;

    Point(int x = 0, int y = 0): x(x), y(y) {}

    Point operator + (Point p) {
        return Point(x+p.x, y+p.y);
    }
    Point operator - (Point p) {
        return Point(x-p.x, y-p.y);
    }
    Point operator * (double a) {
        return Point(x*a, y*a);
    }
    Point operator / (double a) {
        return Point(x/a, y/a);
    }

    double abs() {
        return sqrt(norm());
    }
    int norm() {
        return x*x + y*y;
    }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator == (const Point &p) const {
        return x == p.x && y == p.y;
    }
};

typedef Point Vector;

class Segment {
public:
    Point p1, p2;

    Segment(Point p1, Point p2): p1(p1), p2(p2) {}
};

static const int BOTTOM = 0;
static const int LEFT = 1;
static const int RIGHT = 2;
static const int TOP = 3;
class EndPoint {
public:
    Point p;
    int seg, st;

    EndPoint() {}
    EndPoint(Point p, int seg, int st): p(p), seg(seg), st(st) {}

    bool operator < (const EndPoint &ep) const {
        if (p.y == ep.p.y) {
            return st < ep.st;
        } else {
            return p.y < ep.p.y;
        }
    }
};

EndPoint EP[2 * MAX_N];

int manhattanIntersection(vector<Segment> S) {
    int n = S.size();

    for (int i = 0, k = 0; i < n; i++) {
        if (S[i].p1.y == S[i].p2.y) {
            if (S[i].p1.x > S[i].p2.x) swap(S[i].p1, S[i].p2);
        } else if (S[i].p1.y > S[i].p2.y) {
            swap(S[i].p1, S[i].p2);
        }


        if (S[i].p1.y == S[i].p2.y) {
            EP[k++] = EndPoint(S[i].p1, i, LEFT);
            EP[k++] = EndPoint(S[i].p2, i, RIGHT);
        } else {
            EP[k++] = EndPoint(S[i].p1, i, BOTTOM);
            EP[k++] = EndPoint(S[i].p2, i, TOP);
        }
    }

    sort(EP, EP + 2*n);
    set<int> BT;
    BT.insert(INF);
    int cnt = 0;

    for (int i = 0; i < 2*n; i++) {
        if (EP[i].st == TOP) {
            BT.erase(EP[i].p.x);
        } else if (EP[i].st == BOTTOM) {
            BT.insert(EP[i].p.x);
        } else if (EP[i].st == LEFT) {
            auto b = lower_bound(BT.begin(), BT.end(), S[EP[i].seg].p1.x);
            auto e = upper_bound(BT.begin(), BT.end(), S[EP[i].seg].p2.x);
            cnt += distance(b, e);
        }
    }

    return cnt;
}

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

    int x1, y1, x2, y2;
    vector<Segment> S;
    for (int i = 0; i < n; i++) {
        cin >> x1 >> y1 >> x2 >> y2;
        Segment s(Point(x1, y1), Point(x2, y2));
        S.push_back(s);
    }

    cout << manhattanIntersection(S) << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string S, T;

  cin >> S >> T;
  int ans = 0;
  if(S[0] == T[0]){
    ans++;
  }
  if(S[1] == T[1]){
    ans++;
  }
  if(S[2] == T[2]){
    ans++;
  }

  cout << ans << endl;


  return 0;
}



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

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

using namespace std;
typedef long long ll;

int main(){
	float T,X;
	ll ANS=0;
	cin >> T  >> X;
	double a=T/X;
	cout << a << endl;
}

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

using namespace std;

main(){
       int a,b;
       scanf("%d %d",&a,&b);
       if(a < b)printf("a < b\n");
       else if(a > b)printf("a > b\n");
       else if(a == b)printf("a == b\n");
       return 0;
       }

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x) cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x) cout << ((x) ? "YES" : "NO") << endl

const ll mod = 998244353;
ll log10(ll a) {ll ret = 0;while(a != 0) {a /= 10;++ret;}return ret;}
ll sub(ll a, ll b){
	a %= mod;
	b %= mod;
	if(a < b) a += mod;
	return (a - b) % mod;
}

class subsetsum {
public:
	ll n;
	vector<ll> a;
	vector<vector<ll>> table;
	ll mod;

	subsetsum() : mod(0x7FFFFFFFFFFFFFFF) {}
	subsetsum(ll n0) : mod(0x7FFFFFFFFFFFFFFF) {init(n0);}
	subsetsum(ll n0, ll mod0) : mod(mod0){init(n0);}

	void init(ll n0) {
		n = n0;
		a = vector<ll>(n, 0);
		table = vector<vector<ll>>(n + 1);
	}
	
	bool is_normal() {
		if(n == 0) return false;
		if( a.size() != n || table.size() != n + 1 ) return false;
		return true;
	}

	/*
	 *  各要素を RGB の3色に塗り分け、その色を i 個目まで決めた時に、
	 *  R を塗った要素の合計が j であるような場合の数
	 *  border 以上、sum 以下の組み合わせを数え上げ
	 */
	ll dp1(ll border, ll sum) {
		if(!is_normal()) {cerr << "dp1: is_normal() is false" << endl;return 0;}

		table = vector<vector<ll>>(n + 1, vector<ll>(sum + 1, 0));
		table[0][0] = 1;
		for(size_t i = 1; i <= sum; ++i) table[0][i] = 0;

		for(size_t i = 0; i < n; ++i) {
			for(size_t j = 0; j <= sum; ++j) {
				table[i + 1][j] = (2 * table[i][j]) % mod ;
				if(j >= a[i]) {
					table[i + 1][j] = (table[i + 1][j] + table[i][j - a[i]]) % mod;
				}
			}
		}

		ll ret = 0;
		repd(i, border, sum+1) {
			ret = (ret + table[n][i]) % mod;
		}

		return ret;
	}

	/*
	 *  各要素を RG の2色に塗り分け、その色を i 個目まで決めた時に、
	 *  R を塗った要素の合計が j であるような場合の数
	 */
	ll dp2(ll sum) {
		if(!is_normal()) {cerr << "dp1: is_normal() is false" << endl;return 0;}

		table = vector<vector<ll>>(n + 1, vector<ll>(sum + 1, 0));
		table[0][0] = 1;
		for(size_t i = 1; i <= sum; ++i) table[0][i] = 0;

		for(size_t i = 0; i < n; ++i) {
			for(size_t j = 0; j <= sum; ++j) {
				table[i + 1][j] = table[i][j];
				if(j >= a[i]) {
					table[i + 1][j] = (table[i + 1][j] + table[i][j - a[i]]) % mod;
				}
			}
		}

		return table[n][sum];
	}
};

int main(int argc, const char* argv[]) {
	ll n, sum = 0;
	cin >> n;
	subsetsum sss(n, mod);
	rep(i, n) {
		cin >> sss.a[i];
		sum += sss.a[i];
	}

	ll u = 1; rep(i, n) u = (u * 3) % mod;
	ll a = sss.dp1((sum + 2 - 1) / 2, sum);
	ll b = ( (sum % 2 == 0) ? sss.dp2(sum / 2) : 0 );

	cout << (sub(u, 3 * a) + 3 * b) % mod << endl;

	return 0;
}


Measured memory_bytes: 318016
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 500000000
#define IOS ios_base::sync_with_stdio(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prll(a,sz)  cout<<a[0];for(ll i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<ll,ll>pi;
typedef pair<ll,ll>pll;
//ll fx[]={0,0,1,-1};
//ll fy[]={1,-1,0,0};
//ll gx[]={0,0,1,1,1,-1,-1,-1};
//ll gy[]={1,-1,0,1,-1,0,1,-1};
bool check(ll n,ll p){return (1<<p)&n;}
const ll N=2010;
ll mod=1e9+7;
ll ara[N],A[N],D[N];
int  main()
{
    IOS;
    ll n,k;cin>>n>>k;
//    for(int i=0;i<n;i++)
//        ara[i]=2000-i;
    for(ll i=0;i<n;i++)cin>>ara[i];
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
            if(ara[j]<ara[i])A[i]++;
        for(ll j=i-1;j>=0;j--)
            if(ara[j]<ara[i])D[i]++;
        D[i]+=A[i];
    }
    ll res=0;
    for(ll i=0;i<n;i++)
    {
        ll temp=k*(k-1)/2;
        ll sum=((k*A[i])%mod+(temp%mod)*D[i])%mod;
//        cout<<"sum for "<<i<<" "<<D[i]<<"  "<<sum<<endl;
        res=(res+sum)%mod;
    }
    cout<<res<<endl;
}
/*
5 3
4 5 3 1 2

*/


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	aStr := nextString()
	bStr := nextString()

	a, _ := new(big.Int).SetString(aStr, 10)
	b, _ := new(big.Int).SetString(bStr, 10)
	c := big.NewInt(0).Mul(a, b)

	fmt.Println(c)
}



Measured memory_bytes: 1268
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define pi acos(-1.0)
#define lowbit(x) ((x)&(-(x)))
#define debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9+7;
const double eps = 1e-6;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll mul(ll a,ll b){ll ans=0;a%=mod,b%=mod;while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }return ans;}
ll powmod(ll a,ll b){ ll ans = 1, pow = a; while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; } return ans;}
//(b/a)%p=b*a^(p-2)%p
//int pr(ll num){//判素
//     if(num == 1) return 0;
//     if(num ==2|| num==3 ) return 1 ;
//     if(num %6!= 1&&num %6!= 5) return 0 ;
//     int tmp =sqrt( num);
//     for(int i= 5;i <=tmp; i+=6 )
//          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
//     return 1 ;
//}
int Day(int y,int m, int d){if(m==1||m==2) { m+=12; y--; }int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;return w+1;}
//int pri[10000005];
//void getpri(){
//    memset(pri,true,sizeof(pri));
//    pri[0]=pri[1]=0;
//    for(int i=2;i<=10000000;i++){
//        if(pri[i]){
//            for(int j=2*i;j<=10000000;j+=i) pri[j]=0;
//        }
//    }
//}
//struct ac{
//    int x,y;
//    int fa;
//} pre[10000005];
//void init(){
//    for(int i=1; i<=10000005;++i) pre[i].fa=i;
//}
//int getf(int x){
//    if(pre[x].fa == x) return x;
//    else return pre[x].fa = getf(pre[x].fa);
//}
//void join(int x,int y){
//    int a = getf(x);
//    int b = getf(y);
//    if(a!=b) pre[b].fa=a;
//}
//大小写转换
//String s;
//Form(s.begin(),s.end(),s.begin(),::toupper);
//Form(s.begin(),s.end(),s.begin(),::tolower);
//(char)toupper('a')
//(char)tolower('B')
//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec
//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址
const int maxn=2e5+5;
ll dp[1005][1005]={0};
ll v[1005][1005]={0};
string s[1005];
int n,m;
int dir[2][2]={{1,0},{0,1}};
int main(){
    IO;
    cin>>n>>m;
    for(int i=0;i<n;++i){
        cin>>s[i];
    }
    queue<pair<int,int>> q;
    q.push(make_pair(0,0));
    dp[0][0]=1;
    v[0][0]=1;
    while(!q.empty()){
        pair<int,int> temp;
        temp=q.front();
        q.pop();
        for(int i=0;i<2;++i){
            int nx=temp.first+dir[i][0];
            int ny=temp.second+dir[i][1];
            //cout<<nx<<" "<<ny<<endl;
            if(nx<n&&ny<m&&s[nx][ny]=='.'){
                dp[nx][ny]+=dp[temp.first][temp.second];
                dp[nx][ny]%=mod;
                if(!v[nx][ny]){
                    q.push(make_pair(nx,ny));
                    v[nx][ny]=1;
                }
            }
        }
    }
    cout<<dp[n-1][m-1]<<endl;
    return 0;
}


Measured memory_bytes: 20396
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <set>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

int main(void){
    ll x, k, d;
    cin >> x >> k >> d;
    if(x < 0) x = -x;
    ll l = x / d;
    if(l < k){
        cout << (ll)fabs(x - ((k-l)%2 + l) *d) << endl;
    } else{
        cout << (ll)fabs(x - k * d) << endl;
    }
    
    return 0;
}

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

int main() {
    int k; scanf("%d", &k);
    char s[10005]; scanf("%s", s);
    for (int i=0; s[i]; i++) s[i] = 'A' + ( ((s[i] - 'A') + k) % 26 );
    puts(s);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  int N;
  cin >> N;

  vector<vector<P>> B(N,vector<P>());
  REP(i,N){
    int A;
    cin >> A;
    REP(j,A){
      int x,y;
      cin >> x >> y;
      B[x-1].push_back(make_pair(i,y));
    }
  }

  int MAX = 0;
  REP(i,pow(2,N)){
    int x = i;
    int cnt = 0;
    vector<int> vec;
    REP(i,N){
      vec.push_back(x%2);
      if(x%2==1){
        cnt++;
      }
      x/=2;
    }
    int flag = 0;
    REP(i,N){
      if(vec.at(i)==0){
        for(auto p:B[i]){
          if(vec.at(p.first)==1&&p.second==1){
            flag=1;
          }
        }
      }else if(vec.at(i)==1){
        for(auto p:B[i]){
          if(vec.at(p.first)==1&&p.second==0){
            flag=1;
          }
        }
      }
    }
    if(flag==0){
      MAX=max(MAX,cnt);
    }
  }

  cout << MAX << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

void selectionSort(int A[],int N);
int count=0;
int main()
{
  
  int i;
  int A[100],N;
  
  scanf("%d",&N);
  for(i=0;i<N;++i){
    scanf("%d",&A[i]);
  }
  
  selectionSort(A,N);
  
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  
  return 0;
}

void selectionSort(int A[], int N)
{
  int i,j,minj,temp,flag = 0;
  
  for(i=0;i<N;i++){
    minj=i;
    flag = 0;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
	minj=j;
	flag = 1;
      }
    }
    if(flag==1){
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      count++;
    }
    
  }
  
}

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

#define fi                      first
#define se                      second
#define pb                      push_back
#define endl                    '\n'
#define all(x)                  x.begin(),x.end()
#define pii                     pair<int,int>
#define fast                    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define SZ(x)                   ((int)x.size())

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void solve();

int32_t main()
{
        fast;
        int t = 1;
        // cin >> t;
        for(int i = 1; i <= t; ++i)
                solve();
        cerr << "Time taken: " << ((clock() * 1000) / CLOCKS_PER_SEC) << "ms\n";
}

void solve() {
	int n;
	cin >> n;
	std::vector<int> v(n);
	for(int i = 0 ; i < n; ++i) {
		cin >> v[i];
	}

	int cur = 1;
	for(int i = 0;i < n; ++i) {
		if(v[i] == cur) {
			cur++;
		}
	}
	if(cur == 1) {
		cout << -1 << endl;
		return;
	}
	cout << n - cur + 1 << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
  
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int h,w,n;
 
char fi[100][100];
bool d(char fi[100][100]){
    char fi2[100][100];
    memcpy(fi2,fi,10000);
    bool flag = false;
    for(int i = 0;i < h;i++){
        int con = 0;
        for(int j = 1;j < w;j++){
            if(fi2[i][j - 1] == fi2[i][j] && fi2[i][j - 1] != '.'){
                if(con == 0)
                    con++;
                con++;
                if(con >= n){
                    flag = true;
                    for(int k = j - n + 1;k <= j;k++)
                        fi[i][k] = '.';
                }
            }else
                con = 0;
        }
    }
 
    for(int i = 0;i < w;i++){
        int con = 1;
        for(int j = 1;j < h;j++){
            if(fi2[j - 1][i] == fi2[j][i] && fi2[j - 1][i] != '.'){
                if(con == 0)
                    con++;
                con++;
                if(con >= n){
                    flag = true;
                    for(int k = j - n + 1;k <= j;k++)
                        fi[k][i] = '.';
                }
            }else
                con = 1;
        }
    }
    return flag;
}
 
void f(char fi[100][100]){
    for(int i = 0;i < w;i++){
        while(1){
            bool flag = true;
            for(int j = 0;j < h - 1;j++){
                if(fi[j][i] != '.' && fi[j + 1][i] == '.'){
                    flag = false;
                    for(int k = j;k >= 0;k--){
                        fi[k + 1][i] = fi[k][i];
                    }
                    fi[0][i] = '.';
                }
            }
            if(flag)
                break;
        }
    }
}
 
bool s(int y, int x){
    char fi2[100][100];
    memcpy(fi2,fi,sizeof(fi));
 
    char ex = fi2[y][x];
    fi2[y][x] = fi2[y][x + 1];
    fi2[y][x + 1] = ex;

    f(fi2);
    while(d(fi2)){
        f(fi2);
    }
 
    bool flag = true;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(fi2[i][j] != '.')
                flag = false;
        }
    }
    return flag;
}
 
int main(){
    scanf("%d%d%d",&h,&w,&n);
    for(int i = 0;i < h;i++)
        scanf("%s",&fi[i][0]);
    bool flag = false;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w - 1;j++){
            if(s(i,j)){
                flag = true;
                break;
            }
        }
        if(flag)
            break;
    }
    if(flag)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

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

typedef long long int ll;


int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	
	ll n;
	cin>>n;
	
	ll arr[n+1];
	
	for(ll i=0;i<n;i++)cin>>arr[i];
	
	map <ll,ll> mp;
	for(ll i=0;i+1<n;i++)
	{
		if(i==0)
		{
			if(arr[i]>arr[i+1])
			{
				if(arr[i]-arr[i+1]==1)
				{
					
					mp[arr[i+1]]++;
				}
				else{
					cout<<"No"<<endl;return 0;
				}
			}
			
		}
		else{
			if(arr[i]>arr[i+1])
			{
				if(arr[i]-arr[i+1]==1)
				{
					if(mp[arr[i]]==0)
					{
						mp[arr[i+1]]++;
						
					}
					else{
						cout<<"No"<<endl;return 0;
					}
				}
				else{
					cout<<"No"<<endl;return 0;
				}
			}
		}
	}
	cout<<"Yes"<<endl;return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {

    map<int, ll> m;
    int n;
    cin >> n;
    vi a(n);

    fo(i, n) {
        cin >> a[i];
        m[a[i]]++;
    }

    ll somatot = 0;
    for ( auto it : m ) {
        somatot += (it.ss * (it.ss - 1)) / 2;
    }

    fo(i, n) {
        int cont = m[a[i]];
        ll ans = somatot - (cont * (cont - 1)) / 2 + ((cont - 1) * (cont - 2)) / 2;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 11892
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    ll A, B, N;  cin >> A >> B >> N;
    cout << floor(A*min(B-1,N)/B) - A*floor(min(B-1,N)/B) << endl;
	return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;
const int NMAX = 100005;
int pre[NMAX];

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for(int i=0; i<m; i++){
		int x, y;
		cin >> x >> y;
		pre[x]++;
		pre[y+1]--;
	}

	for(int i=2; i<=n; i++) pre[i] += pre[i-1];
	int res = 0;
	for(int i=1; i<=n; i++){
		if(pre[i] == m) res++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string c1,c2,c3; cin >> c1 >> c2 >> c3;
    cout << c1[0] << c2[1] << c3[2] << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    cout << s[0][0] << s[1][1] << s[2][2] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	ll h, w; cin >> h >> w;
	ll al = h * w;

	if (!(h % 3) || !(w % 3))
	{
		cout << 0 << endl;
		return 0;
	}

	ll ans = al;

	REP1O(y, h)
	{
		ll a = w * y;
		ll b, c, ma , mi;

		b = (h - y) / 2 * w;
		c = al - a - b;

		ma = max(a, max(b, c));
		mi = min(c, min(a, b));

		chmin(ans, ma - mi);

		b = (h - y) * (w / 2);
		c = al - a - b;

		ma = max(a, max(b, c));
		mi = min(c, min(a, b));

		chmin(ans, ma - mi);

	}

	REP1O(x, w)
	{
		ll a = h * x;
		ll b, c, ma, mi;

		b = (w - x) / 2 * h;
		c = al - a - b;

		ma = max(a, max(b, c));
		mi = min(c, min(a, b));

		chmin(ans, ma - mi);

		b = (w - x) * (h / 2);
		c = al - a - b;

		ma = max(a, max(b, c));
		mi = min(c, min(a, b));

		chmin(ans, ma - mi);
	}

	cout << ans << endl;
}


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

int main(void){
    int r, g, b;
    cin >> r >> g >> b;

    // implements
    if((r*100+g*10+b)%4 == 0){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void){
  int n;
  cin>>n;
  string s=to_string(n);
  size_t size=s.length();
  int sum(0);
  for(int i(0);i<size;i++){
    int t=(unsigned char)s[i];
    int u=t-'0';
    sum+=u;
  }
  if(n%sum==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
data = input()
D = 0

if data == 'a':
	print("vowel")
elif data == 'i':
	print("vowel")
elif data == 'u':
	print("vowel")
elif data == 'e':
	print("vowel")
elif data == 'o':
	print("vowel")
else:
	print("consonant")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		String s1 = sc.next();
		String s2 = sc.next();
		StringBuilder sb = new StringBuilder();
		String res = "";
		for(int i=0;i<n;i++) {
			sb.append(s1.charAt(i));
			sb.append(s2.charAt(i));
		}
		res = sb.toString();
		// 出力
		System.out.println(res);

		//scclose
		sc.close();
	}

}


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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	ll a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>

int main(){
    int n, cont = 0;

    scanf("%d", &n);

    for(int i = 1; i <= n; ++i){
        if((i % 2) == 0){
            ++cont;
        }else if(i == n){
            ++cont;
        }
    }
    printf("%d\n", cont);


    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define M 100005
int n,A[M];
int Ans;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++)scanf("%d",A+i);
	for(int i=2; i<n; i++)
		if((A[i]>A[i+1]&&A[i]<A[i-1])||(A[i]<A[i+1]&&A[i]>A[i-1]))++Ans;
	cout<<Ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	double m;
	double max = 0.0;
	double min = 1.7976931348623158e+308;
	
	while( scanf("%lf", &m)!=EOF) {
		if (m<=0.0) break;
		if (m>max) max = m;
		if (m<min) min = m;
	}
	printf("%f", max-min);
	return 0;
}

Measured memory_bytes: 0
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var amin = int.MaxValue;
        var count = 0;
        var sum = 0L;
        for (int i = 0; i < n; i++)
        {
            if (a[i] < 0) { count++; sum += -a[i]; amin = Min(amin, -a[i]); }
            else { sum += a[i];        amin = Min(amin, a[i]);       }
        }
        getAns(count, sum, amin);
    }
    static void getAns (int count , long sum,int amin   )
    {
        var ans = 0L;
        if (count % 2 == 0) ans = sum;
        else ans = sum - amin * 2;
        Console.WriteLine(ans);
    }
}

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

int main(){
	int A1[3];
	int A2[3];
	int A3[3];
	cin >> A1[0] >> A1[1] >> A1[2];
	cin >> A2[0] >> A2[1] >> A2[2];
	cin >> A3[0] >> A3[1] >> A3[2];

	int N;
	cin >> N;

	int b[N];
	for (int loop = 0; loop < N; ++loop) {
		cin >> b[loop];
	}

	//A1行
	int flag = 0;
	for (int loop = 0; loop < 3; ++loop) {
		for (int loop1 = 0; loop1 <= N; ++loop1) {
			if (b[loop1] == A1[loop]) {
				++flag;
				if (3 == flag) {
					cout << "Yes" << endl;
					return 0;
				}
				break;
			}
		}
	}

	//A2列
	flag = 0;
	for (int loop = 0; loop < 3; ++loop) {
		for (int loop1 = 0; loop1 <= N; ++loop1) {
			if (b[loop1] == A2[loop]) {
				++flag;
				if (3 == flag) {
					cout << "Yes" << endl;
					return 0;
				}
				break;
			}
		}
	}

	//A3列
	flag = 0;
	for (int loop = 0; loop < 3; ++loop) {
		for (int loop1 = 0; loop1 <= N; ++loop1) {
			if (b[loop1] == A3[loop]) {
				++flag;
				if (3 == flag) {
					cout << "Yes" << endl;
					return 0;
				}
				break;
			}
		}
	}

	//A1[0],A2[0],A3[0]
	flag = 0;
	for (int loop1 = 0; loop1 <= N; ++loop1) {
		if (b[loop1] == A1[0]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A2[0]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A3[0]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	//A1[0],A2[1],A3[2]
	flag = 0;
	for (int loop1 = 0; loop1 <= N; ++loop1) {
		if (b[loop1] == A1[0]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A2[1]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A3[2]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	//A1[1],A2[1],A3[1]
	flag = 0;
	for (int loop1 = 0; loop1 <= N; ++loop1) {
		if (b[loop1] == A1[1]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A2[1]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A3[1]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	//A1[2],A2[2],A3[2]
	flag = 0;
	for (int loop1 = 0; loop1 <= N; ++loop1) {
		if (b[loop1] == A1[2]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A2[2]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A3[2]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	//A1[2],A2[1],A3[0]
	flag = 0;
	for (int loop1 = 0; loop1 <= N; ++loop1) {
		if (b[loop1] == A1[2]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A2[1]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
		if (b[loop1] == A3[0]) {
			++flag;
			if (3 == flag) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}


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

#define pb push_back
#define rb  pop_back
#define rf  pop_front
#define ins insert
#define f   first
#define s   second
#define um  unordered_map
#define us  unordered_set
#define pq  priority_queue

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< long long int ,long long int > iil;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef vector<double> vd;
typedef pair<double,double> pd;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef us<int> si;
typedef us<double> sd;
typedef us<ll> sll;
typedef vector<vd> md;


const int MAX = 1e6;
const int N = 200043;
const int MOD = 998244353;

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define EE endl
#define PI 3.14159265
#define g(a,b) a>b?a:b
#define l(a,b) a<b?a:b
#define SOT(A) sort(A.begin(),A.end())
#define SOTR(A) sort(A.rbegin(),A.rend())
#define REV(a) reverse(ALL(a))

// LOOP Control Statements
#define forn(i,j,n) for ( auto i=j ; i<n ; i++ )
#define fornd(i,j,n) for ( auto i=j ; i>n ; i-- )
#define FORE(i, b) for(auto &i:b)


#define SQ(i) (i*i)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define tcase(term) int tc;cin>>tc;for(int term=0; cout<<"CASE "<<term+1<<EE,term<tc;term++)





int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	// tcase(terms)
    {
    	long double a,b;
    	cin>>a>>b;
    	ll ans=a*b;
    	cout<<ans;
	}
}


Measured memory_bytes: 3708
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
n,m = LI()
if m <= 2*n:print(m//2)
else:
    ans = n
    m -= 2*n
    ans += m//4
    print(ans)
"""

#D
def f(a,b,c):
    k = a^b
    if c == "x":
        k = 1-k
    return k
n = I()
s = S()
s.append(s[0])
na = ["S","W"]
pre = [0,0]
for i in range(1,n+1):
    pre.append(f(pre[-2],pre[-1],s[i]))
if pre[0] == pre[-2] and pre[1] == pre[-1]:
    for i in range(n-1):
        print(na[pre[i]],end = "")
    print(na[pre[n-1]])
    quit()
pre = [0,1]
for i in range(1,n+1):
    pre.append(f(pre[-2],pre[-1],s[i]))
if pre[0] == pre[-2] and pre[1] == pre[-1]:
    for i in range(n-1):
        print(na[pre[i]],end = "")
    print(na[pre[n-1]])
    quit()
pre = [1,0]
for i in range(1,n+1):
    pre.append(f(pre[-2],pre[-1],s[i]))
if pre[0] == pre[-2] and pre[1] == pre[-1]:
    for i in range(n-1):
        print(na[pre[i]],end = "")
    print(na[pre[n-1]])
    quit()
pre = [1,1]
for i in range(1,n+1):
    pre.append(f(pre[-2],pre[-1],s[i]))
if pre[0] == pre[-2] and pre[1] == pre[-1]:
    for i in range(n-1):
        print(na[pre[i]],end = "")
    print(na[pre[n-1]])
    quit()
print(-1)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 6904
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ


int main(){
	int a,b;scanf("%d%d",&a,&b);
	if(b<a)swap(a,b);
	for(int i=0;i<b;i++)printf("%d",a);printf("\n");
}

Measured memory_bytes: 128
n, t = map(int, input().split())
li = list(map(int, input().split()))
ans = 0

ans += t
for i in range(1,n):
    if li[i] >= li[i - 1] + t:
        ans += t
    else:
        ans += li[i] - li[i - 1]

print(ans)

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

#define swap(typ, x, y) \
    do { \
        typ tmp; \
        tmp = x; \
        x = y; \
        y = tmp; \
    } while (0)

void max_heapify(int *arr, int i, int size) {
    int l, r, largest;

    l = (i+1) * 2 - 1;
    r = (i+1) * 2;

    if (l <= (size - 1) && arr[l] > arr[i]) {
        largest = l;
    } else {
        largest = i;
    }
    if (r <= (size - 1) && arr[r] > arr[largest]) {
        largest = r;
    }

    if (largest != i) {
        swap(int, arr[i], arr[largest]);
        max_heapify(arr, largest, size);
    }
}

void build_max_heap(int *arr, int size) {
    for (int i = (size / 2); i >= 0; i--) {
        max_heapify(arr, i, size);
    }
}

void insert_priority_queue(int *arr, int elem, int *size) {
    int index;
    arr[*size] = elem;
    (*size)++;

    index = *size - 1;
    while (arr[index] > arr[(index-1) / 2]) {
        swap(int, arr[index], arr[(index-1) / 2]);
        index = (index-1) / 2;
    }
}

int extract_priority_queue(int *arr, int *size) {
    int max_val = arr[0];
    swap(int, arr[0], arr[*size-1]);
    (*size)--;
    max_heapify(arr, 0, *size);
    return max_val;
}

#define MAX_NUM_ITEMS 100000

int main(void) {
    int n, m;
    int prices[MAX_NUM_ITEMS];

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

    for (int i = 0; i < n; i++) {
        int price;
        scanf("%d", &price);
        prices[i] = price;
    }

    build_max_heap(prices, n);

    for (int i = 0; i < m; i++) {
        int price = extract_priority_queue(prices, &n);
        price /= 2;
        insert_priority_queue(prices, price, &n);
    }

    long sum = 0;
    for (int i = 0; i < n; i++) {
        sum += ((long) prices[i]);
    }

    printf("%ld\n", sum);

    return 0;
}


Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

func main() {
	Pow := math.Pow
	var c1x, c1y, c1r int
	var c2x, c2y, c2r int

	fmt.Scanf("%d %d %d", &c1x, &c1y, &c1r)
	fmt.Scanf("%d %d %d", &c2x, &c2y, &c2r)

	d := math.Sqrt(Pow(float64(c2x-c1x), 2) + Pow(float64(c2y-c1y), 2))

	if d < math.Abs(float64(c2r-c1r)) {
		fmt.Println(0)
	} else if d == math.Abs(float64(c2r-c1r)) {
		fmt.Println(1)
	} else if math.Abs(float64(c2r-c1r)) < d && d < math.Abs(float64(c1r+c2r)) {
		fmt.Println(2)
	} else if d == math.Abs(float64(c1r+c2r)) {
		fmt.Println(3)
	} else if d > math.Abs(float64(c1r+c2r)) {
		fmt.Println(4)
	}
}




Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int mp[N];
int a[N];
int32_t main()
{
    IOS;
    
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
        mp[a[i]]++;
    }
    int q;
    cin>>q;
    while(q--)
    {
        int x,y;
        cin>>x>>y;
        sum-=x*mp[x];
        mp[y]+=mp[x];
        sum+=y*mp[x];
        mp[x]=0;
        cout<<sum<<endl;
    }


    
    
}

Measured memory_bytes: 5212
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
        int n;cin>>n;
        VEC(int,p,n);
        int res = 0;
        REP(i,1,n-2){
            if(p[i] == min({p[i-1],p[i],p[i+1]}) || p[i] == max({p[i-1],p[i],p[i+1]}))continue;
            res++;
        }
        cout<<res;
    }
    


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 	
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

signed main() {
	IOS;
	ld p = 1.01;
	ld cur = 100;
	int c = 0;
	int x;	cin >> x;
	while(true){
		c++;
		cur = (cur*p);
		cur = (int)cur;
		if(cur >= x)
			break;
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 3660
X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

S = [(p, 0) for p in P] + [(q, 1) for q in Q] + [(r, 2) for r in R]
S.sort(reverse=True)

ans = 0
ct = [0] * 3
for s in S:
    if sum(ct) >= X+Y:
        break
    elif s[1] == 0 and ct[0] < X:
        ans += s[0]
        ct[0] += 1
    elif s[1] == 1 and ct[1] < Y:
        ans += s[0]
        ct[1] += 1
    elif s[1] == 2 and (ct[0] < X or ct[1] < Y):
        ans += s[0]
        ct[2] += 1

print(ans)


Measured memory_bytes: 39968
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint N,A,B;
    cin >> N >> A >> B;
    if((B-A)%2==0) cout << (B-A)/2 << endl;
    else{
        lint dis=B-A;
        lint X,Y;
        X=((A-1)*2+(B-A)+1)/2;
        Y=((N-B)*2+(B-A)+1)/2;
        cout << min(X,Y) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

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

    int k = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == k + 1) {
            k++;
        }
    }

    cout << (k == 0 ? -1 : n - k) << endl;

    return 0;
}

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

using namespace std;

int main(){

	string s,t;
	cin >> s >> t;
	long long int p=0,ans=0,q,temp=0;
	for(int i=0;i<t.length();i++){
		q = (int)s.find(t[i],p);
		if(p == 0 && q == -1){
			cout << "-1" << endl;
			return 0;
		}else if(q != -1){
			p = q+1;
			temp = p;
		}else{
			p = 0;
			ans += s.length();
			i--;
			temp = 0;
		}
	}
	if(temp != 0){
		ans += temp;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        final String S = sc.next();
        final String T = sc.next();
        
        long diff = IntStream.range(0, S.length())
                .filter(i -> S.charAt(i) != T.charAt(i))
                .count();
        
        System.out.println(diff);
    }
}


Measured memory_bytes: 41496