akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void inline add(int&,int);
int mul(int,int);
int powz(int,int);
int sub(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000002;
map<string,int>cnt;
void solve(){
	int n;
	cin>>n;
	string s;
	for(int i=0;i<n;i++){
		cin>>s;
		sort(all(s));
		cnt[s]++;
	}
	ll ans=0;
	for(auto i:cnt){
		ans+=(1ll*(i.S)*(i.S-1))/2;
	}
	cout<<ans;
	
}

 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void inline add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 11264
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

int dp[110][10010];

int main() {
	int n, W; cin >> n >> W;
	vi v(n), w(n); rep(i, n) cin >> v[i] >> w[i];

	rep(i, W + 1) dp[0][i] = 0;

	rep(i, n) {
		rep(j, W + 1) {
			if (j >= w[i]) dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
			else dp[i + 1][j] = dp[i][j];
		}
	}
	cout << dp[n][W] << endl;
}


Measured memory_bytes: 7052
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()

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

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

int main() {
  string s;
  cin >> s;
  
  bool ans = true;
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]) ans = false;
  
  if(ans) cout << "Good" <<endl;
  else cout << "Bad" << endl;
  
  return 0;
}

Measured memory_bytes: 256
n=int(input())
state=[[] for _ in range(n)]
for _ in range(n):
    a=int(input())
    for i in range(a):
        x,y=map(int,input().split())
        state[_].append([x,y])
ans=0
for i in range(2**n):
    temp=[0]*n
    for j in range(n):
        if i&1: temp[j]=1
        i>>=1
    flag=1
    for k,s in enumerate(temp):
        if s==0: continue
        for st in state[k]:
            if temp[st[0]-1]!=st[1]:
                flag=0
                break
            if not flag: break
    if flag:
        cnt=temp.count(1)
        if cnt>ans: ans=cnt
print(ans)

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

long long bfs(long long H){
    if(H / 2 == 0) return 1;
    H /= 2;
    return 2 * bfs(H) + 1;
}
int main(){
    long long H;
    cin >> H;
    printf("%lld\n", bfs(H));
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
r = 'APPROVED'
for i in range(n):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            continue
        else:
            r = 'DENIED'
            break
print(r)

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(ll)(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(ll (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// dp[i][x]: 上からi個までの長方形を動かしていてi個目の長方形の横座標をxに動かした時点でのそこまでのコストの最小値
// dp[i][x] = |x-l[i]| + min dp[i-1][x'] (x-(r[i-1]-l[i-1]) <= x' <= x+(r[i]-l[i]))
// これでO(nx^2) 部分点
//
// dp[i-1]からdp[i]を求めるには以下の操作ができればいい
// 1) x軸方向に平行移動
// 2) ある一定長さの区間のminを取る
// 3) |x-l[i]|を足す
// dpの式に着目する dp[i]の式は|x-l|という形の式をi個足し合わせたものなので、下に凸で、
// 傾きはxが-∞のとき-i、そこから徐々に傾きが大きくなっていき、0になる範囲を経由し、xが∞のときiになる
// iが増える(|x-l|という形の式が増える)に連れて傾き0の部分が広がり、そのぶんだけ傾き負の部分は左にスライドし、正の部分は右にスライドする
// 移動量の総和を最小化するには各矩形は傾きが0の範囲のxのうち一番近い場所に移動すればいい
// 傾きが変わる点をset(正負で分ける)に入れといて、0の範囲が増える度に更新する

ll n, l[114514], r[114514];
multiset<ll> le, ri;
ll ls, rs, ans;

signed main() {
	cin >> n;
	rep(i,n) cin >> l[i] >> r[i];
	ls = rs = l[0];
	le.insert(l[0]), ri.insert(l[0]);
	reps(i,1,n) {
		ls -= r[i]-l[i], rs += r[i-1]-l[i-1];
		ll a = *le.rbegin(), b = *ri.begin();
		if (ls<=l[i] && l[i]<=rs) {
			le.insert(l[i]-(ls-a));
			ri.insert(l[i]-(rs-b));
			ls = rs = l[i];
		} else if (l[i]<ls) {
			ans += abs(l[i]-ls);
			le.insert(l[i]-(ls-a));
			le.insert(l[i]-(ls-a));
			ll left = *le.rbegin() + (ls-a);
			le.erase(--le.end());
			ri.insert(left-(rs-b));
			ls = *le.rbegin() + (ls-a);
			rs = left;
		} else {
			ans += abs(l[i]-rs);
			ri.insert(l[i]-(rs-b));
			ri.insert(l[i]-(rs-b));
			ll right = *ri.begin() + (rs-b);
			ri.erase(ri.begin());
			le.insert(right - (ls-a));
			ls = right;
			rs = *ri.begin() + (rs-b);
		}
		//cout << i << ' ' << ans << ln;
	}
	cout << ans << ln;
}

Measured memory_bytes: 11264
using System;
using System.Collections.Generic;

class A
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		Console.WriteLine($"{n}: {string.Join(" ", Factorize(n))}");
	}

	static long[] Factorize(long n)
	{
		var r = new List<long>();
		for (long x = 2; x * x <= n && n > 1; ++x) while (n % x == 0) { r.Add(x); n /= x; }
		if (n > 1) r.Add(n);
		return r.ToArray();
	}
}



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

constexpr int MOD = 1000000007;
class mint {
  private: 
    long long x;

  public:
    constexpr mint(const long long x = 0) noexcept : x((x % MOD + MOD) % MOD) {}
    constexpr long long value() noexcept { return x; }
    constexpr mint operator += (const mint right) noexcept {
      if ((x += right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator -= (const mint right) noexcept {
      if ((x += MOD - right.x) >= MOD) x -= MOD;
      return *this;
    }
    constexpr mint operator *= (const mint right) noexcept {
      x = x * right.x % MOD;
      return *this;
    }
    constexpr mint operator /= (const mint right) noexcept {
      return *this *= right.inv();
    }
    constexpr mint operator + (const mint right) const noexcept {
      return mint(*this) += right;
    }
    constexpr mint operator - (const mint right) const noexcept {
      return mint(*this) -= right;
    }
    constexpr mint operator / (const mint right) const noexcept {
      return mint(*this) /= right;
    }
    constexpr mint operator * (const mint right) const noexcept {
      return mint(*this) *= right;
    }

    constexpr mint inv() const {
      return pow(MOD-2);
    }

    constexpr mint pow(long long n) const {
      if (n == 0) return 1;
      mint a = pow(n>>1);
      a *= a;
      if (n & 1) a *= *this;
      return a;
    }
};

constexpr int MAX = 500005;
mint fact[MAX], invfact[MAX];

void init()
{
  fact[0] = 1;
  for (int i = 1; i < MAX; ++i) fact[i] = fact[i-1] * i;

  invfact[MAX-1] = mint(fact[MAX-1]).inv();
  for (int i = MAX-1; i >= 1; --i) invfact[i-1] = invfact[i] * i;
}

mint nCr(long long n, long long r)
{
  return fact[n] * invfact[r] * invfact[n-r];
}

mint nPr(long long n, long long r)
{
  return fact[n] * invfact[n-r];
}

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

  init();

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

  mint ans(0);
  for (int k = 0; k <= n; ++k) {
    mint tmp = (nCr(n, k) * nPr(m, k) * mint(nPr(m-k, n-k)).pow(2));
    if (k % 2 == 0) ans += tmp;
    else ans -= tmp;
  }

  cout << ans.value() << endl;

  return (0);
}

Measured memory_bytes: 11440
#include <cstdio>
#include <cstring>
const int Mod = 1e9 + 7;
int f[1 << 17], n, m, u[140], v[140], P[140], s[17], d[1 << 17], to[1 << 17];
int dfs(int S)
{
	if(~f[S]) return f[S];
	if(S & 1 ^ S >> 1 & 1) f[S] = 0;
	else f[S] = 1;
	int t = (S - 1) & S;
	while(t)
	{
		if(S - t & 1 ^ S - t >> 1 & 1 || !f[S - t]);
		else
		{
			int c2 = 0;
			for(int j = 0; j < n; ++j) if(S - t >> j & 1) s[j] = 0;
			for(int j = 0; j < n; ++j) 
				if(S - t >> j & 1) s[j] += d[to[j] & t];
				else if(t >> j & 1) c2 += d[to[j] & S - t];
			int g = 1;
			for(int j = 0; j < n; ++j) if(S - t >> j & 1)
			{
				if(s[j]){ g = 1ll * g * (P[s[j]] - 1) % Mod; }
				else { g = 0; break; }
			}
			if(g) f[S] = (f[S] + 1ll * g * P[c2] % Mod * dfs(S - t)) % Mod;
		}
		t = (t - 1) & S;
	}
	return f[S];
}
int main()
{
	memset(f, -1, sizeof(f));
	scanf("%d %d", &n, &m);
	P[0] = 1; for(int i = 1; i <= m; ++i) P[i] = (P[i - 1] << 1) % Mod;
	for(int i = 1; i <= m; ++i) scanf("%d %d", &u[i], &v[i]);
	int Full = 1 << n;
	for(int i = 1; i < Full; ++i) d[i] = d[i - (-i & i)] + 1;
	for(int i = 1; i <= m; ++i) to[u[i] - 1] |= 1 << v[i] - 1;
	/*for(int i = 0; i < Full; ++i)
	{
		if(i & 1 ^ i >> 1 & 1);
		else f[i] = 1;
		int t = (i - 1) & i;
		while(t)
		{
			if(i - t & 1 ^ i - t >> 1 & 1 || !f[i - t]);
			else
			{
				int c1 = 0, c2 = 0, tmp = 0;
				for(int j = 0; j < n; ++j) if(i - t >> j & 1) s[j] = 0;
				for(int j = 0; j < n; ++j) 
					if(i - t >> j & 1) s[j] += d[to[j] & t];
					else if(t >> j & 1) c2 += d[to[j] & i - t];
				int g = 1ll * P[c2] * f[i - t] % Mod;
				for(int j = 0; j < n; ++j) if(i - t >> j & 1)
				{
					if(s[j]){ g = 1ll * g * (P[s[j]] - 1) % Mod; }
					else { g = 0; break; }
				}
				f[i] = (f[i] + g) % Mod;
			}
			t = (t - 1) & i;
		}
	}*/
	printf("%d\n", (P[m] - dfs(Full - 1) + Mod) % Mod);
	return 0;
}

Measured memory_bytes: 768
#![allow(non_snake_case)]
use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let M: usize = read();
    let max = 100;
    let mut vec: Vec<usize> = vec![max; N];
    for _ in 0..M {
        let s: usize = read();
        let s = s - 1;
        let c: usize = read();
        // 矛盾した指示
        if vec[s] != max && vec[s] != c {
            println!("-1");
            return;
        }
        // 一番左が0
        if N >= 2 && s == 0 && c == 0 {
            println!("-1");
            return;
        }
        vec[s] = c;
    }
    let mut ans = 0;
    for i in 0..N {
        // 指定がない場合
        ans += (if vec[i] == max {
            // 一番左(0以外)
            if i == 0 && N >= 2 {
                1
            } else {
                0
            }
        } else {
            vec[i]
        }) * 10_usize.pow((N - i - 1) as u32)
    }
    println!("{}", ans);
}


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

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

			int num = int.Parse(Console.ReadLine());
			var ss = Console.ReadLine().ToList();
			var count = ss.Count();

			int answer = 0;

			for (int i = 1; i < count; ++i) {

				var left = new HashSet<char>(ss.Take(i));
				var right = new HashSet<char>();
				int max = 0;

				for (int j = i; j < count; ++j) {
					if (left.Contains(ss[j]) && !right.Contains(ss[j])) {
						++max;

						right.Add(ss[j]);

					}
				}

				answer = Math.Max(answer, max);
			}

			Console.WriteLine(answer);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13404
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int N;
    cin >> N;
    int AC = 0, WA = 0, TLE = 0, RE = 0;
    REP(_, N) {
        string S;
        cin >> S;
        if (S == "AC") ++AC;
        if (S == "WA") ++WA;
        if (S == "TLE") ++TLE;
        if (S == "RE") ++RE;
    }
    
    cout << "AC x " << AC << "\n";
    cout << "WA x " << WA << "\n";
    cout << "TLE x " << TLE << "\n";
    cout << "RE x " << RE << "\n";
    return 0;
}


Measured memory_bytes: 3600
import sys
import math
import copy
import queue
from decimal import *
input = sys.stdin.readline
def LI(): return [Decimal(x) for x in input().split()]

a,b,c = LI()


if  4 * a * b < (c - a - b) * (c - a - b) and c-a-b > 0:
    print ('Yes')
else:
    print ('No')

Measured memory_bytes: 5144
class Point:
    def __init__(self,x,y):
        self.x = x
        self.y = y

    def __add__(self,a):
        return self.__class__(self.x+a.x,self.y+a.y)

    def __sub__(self,a):
        return self.__class__(self.x-a.x,self.y-a.y)

    def __mul__(self,d):
        return self.__class__(self.x*d,self.y*d)

    def __truediv__(self,d):
        return self.__class__(self.x/d,self.y/d)

    def __str__(self):
        return '%.10f %.10f'%(self.x,self.y)

    def abs(self):
        return self.norm()**(1.0/2.0)

    def norm(self):
        return (self.x*self.x+self.y*self.y)

    def rotate(self,d):
        r = math.pi*d/180.0
        return self.__class__( self.x*math.cos(r)-self.y*math.sin(r),
                               self.x*math.sin(r)+self.y*math.cos(r))

    def dot(self,p)  :return (self.x*p.x+self.y*p.y)
    def cross(self,p):return (self.x*p.y-self.y*p.x)

class Segment:
    def __init__(self,p1,p2):
        self.p1 = p1
        self.p2 = p2

    def __init__(self,a,b,c,d):
        self.p1 = Point(a,b)
        self.p2 = Point(c,d)

    def parallel(self,s):
        v1 = self.p2-self.p1
        v2 = s.p2-s.p1
        return v1.cross(v2)==0.0

    def orthogonal(self,s):
        v1 = self.p2-self.p1
        v2 = s.p2-s.p1
        return v1.dot(v2)==0.0

def project(s,p):
    v = s.p2-s.p1
    r = v.dot(p-s.p1)/v.norm()
    return s.p1+v*r

def reflect(s,p):
    return p+(project(s,p)-p)*2.0

def main():
    q = int(input())
    for _ in range(q):
        a,b,c,d,e,f,g,h = map(float,input().split())
        s = Segment(a,b,c,d)
        t = Segment(e,f,g,h)
        if s.parallel(t):print (2)
        elif s.orthogonal(t):print (1)
        else :print (0)

if __name__ == '__main__':
    main()




Measured memory_bytes: 5652
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

double Distance(vector<int>& vec1, vector<int>& vec2, int dimention) {
   double distance{0};
   const int number = vec1.size();
   for (int i = 0; i < number; ++i) {
      distance += pow(abs(vec1[i] - vec2[i]), dimention);
   }
   return pow(distance, 1.0 / dimention);
}

double ChebyshevDistance(vector<int>& vec1,vector<int>& vec2) {
   int distance{0};
   const int number = vec1.size();
   for (int i = 0; i < number; ++i) {
      distance= max(abs(vec1[i] - vec2[i]), distance);
   }
   return distance;
}

int main() {

   int n;
   cin >> n;

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

   cout << fixed << Distance(x, y, 1) << endl;
   cout << fixed << Distance(x, y, 2) << endl;
   cout << fixed << Distance(x, y, 3) << endl;
   cout << fixed << ChebyshevDistance(x, y) << endl;

   return 0;

}

Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
int main(){
  string h;
  cin>>h;
  for(int i=0;i<h.length();i++){
    for(int m=i+1;m<h.length();m++){
      if(h[i]==h[m]){
        cout<<"no"<<endl;
        return 0;
      }
    }
  }
  cout<<"yes"<<endl;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int l,r,d; cin >> l >> r >> d;
  int cnt = 0;
  for(int i = l; i <= r; ++i){
    cnt += (i % d == 0);
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3592
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    s = LS()
    return 'A{}C'.format(s[1][0])


print(main())


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


int main(){

  stack<int> st;
  int n, a;

  while(cin >> n){
    
    if(n!= 0){
      st.push(n);
    }
    else{
      a = st.top();
      cout << a << endl;
      st.pop();
    }


  }


}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    // 解説AC
    int n;
    cin >> n;
    pint red[n], blue[n];
    rep (i, 0, n) cin >> red[i].first >> red[i].second;
    rep (i, 0, n) cin >> blue[i].first >> blue[i].second;
    sort (red, red + n);
    sort (blue, blue + n);
    bool chk[n] = {};
    int ans = 0;
    // まず、redの点を固定する
    per (i, 0, n) {
        int res = -1;
        int now = inf;
        per (j, 0, n) {
            if (chk[j]) continue;
            if (red[i].first < blue[j].first &&
                red[i].second < blue[j].second) {
                // 条件に当てはまる中でblueのyが最も小さいのを選ぶ
                if (now > blue[j].second) {
                    res = j;
                    now = blue[j].second;
                }
            }
        }
        if (res != -1) {
            chk[res] = 1;
            ans++;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long 
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod 1000000009
using namespace std;
bool isprime(ll n)
{
    //if(n<2)
    //return false;
    if(n==1)
    return true;
    if(n==2 || n==3)
    return true;
    if(n%2==0)return false;
    for(ll i=3;i*i<=n;i+=2)
    {
        if(n%i==0)
        return false;
        
    }
    return true;
}
int gcd(ll a,ll b)
{
    if(a==0)
    return b;
    return gcd(b%a,a);
}
int lcm(ll a,ll b)
{
    return a*(b/gcd(a,b));
}
 set<ll> fac;
void allFactors(ll n)
{
   // set<ll> fac;
    for(ll i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            fac.insert(i);
            if(i!=n/i)
            {
                fac.insert(n/i);
               
            }
        }
    }
    //return fac.size();
}
bool threefactors(ll n)//when you have need of a no which is divisible by 1,itself,any other one no.
{
    ll p=sqrt(n);
    if(p*p==n)
    {
        if(isprime(p))
        return 1;
        else
        return 0;
    }
    else
    return 0;
}

int main()
{
     IOS
     //int w;
     //cin>>w;
     //while(w--)
     {
       int n;
       cin>>n;
       vector<vector<int>>v(3,vector<int>(n+1,0));
       for(int i=1;i<=n;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>v[j][i];
		}
	}
	vector<vector<int>>dp(3,vector<int>(n+1,0));
	for(int i=1;i<=n;i++)
	{
		dp[0][i]=max(dp[1][i-1],dp[2][i-1])+v[0][i];
		dp[1][i]=max(dp[0][i-1],dp[2][i-1])+v[1][i];
		dp[2][i]=max(dp[0][i-1],dp[1][i-1])+v[2][i];
	}
	cout<<max({dp[0][n],dp[1][n],dp[2][n]});
     }
     return 0;
} 
//ascii of a=97
//ascii of A=65
//ascii of 0=48


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

int main(){
  string s; cin >> s;
  list<char> res;
  for(char x : s) res.push_back(x);
  int q; cin >> q;
  bool swap = false;
  
  for(int i=0; i<q; ++i){
    int q1;
    cin >> q1;
    if(q1 == 1){
      swap = !(swap);
    }
    if(q1 == 2){
      int f; cin >> f;
      char c; cin >> c;
      if(f == 1){
        if(swap == false) res.push_front(c);
        else res.push_back(c);
      }
      if(f == 2){
        if(swap == false) res.push_back(c);
        else res.push_front(c);
      }
    }
  }
  
  if(swap == true){
    int size = res.size();
    for(int i=0; i<size; ++i){
      cout << res.back();
      res.pop_back();
    }
  }
  else for(char x : res) cout << x;
  cout << endl;
  return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n, k;
  cin >> n >> k;
  set<ll> st;
  for (int i = 0; i < k; i++) {
    ll d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      ll a;
      cin >> a;
      st.insert(a);
    }
  }

  cout << n - st.size() << ln;

  return 0;
}

Measured memory_bytes: 3660
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        string[] line = Console.ReadLine().Split(' ');
        double a = int.Parse(line[0]);
        double b = int.Parse(line[1]);
        double c = int.Parse(line[2]);
        double d = int.Parse(line[3]);
        double ta = Math.Ceiling(c/b);
        double ao = Math.Ceiling(a/d);

        Console.WriteLine(ta<=ao ? "Yes" : "No");
    }
}


Measured memory_bytes: 17832
n=int(input())
b=[int(i) for i in input().split()]
ans=[]
while len(b)>0:
  f=0
  for i in range(len(b),0,-1):
    if b[i-1]==i:
      ans.append(i)
      del b[i-1]
      f=1
      break
  if f==0:
    print(-1)
    exit()
print(*ans[::-1],sep='\n')

Measured memory_bytes: 9196
#136_D
s=input()
n=len(s)

#d[i]...連続数
d=[]
tmp=1
for i in range(1,n):
    if s[i]==s[i-1]:
        tmp+=1
    else:
        d.append(tmp)
        tmp=1
d.append(tmp)

ans=[0 for _ in range(n)]
index=0
for i in range(0,len(d),2):
    l,r=d[i],d[i+1]
    ans[index+l-1]+=-(-l//2)+r//2
    ans[index+l]+=l//2-(-r//2)
    index+=l+r
print(*ans)

Measured memory_bytes: 7152
import sys
# gcd
# from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
# import math
# from functools import reduce
#
# input関係の定義
# fin = open('in_6.txt', 'r')
# sys.stdin = fin
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template

YES = "Yes"  # type: str
NO = "No"  # type: str

def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    s = list(next(tokens))  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int

    # write code
    x_axis = []
    y_axis = []
    i = 0
    cntT = 0
    cntF = 0
    for i in range(len(s)):
        if s[i] == 'T':
            if cntT % 2 == 0:
                x_axis.append(cntF)
            else:
                y_axis.append(cntF)
            cntT += 1
            cntF = 0
            continue
        else:
            cntF += 1
            continue
    if cntT % 2 == 0:
        x_axis.append(cntF)
    else:
        y_axis.append(cntF)


    x -= x_axis[0]
    del x_axis[0]
    # print(x_axis, y_axis)
    x_set = {x}
    y_set = {y}
    for num in x_axis:
        x_set = {i + k for i in x_set for k in {-num, num} if - 8000 <= i <= 8000}
    for num in y_axis:
        y_set = {i+k for i in y_set for k in {-num,num} if -8000<=i<=8000}

    # print(x_set, y_set)
    if 0 in x_set and 0 in y_set:
        print(YES)
    else:
        print(NO)



Measured memory_bytes: 3944
package main

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

type square struct {
	io *IO
}

func (s *square) output(yes bool) {
	if yes {
		s.io.Print("Yes")
	} else {
		s.io.Print("No")
	}
}

func main() {
	io := NewStdIO()
	defer io.Flush()
	s := square{
		io: io,
	}

	c := make([][]int, 3)
	for i := 0; i < 3; i++ {
		c[i] = make([]int, 3)
	}

	for i := 0; i < 3; i++ {
		r := strings.Split(s.io.Next(), " ")
		c[i][0] = stoi(r[0])
		c[i][1] = stoi(r[1])
		c[i][2] = stoi(r[2])
	}

	a1 := 0
	ans := c[0][0] - a1
	a2 := c[1][0] - ans
	a3 := c[2][0] - ans
	for j := 1; j < 3; j++ {
		if c[0][j]-a1 != c[1][j]-a2 || c[1][j]-a2 != c[2][j]-a3 {
			s.output(false)
			return
		}
	}
	s.output(true)
}

func stoi(s string) int {
	i, err := strconv.Atoi(s)
	if err != nil {
		fmt.Println(i)
		fmt.Println(err)
	}
	return i
}

// NewStdIO return standard IO instance.
func NewStdIO() *IO {
	return &IO{
		In:  bufio.NewReader(os.Stdin),
		Out: bufio.NewWriter(os.Stdout),
	}
}

// IO supports IO processing.
type IO struct {
	In  *bufio.Reader
	Out *bufio.Writer
}

// Flush outputs buffed data.
func (io *IO) Flush() {
	if err := io.Out.Flush(); err != nil {
		panic(err)
	}
}

// Printf writes string to buffer.
func (io *IO) Print(s string) {
	if _, err := fmt.Fprint(io.Out, s); err != nil {
		panic(err)
	}
}

// Printf writes string to buffer.
func (io *IO) Printf(format string, a ...interface{}) {
	if _, err := fmt.Fprintf(io.Out, format, a...); err != nil {
		panic(err)
	}
}

// Next reads line and return string.
func (io *IO) Next() string {
	var b []byte
	for {
		l, pre, err := io.In.ReadLine()
		if err != nil {
			panic(err)
		}
		b = append(b, l...)
		if !pre {
			break
		}
	}
	return string(b)
}


Measured memory_bytes: 640
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll N,M;
	cin >> N>>M;
	
	// 解法
	ll ans = pow(2, M)*(M*1900+(N-M)*100);
	
	//出力
	cout << ans << endl;
}


Measured memory_bytes: 256
S = gets.chomp
N = S.size

s = S.to_i(2)

a = "#{ '01' * (N / 2) }#{ '0' if N.odd? }".to_i(2)
b = "#{ '10' * (N / 2) }#{ '1' if N.odd? }".to_i(2)

puts [a, b].map {|i| (i ^ s).to_s(2).count('1') }.min


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

int main(void)
{
        int i,j,num,diff;
            
        while(1){
                int min = 1000000;
                cin >> num;
                if(num == 0){ 
                        break;
                }   
                    
                vector<int> data(num);
                for(i = 0; i < num; i++){
                        cin >> data[i];
                }   
                    
                for(i = 0; i < num - 1; i++){
                        for(j = i + 1; j < num; j++){
                                diff = abs(data[i] - data[j]);
                                if(diff <= min){
                                        min = diff;
                                }   
                        }   
                }   
                cout << min <<endl;
        }   
        return 0;
}

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

int main() {
    int N; cin >> N;
    priority_queue<int> ans;
    int count = 0;
    ll pre; cin >> pre;
    for (int i = 1; i < N; i++) {
        ll h; cin >> h;
        if (h > pre) {
            ans.push(count);
            count = 0;
        }
        else count++;
        pre = h;
    }
    ans.push(count);
    cout << ans.top() << endl;
}

Measured memory_bytes: 892
using System;

namespace _168_a
{
    internal class Therefore
    {
        private static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

            var firstDigit = n % 10;

            switch (firstDigit)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    Console.WriteLine("hon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                case 3:
                    Console.WriteLine("bon");
                    break;
            }
        }
    }
}


Measured memory_bytes: 27400
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s=="a" || s=="i" || s=="u" || s=="e" || s=="o")
    {
      cout<<"vowel"<<endl;
    }else{
    cout<<"consonant"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
W, H, N = gets.split.map(&:to_i)
left, right = [0, 0], [W, H]
N.times do |i|
  x, y, a = gets.split.map(&:to_i)
  case a
  when 1
    left[0] = [left[0], x].max
  when 2
    right[0] = [right[0], x].min
  when 3
    left[1] = [left[1], y].max
  when 4
    right[1] = [right[1], y].min
  end
end
puts [right[0] - left[0], 0].max * [right[1] - left[1]].max


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
long long n,l,r,zs;
int main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	  {
	  	cin>>l>>r;
	  	zs=zs+r-l+1;
	  }
	cout<<zs;
    return 0;
}

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

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

    // input
    ll Q;
    cin >> Q;

    vector<ll> A;

    while(Q--){
        ll a;
        cin >> a;

        // push
        if(a==0){
            ll x; cin >> x;
            A.push_back(x);
        }
        // random
        else if(a==1){
            ll p; cin >> p;
            p(A[p]);
        }
        // pop
        else{
            A.pop_back();
        }
    }

    
    return 0;
}


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

using namespace std;
using ll = long long;

#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<int>> h(n, vector<int>(3));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 3; ++j) cin >> h[i][j];
    }
    vector<vector<int>> dp(n, vector<int>(3, -1));
    for (int i = 0; i < 3; ++i) dp[0][i] = h[0][i];
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j != k) dp[i][k] = max(dp[i][k], dp[i - 1][j] + h[i][k]);
            }
        }
    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
    return 0;
}

Measured memory_bytes: 14248
#include<iostream>
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a >= 0 || c >= 0){
        c -= b;
        if(a <= 0 || c <= 0){
            break;
        }
        a -= d;
        if(a <= 0 || c <= 0){
            break;
        }
    }
    if(a > c){
        cout << "Yes" << endl;
    }
    if(a <= c){
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
N, K = map(int, input().rstrip().split(' '))
result = 0.0

def get_n(num, K):
    now_score = num
    for i in range(20):
        if now_score >= K:
            return i
        now_score *= 2

for i in range(1, N+1):
    n = get_n(i, K)
    i_score = (1/N) * ((1/2)**n)
    result += i_score

print(result)

Measured memory_bytes: 3060
n, w = gets.chomp.split(" ").map(&:to_i)
wv = n.times.map { gets.chomp.split(" ").map(&:to_i) }
V_MAX = 10 ** 5
W_MAX = 10 ** 15
dp = Array.new(V_MAX + 1) { W_MAX }
dp[0] = 0
n.times do |i|
  t_dp = dp.clone
  wi, vi = wv[i]
  vi.upto(V_MAX) do |j|
    t_w = dp[j - vi] + wi
    t_dp[j] = t_w if dp[j] > t_w
  end
  dp = t_dp
end
ans = 0
(V_MAX + 1).times do |i|
  ans = i if dp[i] <= w
end
puts ans

Measured memory_bytes: 69028
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
constexpr LL kInf = 1e18;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vs){
  for (const T& v : vs) os << v << " ";
  return os;
}

int main() {
  LL H, N; cin >> H >> N;
  vector<vector<LL>> dp(N + 1, vector<LL>(H + 1, kInf));
  for (int i = 0; i <= N; ++i) dp[i][H] = 0;
  for (int i = 1; i <= N; ++i) {
    LL A, B; cin >> A >> B;
    for (int j = H-1; j >= max(0LL, H-A-1); --j) {
      dp[i][j] = min(dp[i-1][j], B);
    }
    for (int j = H-A; j >= 0; --j) {
      dp[i][j] = min(dp[i-1][j], dp[i][j + A] + B);
    }
  }
  cout << dp[N][0] << endl;
}


Measured memory_bytes: 78720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  if (a == 1) {a = 14;}
  if (b == 1) {b = 14;}
  if (a > b) {cout << "Alice" << endl;}
  else if (b > a) {cout << "Bob" << endl;}
  else { cout << "Draw" << endl; }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 3005;
const ll M = 998244353;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll qpow(ll a,ll b) {ll s=1;while(b){if(b&1)s=(s*a)%M;a=(a*a)%M;b>>=1;} return s;}
int n,s,a[maxn];
ll f[maxn][maxn];


int main()
{
    fastio();
    cin>>n>>s;
    rep(i,1,n) cin>>a[i];
    f[0][0] = 1;
    rep(i,1,n){
        rep(j,0,s){
            f[i][j] = (f[i-1][j]*2)%M;
            if(j>=a[i]) {f[i][j] += f[i-1][j-a[i]];f[i][j]%=M;}
        }
    }
    cout<<f[n][s]<<endl;
    return 0;
}


Measured memory_bytes: 74096
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> odd, even;
    int tmp;
    for (int i = 0; i < n; i++)
    {
        cin >> tmp;
        if (i % 2 != 0)
        {
            even.emplace_back(tmp);
        }else
        {
            odd.emplace_back(tmp);
        }
        
    }

    if (n % 2 != 0)
    {
        for (int i = odd.size() - 1; i >= 0; i--)
        {
            cout << odd[i] << ' ';
        }
        for (int i = 0; i < even.size(); i++)
        {
            cout << even[i] << ' ';
        }
        
    }else
    {
        for (int i = even.size() - 1; i >= 0; i--)
        {
            cout << even[i] << ' ';
        }
        for (int i = 0; i < odd.size(); i++)
        {
            cout << odd[i] << ' ';
        }
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int dp[n];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
H = list(map(int, input().split()))

max_consec = 0
consec = 0
c = H[0]
for i in range(1, len(H)):
    p = c
    c = H[i]
    if (p >= c):
        consec += 1
        max_consec = max(max_consec, consec)
    else:
        consec = 0

print(max_consec)


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

const int mod=1e9+7;
char shit1[100],shit2[100];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s%s",shit1,shit2);
    long long ans=1;
    int last=0;
    for(int i=0;i<n;i++)
    {
        if(shit1[i]==shit2[i]){
            ans=ans*(3-last)%mod;
            last=1;
        }
        else{
            if(last==0) ans=ans*6%mod;
            if(last==1) ans=ans*2%mod;
            if(last==2) ans=ans*3%mod;
            last=2;i++;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cerr<<(#v)<<":";for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;
#define printVS(vs) cerr<<(#vs)<<":"<<endl;for(auto(s):(vs)){cerr<<(s)<< endl;}
#define printVV(vv) cerr<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cerr<<" "<<(x);}cerr<<endl;}
#define printP(p) cerr<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cerr<<(#vp)<<":"<<endl;for(auto(p):(vp)){cerr<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

const int H = 10;
const int W = 10;

bool inside(int x, int y) {
    return 0 <= x && x < H && 0 <= y && y < W;
}

bool validMove(int dx, int dy) {
  return (abs(dx) == 2) ^ (abs(dy) == 2);
}

bool existValidState(const vvi& vv) {
  rep(x, H) {
    rep(y, W) {
      if (vv[x][y] == 1) return true;
    }
  }
  return false;
}

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

    int sx, sy;
    while (cin >> sx >> sy) {
      if (sx == 0 && sy == 0) return 0;
      int n;
      cin >> n;
      vector<Pii> vp(n + 1);
      rep2(t, 1, n + 1) {
        int x, y;
        cin >> x >> y;
        vp[t] = Pii(x, y);
      }

      vvvi dp(n + 1, vvi(H, vi(W, 0)));
      dp[0][sx][sy] = 1;
      rep(t, n) {
        rep(x, H) {
          rep(y, W) {
            if (dp[t][x][y] == 0) continue;
            // cerr << "t = " << t << ", x = " << y << ", y = " << x << endl;
            // cerr << "vp[t+1].first = " << vp[t+1].second << ", vp[t+1].second = " << vp[t+1].second << endl;
            for (int dx = -2; dx <= 2; dx++) {
              for (int dy = -2; dy <= 2; dy++) {
                if (!validMove(dx, dy)) continue;
                int nx = x + dx;
                int ny = y + dy;
                if (!inside(nx, ny)) continue;
                // cerr << "nx = " << ny << ", ny = " << nx << endl;
                if (abs(vp[t+1].first - nx) <= 1 && abs(vp[t+1].second - ny) <= 1) {
                  dp[t+1][nx][ny] = 1;
                }
              }
            }
          }
        }
      }

      cout << (existValidState(dp[n]) ? "OK" : "NA") << endl;

      // rep(t, n + 1) {
      //   cerr << "t = " << t << ":" << endl;
      //   rep(x, H) {
      //     rep(y, W) {
      //       cerr << dp[t][y][x];
      //     }
      //     cerr << endl;
      //   }
      //   cerr << endl;
      // }
    }
}



Measured memory_bytes: 3036
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define EPS (1e-10)

int used[20];
int cx[20],cy[20];
int dx,dy;
int n;
int tmp;

void dragon(double sum,int hx,int hy)
{
	int i,c;
	double r;
	
	if(tmp)return;
	
	c=0;
	for(i=0;i<n;i++){
		if(used[i])c++;
	}
	if(c==n){
		tmp = 1;
		return;
	}
	
	for(i=0;i<n;i++){
		if(used[i]==0){
		  r = sum + sqrt((hx-cx[i])*(hx-cx[i])+(hy-cy[i])*(hy-cy[i]));
			if(r + EPS > sqrt((dx-cx[i])*(dx-cx[i])+(dy-cy[i])*(dy-cy[i])) )return;
		}
	}
	
	for(i=0;i<n;i++){
		if(used[i]==0){
			used[i]=1;
			r = sum + sqrt((hx-cx[i])*(hx-cx[i])+(hy-cy[i])*(hy-cy[i]));
			dragon(r,cx[i],cy[i]);
			used[i]=0;
		}
	}
}



int main(void)
{
	int i,j,c;
	int hx,hy;




	while(1)
	{
		scanf("%d %d %d %d %d",&n,&hx,&hy,&dx,&dy);
		if(n==0 && hx==0 && hy==0 && dx==0 && dy==0)break;
		
		for(i=0;i<n;i++){
			scanf("%d %d",&cx[i],&cy[i]);
		}
	  
		for(i=0;i<n;i++){
			used[i]=0;
		}
    
    tmp = 0;
    dragon(0.0,hx,hy);
		if(tmp){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
		
	}
	return 0;
	
}	


		

Measured memory_bytes: 380
o=list(input())[::-1]
e=list(input())[::-1]
ans=[]
if len(o)==len(e):
    for i in range(len(o)):
        ans.append(o.pop())
        ans.append(e.pop())
else:
    for i in range(len(e)):
        ans.append(o.pop())
        ans.append(e.pop())
    ans.append(o.pop())
print("".join(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int a[3];
  for(int i = 0; i<3; i++){
    cin>>a[i];
  }
  int k;
  cin>>k;
  sort(a,a+3);
  for(int i = 0; i<k; i++){
    a[2]*=2;
  }
  int sum = 0;
  for(int i = 0; i<3; i++){
    sum+=a[i];
  }
  cout<<sum<<endl;
  return 0;
}




Measured memory_bytes: 256