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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  ll n, d;
  cin >> n >> d;

  ll ans = 0;

  rep(i,0,n) {
    ll x, y;
    cin >> x >> y;

    if (x*x + y*y <= d*d) ++ ans;
  }

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

Measured memory_bytes: 3664
import Control.Monad
import qualified Data.IntMap as IntMap
import Data.Time
--import Data.Array.IO
import qualified Data.Vector.Unboxed as V
import Data.Maybe

{-toIntMap :: Int -> Int -> [Int] -> IntMap.IntMap Int
toIntMap i k [] = IntMap.empty
toIntMap i k (x:xs) | i == k = (toIntMap (i+1) k xs)
                    | otherwise = IntMap.insertWith (+) x 1 (toIntMap (i+1) k xs)-}

{-toIntMap :: Int -> Int -> V.Vector Int -> IntMap.IntMap Int
toIntMap i k v | V.null v = IntMap.empty
               | i == k = (toIntMap (i+1) k (V.tail v))
               | otherwise = IntMap.insertWith (+) (V.head v) 1 (toIntMap (i+1) k (V.tail v))-}

toIntMap :: V.Vector Int -> IntMap.IntMap Int
toIntMap v | V.null v = IntMap.empty
           | otherwise = IntMap.insertWith (+) (V.head v) 1 (toIntMap (V.tail v))



main = do
  --let n = 100000  -- n=2000   ->  1.6s
  --let as = replicate n 1
  n <- read<$>getLine
  as <- (map read) . words<$>getLine :: IO [Int]
  --preJikkou <- getCurrentTime
  let as_v = V.fromList as
  let whole = toIntMap as_v
  let f v = v * (v-1) `div` 2
  let whole_value = IntMap.foldl (+) 0 $ IntMap.map f whole

  V.forM_ (V.generate n id) $ \k -> do
    --let excpt = (take k as) ++ (drop (k+1) as)
    print $ whole_value - ((fromMaybe 0 (IntMap.lookup (as_v V.! k) whole)) - 1)

  --postJikkou <- getCurrentTime
  --print $ diffUTCTime postJikkou preJikkou

Measured memory_bytes: 70268
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    ll sum = 0;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    set<ll> st;
    for(ll i = 1; i*i <= sum; ++i){
        if(sum%i == 0){
            st.insert(i);
            st.insert(sum/i);
        }
    }
    ll ans = 1;
    for(auto x : st){
        ll cost = 0, total = 0;
        vector<ll> rest(n);
        rep(i,n){
            rest[i] = a[i] % x;
            total += rest[i];
        }
        sort(rest.begin(), rest.end());
        ll l = n - total / x;
        rep(i,l) cost += rest[i];
        if(cost <= k) chmax(ans, x);
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0,ans =0;
  cin >> N;
  vector<ll>A(N);
  rep(i,N){
    cin >> A[i];
  }
  sort(A.begin(), A.end()); //小さい順
  reverse(A.begin(), A.end());
  rep(i,N){
    if(i == 0){
      ans+=A[i]/2;
    }
    else{
      ans += A[i];
    }
  }
  cout << ans;
}


Measured memory_bytes: 3604
#include <iostream>

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <vector>

using namespace std;

template <typename T>
std::vector<T> divisor_list(const T N)
{
    std::vector<T> result;

    for (T val = 1; val * val <= N; val++)
    {
        if (N % val == 0)
        {
            result.push_back(val);
            result.push_back(N / val);
        }
    }
    sort(result.begin(), result.end());

    return result;
}

uint64_t log10(uint64_t val)
{
    uint64_t counter = 0;
    while (val > 0)
    {
        counter++;
        val /= 10;
    };
    return counter;
}

int main()
{
    uint64_t N;
    cin >> N;
    auto div_list = divisor_list(N);
    uint64_t answer = 10000000;
    for (auto v : div_list)
    {
        answer = min(answer, max(log10(v), log10(N / v)));
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
int t_mult(int a, int b)
{
	if(a >= 1 && a <= 9
			&& b >= 1 && b <= 9 ) {
		return a*b;
	}

	return -1;
}

int main(void)
{
	int A, B;

	scanf("%d %d", &A, &B);

	printf("%d", t_mult(A, B));

	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"sort"
)

// Pair .
type Pair struct {
	l int
	r int
}

// Pairs .
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}

func (p Pairs) Less(i, j int) bool {
	if p[i].l == p[j].l {
		return p[i].r < p[i].r
	}

	return p[i].l < p[j].l
}

func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func main() {
	var n int
	fmt.Scan(&n)

	pairs := make([]Pair, n)
	var x, l int
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &l)
		pairs[i] = Pair{x - l, x + l}
	}
	sort.Sort(Pairs(pairs))

	ans := n
	p1 := pairs[0]
	for i := 1; i < n; i++ {
		p2 := pairs[i]
		if p2.l < p1.r {
			if p2.r < p1.r {
				p1 = p2
			}
			ans--
		} else {
			p1 = p2
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 4992
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n,k = inp
d = inp
t = na(10,false)
d.each do |dd|
  t[dd] = true
end
able = []
10.times do |i|
  able << i.to_s unless(t[i])
end
lable = copy(able)
lable.delete("0")
s = n.to_s
ans = lable[0]+able[0]*s.size
pans =""
s.size.times do |i|
  f = false
  ff = false
  able.each do |dd|
    if(dd >= s[i])
      pans += dd
      f = true
      ff = true if(dd > s[i])
      break
    end
  end
  unless f
    puts ans
    exit
  end
  if(ff)
    pans+=able[0]*(s.size - i-1)
    puts pans
    exit
  end
end
puts pans

Measured memory_bytes: 1788
def fun(a)
    l = a.size
    c = a[0]
    x = 0
    i = 0
    b = ""
    while i < l
        while a[i] == c
            x+=1
            i+=1
        end
        b += x.to_s+c
        c = a[i]
        x = 0
    end
    b
end

n = gets.to_i

while n!=0
  a = gets.chomp()
  n.times{a = fun(a)}
  puts a
  n = gets.to_i
end

Measured memory_bytes: 88664
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, A[18];
vector<pair<ll, ll>>DP[18][18];
ll RES;

vector<pair<ll,ll>> f(int l, int r) {
	if (DP[l][r].empty()) {
		vector<pair<ll, ll>>v;
		for (int i = l + 1; i <= r - 1; ++i) {
			vector<pair<ll, ll>>L = f(l, i);
			vector<pair<ll, ll>>R = f(i, r);
			for (int j = 0; j < L.size(); ++j) {
				for (int k = 0; k < R.size(); ++k) {
					v.push_back(mkp(L[j].first + L[j].second + R[k].first - A[i], L[j].second + R[k].first - A[i] + R[k].second));
				}
			}
		}
		for (int i = 0; i < v.size(); ++i) {
			bool f = true;
			for (int j = 0; j < v.size(); ++j) {
				if (v[i].first > v[j].first&&v[i].second > v[j].second || (v[i] == v[j] && i < j)) {
					f = false;
					break;
				}
			}
			if (f) {
				DP[l][r].push_back(v[i]);
			}
		}
	}
	return DP[l][r];
}

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	for (int i = 0; i < N - 1; ++i) {
		DP[i][i + 1].push_back(mkp(A[i], A[i + 1]));
	}
	vector<pair<ll, ll>>res = f(0, N - 1);
	RES = llmax;
	for (pair<ll, ll>p : res) {
		RES = min(RES, p.first + p.second);
	}
	cout << RES << endl;
}

Measured memory_bytes: 928
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

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

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

int main(){
	while(1){
		int T,P,R; cin>>T>>P>>R;
		if(T==0) break;
		vi pnt(T,0);
		vi cnt(T,0);
		vvi ws(T,vi(P,0));

		rep(i,R){
			int t,p,sec;
			string mes;
			cin>>t>>p>>sec>>mes;
			if(mes=="CORRECT"){
				cnt[t-1]++;
				pnt[t-1]+=(ws[t-1][p-1]*1200+sec);
			}
			else{
				ws[t-1][p-1]++;
			}
		}

		vi team(T);
		rep(i,T) team[i]=i;

		/*
		cout<<"-----"<<endl;
		rep(i,T){
			cout<<team[i]+1<<" "<<cnt[team[i]]<<" "<<pnt[team[i]]<<endl;
		}
		cout<<"-----"<<endl;
		*/

		rep(i,T){
			rep(j,T-1){
				int a = team[j];
				int b = team[j+1];
				if(cnt[a]<cnt[b] || (cnt[a]==cnt[b] && pnt[a]>pnt[b]) ){
					//cout<<"a: "<<a+1<<" "<<cnt[a]<<" "<<pnt[a]<<endl;
					//cout<<"b: "<<b+1<<" "<<cnt[b]<<" "<<pnt[b]<<endl;
				// || (cnt[i]==cnt[j] && pnt[i]==pnt[j] && team[i] < team[j]) ){
					swap(team[j],team[j+1]);
				}
			}
		}
		/*
		rep(i,T*T){
			int a = team[i];
			int b = team[i+1];
			if(cnt[a]==cnt[b] && pnt[a]==pnt[b] && team[a] > team[b]){
				swap(team[a],team[b]);
			}
		}
		*/
		rep(i,T){
			cout<<team[i]+1<<" "<<cnt[team[i]]<<" "<<pnt[team[i]]<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3136
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

int N, K;
int A[200001];
int F[200001];

//----------ソート用----------
struct St
{
	int a,f,n;
	bool operator < (const St& st) const
	{
		return (n < st.n); //(昇順)
	}
};

St st[200001];

//にぶたん
bool isOK(int index)
{
	int count = 0;
	for (int i = 0; i < N; i++)
	{
		if (index < st[i].n)
		{
			int sub = st[i].n - index;
			int c = ceil(sub / (double)st[i].f);
			count += c;
		}
	}
	return (count <= K);
}

int binary_search(int n)
{
	int left = -1;
	int right = n;
	while (right - left > 1)
	{
		int mid = left + (right - left) / 2;
		if (isOK(mid))
			right = mid;
		else
			left = mid;
	}
	return right;
}


signed main()
{
	cin >> N >> K;
	REP(i, N) cin >> A[i];
	REP(i, N) cin >> F[i];

	ARY_SORT(A, N);
	ARY_SORT(F, N);
	for (int i = 0; i < N; i++)
	{
		st[i].a = A[i];
		st[i].f = F[N - i - 1];
		st[i].n = st[i].a * st[i].f;
	}
	ARY_SORT(st, N);

	int b = binary_search(1000000000000);
	cout << b << endl;

}


Measured memory_bytes: 8064
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

llong pow(int x, int n){
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

template <typename T> struct BIT { // 1-indexed
private:
    vector<T> array;
    const int n;

public:
    // 初期化
    BIT(int _n) : array(_n + 1, 0), n(_n) {}

    // 1番目からi番目までの累積和を求める
    T sum(int i) {
        T s = 0;
        while(i > 0) {
            s += array[i];
            i -= i & -i; // LSB減算
        }

        return s;
    }

    // [i, j]の要素の総和
    T sum(int i, int j) {
        T ret_i = sum(i - 1);
        T ret_j = sum(j);

        return ret_j - ret_i;
    }

    // i番目に要素xを追加
    void add(int i, T x) {
        while (i <= n) {
            array[i] += x;
            i += i & -i; // LSB加算
        }
    }
};

template <typename T> struct BIT2 { // 1-indexed
private:
    vector<vector<T> > array;
    const int n;
    const int m;

public:
    // 初期化
    BIT2(int _n, int _m) : array(_n + 1, vector<T>(_m + 1, 0)), n(_n), m(_m) {}

    // (1, 1)から(x, y)までの累積和を求める
    T sum(int x, int y) {
        T s = 0;
        for (int i = x; i > 0; i -= i & (-i)) {
            for (int j = y; j > 0; j -= j & (-j)) {
                s += array[i][j];
            }
        }

        return s;
    }

    // [(x1, y1), (x2, y2)]の要素の総和
    T sum(int x1, int y1, int x2, int y2) {
        return sum(x2, y2) - sum(x1 - 1, y2) - sum(x2, y1 - 1) + sum(x1 - 1, y1 - 1);
    }

    // (x, y)に要素kを追加
    void add(int x, int y, T k) {
        for (int i = x; i <= n; i += i & (-i)) {
            for (int j = y; j <= m; j += j & (-j)) {
                array[i][j] += k;
            }
        }
    }
};

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

string toUpper(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = toupper(s[i]);
    }
    return t;
}

string toLower(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = tolower(s[i]);
    }
    return t;
}

int main(){
    int n, i;
    cin >> n >> i;
    cout << n - i + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
res_list = [0] * N

for i in range(N - 1, -1, -1):
    r = sum(res_list[i::(i + 1)])
    if (r - a_list[i]) % 2 != 0:
        res_list[i] = 1

S = sum(res_list)
print(S)

if S != 0:
    print(" ".join([str(i+1) for i in range(N) if res_list[i] == 1]))


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

const int MAX_N = 20;
const int inf = 1e9;

int A[MAX_N],B[MAX_N];
int dp[(1<<MAX_N)][MAX_N];

void chmin(int &a, int b){ if( a > b ){ swap(a,b);}return;}

signed main(void){ 
  
  int N; cin >> N;
  
  for(int i = 0; i < N; i++){ cin >> A[i];}
  for(int i = 0; i < N; i++){ cin >> B[i];}
  
  for(int i = 0; i < (1<<MAX_N); i++){
    for(int j = 0; j < MAX_N; j++){ 
      dp[i][j] = inf;
    }
  }
  
 //一枚だけ揃っている状態を初期値に持ちたい
  
  for(int i = 0; i < N; i++){ 
    dp[(1<<i)][i] = i;
  }
  
  for(int bit = 0; bit < (1<<N); bit++){ 
    int num = 0;
    for(int i = 0; i < N; i++){
      if( bit>>i&1 ){ num++;} //もう揃っているカードの枚数
    }
    
    int pos = num-1; //現在位置
    for(int i = 0; i < N; i++){
      if(!(bit>>i&1) ){ //このカードをnum(0-indexed)の位置に持ってくることを考える
        pos++;
        for(int j = 0; j < N; j++){ 
          if( bit >> j & 1 ){ 
           // dp[bit][j]からの遷移を考える
            
            int VAL = (num-1-j)%2;
            if( VAL ){ VAL = B[j];}
            else{ VAL = A[j];} //これが今現在の一番後ろの値
          
          
            int side = (num-i)%2;//これが奇数だったらB,偶数だったらAが表になる
            
            
            if(side){ side =  B[i];}
            else{ side = A[i];}
            
            if( side < VAL  ){ continue;} 
            
            int res = pos-num; //iの現在位置からnumまでどれだけ動けばいいのか
            
            chmin(dp[bit|(1<<i)][i], dp[bit][j]+res);
            
           if(false){ cout << dp[bit|(1<<i)][i] << endl;}
      
          }
        }
      }
    }
  }
         
  
  int ans = inf;
  
  for(int i = 0; i < N; i++){ chmin(ans, dp[(1<<N)-1][i]);}
  
  if( ans == inf ){ ans = -1;}
  
  cout << ans << endl;
  
  return 0;
}
  
  

Measured memory_bytes: 164224
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  vector<int> a(N);
  cin >> a;
  if (accumulate(all(a), 0) == 0) {
    cout << "Yes" << endl;
    return;
  }
  if (N % 3 != 0) {
    cout << "No" << endl;
    return;
  }
  sort(all(a));
  vector<pair<int, int>> rl;
  for (int i = 0; i < N; i++) {
    if (rl.empty() || rl.back().first != a[i]) {
      rl.emplace_back(a[i], 1);
    } else {
      rl.back().second++;
    }
  }
  vector<int> x;
  bool judge = true;
  for (auto val : rl) {
    int t = val.second / (N / 3);
    if (val.second != t * (N / 3)) judge = false;
    for (int i = 0; i < t; i++) x.push_back(val.first);
  }
  if (rl.size() > 3 || x.size() != 3 || !judge) {
    cout << "No" << endl;
    return;
  }
  if ((x[0] ^ x[1]) == x[2])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 1784
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

template <typename T>
class Cumulative{
    public:
        int h, w;
        vector<vector<T>> c, a;

        Cumulative(const vector<vector<T>>& c, int h, int w)
            : h(h), w(w), c(c), a(h+1, vector<T>(w+1)) {
                for(int i = 1; i <= h; i++){
                    for(int j = 1; j <= w; j++){
                        a[i][j] += c[i-1][j-1] + a[i-1][j] + a[i][j-1] - a[i-1][j-1];
                    }
                }
            }

        T query(int i, int j, int k, int l){
            return a[k][l] - a[k][j] - a[i][l] + a[i][j];
        }
};

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

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

    auto s = initVec2<bool>(n, m, false);
    rep(i, n) rep(j, m){
        char c;
        cin >> c;
        if(c == '1'){
            s[i][j] = true;
        }
    }

    auto v = initVec2<int>(n, m);
    auto ev = initVec2<int>(n, m);
    auto eh = initVec2<int>(n, m);
    rep(i, n){
        rep(j, m){
            if(s[i][j]){
                v[i][j] = 1;
            }
            if(i > 0 && s[i-1][j] && s[i][j]){
                ev[i][j] += 1;
            }
            if(j > 0 && s[i][j-1] && s[i][j]){
                eh[i][j] += 1;
            }
        }
    }

    Cumulative<int> vertex(v, n, m);
    Cumulative<int> edgev(ev, n, m);
    Cumulative<int> edgeh(eh, n, m);

    rep(i, q){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        cout << vertex.query(x1 - 1, y1 - 1, x2, y2) - edgev.query(x1, y1 - 1, x2, y2) - edgeh.query(x1 - 1, y1, x2, y2)<< endl;
    }

    return 0;
}


Measured memory_bytes: 143744
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
const int maxn=100010,inf=0x3f3f3f3f;
struct edge{int v,flow,from;}e[maxn];
int first[maxn],d[maxn],cur[maxn],tot=1,S,T,n;
void insert(int u,int v,int w){//printf("%d %d\n",u,v);
    tot++;e[tot].v=v;e[tot].flow=w;e[tot].from=first[u];first[u]=tot;
    tot++;e[tot].v=u;e[tot].flow=0;e[tot].from=first[v];first[v]=tot;
}
queue<int>q;
bool bfs(){
    memset(d,-1,sizeof(d));
    d[S]=0;q.push(S);
    while(!q.empty()){
        int x=q.front();q.pop();
        for(int i=first[x];i;i=e[i].from)
        if(e[i].flow&&d[e[i].v]==-1){
            d[e[i].v]=d[x]+1;
            q.push(e[i].v);
        }
    }
    return d[T]!=-1;
}
int dinic(int x,int a){
    if(x==T||a==0)return a;
    int flow=0,f;
    for(int& i=cur[x];i;i=e[i].from)
    if(e[i].flow&&d[e[i].v]==d[x]+1&&(f=dinic(e[i].v,min(e[i].flow,a)))>0){
        e[i].flow-=f;
        e[i^1].flow+=f;
        a-=f;
        flow+=f;
        if(a==0)break;
    }
    return flow;
}   
int A[maxn],B[maxn],C[maxn],D[maxn];
int main(){
    scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&A[i],&B[i]);
	for (int i=1;i<=n;i++) scanf("%d%d",&C[i],&D[i]);
	S=n*2+1;T=S+1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if (A[i]<C[j] && B[i]<D[j]) insert(i,j+n,1);
	for (int i=1;i<=n;i++)insert(S,i,1),insert(i+n,T,1);
    int ans=0;
    while(bfs()){
        for(int i=1;i<=T;i++)cur[i]=first[i];
        ans+=dinic(S,inf);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
int main(void)
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a!=b && a != c) pr(a);
    if(a!=b && b != c) pr(b);
    if(c!=a && b != c) pr(c);
}

Measured memory_bytes: 256
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

const INF: usize = std::usize::MAX;

fn main() {
   input! {
      n: usize,
      a: [usize; n]
   }
   let mut dp = vec![vec![INF; n + 1]; n + 1];
   for i in 0..n {
      dp[i][i + 1] = 0;
   }

   for l in 2..n + 1 {
      for i in 0..n - l + 1 {
         let mut s = a[i];
         for m in i + 1..i + l {
            dp[i][i + l] = std::cmp::min(dp[i][i + l], dp[i][m] + dp[m][i + l]);
            s += a[m];
         }
         dp[i][i + l] += s;
      }
   }
   println!("{}", dp[0][n]);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,a=0;
  cin>>A>>B;
  for(int i=0;i<10000;i++){
    if(int(i*0.08)==A && int(i*0.10)==B){
      a=1;
      cout<<i<<endl;
      break;
    }
  }
  if(a==0)
    cout<<-1<<endl;
}

Measured memory_bytes: 3604
N,M = map(int,input().split())
es = [[] for i in range(N)]

for i in range(M):
    l,r,d = map(int,input().split())
    l,r = l-1, r-1
    es[l].append((r,d))
    es[r].append((l,-d))

dist = [None] * N
for i in range(N):
    if dist[i] is not None: continue
    stack = [i]
    dist[i] = 0
    while stack:
        v = stack.pop()
        for to,d in es[v]:
            if dist[to] is None:
                stack.append(to)
                dist[to] = dist[v] + d
            elif dist[to] != dist[v] + d:
                print('No')
                exit()
print('Yes')


Measured memory_bytes: 65948
#include<stdio.h>
int main(){
  int m,n,c;
  scanf("%d",&n);
  scanf("%d",&m);
  scanf("%d",&c);
  int a[n][m],b[m];
  int sum=0,ans=0;
  for(int i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  for(int p=0;p<n;p++){
    for(int j=0;j<m;j++){
      scanf("%d",&a[p][j]);
      sum+=a[p][j]*b[j];
    }
   // printf("%d\n",sum);判定用
    if(sum+c>0)
      ans++;
    sum=0;
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
gets.to_i.times do
    a,b,c,d = gets.split.map(&:to_i)
    g = b.gcd(d)
    l = (a-c)%g
    l = g if l == 0
    if l+c < b || a < b || b > d
        puts "No"
    else
        puts "Yes"
    end
end

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

int main() {
  int a,b;
  cin >> a >> b;
  if ( a%3==0||b%3==0||(a+b)%3==0 ) cout << "Possible" << '\n';
  else cout << "Impossible" << '\n';
  return 0; 
}


Measured memory_bytes: 256
A, B = map(int, input().split())

def xor_sum(A): #0からAまでのxorの和
  ans = 0
  if A % 2 == 0:
    ans += A
  if ((A+1) // 2) % 2 == 1: #A以下の奇数の数が奇数個のとき
    ans += 1
  return ans
  
print(xor_sum(B) ^ xor_sum(A-1))
   

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

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

    if (n == m) {
        puts("Yes");
    } else {
        puts("No");
    }
}

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

const int INF = 1 << 30;
int N;
int a[10];

int dfs(int idx) {
  if (idx == N) return 0;
  int res = INF;
  if (a[idx] == 0) {
    res = min(res, dfs(idx + 1));
  } else {
    int tmp = a[idx];
    for (int i = 0; i < N - idx; i++) {
      for (int j = 0; j <= i; j++) {
        a[idx + j] = (a[idx + j] - tmp + 10) % 10;
      }
      res = min(res, dfs(idx + 1) + 1);
      for (int j = 0; j <= i; j++) {
        a[idx + j] = (a[idx + j] + tmp) % 10;
      }
    }
  }
  return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> N, N) {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < N; i++) {
      a[i] = (t[i] - s[i] + 10) % 10;
    }
    cout << dfs(0) << endl;
  }  

  return 0;
}


Measured memory_bytes: 3164
#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

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;

#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 REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

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


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;


int main() {
  i64 A, B;
  cin >> A >> B;

  if (A >= 13) {
    cout << B << endl;
  } else if (A >= 6) {
    cout << B / 2 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
	int n,m;cin>>n>>m;
  while(n!=0&&m!=0)
  {
    ll ans=0;
    vector<int> h(n);
    vector<int> w(m);
    int i,j;
    rep(i,n)cin>>h[i];
    rep(i,m)cin>>w[i];
    vector<int> hsum(n+1,0);
    vector<int> wsum(m+1,0);
    rep(i,n)hsum[i+1]=h[i]+hsum[i];
    rep(i,m)wsum[i+1]=w[i]+wsum[i];
    vector<int> hcount(1500001,0);
    vector<int> wcount(1500001,0);
    rep(i,n)for(j=i+1;j<=n;j++)
    {
      hcount[hsum[j]-hsum[i]]++;
    }
    rep(i,m)for(j=i+1;j<=m;j++)
    {
      wcount[wsum[j]-wsum[i]]++;
    }
    rep(i,1500001)ans+=hcount[i]*wcount[i];
    cout<<ans<<endl;
    cin>>n>>m;
  }
}



Measured memory_bytes: 14564
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N,Q = map(int,input().split())
# 1-indexed union-find
# parent(親)
par = [i for i in range(N+1)]
# rank(深さ)
rank = [0]*(N+1)
# 同グループの頂点数
size = [1]*(N+1)

# 木の根を求める
def root(x):
    if par[x] == x:             # 根の時
        return x
    else:
        par[x] = root(par[x])   # 経路圧縮
        return par[x]

# xとyの属する集合を併合(ランク有)
def unite(x,y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y              # xの親をyに
        size[y] += size[x]      # yの頂点数+=xの頂点数
    else:
        par[y] = x              # yの親をxに
        size[x] += size[y]      # xの頂点数+=yの頂点数
        if rank[x] == rank[y]:
            rank[x] += 1
 
for i in range(Q):
    a,b = map(int,input().split())
    unite(a,b)
ans = 0
for i in range(1,N+1):
    ans = max(ans,size[root(i)])

print(ans)




Measured memory_bytes: 83868
n=int(input())

cost=[0 for i in range(n)]

s=list(map(int,input().split()))
cost[1]=abs(s[1]-s[0])

for i in range(2,n):
    cost[i]=min(cost[i-1]+abs(s[i]-s[i-1]),cost[i-2]+abs(s[i]-s[i-2]))

print(cost[-1])


Measured memory_bytes: 89536
#include<stdio.h>
int main()
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (x + r > W || y + r > H || x - r < 0 || y - r < 0)
		printf("No\n");
	else
		printf("Yes\n");
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 200000 + 10;
const LL MOD = 1e9 + 7;
int n, a, b, c; 
LL mpow(LL a, LL x) {
	if (x == 0) return 1;
	LL t = mpow(a, x >> 1);
	if (x % 2 == 0) return t * t % MOD;
	return t * t % MOD * a % MOD;
}
LL fac[N], inv[N];
LL C(int x, int y) {
	return fac[x] * inv[y] % MOD * inv[x-y] % MOD;
}
int main() {
	fac[0] = 1; inv[0] = 1;
	for (int i = 1; i < N; i ++) {
		fac[i] = fac[i-1] * i % MOD;
		inv[i] = mpow(fac[i], MOD - 2);
	}
	cin >> n >> a >> b >> c;
	LL p1 = a * mpow(a+b, MOD-2) % MOD;
	LL p2 = b * mpow(a+b, MOD-2) % MOD;
	LL ans = 0;
	for (int i = n; i <= 2 * n - 1; i ++) {
		// ..... A
		LL tmp = C(i-1, n-1) * mpow(p1, n) % MOD * mpow(p2, (i-1)-(n-1)) % MOD; 
		// ..... B
		tmp += C(i-1, n-1) * mpow(p2, n) % MOD * mpow(p1, (i-1)-(n-1)) % MOD;
		tmp %= MOD;
		ans = (ans + tmp * i % MOD) % MOD;
	}
	cout << (ans * 100 % MOD * mpow(a + b, MOD-2) % MOD) << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
#define pi 3.1415926


int main(){
    int k,x;
    cin >> k >> x;
    if(k*500 >= x)
        cout << "Yes";
    else 
        cout << "No";
    
    
    
}

    

		


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


#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int n;
	while(cin >> n){
		if( cin.eof()  ) break;
		// a(n) = a(n-1) + n  a(0)=1, a(1)=2
		int a,oa=1;
		rep2(i,1,n+1){
			a = oa + i;
			oa = a;
		}
		cout << a << endl;
	}
	return 0;
	
	
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define repd(i, a, b) for (int i = a; i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int main()
{
    int H, W, M;
    cin >> H >> W >> M;
    vector<int> h(H + 1, 0);
    vector<int> w(W + 1, 0);
    set<pair<int, int>> target;
    rep(i, 0, M)
    {
        int t1, t2;
        cin >> t1 >> t2;
        h[t1]++;
        w[t2]++;
        target.insert(make_pair(t1, t2));
    }
    vector<pair<int, int>> hi;
    rep(i, 0, H + 1)
        hi.push_back(make_pair(h[i], i));
    vector<pair<int, int>> wi;
    rep(i, 0, W + 1)
        wi.push_back(make_pair(w[i], i));
    sort(all(hi));
    sort(all(wi));
    ll ans = hi[H].first + wi[W].first - 1;
    bool found = 0;
    for (int i = H; i >= 0; i--)
    {
        if (hi[i].first != hi[H].first || found)
            break;
        for (int j = W; j >= 0; j--)
        {
            if (wi[j].first != wi[W].first || found)
                break;
            else if (!target.count(make_pair(hi[i].second, wi[j].second)))
                found = 1;
        }
    }
    if (found)
        cout << ans + 1 << endl;
    else
        cout << ans << endl;
}


Measured memory_bytes: 28044
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll  A,B,C,D,E,F,G,H,K,L,M,N,P,Q,R,U,W,X,Y,Z;
string S,T;

int main(){
  cin >> A >> B;
  rep(i,100000){
    if(i*8/100 == A && i/10 == B){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


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


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

  int n, h;
  cin >> n >> h;

  vector<int> a(n), b(n);
  for (int i=0; i<n; i++) {
    cin >> a[i] >> b[i];
  }
  
  int max_a = *max_element(a.begin(), a.end());
  sort(b.rbegin(), b.rend());

  int ans = 0;
  int sum = 0;
  for (int i=0; i<n; i++) {
    if (b[i] < max_a || sum >= h) break;
    sum += b[i];
    ans += 1;
  }

  while (sum < h) {
    sum += max_a;
    ans += 1;
  }
  
  cout << ans << "\n";

  return 0; 
}


Measured memory_bytes: 1024
N = gets.to_i

table = Array.new(10) { Array.new(10, 0) }
(1..N).each do |n|
  ns = n.to_s
  head = ns[0].to_i
  tail = ns[-1].to_i
  table[head][tail] += 1
end
ans = 0
(0..9).each do |a|
  (0..9).each do |b|
    ans += table[a][b] * table[b][a]
  end
end
puts ans

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
int f[100001];
const int r=1000000007;
int binpower(int a,int b) {
    if (b==0)
        return 1;
    if (b%2==1)
        return ((long long)a*binpower(a,b-1))%r;
    int x=binpower(a,b/2);
    return ((long long)x*x)%r;
}
int c(int n,int m) {
    if (m>n)
        return 0;
    int x=((long long)f[m]*f[n-m])%r;
    return ((long long)f[n]*binpower(x,r-2))%r;
}
int main() {
    char ch;
    cin>>ch;
    cout<<(char)(ch+1)<<endl;
}


Measured memory_bytes: 256
n=int(input())
p=list(map(int, input().split()))
c=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        c+=1
print(c)
        


Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

int main(){
    ll I,O,T,J,L,S,Z;
    cin>>I>>O>>T>>J>>L>>S>>Z;
    ll ans=O;
    if( (I%2==1?1:0)+(J%2==1?1:0)+(L%2==1?1:0)>=2 && I*J*L!=0 ){
        I--;
        J--;
        L--;
        ans+=3;
    }
    ans+=I/2*2+J/2*2+L/2*2;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    int dig=1;
    int b2=b;

    while(b>0){
        b/=10;
        dig*=10;
    }
    for(int i=1;i<=400;i++){
        if(i*i==a*dig+b2){
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;
}

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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, A ,B;
    cin >> N >> A >> B;

    print(min(N * A, B));
    
}


Measured memory_bytes: 3612
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    string s;
    cin >> s;
    if (s.length() != 6) cout << "No\n";
    else if (s[2] != s[3] || s[4] != s[5]) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
import java.awt.*;
import java.util.Comparator;
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), ans = 0;
        Point[] red = IntStream.range(0, n)
                .mapToObj(i -> new Point(scanner.nextInt(), scanner.nextInt()))
                .sorted(Comparator.comparingInt((Point p) -> p.y).reversed())
                .toArray(Point[]::new);
        Point[] blue = IntStream.range(0, n)
                .mapToObj(i -> new Point(scanner.nextInt(), scanner.nextInt()))
                .sorted(Comparator.comparingInt(p -> p.x))
                .toArray(Point[]::new);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (red[j] != null && blue[i].y > red[j].y && blue[i].x > red[j].x) {
                    ans++;
                    red[j] = null;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 27728
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
int main() {
    ll n; cin >> n;
    vector<pair<ll, ll>> vc = prime_factorize(n);
    int ans = 0;
    for (auto v : vc) {
        ll num = v.second;
        ll cnt = 1;
        while (num >= cnt) {
            num -= cnt;
            cnt++;
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int main(void){
	int N, T, c, t, min = -1;
	cin >> N >> T;
	for(int i = 0; i < N; i++){
		cin >> c >> t;
		if(t <= T){
			if(min == -1 || c < min)	min = c;
		}
	}
	if(min == -1)	cout << "TLE" << endl;
	else cout << min << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod

int ipow(int i, int n){
    int t = 1;
    REP(k, n){
        t *= i;
        if(t > 1000000000000) return INF;
    }
    return t;
}

signed main(){

    int N, A; cin >> N >> A;
    
    int ans = N;
    FOR(a, 1, 40){
        int n = 2;
        while(ipow(n, a + 1) < N) n++;
        int k0;
        REP(k, a + 2){
            int p1 = ipow(n - 1, k), p2 = ipow(n, a + 1 - k);
            if(p1 < N && p2 < N && (__int128_t)p1 * (__int128_t)p2 < (__int128_t)N) break;
            else k0 = k;
        }
        int tmp = A * a + n * (a + 1 - k0) + (n - 1) * k0;
        Min(ans, tmp);
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 256