akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(3);
  for(int i = 0;i < 3;i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  if(a.at(0) == a.at(1) && a.at(0) == 5 && a.at(2) == 7) {
    cout << "YES" << endl;
  }else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

char s[100];

int main()
{
    char ch;

    int len = 0;
    while ((ch = getchar()) != '\n')
    {
        s[len++] = ch;
    }

    s[len] = 0;

    bool yes = true;

    for (int i = 0; i < len/2; ++i)
    {
        if (s[i] != s[len-1-i])
        {
            yes = false;
            break;
        }
    }

    int ll = (len-1)/2;
    for (int i = 0; i < ll/2 && yes; i++)
    {
        if (s[i] != s[ll-1-i])
        {
            yes = false;
        }
    }

    for (int i = 0; i < ll/2 && yes; i++)
    {
        if (s[len-1-i] != s[ll+1+i])
        {
            yes = false;
        }
    }

    if (yes)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int r,b,w,g;
  cin>>r>>b>>w>>g;
  cout<<r+b+w+g<<endl;

  return 0;
}


Measured memory_bytes: 3188
n = int(input())
ans = [0 for _ in range(n)]
for i in range(1,100):
  for j in range(1,100):
    for k in range(1,100):
      s = i**2 + j**2 + k**2 +i*j + j*k + k*i
      if s <= n:
        ans[s-1] += 1
for i in range(n):
  print(ans[i])

Measured memory_bytes: 69568
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	bool judge = true;
	int n,tmp;
	vector<int> a;
	cin >> n;
	for (int i = 0; i < n; i++) { cin >> tmp; a.push_back(tmp); }
	sort(a.begin(), a.end());
	for (int i = 0; i < n - 1;i++)
	{
		if (a[i] == a[i + 1]) { judge = false; break; }
	}
	if (judge) { cout << "YES\n"; }
	else { cout << "NO\n"; }

	return 0;
}


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

using namespace std;

template <int p>
struct Modint
{
	int value;

	Modint() : value(0) {}
	Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {}

	inline Modint &operator+=(const Modint &b)
	{
		if ((this->value += b.value) >= p)
			this->value -= p;
		return (*this);
	}
	inline Modint &operator-=(const Modint &b)
	{
		if ((this->value += p - b.value) >= p)
			this->value -= p;
		return (*this);
	}
	inline Modint &operator*=(const Modint &b)
	{
		this->value = (int)((1LL * this->value * b.value) % p);
		return (*this);
	}
	inline Modint &operator/=(const Modint &b)
	{
		(*this) *= b.inverse();
		return (*this);
	}

	Modint operator+(const Modint &b) const { return Modint(*this) += b; }
	Modint operator-(const Modint &b) const { return Modint(*this) -= b; }
	Modint operator*(const Modint &b) const { return Modint(*this) *= b; }
	Modint operator/(const Modint &b) const { return Modint(*this) /= b; }

	inline Modint &operator++(int) { return (*this) += 1; }
	inline Modint &operator--(int) { return (*this) -= 1; }

	inline bool operator==(const Modint &b) const { return this->value == b.value; }
	inline bool operator!=(const Modint &b) const { return this->value != b.value; }
	inline bool operator<(const Modint &b) const { return this->value < b.value; }
	inline bool operator<=(const Modint &b) const { return this->value <= b.value; }
	inline bool operator>(const Modint &b) const { return this->value > b.value; }
	inline bool operator>=(const Modint &b) const { return this->value >= b.value; }

	//requires that "this->value and p are co-prime"
	// a_i * v + a_(i+1) * p = r_i
	// r_i = r_(i+1) * q_(i+1) * r_(i+2)
	// q == 1 (i > 1)
	// reference: https://atcoder.jp/contests/agc026/submissions/2845729 (line:93)
	inline Modint inverse() const
	{
		assert(this->value != 0);
		int r0 = p, r1 = this->value, a0 = 0, a1 = 1;
		while (r1)
		{
			int q = r0 / r1;
			r0 -= q * r1;
			swap(r0, r1);
			a0 -= q * a1;
			swap(a0, a1);
		}
		return Modint(a0);
	}

	friend istream &operator>>(istream &is, Modint<p> &a)
	{
		long t;
		is >> t;
		a = Modint<p>(t);
		return is;
	}
	friend ostream &operator<<(ostream &os, const Modint<p> &a)
	{
		return os << a.value;
	}
};

const int MOD = 1e9 + 7;

using Int = Modint<MOD>;


void solve()
{
	int N;
	string S;
	cin >> N >> S;
	vector<Int> dp(N, Int(1));
	for (int i = 0; i < N-1; i++)
	{
		vector<Int> nx(N);
		if (S[i] == '>')
		{
			for (int j = N-i-2; j >= 0; j--)
			{
				nx[j] = nx[j+1] + dp[j+1];
			}
		}
		else
		{
			nx[0] = dp[0];
			for (int j = 0; j < N-i-2; j++)
			{
				nx[j+1] = nx[j] + dp[j+1];
			}
		}
		swap(dp, nx);
	}
	cout << dp[0] << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

using namespace std;

/*
	Name:Atcoder ABC166 A 
	Copyright:NONE 
	Author: CHAIN
	Date: 15-08-20 18:15
	Description: AtCoder Inc. holds a contest every Saturday.There are two types
	of contests called ABC and ARC, and just one of them is held at a time.The 
	company holds these two types of contests alternately: an ARC follows an 
	ABC and vice versa.Given a string S, resenting the type of the contest held
	last week, print the string representing the type of the contest held this
	week.
*/

int main(){
	string s;
	cin>>s;
	cout<< (s =="ABC"?"ARC":"ABC")<<'\n';
	return 0;
} 

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    int i,n,k;
    sf(n);
    int cnt=0;
    rep(i,n)
    {
        sf(k);
        if(k!=i)
            cnt++;
    }
    if(cnt<=2)
        puts("YES");
    else
        puts("NO");
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int a = int.Parse(ReadLine());
        string[] b = ReadLine().Split(' ');
        int[] d = new int[b.Length];
        for(int i=0;i<b.Length;i++){
            d[i] = int.Parse(b[i]);
        }
        Array.Sort(d);
        string c = "YES";
        for(int i=1;i<b.Length;i++){
            if(d[i] == d[i-1]){
                c = "NO";
                break;
            }
        }
        WriteLine(c);
    }
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    string s;cin >> s;
    lint r = 0;
    REP(i,SZ(s)){
        r += (s[i] == '0');
    }
    lint b = SZ(s) - r;
    lint ans=0;

    ans = SZ(s) - abs(r - b);

    cout << ans <<"\n";

    return 0;
}

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


long long int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int N;
  long long int O,S;
  O = 1000;
  S = 0;
  cin >> N;
  long long int A[N+1];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  A[N]=0;
  for(int i=0;i<N;i++){
    if(A[i]<A[i+1]){
      S = S + O/A[i];
      O = O%A[i];
    }
    if(A[i]>A[i+1]){
      O = O + S*A[i];
      S=0;
    }
  //  cout << O << ":" << S <<endl;
  }
  
  cout << O <<endl;
  
  return 0;
}


long long int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


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

const int INF = 0x3f3f3f3f;
const int MAX = 1e5+20;
int n,arr[MAX],dp[MAX];

int solve(int cur) {
    if(cur==n-1) return 0;
    if(cur>n) return INF;

    if(~dp[cur]) return dp[cur];

    int w1 = abs(arr[cur]-arr[cur+1]);
    int w2 = abs(arr[cur]-arr[cur+2]);

    return dp[cur] = min(solve(cur+1)+w1,w2+solve(cur+2));
}

int main() {

    memset(dp,-1,sizeof(dp));

    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&arr[i]);

    solve(0);
    printf("%d\n",dp[0]);

    return 0;
}


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

int main() {
  int a, b, c;
  int ans;
  cin >> a >> b >> c;
  ans = a + b + c;
  //cout << ans;
  if (ans >= 22) cout << "bust";
  if (ans <= 21) cout << "win";
}
// g++ lo.cpp
// ./a.exe
// g++ -o つくりたいふぁいるめい　もとのふぁいる.cpp

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

int main(void){
  int n, m, x;
  int a;
  int up=0;
  int down=0;
  cin >> n >> m >> x;
  for (size_t i = 0; i < m; i++) {
    cin >> a;
    if (a>x) {
      up+=1;
    }else{
      down+=1;
    }
  }
  if(up>down){
    cout << down << endl;
  }else{
    cout << up << endl;
  }
  return 0;
}


Measured memory_bytes: 256
class Alipnists
  def solve
    n = gets.chomp.to_i
    ts = gets.scan(/\d+/).map(&:to_i)
    as = gets.scan(/\d+/).map(&:to_i)

    if n == 1
      if ts[0] != as[0]
        return 0
      else
        return 1
      end
    end

    if n == 2
      if ts[0] >= as[1]
        if as[0] != ts[0] || ts[1] != ts[0]
          return 0
        else
          return 1
        end
      else
        if as[0] != as[1] || ts[1] != as[0]
          return 0
        else
          return 1
        end
      end
      100
    end

    ans = 1

    if as[0] > as[1]
      if as[0] != ts[0]
        return 0
      end
    else
      if ts[0] > as[0]
        return 0
      end
    end

    if ts[n-1] > ts[n-2]
      if ts[n-1] != as[n-1]
        return 0
      end
    else
      if ts[n-1] < as[n-1]
        return 0
      end
    end
    
    (1...n-1).each do |i|
      if ts[i] > ts[i-1]
        if as[i] > as[i+1]
          if as[i] != ts[i]
            return 0
          end
        else
          if ts[i] > as[i]
            return 0
          end
        end
      else
        if as[i] > as[i+1]
          if ts[i] < as[i]
            return 0
          end
        else
          ans *= [as[i], ts[i]].min
          ans %= 1000000007
        end
      end
    end
    ans
  end
end

if $0 == __FILE__
  puts Alipnists.new.solve
end


Measured memory_bytes: 19612
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    b = [int(i) for i in input().split()]

    s = b[0] + b[-1]

    p = b[0]
    for i in b[1:]:
        s += min(p, i)
        p = i

    print(s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29292
#include <stdio.h>

int main(void) {
  int i, j, k, h, w;
  scanf("%d%d", &h, &w);
  char c[h][w + 10];
  for(i = 0; i < h; ++i) scanf("%s", c[i]);
  int ans[h][w];
  for(i = 0; i < h; ++i) for(j = 0; j < w; ++j) {
    if(c[i][j] == '.') ans[i][j] = -1;
    else ans[i][j] = 0;
  }
  for(i = 1; i <= w; ++i) {
    for(j = 0; j < h; ++j) {
      for(k = w - 1; k >= 0; k--) {
        if(k && c[j][k - 1] == 'c') c[j][k] = 'c';
        else c[j][k] = '.';
      }
    }
    for(j = 0; j < h; ++j) {
      for(k = 0; k < w; ++k) {
        if(ans[j][k] == -1 && c[j][k] == 'c') ans[j][k] = i;
      }
    }
  }
  for(i = 0; i < h; ++i) {
   for(j = 0; j < w - 1; ++j) printf("%d ", ans[i][j]);
   printf("%d\n", ans[i][w - 1]);
  }
  return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B < C + D) {
    cout << "Right" <<endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second

int main(){
    FAST
    int n, k; cin >> n >> k;
    bool has[n + 1];
    mm(has);
    for(int i = 0; i < k; i++){
        int d; cin >> d;
        for(int j = 0; j < d; j++){
            int a; cin >> a;
            has[a] = 1;
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(!has[i])ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3588
#include<queue>
#include<cstdio>
#include<algorithm>

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

using namespace std;

// #include"binary_heap.cpp"
// #include"d_heap.cpp"
// #include"pqueue.cpp"

template<class T>
class d_heap_for_Dijkstra{
	static const int N_MAX=100;
	int n,d,key[N_MAX],pos[N_MAX];
	T val[N_MAX];

	void sift_up(int i,const T &x){
		val[i]=x;
		while(i!=0 && val[(i-1)/d]>val[i]){
			int p=(i-1)/d;
			swap(pos[key[p]],pos[key[i]]);
			swap(key[p],key[i]);
			swap(val[p],val[i]);
			i=p;
		}
	}
	void sift_down(int i,const T &x){
		val[i]=x;
		for(int j,k,c;;i=j){
			j=i;
			for(c=0,k=d*i+1;c<d;c++,k++) if(k<n && val[j]>val[k]) j=k;
			if(j==i) break;
			swap(pos[key[j]],pos[key[i]]);
			swap(key[j],key[i]);
			swap(val[j],val[i]);
		}
	}
public:
	d_heap_for_Dijkstra(int d):n(0),d(d){}
	int find_min()const{ return key[0]; }
	void insert(int u,const T &x){
		int i=n++;
		key[i]=u;
		pos[u]=i;
		sift_up(i,x);
	}
	void delete_min(){
		n--;
		pos[key[n]]=pos[key[0]];
		key[0]=key[n];
		sift_down(0,val[n]);
	}
	void decrease_key(int u,const T &x){
		sift_up(pos[u],x);
	}
	bool empty()const{ return n==0; }
	int size()const{ return n; }
	// bool member(int u)const{ return pos[u]}
	void print(){
		puts("-------");
		printf("n=%d:\n",n);
		rep(i,n) printf("  key[%d] = %d, val[%d] = %d\n",i,key[i],i,val[i]);
		// rep(i,5) printf("  pos[%d] = %d\n",i,pos[i]);
		puts("-------");
	}
};

const int INF=1<<29;

struct edge{ int v,cost1,cost2; };

int main(){
	for(int m,n;scanf("%d%d",&m,&n),n;){
		vector<edge> G[100];
		rep(i,m){
			int u,v,cost1,cost2; scanf("%d%d%d%d",&u,&v,&cost1,&cost2); u--; v--;
			G[u].push_back((edge){v,cost1,cost2});
			G[v].push_back((edge){u,cost1,cost2});
		}

		int q; scanf("%d",&q);
		while(q--){
			int s,t,type; scanf("%d%d%d",&s,&t,&type); s--; t--;
// printf("s=%d, t=%d\n",s+1,t+1);

			int d[100];
			rep(u,n) d[u]=(u==s?0:INF);
			d_heap_for_Dijkstra<int> H(2);
			H.insert(s,0);
			while(!H.empty()){
// H.print();
				int u=H.find_min();
// printf("  u=%d, d[%d]=%d\n",u,u,d[u]);
				H.delete_min();

				rep(i,G[u].size()){
					const edge &e=G[u][i];
					int d2=d[u]+(type==0?e.cost1:e.cost2);
					if(d[e.v]>d2){
// printf("    v=%d, d2=%d\n",e.v,d2);
						if(d[e.v]==INF) H.insert(e.v,d2);
						else            H.decrease_key(e.v,d2);
						d[e.v]=d2;
					}
				}
			}

			printf("%d\n",d[t]);
		}
	}

	return 0;
}

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

#define ALL(x) x.begin(), x.end()

using namespace std;

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

void solve(void) {

	cout << setprecision(10);
	int n;
	cin >> n;

	vector<double> A(n);
	for(double& x : A) {
		cin >> x;
	}

	vector<vector<double>> dp(n+1, vector<double>(n+1));
	dp[0][0] = 1;
	double ans = 0;

	for(int i = 0; i <= n; i++) {
		for(int j = 0; i + j <= n; j++) {
			if(i == 0 && j == 0) {
				dp[i][j] = 1;
			} else {
				int x = i + j - 1;
				if(i > 0) {
					dp[i][j] += A[x] * dp[i-1][j];
				}
				if(j > 0) {
					dp[i][j] += (1.0 - A[x]) * dp[i][j-1];
				}

			}
		}
	}

	for(int i = n; i > n/2; i--) {
		int j = n - i;
		ans += dp[i][j];
	}

	cout << ans << '\n';
}

int main(void) {

	solve();
	return 0;
}


Measured memory_bytes: 70656
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <numeric>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define ALL(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

// ll gcd(ll a,ll b)  {
// 	if (a%b==0)  return(b);
// 	else return(gcd(b,a%b));
// }
//
// ll lcm(ll number1,ll number2){
// 	return number1 * number2 / gcd(number1,number2);
// }



int main(){
	int N; cin >> N;
	vector<int> d;
	rep(i,N){
		int a; cin >> a;
		d.push_back(a);
	}
	sort(ALL(d));
	int a = d[N/2-1];
	int b = d[N/2];
	cout << b-a << endl;


	return 0;
}


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

using namespace std;

int n,m,i,j,cnt[100005];
bool red[100005];

int main(){
	scanf("%d%d", &n, &m);
	for(i = 1; i <= n; i++)
	cnt[i] = 1;
	red[1] = 1;
	for(i = 0; i < m; i++){
		int x,y;
		scanf("%d%d", &x, &y);
		if(red[x] && cnt[x] == 1){
			red[x] = 0;
			red[y] = 1;
		}
		else if(red[x])
		red[y] = 1;
		cnt[x]--;
		cnt[y]++;
	}
	int ans = 0;
	for(i = 1; i <= n; i++)
	ans += red[i];
	printf("%d\n", ans);
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=6e5+10,M=3e5;
char c[N],z;
int n,op=1,l,r;
inline ll read()
{
	ll x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}
int main()
{
	//freopen("1.in","r",stdin);
	scanf("%s",c+M);
	int len=strlen(c+M);
	l=M;r=l+len-1;
	n=read(); 
	for(int i=1;i<=n;++i)
	{
		int T=read();
		if(T==1) op=-op;
		else if(T==2)
		{
			int f=read();
			cin>>z;
			if((op==1&&f==1)||(op==-1&&f==2)) c[--l]=z;
			else                              c[++r]=z;
		}
	} 
	if(op==1)
	{
		for(int i=l;i<=r;++i) printf("%c",c[i]);
		return 0;
	}
	for(int i=r;i>=l;--i) printf("%c",c[i]);
	return 0;
}


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

typedef long long ll;
const int N = 1e5 + 100;

int n, k, cnt, ans, p = 1;
string s;
vector<int> vec;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k >> s;
	cnt = (s[0] == '0');
	for (int i = 0; i < n; i++) {
		if(i && s[i] == '1' && s[i - 1] == '0')
			cnt--;
		while(p < n) {
			if(s[p - 1] == s[p])
				p++;
			else if(s[p] == '1')
				p++;
			else if(cnt < k)
				cnt++, p++;
			else
				break;
		}
		ans = max(ans, p - i);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    // Your code here!
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int dp[n];
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        int q1=INT_MAX,q2=INT_MAX;
        if(i>=1)
        {
            q1=dp[i-1]+abs(a[i]-a[i-1]);
        }
        if(i>=2)
        {
            q2=dp[i-2]+abs(a[i]-a[i-2]);
        }
        dp[i]=min(q1,q2);
    }
    cout<<dp[n-1]<<'\n';
    return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

# 同じ数字2つをマージした時の行き先と増える操作回数
# (nxt, cnt)
D = {
    0: (0, 1),
    1: (2, 1),
    2: (4, 1),
    3: (6, 1),
    4: (8, 1),
    5: (1, 2),
    6: (3, 2),
    7: (5, 2),
    8: (7, 2),
    9: (9, 2),
}

M = INT()
C = Counter()
for i in range(M):
    d, c = MAP()
    # 同じ数字の桁は全て一纏めにする
    C[d] += c

# 数字aがcnt個あった時に、全てマージした後の数字と費やした操作回数を返す
def calc(a, cnt):
    sm = 0
    odd = []
    # 1つになるまでやる
    while cnt > 1:
        # 奇数だと半分にした時1つ余るので後で別処理するように分けておく
        if cnt % 2 == 1:
            odd.append(a)
            cnt -= 1
        cnt //= 2
        sm += cnt * D[a][1]
        a = D[a][0]
    # 奇数の時に分けておいた分を愚直シミュレーション
    for b in odd:
        a += b
        sm += 1
        if a >= 10:
            a = int(str(a)[0]) + int(str(a)[1])
            sm += 1
    return (a, sm)

ans = 0
A = []
for k, v in C.items():
    # 数字毎にマージ、これで残り最大10桁まで減るはず
    a, sm = calc(k, v)
    ans += sm
    A.append(a)

# 残りを愚直シミュレーション
sm = A[0]
for a in A[1:]:
    sm += a
    ans += 1
    if sm >= 10:
        sm = int(str(sm)[0]) + int(str(sm)[1])
        ans += 1
print(ans)


Measured memory_bytes: 3508
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
void solve(){
     int n,cnt;
     cin>>n;
     vector<int> v(n);
     for(auto& it:v)cin>>it;
     int ans=INT_MAX;
     for(auto it:v){
     	cnt=0;
     	while(it%2==0){
     		it>>=1;
     		cnt++;
     	}
     	ans=min(ans,cnt);
     }
     cout<<ans<<endl;
 }
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }

int n,m;

	
void solve() {
      cin>>n>>m;
      
      if(n%2==1) {
		    for(int i=1;i<=m;i++) 
		       cout<<i<<" "<<n-i<<endl;		       
		  } 
		  
      else { 
		  int mid=(m+1)/2;
		  for(int i=1;i<=mid;i++) 
			cout<<i<<" "<<n-i+1<<endl;
		  for(int i=mid+1;i<=m;i++)
		   cout<<i<<" "<<n-i<<endl;	   
	   }
    
 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int gcd(long long int a, long long int b) {
	long long int r, tmp;

	if (a > b) {
		tmp = b;
		b = a;
		a = tmp;
	}

	while ((r = b % a) != 0) {
		b = a;
		a = r;
	}

	return a;
}

int main()
{
	long long int n, *x;
	long long int start;

	cin >> n >> start;
	x = new long long int[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	for (int i = 0; i < n; i++) {
		x[i] = abs(x[i] - start);
	}

	for (int i = 1; i < n; i++) {
		x[i] = gcd(x[i - 1], x[i]);
	}

	cout << x[n - 1] << endl;

	delete[] x;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;
    
    cout << min(A, B) + min(C, D) << endl;
    return 0;
}


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

int main(){
    while(1){
        int m, nmin, nmax;
        cin >> m >> nmin >> nmax;
        if(m == 0 && nmin == 0 && nmax == 0)break;

        int p[100002];  // 1-origin
        for(int i = 1; i <= m; i++){
            cin >> p[i];
        }

        int gap = 0, ans;
        for(int i = nmin; i <= nmax; i++){
            if(p[i] - p[i + 1] >= gap){
                gap = p[i] - p[i + 1];
                ans = i;
            }
        }

        cout << ans << endl;
        //cout << gap << endl;
    }





    return 0;
}

Measured memory_bytes: 3124
{-# LANGUAGE PatternSynonyms, ViewPatterns #-}

import Text.Printf
import Data.Sequence

func :: Seq Char -> Int
func (viewl -> EmptyL) = 0
func (viewl -> 'R' :< r) = func r
func (viewr -> l :> 'W') = func l
func (viewl -> 'W' :< (viewr -> m :> 'R')) = 1 + func m
func (viewl -> 'W' :< m) = 1 + func m
func (viewr -> m :> 'R') = 1 + func m

main :: IO ()
main = do
  _ <- getLine
  s <- getLine
  printf "%d\n" $ func $ fromList s

Measured memory_bytes: 16244
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
# S=numpp.assaray(S)=="#"
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()



def main():
    N=I()
    A=S()
    al="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    out=""
    for a in A:
        x=al.find(a)
        x+=N
        while x>25:
            x-=26
        out+=al[x]

    print(out)




if __name__ == "__main__":
    main()

Measured memory_bytes: 23276
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            int H;int W;
            Multi(out H, out W);
            var cell = new char[H][];
            for(int i = 0; i < H; i++)
            {
                cell[i] = GetStr().ToCharArray();
            }
            cell = cell.Where(c => c.Any(a=>a=='#')).ToArray();
            var rcell = new char[W][];
            for(int i = 0; i < W; i++)
            {
                rcell[i] = new char[cell.Count()];
                for(int j = 0; j < cell.Count(); j++)
                {
                    rcell[i][j] = cell[j][i];
                }
            }
            rcell = rcell.Where(c => c.Any(a => a == '#')).ToArray();
            cell = new char[cell.Count()][];
            for(int i = 0; i < cell.Count(); i++)
            {
                cell[i] = new char[rcell.Count()];
                for(int j = 0; j < rcell.Count(); j++)
                {
                    cell[i][j] = rcell[j][i];
                }
                Console.WriteLine(new string(cell[i]));
            }

        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a, b, c = 0;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        int d = 0;
        for (char j : s) d += j - '0';
        if (d >= a && d <= b) c += i;
    }
    cout << c;
}


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

using namespace std;

int main(){
	string x;
	int n,m;
    vector<int> p, a;
	p.push_back(0);
	a.push_back(0);
	getline(cin, x);
	while(n=x.find("peach", p.back() + 1), ~n)
		p.push_back(n);
	while(m=x.find("apple", a.back() + 1), ~m)
		a.push_back(m);
	for(int i = 1; i < p.size(); i++)
		x.replace(p[i], 5, "apple");
	for(int j = 1; j < a.size(); j++)
		x.replace(a[j], 5, "peach");
	cout<< x <<endl;
	return 0;
}


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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
	int plan_1 = n * a;
	int plan_2 = b;
    if (plan_1 <= plan_2)
      cout << plan_1 << endl;
    else
      cout << plan_2 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static int INF = (int) 1e8;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int[] L = new int[N];
        for (int n = 0; n < N; n += 1) {
            L[n] = sc.nextInt();
        }

        System.out.println(dfs(0, 0, 0, 0, N, A, B, C, L));
    }

    private static int dfs(int n, int a, int b, int c, int N, int A, int B, int C, int[] L) {
        if (n == N) {
            if (a == 0 || b == 0 || c == 0) {
                return INF;
            } else {
                return Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30;
            }
        }

        int dfsNull = dfs(n + 1, a, b, c, N, A, B, C, L);
        int dfsA = dfs(n + 1, a + L[n], b, c, N, A, B, C, L) + 10;
        int dfsB = dfs(n + 1, a, b + L[n], c, N, A, B, C, L) + 10;
        int dfsC = dfs(n + 1, a, b, c + L[n], N, A, B, C, L) + 10;

        int[] maxArray = new int[]{dfsNull, dfsA, dfsB, dfsC};
        return Arrays.stream(maxArray).min().getAsInt();
    }

}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007

// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define ll long long int
#define VI vector <ll>
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------
vector <vector <int>> G,BL;
VI AA;
bool check[M5];
void dfs(int v){
    if(check[v]) return;
    check[v] = true;
    AA.push_back(v);
    REP(i,G[v].size()){
        dfs(G[v][i]);
    }
}

void solve() {

    ll N,M,K;
    ll A[M5],B[M5];
    ll C[M5],D[M5];
    ll FR[M5];
    REP(i,M5){
        check[i] = false;
    }

    G.resize(M5);
    BL.resize(M5);
    AA.resize(M5);
    cin >> N >> M >> K;
    REP(i,M){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[min(a,b)].push_back(max(a,b));
        G[max(a,b)].push_back(min(a,b));

    }
    REP(i,K){
        int c,d;
        cin >> c >> d;
        c--;
        d--;
        BL[min(c,d)].push_back(max(c,d));
    }
    VI GR;
    GR.resize(M5);
    REP(i,N){
        AA.clear();
        dfs(i);
        REP(j,AA.size()){
            FR[AA[j]] = AA.size();
            GR[AA[j]] = i;
        }
    }

    REP(i,BL.size()){
        REP(j,BL[i].size()){
            if(GR[i] == GR[BL[i][j]]){
//                cout << i << "and" << BL[i][j] 
                FR[i]--;
                FR[BL[i][j]]--;
            }
        }
    }

    REP(i,N){
        cout << FR[i] - G[i].size() - 1 << " ";
    }

}

signed main() {
    

    solve();

    return 0;
}

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

int main() {
    string S; cin >> S;
    int n = S.size();

    for(int i = 0; i < n; ++i)
        for(int j = i + 1; j < n; ++j)
            if(S[i] == 'C' && S[j] == 'F') {
                cout << "Yes\n";
                return 0;
            }

    cout << "No\n";
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {

    string s;
    cin >> s;
    rep(i, 1 << 4) {
        vector<int> v;
        rep(j, 4)if ((i >> j) & 1) v.push_back(j);

        string u = "AKIHABARA";
        for (int j : v) {
            if (j == 0) u[0] = ' ';
            if (j == 1) u[4] = ' ';
            if (j == 2) u[6] = ' ';
            if (j == 3) u[8] = ' ';
        }
        string t = "";
        rep(i, u.size())if (u[i] != ' ') t.push_back(u[i]);
        if (s == t) {
            cout << "YES" << endl;
            ret();
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10 ** 7)

MOD = 2  # type: int


def solve(N: int, a: "List[int]"):
    ans = [0 for x in range(N)]
    for i in range(N - 1, -1, -1):
        s = 0
        for j in range(i, N, i + 1):
            s += ans[j]
        # print(s, a[i], s ^ a[i])
        if (s + a[i]) & 1:
            ans[i] = 1
    # print(ans)
    b = int(sum(ans))
    print(b)
    l = []
    if b:
        for i, x in enumerate(ans):
            if x == 1:
                l.append(i + 1)
        print(*l)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

/*
0-index
functionの中を書いて使う
segtree<ll> seg(n, [](ll a, ll b){return a + b;}, 0);
*/
template<typename T>
struct segtree{
	int n;
	vector<T> dat;
	T ZERO;
	function<T(T,T)> func;//要素と要素をマージする関数

	segtree(int n_, function<T(T,T)> func_, T zero):func(func_), ZERO(zero){
	  n = 1;
	  while(n < n_)n*=2;
	  dat.resize(2*n);
	  for(int i = 0;i < 2*n;i++)dat[i] = ZERO;
	}

	void update(int k, T a){
	  k += n - 1;dat[k] = a;
	  while(k > 0){
		k = (k-1)/2;
		dat[k] = func(dat[k*2+1],dat[k*2+2]);
	  }
	}

	void set(int k, T a) {
		k += n - 1;dat[k] = a;
	}

	void build(){
		for(int i = n - 2;i >= 0;i--){
			dat[i] = func(dat[2 * i + 1], dat[2 * i + 2]);
		}
	}

	T get(int k){return dat[k+n-1];}

	T que(int a,int b){
		T L = ZERO,R = ZERO;
		int A = a + n - 1;
		int B = b + n - 1;
		while(A < B){
			if((A & 1) == 0)L = func(L,dat[A++]);
            if((B & 1) == 0)R = func(dat[--B],R);
            A = A >> 1;
            B = B >> 1;
		}
		return func(L,R);
	}
};

ll ans[111111];

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

    ll n, m;cin >> n >> m;
    string str;cin >> str;
    segtree<P> seg(222222, [](P a, P b){return min(a, b);}, MP(INF, INF));
    seg.update(n, MP(0, n));

    REV(i, n){
        if(str[i] == '1')continue;
        auto now = seg.que(i+1, i+m+1);
        if(now.FI == INF)continue;
        seg.update(i, MP(now.FI+1, i));
        ans[i] = now.SE;
    }

    if(seg.get(0).FI == INF){
        cout << -1 << endl;
        return 0;
    }

    int now = 0;
    while(now != n){
        cout << ans[now] - now << " ";
        now = ans[now];
    }
    cout << endl;
/*
    REP(i, n+1){
        cout << "(" << seg.get(i).FI << "," << seg.get(i).SE << ")";
    }cout << endl;
*/
	return 0;
}


Measured memory_bytes: 9680
import Control.Monad
import Control.Monad.ST
import qualified Data.Array as A
import qualified Data.Array.ST as ST
import qualified Data.Array.Unboxed as AU
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.Int
import qualified Data.IntMap as IM
import Data.List
import qualified Data.Map as M
import Data.Maybe
import Data.Ord
import qualified Data.Set as S
import Data.Time
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [n] <- readInt
  print $ solve n

solve n = f n 1 0 -2
  where
    f n a acc
      | a * a > n = acc
      | n `mod` a == 0 = f n (a + 1) (a + n `div` a)
      | otherwise = f n (a + 1) acc


Measured memory_bytes: 508
k = int(input())
import math
ans = 0
ans += int((1+k)*k/2)

if k >= 2:
    for i in range(1,k+1):
        for j in range(1,k+1):
            if i != j:
                tmp = math.gcd(i,j)
                ans += math.gcd(tmp,j)*3
if k >= 3:
    for i in range(1,k-1):
        for j in range(i+1,k):
            for l in range(j+1,k+1):
                tmp = math.gcd(i,j)
                ans += math.gcd(tmp,l)*6
                    
print(ans)

Measured memory_bytes: 9216
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
constexpr long long int NINF = std::numeric_limits<long long int>::min();
#define int long long int

void solve() {
  int N, T, A;
  cin >> N >> T >> A;

  A *= 1000;
  T *= 1000;

  vector<pair<int, int>> v;

  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;

    v.emplace_back(abs(A - (T - x * 6)), i);
  }
  sort(v.begin(), v.end());
  cout << v[0].second << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	ll N, M;
	cin >> N >> M;;
	cout << abs(N-2)*abs(M-2) << endl;
	return 0;
}

Measured memory_bytes: 256