akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    string s; cin >> s;
    int n = s.size();
    int cnt = 1;
    vector<int> ans(n);
    rep(i,n-1){
        if(s[i] == s[i+1]) cnt++;
        else{
            if(s[i] == 'R'){
                ans[i] += cnt-cnt/2;
                ans[i+1] += cnt/2;
            }
            else{
                ans[i-cnt+1] += cnt-cnt/2;
                ans[i-cnt] += cnt/2;
            }
            cnt = 1;
        }
    }
    ans[n-1-cnt+1] += cnt-cnt/2;
    ans[n-1-cnt] += cnt/2;
    rep(i,n) cout << ans[i] << " ";
    cout << endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <set>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
int main(){
    int s;
    cin >> s;
    if(s > 888){
        s = 999;
    }
    else if(s > 777){
        s = 888;
    }
    else if(s > 666){
        s = 777;
    }
    else if(s > 555){
        s = 666;
    }
    else if(s > 444){
        s = 555;
    }
    else if(s > 333){
        s = 444;
    }
    else if(s > 222){
        s = 333;
    }
    else if(s > 111){
        s = 222;
    }
    else{
        s = 111;
    }
    cout << s << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=998244353;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(string S){
    int len = S.length();
    debug(len);
    for(int i=2; i<=len; i+=2){
        debug(S.substr(0, (len - i) / 2));
        debug(S.substr((len - i) / 2));
        debug(" ");
        if(S.substr(0, (len - i) / 2) == S.substr((len - i) / 2, (len - i) / 2)){
            cout<<len - i<<endl;
            break;
        }
    }
    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    string S;
    cin>>S;
    answer(S);

    return 0;
}


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

int main(){
  int h,w; cin>>h>>w;
  char a[h][w];
  int i,j;
  bool hf[h]={},wf[w]={};
  
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cin>>a[i][j];
    }
  }
  
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(a[i][j]=='#'){
        hf[i]=1;
        break;
      }
    }
  }
  
  for(i=0;i<w;i++){
    for(j=0;j<h;j++){
      if(a[j][i]=='#'){
        wf[i]=1;
        break;
      }
    }
  }

  for(i=0;i<h;i++){
    if(hf[i]==1){
      for(j=0;j<w;j++){
        if(wf[j]==1){
        cout<<a[i][j];
        }
      }
      cout<<endl;
    }
  }
  
  return 0;
}

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

using namespace std;

int main() {
    int h, a;
    cin >> h >> a;

    int n;
    if (h % a == 0) {
        n = h / a;
    }
    else {
        n = h / a + 1;
    }

    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
map<int, int> memo;
cin >> N;
for(int i=1; i<N; i++){
  int A;
  cin >> A;
  memo[A] += 1;
}
for(int i=1; i<=N; i++){
  cout << memo[i] << endl;
}

}


Measured memory_bytes: 13004
#include<stack>   //????????????
#include<iostream>
 
using namespace std;
 
int main(void){
    int n,i,data[10],ans=1;
    stack<int> right;
    stack<int> left;
 
    cin>>n;
    while(n>0){
        n--;
        cin>>data[0]>>data[1]>>data[2]>>data[3]>>data[4]>>data[5]>>data[6]>>data[7]>>data[8]>>data[9];
        right.push(data[0]);
        for(i=1;i<10;i++){
            if(right.top()<data[i])
                right.push(data[i]);
            else{
                if(left.empty())
                    left.push(data[i]);
                else{
                    if(left.top()<data[i])
                        left.push(data[i]);
                    else
                        ans=0;
                }
            }
        }
        if(ans==0) cout<<"NO"<<endl;
        else cout<<"YES"<<endl;
        while(!left.empty())
            left.pop();
        while(!right.empty())
            right.pop();
    }
 
    return 0;
}


Measured memory_bytes: 1192
package main

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

func main() {
	n := readi()
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = readString()
	}

	ans := 0
	memo := make(map[string]bool)
	for i := 0; i < n; i++ {
		_, ok := memo[s[i]]
		if ok {
			continue
		}
		memo[s[i]] = true
		ans = ans + 1
	}

	fmt.Println(ans)
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

// 最大公約数
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

// 最小公倍数
func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func comb(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7

	COMB_MAX = 510000
)

var (
	readString func() string
)

var (
	fac  = [COMB_MAX]int{}
	finv = [COMB_MAX]int{}
	inv  = [COMB_MAX]int{}
)

func init() {
	readString = newReadString(os.Stdin)
}

func combInit() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < COMB_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
	}
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


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

double equ(double x1, double y1, double x2, double y2, double x, double y){
    return (x1-x2)*(y-y1) - (y1-y2)*(x-x1);
}

bool same_side(double x1, double y1, double x2, double y2,
               double xa, double ya, double xb, double yb){
    return equ(x1, y1, x2, y2, xa, ya) * equ(x1, y1, x2, y2, xb, yb) > 0;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
        double xg = (x1+x2+x3)/3, yg = (y1+y2+y3)/3;
        if( same_side(x1, y1, x2, y2, xg, yg, xp, yp) &&
            same_side(x2, y2, x3, y3, xg, yg, xp, yp) &&
            same_side(x3, y3, x1, y1, xg, yg, xp, yp) ){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1212
import java.util.*;
import java.io.*;
import java.time.chrono.MinguoDate;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    static int dx[]={-1,0,1,0};
    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        
        int n=sc.nextInt();
        int k=sc.nextInt();
        int a[]=new int[n];
        long d[]=new long[n*(n+1)/2];
        for (int i = 0; i < a.length; i++) {
			a[i]=sc.nextInt();
		}
        for (int i = 0,c=0; i < a.length; i++) {
        	long s=0;
        	for (int j = i; j < a.length; j++) {
				s+=a[j];
				d[c++]=s;
			}
		}
        sort(d);
        ArrayList<Long> lx=new ArrayList<>();
        ArrayList<Long> ly=new ArrayList<>();
        lp:for (int i = 63; -1 < i; i--) {
        	int c=0;
        	if(lx.size()==0) {
        		for (int t = d.length-1; -1 < t; t--) {
       				if( (d[t]&(1L<<i))>0 )lx.add(d[t]);
        	    }
//        		db(i,lx.size());
        	}
        	else {        		
        		for (int t = 0; t < lx.size(); t++) {
        			long w=lx.get(t);
        			if( (w&(1L<<i))>0 )ly.add(w);
        	    }
        		if(ly.size()>=k) {lx=new ArrayList<>(ly); }
        		ly.clear();
        	}
        	if(lx.size()<k)lx.clear();
//        	db(i,lx.size());
		}
//        db(d);
        long ans=0;
        if(lx.size()>=k) {
        	ans=lx.get(0);
			for (int t = 1; t < k; t++) {
				ans &= lx.get(t);
			}
        }
        


        out.println(ans);
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}



//class P implements Comparable<P>{
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//    public int compareTo(P p){
//        return d-p.d; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 45084
#include <iostream>
#include <string>
#include <vector>
#define N 1000
#define pb push_back

using namespace std;

bool sol(string st){
  int i;
  bool flag=true;
  for(i=0;i<st.size()-1;i++){
    if(!flag) break;
    if(st[i]=='A'){
      if(!(st[i+1]=='B'||st[i+1]=='D')) flag=false;
    }
    if(st[i]=='B'){
      if(!(st[i+1]=='A'||st[i+1]=='C'||st[i+1]=='E')) flag=false;
    }
    if(st[i]=='C'){
      if(!(st[i+1]=='B'||st[i+1]=='F')) flag=false;
    }
    if(st[i]=='D'){
      if(!(st[i+1]=='A'||st[i+1]=='E'||st[i+1]=='G')) flag=false;
    }
    if(st[i]=='E'){
      if(!(st[i+1]=='B'||st[i+1]=='D'||st[i+1]=='F'||st[i+1]=='H')) flag=false;
    }
    if(st[i]=='F'){
      if(!(st[i+1]=='C'||st[i+1]=='E'||st[i+1]=='I')) flag=false;
    }
    if(st[i]=='G'){
      if(!(st[i+1]=='D'||st[i+1]=='H')) flag=false;
    }
    if(st[i]=='H'){
      if(!(st[i+1]=='G'||st[i+1]=='E'||st[i+1]=='I')) flag=false;
    }
    if(st[i]=='I'){
      if(!(st[i+1]=='F'||st[i+1]=='H')) flag=false;
    }
  }
  return flag;
}

int main(){
  int i;
  string s;
  for(i=0;i<N;i++){
    cin>>s;
    if(sol(s)) cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int d, e;
    while (cin>>d>>e, d||e) {
        double ans = float(INF);
        rep(i, d) {
            int j = d-i;
            ans = min(ans, fabs(sqrt(pow(i,2.0f)+pow(j,2.0f))-e));
        }

        cout << ans << endl;
    }
}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
#define int long long

int n,ans;
int a[3] = {3,5,7};
int cnt[3];

int dfs(int i,int r){
  //cout << r << endl;
  if(i <= 10){
    if(r > n) return 0;
    int t = r;
    fill(cnt,cnt+3,0);
    for(int k = 1; k <= 9; k++){
      if(t <= 0) break;
      int judge = t%10;
      for(int l = 0; l < 3; l++){
        if(judge == a[l]) cnt[l]++;
      }
      t /= 10;
    }
    if(cnt[0]&&cnt[1]&&cnt[2]) ans++;
  }
  for(int k = 0; k < 3; k++){
    dfs(i+1,r*10+a[k]);
  }
  return ans;
}

signed main(){

  cin >> n;
  cout << dfs(0,0) << endl;

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 2e5 + 10;
int a[N], h[N];
int64 dp[N], c[N];

void insert(int x, int64 y) {
  for (; x < N; x += x & -x) {
    c[x] = max(c[x], y);
  }
}

int64 query(int x) {
  int64 ret = 0;
  for (; x; x -= x & -x) {
    ret = max(ret, c[x]);
  }
  return ret;
}

int main() {
  int n;
  scanf("%d", &n);
  vector<int> A;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &h[i]);
    A.push_back(h[i]);
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < n; ++i) {
    h[i] = lower_bound(A.begin(), A.end(), h[i]) - A.begin() + 1;
    scanf("%d", &a[i]);
  }
  dp[0] = a[0];
  insert(h[0], dp[0]);
  for (int i = 1; i < n; ++i) {
    dp[i] = query(h[i]) + a[i];
    insert(h[i], dp[i]);
  }
  int64 ret = 0;
  for (int i = 0; i < n; ++i) ret = max(ret, dp[i]);
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 5876
import operator


def solve(a, b, c, d):
    op = [operator.add, operator.sub]
    sp = ['+', '-']
    for i in range(8):
        j, k, l = i & 1, (i >> 1) & 1, (i >> 2) & 1
        calc = op[j](a, b)
        calc = op[k](calc, c)
        calc = op[l](calc, d)
        if calc == 7:
            return '{}{}{}{}{}{}{}=7'.format(a, sp[j], b, sp[k], c, sp[l], d)


print(solve(*map(int, input())))


Measured memory_bytes: 3064
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100001
#define INF (ll)1e18
#define pll pair<ll,ll>
#define pii pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define pi 3.1415926535897

int main() {
    
    get(n);
    gets(s);

    auto allok = [&](ll len) {

        unordered_map<string,pll> ma;

        for(ll i=0;i<=n-len;i++) {
            string a = s.substr(i,len);

            if(ma.find(a)!=ma.end()) {
                ma[a].se = i;
                if(i-ma[a].fi>=len)
                    return true;
            }
            else {
                ma[a] = {i,i};
            }
        }

        return false;
    };

    ll low = 1, high = n/2;
    while(low<=high) {
        ll mid = low + (high-low)/2;
        if(allok(mid))
            low = mid+1;
        else
            high = mid-1;
    }

    printf("%lld\n",high);
    return 0;  
}

Measured memory_bytes: 6732
package main

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

func main() {

	var n int

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	buf := make([]byte, 10000)
	sc.Buffer(buf, 100000)

	sc.Scan()
	n, _ = strconv.Atoi(sc.Text())
	strarray := make([]string, 2)

	for i := 0; i < 2; i++ {
		sc.Scan()
		strarray[i] = sc.Text()
	}
	answer := ""
	for i := 0; i < n; i++ {
		answer += strarray[0][i:i+1] + strarray[1][i:i+1]
	}

	fmt.Println(answer)
}


Measured memory_bytes: 640
#include <stdio.h>

int 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 {
    printf("a == b\n");
  }
	return 0;
}



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

int dp[100010];
int main(){
  dp[0]=0;
  for(int n=1;n<=100000;n++){
    dp[n]=100000;
    int power=1;
    while(power<=n){
      dp[n]=min(dp[n],dp[n-power]+1);
      power*=6;
    }
    power=1;
    while(power<=n){
      dp[n]=min(dp[n],dp[n-power]+1);
      power*=9;
    }
  }
  int n;
  cin>>n;
  cout<<dp[n];

}

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

int main(){
  ll k,a,b;
  cin>>k>>a>>b;
  ll ans=0;
  if(b-a<=2 || k-a<=0){
    ans=k+1;
  }else{
    ans=a;
    if((k-a+1)%2==0){
      ans+=(b-a)*((k-a+1)/2);
    }else{
      ans+=(b-a)*((k-a+1)/2)+1;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<map>
#include<sstream>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
const int maxn = 2e5+7;
int a[maxn];
char s[maxn];
int main()
{
    char c;
    cin >> c;
    if(c == 'a'||c == 'e'||c == 'i'||c == 'o'||c == 'u')
    {
        cout <<"vowel"<<endl;
    }
    else cout << "consonant" << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

macro_rules! swap {
    ($a:expr, $b:expr) => {
        let tmp = $a;
        $a = $b;
        $b = tmp;
    };
}

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let mut p = arr(n, |_| scan.read::<usize>()-1);
    let mut cnt = 0usize;
    for i in 0..n {
        if p[i] == i {
            cnt += 1;
            if i+1<n {swap!(p[i], p[i+1]);}
            else {swap!( p[i-1],  p[i]);}
        }
    }
    println!("{}", cnt);
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

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

int main()
{
	int a,b,r,d;
	double f;

	cin>>a>>b;

	d=a/b;
	r=a%b;
	f=(double)a/b;

	printf("%d %d %f\n",d,r,f);

	return 0;
}
	

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll , ll> P;
typedef pair<ll, ll> PL;
const ll INT_INF = 2147483646;
const ll ll_INF = 9223372036854775807;
ll mod = 1e9+7;

bool SecondCompare(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
	       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
	       return a.second>b.second;
}

ll gcd(ll big, ll small){
    ll tmp = big%small;

    if(tmp == 0) return small;
    return gcd(small,tmp);
}

int main(){
    string s;
    cin >> s;
    string yy = "2019",mm = "04",dd="30";

    for(int i = 0; i < 4; i++){
        if(s[i] > yy[i]){
            cout << "TBD\n";
            return 0;
        }
        else if(s[i] < yy[i]){
            cout << "Heisei\n";
            return 0;
        }
    }
    for(int i = 0; i < 2; i++){
        if(s[5+i] > mm[i]){
            cout << "TBD\n";
            return 0;
        }
        else if(s[5+i] < mm[i]){
            cout << "Heisei\n";
            return 0;
        }
    }
    for(int i = 0; i < 2; i++){
        if(s[8+i] > dd[i]){
            cout << "TBD\n";
            return 0;
        }
        else if(s[8+i] < dd[i]){
            cout << "Heisei\n";
            return 0;
        }
    }

    cout << "Heisei\n";

}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int S,h,m,s;
    scanf("%d",&S);
    h=S/3600;
    m=(S-h*3600)/60;
    s=S-h*3600-m*60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



Measured memory_bytes: 2068
#include <iostream>
#include <string>
#include <cmath> 
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <numeric> 
#include <iomanip>
#include <map> 
#include <stack>
#include <sstream>
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int MAX = 1e6;
long long max(long long a, long long b) { if (a > b)return a; else return b; }
long long min(long long a, long long b) { if (a < b)return a; else return b; }
const int MAXN = 1000000 + 30;
int a[MAXN];


  		     		    	   				   	

int main()
{
	
		ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
		string s;
		cin >> s;
		if (s[3] == s[2] && s[4] == s[5])
		{
			cout << "Yes" << endl;

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

		}

		return 0;
	
}




	

  



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

using namespace std;

#define LCM(a,b)                (a / __gcd(a,b) ) *b
#define GCD(a,b)                __gcd(a,b)
#define dist(x1,y1,x2,y2)       sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define distl(x1,y1,x2,y2)      sqrtl((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
#define fRead(x)                freopen(x,"r",stdin)
#define fWrite(x)               freopen (x,"w",stdout)
#define LL                      long long
#define ULL                     unsigned long long
#define pb                      push_back
#define tcase                   cout<<"Case "<<C++<<": ";
#define all(a)                  a.begin(),a.end()
#define Unique(a)               sort(all(a)),a.erase(unique(all(a)),a.end
#define ABS(x)                  ((x)<0?-(x):(x))
#define min3(a,b,c)             min(a,min(b,c))
#define min4(a,b,c,d)           min(a,min(b,min(c,d)))
#define max3(a,b,c)             max(a,max(b,c))
#define max4(a,b,c,d)           max(a,max(b,max(c,d)))
#define PI                      acos(-1.0)
#define ff                      first
#define ss                      second
#define SP(x,y)                 fixed<<setprecision((y))<<(x)
#define FastRead                ios_base::sync_with_stdio(0);cin.tie(NULL);
#define FOR(x, l, r)            for (int x = l; x<=r; ++x)
#define REP(x,r)                for (int x = 0; x <r; ++x)
#define NN                      cout<<"\n";
#define NNN                     cout<<"\n------------------------------\n";
#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())
//***********************************************************************//
//                      SHAHED AHMED, CSE'15, IUT                        //
//***********************************************************************//


LL lim[20020];
LL fix[20020];
LL val[20020];
LL up[20020];

int main()
{
    LL n;

    cin>>n;

    vector<LL> t(n);
    vector<LL> v(n);

    for(LL i=0;i<n;i++) cin>>t[i];
    for(LL i=0;i<n;i++) cin>>v[i];

    LL pos = 0;

    for(LL i=0;i<t.size();i++)
    {
        lim[pos] = min(lim[pos],v[i]);
        up[pos] = v[i];
        while(t[i]--)
        {
            lim[++pos]= v[i];
            up[pos] = v[i];
        }

    }

    fix[0]=1;
    fix[pos]=1;



    LL increase = 111;

    while(increase--)
    {
        for(LL i=1;i<=pos;i++)
        {
            if(val[i]==lim[i]) fix[i]=1;
            if(val[i]==val[i-1]+1 && fix[i-1]==1) fix[i]=1;
        }

        for(LL i=pos;i>=1;i--)
        {
            if(val[i]==val[i+1]+1 && fix[i+1]==1) fix[i]=1;
        }

        for(LL i=1;i<=pos;i++)
        {
            if(fix[i]!=1)
            {
                val[i]++;
            }
        }
    }

    double tot=0;
    for(LL i=1;i<=pos;i++)
    {
        //cout<<val[i]<<" ";
        tot+=val[i];
    }

    for(LL i=1;i<=pos;i++)
    {
        if(val[i]==val[i-1] && val[i]<up[i-1])
        {
            tot+=0.25;
        }
    }
//
//    cout<<"\n";
//    for(LL i=1;i<=pos;i++)
//    {
//        cout<<val[i]<<" ";
//    }
//    cout<<"\n";

    cout<<SP(tot,20)<<"\n";


}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,x) for(int i = 0; i < x; ++i)
#define nxt '\n'
using namespace std;

int n,ar[100001]={},dp[100001]={};

int solve(int x)
{
	if(x>=n-2) return dp[x];
	if(dp[x]==-1) dp[x]=min(abs(ar[x]-ar[x+1])+solve(x+1) , abs(ar[x]-ar[x+2])+solve(x+2));
	return dp[x];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	cin >> n;
	rep(i,n) cin >> ar[i];
	dp[n-2]=abs(ar[n-1]-ar[n-2]);
	rep(i,n-2) dp[i]=-1;
	cout << solve(0) <<nxt;
	return 0;
}

Measured memory_bytes: 3328
//	Problem Name: Vacation
//
//  Created by Kushal Warke
//  Copyright © 2018 Kushal Warke. All rights reserved.
//

#include <iostream>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
#include <set>
#include <sstream>
#include <stack>
#include <list>
#include <queue>

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(x) ((x)<0?-(x):(x))

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector< pair<int,int> > vpi;
typedef vector< pair<long long,long long> > vpll;

double EPS = 1e-9; 
int INF = 1000000005; 
long long INFF = 1000000000000000005LL;
const int N = 100001;
const int M = 4;
int counts[N][M];
int data[N][M];
int n;
int solve(int day,int act) {
    if(counts[day][act]!=-1) {
        return counts[day][act];
    }
    if(day==n) {
        return counts[day][act] = data[day][act];
    }
    int a,b;
    if(act==1) {
        a = 2;
        b = 3;
    }
    else if(act==2) {
        a = 1;
        b = 3;
    }
    else {
        a = 1;
        b = 2;
    }
    return counts[day][act] = data[day][act] + max(solve(day+1,a),solve(day+1,b));
}
int maxi(int a,int b,int c) {
    return max(a,max(b,c));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    FOR(i,0,N) {
        FOR(j,0,M) {
            counts[i][j] = -1;
        }
    }
    cin>>n;
    FOR(i,1,n+1) {
        FOR(j,1,4) {
            cin>>data[i][j];
        }
    }
    cout<<maxi(solve(1,1),solve(1,2),solve(1,3))<<endl;
    //solve(1,1);
    //solve(1,2);
    //solve(1,3);
    /*FOR(i,1,n+1) {
        FOR(j,1,4) {
            cout<<counts[i][j]<<" ";
        }
        cout<<endl;
    }
    //DEBUG(counts[1][1]);
    //DEBUG(counts[1][2]);
    //DEBUG(counts[1][3]);
    */
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    const int N = 4;
    ll n, w;
    cin >> n >> w;
    vector<vector<int>> vv(N,vector<int>());
    ll w1,v1;
    cin >> w1 >> v1;
    vv[0].push_back(v1);
    REP(i,n-1) {
        ll w, v;
        cin >> w >> v;
        vv[w-w1].push_back(v);
    }
    for(auto &v:vv) sort(RALL(v));
    vector<vector<ll>> vsum(N,vector<ll>{0});
    REP(i,N) REP(j,vv[i].size()) {
        vsum[i].push_back(vsum[i][j] + vv[i][j]);
    }
    ll ans = 0;

    for (ll i = 0; i < vsum[0].size(); i++) {
        ll wi = w1 * i;
        if (wi > w) break;

        for (ll j = 0; j < vsum[1].size(); j++) {
            ll wj = wi + (w1+1) * j;
            if (wj > w) break;

            for(ll k = 0; k < vsum[2].size(); k++) {
                ll wk = wj + (w1+2) * k;
                if (wk > w) break;

                for(ll l = 0; l < vsum[3].size(); l++) {
                    ll wl = wk + (w1+3) * l;
                    if (wl > w) break;
                    ans = max(ans,vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l]);
                    // cerr << i << j << k << l << " " << ans << endl;
                }
            }
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>


using namespace std;

template<class T, size_t N, class F>
struct compare_n
{
    F f;
    bool operator() (const T& t1, const T& t2)
    {
        return f(get<N>(t1), get<N>(t2));
    }
};
 
template<size_t N, class T>
auto make_less_n(const T&)
{
    using t = typename T::value_type;
    using less = std::less<typename tuple_element<N, t>::type>;
    return compare_n<t, N, less>();
}

template<class T>
T digit(T x)
{
    return static_cast<T>(floor(log10(x)+1));
}

int64_t ipow(int64_t x, int64_t y)
{
    return static_cast<int64_t>(pow(x, y));
}

struct point_t
{
    int64_t x,y;
};

int main()
{
    double t,x;
    cin >> t >> x;
    cout << (t / x) << "\n";
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

signed main(){
	int n;cin>>n;
	int cnt=0,a=0,b=0,ab=0;
	rep(i,n){
		string s;
		cin>>s;
		if(s.front()=='B'&&s.back()=='A')ab++;
		else{
			if(s[0]=='B')b++;
			if(s[s.size()-1]=='A')a++;
		}
		
		rep(j,s.size()-1){
			if(s[j]=='A'&&s[j+1]=='B')cnt++;
		}
	}

	if(a==0&&b==0){
		cout<<cnt+max(0ll,ab-1)<<endl;
	}else if(b==0||a==0){
		cout<<cnt+ab<<endl;
	}else if(ab==0){
		cout<<cnt+min(a,b)<<endl;
	}else{
		int k=min(a,b);
		cnt+=k;
		a-=k;
		b-=k;
		cout<<cnt+ab<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
struct mint {
  ll divisor = 1000000007;
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % divisor;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
};

void answer() {
  ll n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> memo(3, 0);
  mint ans = 1;
  rep(i,n) {
    int cnt = upper_bound(ALL(memo), a[i]) - lower_bound(ALL(memo), a[i]);
    ans *= cnt;
    (*lower_bound(ALL(memo), a[i]))++;
    sort(ALL(memo));
  }
  cout << ans << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int L,A,B,C,D,m,x=0;
  scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);
  m=A/C;
  if(A%C!=0)m++;
  if(B%D!=0)x++;
  if(B/D+x>m)m=B/D+x;
  printf("%d\n",L-m);
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1);
    for (int i = 1; i <= N; i++)
        cin >> A[i];

    vector<int> box(N + 1), res;
    for (int i = N; i > 0; i--) {
        int sum = 0;
        for (int j = i; j <= N; j += i) {
            sum += box[j];
        }
        if (sum % 2 != A[i]) {
            box[i]++;
            res.push_back(i);
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++)
        cout << res[i] << " ";
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){

int n;
cin>>n;
int l[n];
int sum = 0;
int MAX = 0;

for(int i=0;i<n;i++){
	cin>>l[i];
	sum += l[i];
	if(MAX < l[i])
		MAX = l[i];
}
sum -= MAX;

if(MAX < sum)
cout<< "Yes"<<endl;

else
cout<< "No" <<endl;

}


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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    int ans = 0, k2 = k;
    
    if(k2 == 0);
    else if(a > k2) {
        ans = k;
        k2 -= k;
    } else {
        ans = a;
        k2 -= a;
    }
    
    if(k2 == 0);
    else if(b > k2) {
        k2 -= k;
    } else {
        k2 -= b;
    }
    
    if(k2 == 0);
    else if(c > k2) {
        ans -= k2;
        k2 -= k;
    } else {
        ans -= c;
        k2 -= c;
    }
    
    cout << ans;
    
    
    return 0;
}


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

using namespace std;

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

  int n;
  string a, b, d;

  cin >> n >> a >> b >> d;

  int ans = 0;
  for(int i = 0; i < n; ++i) {
    int ret = 3;
    for(char c = 'a'; c <= 'z'; ++c) {
      ret = min(ret, int(a[i] != c) + (b[i] != c) + int(d[i] != c));
    }
    ans += ret;
  }

  cout << ans;
  return 0;
}

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

int main(){
    int x[3];
    for(int i=0;i<3;i++)
        cin>>x[i];

    int counter=0;
    if(x[0]==x[1])
        counter++;
    if(x[1]==x[2])
        counter++;
    if(x[0]==x[2])
        counter++;

    if(counter==3 || counter==2 || counter==0)
        cout<<"No"<<endl;
    if(counter==1)
        cout<<"Yes"<<endl;
    return 0;
}   

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  vector<int> x(5);
  rep(i, 5)
  {
    cin >> x[i];
    if (x[i] == 0)
    {
      cout << i + 1 << endl;
    }
  }

  return 0;
}


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

#define pb push_back
#define mp make_pair

const int MOD = 1e9+7;
const int MAX_N=2e5+10;

int N;
ll a[MAX_N];

void solve()
{
	map<int,int> cnt;
	ll ans = 0;
	for(int i=1;i<=N;++i){
		ans+=cnt[i-a[i]];
		cnt[i+a[i]]++;
	}
	cout << ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=1;i<=N;++i) cin >> a[i];
	solve();
	return 0;
}


Measured memory_bytes: 22132
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

struct UnionFind {
    vector<int> par;  // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) {  //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(
        int x) {  // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {  // xとyの木を併合
        int rx = root(x);       // xの根をrx
        int ry = root(y);       // yの根をry
        if (rx == ry) return;  // xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] =
            ry;  // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) {  // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    UnionFind tree(N);

    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        tree.unite(x - 1, y - 1);  // xの木とyの木を併合する
    }

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (!tree.same(0, i)) {
            tree.unite(0, i);
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3788
N=int(input())
A=str(input())
B=str(input())
C=str(input())
n=0

for i in range(0,N,1):
  if A[i]==B[i] and A[i]==C[i]:
    n+=0
    continue
  elif A[i]==B[i] or A[i]==C[i] or B[i]==C[i]:
    n+=1
    continue
  else:
    n+=2

print(n)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

const int nax = 103, INF=  1e9;
int x,n;
bool was[nax];

int main() {
	cin >> x >> n;
	for(int a,i=1; i<= n; ++i) {
		cin >> a;
		was[a] = 1;
	}
	pi best = {INF, INF};
	for(int i = 0; i <= 101; ++i) {
		if(was[i]) continue;
		best = min(best, {abs(x - i), i});
	}
	cout << best.ND;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, M; cin >> N >> M;
  vector<ll> A, B;
  for (ll i = 0; i < N; i++) {
    ll a, b; cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
  }
  vector<ll> C, D;
  for (ll i = 0; i < M; i++) {
    ll c, d; cin >> c >> d;
    C.push_back(c);
    D.push_back(d);
  }
  for (ll i = 0; i < N; i++) {
    ll x = -1;
    ll d = LLONG_MAX;
    for (ll j = 0; j < M; j++) {
      ll dd = abs(A.at(i) - C.at(j)) + abs(B.at(i) - D.at(j));
      if (dd < d) {
	d = dd;
	x = j;
      }
    }
    cout << x+1 << endl;
  }
  

  return 0;
}



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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }

const long long MOD = 1000000007;
const int MAX_N = 100000;
int n;
string s;


ll fact(ll n) {
  ll res = 1;
  while (n > 0) {
    res = (res * n) % MOD;
    n--;
  }
  return res;
}

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

  ll cnt = 1;
  bool even = 0;

  ll res = 1;
  forn1(i,2*n-1) {
    if ((s[i] == 'W' && !even) || (s[i] == 'B' && even)) {
      even = !even;
      cnt++;
    } else {
      res = (res * cnt) % MOD;
      even = !even;
      cnt--;
    }
  }

  if (cnt == 0)
    cout << res*fact(n)%MOD << endl;
  else
    cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){

    char pat[5]="ACGT";
    char s[110];
    int count=0;
    int result=0;
    bool flg=false;
    scanf("%s",s);
    for(int i=0;i<strlen(s); i++)
	{
        for(int j=0;j<5;j++)
            if(s[i]==pat[j])
                flg=true;
        if(flg)
            count++;
		else if(result<count)
		{
            result=count;
            count=0;
        }
        flg=false;
    }
    if(result<count)
        result=count;
    printf("%d",result);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int ans=0;
    int n=sc.nextInt();
    int[] nums=new int[n];
    for(int i=0;i<n;i++){
      nums[i]=sc.nextInt();
    }
    Arrays.sort(nums);
    for(int i=0;i<n;i++){
      ans+=nums[n-1-i]*(i%2==0?1:-1);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22612
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int AB = a[0];
        int BC = a[1];
        int CA = a[2];
        Console.WriteLine(AB * BC / 2);
        
    }
}

Measured memory_bytes: 13268
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 基本はdouble
//map<キー,値> p は辞書。p[キー] = 値
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}   // 


int main() {
	int N; cin >> N;
	vector<string> S(N);
	for (int i = 0; i < N; i++)cin >> S[i];

	sort(ALL(S));
	map<string, int> p;
	for (int i = 0; i < N; i++) {
		p[S[i]]++;
	}

	int m = 0;
	for (int i = 0; i < N; i++) {
		if (m <= p[S[i]])m = p[S[i]];
	}

	map<int,string> t;
	for (int i = 0; i < N; i++) {
		if (p[S[i]] == m) {
			t[i] = S[i];
		}
		else t[i] = "A";
	}

	map<string, int> u;
	for (int i = 0; i < N; i++) {
		if (t[i] != "A" && u[t[i]] ==0) {
			cout << t[i] << endl;
			u[t[i]]++;
		}
	}
}

Measured memory_bytes: 51712
#include<map>
#include<cstdio>
using namespace std;
int main(){for(int T;~scanf("%d",&T)&&T;puts("")){
	map<pair<int,int>,int>m;
	char C[2];
	int n,k;
	for(;T--;){
		scanf("%s%d",C,&n);
		if(*C=='D'){
			for(auto it=m.begin();it!=m.end();)if(it->second==n)m.erase(it++);else	++it;
		}else if(*C=='R'){
			auto it=m.lower_bound(make_pair(n,2000000000));
			printf("%d\n",it==m.begin()||n<(--it)->first.first||it->first.second<n ? -1 : it->second);
		}else if(*C=='W'){
			int c=!scanf("%d",&k),d;
			for(auto it=m.begin();k&&it!=m.end();++it){
				d=it->first.first-c;
				if(d>k)d=k;
				if(d)m.insert({{c,c+d-1},n});
				k-=d;
				c=it->first.second+1;
			}
			if(k)m.insert({{c,c+k-1},n});
		}
	}
}}

Measured memory_bytes: 1236