akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T; cin >> T ;
  rep(i,T){
    ll A,B,C,D; cin >> A >> B >> C >> D ;
    ll g = __gcd(B,D);
    if(B>D) cout << "No" << endl;
    else if(A<C){
      if(A<B) cout << "No" << endl;
      else{
        A += ((-A+D-1)/(D-B))*(D-B);
        ll k = (A-C-1)/g;
        A -= k * g;
        dump(A);
        if(A-B>=0) cout << "Yes" << endl;
        else cout << "No" << endl;
      }
    }else{
      ll k = (A-C-1)/g;
      A -= k * g;
      dump(A);
      if(A-B>=0) cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXSIZE=10000020;
int bufpos;
char buf[MAXSIZE];
#define NEG 0
void init(){
	#ifdef LOCAL
		freopen("C.txt","r",stdin);
	#endif
	buf[fread(buf,1,MAXSIZE,stdin)]='\0';
	bufpos=0;
}
#if NEG
int readint(){
	bool isneg;
	int val=0;
	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);
	bufpos+=(isneg=buf[bufpos]=='-');
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return isneg?-val:val;
}
#else
int readint(){
	int val=0;
	for(;!isdigit(buf[bufpos]);bufpos++);
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return val;
}
#endif
char readchar(){
	for(;isspace(buf[bufpos]);bufpos++);
	return buf[bufpos++];
}
int readstr(char* s){
	int cur=0;
	for(;isspace(buf[bufpos]);bufpos++);
	for(;!isspace(buf[bufpos]);bufpos++)
		s[cur++]=buf[bufpos];
	s[cur]='\0';
	return cur;
}
bitset<52> dp[52];
void work(ll x){
	for(int i=0;i<=50;i++){
		dp[i].reset();
		dp[i][i]=1;
		for(int j=1;j<=i;j++)
			if (x>>j&1)
				dp[i]|=dp[i%j];
	}
}
int a[52],b[52];
int main(){
	init();
	int n=readint();
	work((1LL<<51)-1);
	for(int i=1;i<=n;i++)
		a[i]=readint();
	for(int i=1;i<=n;i++){
		b[i]=readint();
		if (!dp[a[i]][b[i]])
			return puts("-1"),0;
	}
	ll ans=0;
	for(int i=50;i;i--){
		bool flag=false;
		// for(int j=1;j<=n;j++)
			// printf("%d\n",a[j]);
		work(ans+(1LL<<i)-1);
		for(int j=1;j<=n;j++)
			if (!dp[a[j]][b[j]]){
				flag=true;
				break;
			}
		if (flag){
			// printf("%d\n",i);
			ans+=1LL<<i;
		}
	}
	printf("%lld",ans);
}

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

int32_t main()
{
	int n;
	cin >> n;
	int a = n % 10;
	if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9)
	{
		cout << "hon" << endl;
	} else if (a == 0 || a == 6 || a == 8 || a == 1)
	{
		cout << "pon" << endl;
	} else
	{
		cout << "bon" << endl;
	}

}

Measured memory_bytes: 3632
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
int dp[3005][3005], l1, l2;
pair<int, int>ne[3005][3005];
string s1, s2;
int solve(int idx1, int idx2)
{
	//cout << idx1 << ' ' << idx2 << '\n';
	if(idx1==l1 || idx2==l2)
		return 0;
	if(dp[idx1][idx2]!=-1)
		return dp[idx1][idx2];
	int x=solve(idx1+1, idx2);
	if(x >= dp[idx1][idx2])
	{
		dp[idx1][idx2]=x;
		ne[idx1][idx2]=make_pair(idx1+1, idx2);
	}
	x=solve(idx1, idx2+1);
	if(x >= dp[idx1][idx2])
	{
		dp[idx1][idx2]=x;
		ne[idx1][idx2]=make_pair(idx1, idx2+1);
	}
	if(s1[idx1]==s2[idx2])
	{
		x=solve(idx1+1, idx2+1)+1;
		if(x >= dp[idx1][idx2])
		{
			dp[idx1][idx2]=x;
			ne[idx1][idx2]=make_pair(idx1+1, idx2+1);
		}
	}
	return dp[idx1][idx2];
}
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> s1 >> s2;
	l1=s1.length(), l2=s2.length();
	for(int i = 0; i < 3005; i++)
	{
		for(int j = 0; j < 3005; j++)
		{
			dp[i][j]=-1;
			ne[i][j]=make_pair(-1, -1);
		}
	}
	solve(0, 0);
	pair<int, int>cu=make_pair(0, 0);
	string ans="";
	while(cu!=make_pair(-1, -1))
	{
		if(ne[cu.first][cu.second].first > cu.first && ne[cu.first][cu.second].second > cu.second)
			ans+=s1[cu.first];
		cu=ne[cu.first][cu.second];
	}
	cout << ans << '\n';
}
//size

Measured memory_bytes: 109912
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 1e18;
const double PI = acos(-1);
const ll mod = 998244353;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = 0;
    rep(i, n) ans += a[i] - 1;

    cout << ans << endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < 3 ; i++){
    if (s[i] == 'o') ans++;
  }
  cout << ans * 100 + 700 << endl;
}
    


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

template <typename T>
class BIT {
 public:
  BIT(int n) : v_(n) {}
  T Sum(int i) const {
    T ret = 0;
    while (i >= 0) {
      ret += v_[i];
      i = (i & (i + 1)) - 1;
    }
    return ret;
  }
  T Get(int i) const { return Sum(i) - Sum(i - 1); }
  void Add(int i, T v) {
    while (i < v_.size()) {
      v_[i] += v;
      i |= i + 1;
    }
  }

 private:
  std::vector<T> v_;
};

struct Q {
  int l, r, i, v;
};

int main() {
  in(int, n, q);
  V<int> c(n);
  rep(i, n) cin >> c[i];
  V<Q> qs;
  rep(i, q) {
    in(int, l, r);
    --l, --r;
    qs.push_back({l, r, i, 0});
  }
  sort(all(qs), [](const Q& a, const Q& b) { return a.r < b.r; });
  V<int> seen(n, -1);
  int seen_cnt = 0;
  BIT<int> bit(n);
  auto qit = qs.begin();
  V<int> ans(q);
  rep(i, n) {
    int& s = seen[c[i] - 1];
    if (s == -1) {
      ++seen_cnt;
    } else {
      bit.Add(s, -1);
    }
    s = i;
    bit.Add(i, 1);
    while (qit != qs.end() && qit->r == i) {
      ans[qit->i] = seen_cnt - bit.Sum(qit->l - 1);
      ++qit;
    }
  }
  rep(i, q) out(ans[i]);
}

Measured memory_bytes: 19392
#include<stdio.h>
#define N 100000

int main(void){
  int i,num,j;
  int n,ans[N];

  for(i=0;;i++){
    scanf("%d",&n);
    if(n==0)
      break;
    for(j=0;;j++){
      if(n==1){
        ans[i]=j;
        break;
      }
      if(n%2==0){
        n/=2;
      }else{
        n*=3;
        n++;
      }
    }
  }
  num=i;
  for(i=0;i<num;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // スペース区切りの整数の入力
            string[] a = Console.ReadLine().Split(' ');
            long[] aa = new long[n];
            int i;
            for (i = 0; i < n; i++) aa[i] = long.Parse(a[i]);
            long out1 = long.MaxValue;
            long out2;

            long nn = aa.Sum();
            long mm = 0;

            for (i = 1; i < n; i++)
            {
                mm = mm + aa[i - 1];
                nn = nn - aa[i - 1];

                out2 = Math.Abs(mm - nn);
                //long[] bb = new long[i];
                //long[] cc = new long[n-i];
                //Array.Copy(aa, 0, bb, 0, i);
                //Array.Copy(aa, i, cc, 0, n-i);
                //out2 = Math.Abs(bb.Sum() - cc.Sum());
                if (out2 == 0)
                {
                    out1 = 0;
                    break;
                }
                if (out2 < out1) out1 = out2;

            }
            Console.WriteLine(out1);
        }
    }
}

Measured memory_bytes: 30300
#include <stdio.h>
     
    int main(void) {
    int a,b;
    scanf("%d%d",&a,&b);
    if(a < b){
    printf("a < b\n");
    }
    else if(a > b){
    printf("a > b\n");
    }
    else{
    printf("a == b\n");
    }
    return 0;
    }
     

Measured memory_bytes: 580
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

int main() {
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;
    S[K - 1] += 97 - 65;

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 


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

string S; cin >> S;

if (S.size() % 2){
    cout << "No\n";
    return 0;
}

rep(i, 0, S.size()){
    if (i % 2 == 0){
        if (!(S[i] == 'h' && S[i+1] == 'i')){
            cout << "No\n";
            return 0;
        }
    }
}

cout << "Yes\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



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

int main(){
  int h, n, sum = 0;
  cin >> h >> n;
  for(int i = 0; i < n; ++i){
    int a; cin >> a;
    sum += a;
  }
  
  if(sum >= h){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int ans = 0, l, r, d;
	cin >> l >> r >> d;
	for(int i=d; i<=r; i+=d) {
		if(i < l) continue;
		ans++;
	}
	cout << ans;
}

Measured memory_bytes: 3604
import operator
import os
import sys
from functools import reduce

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


class SegmentTree:
    # http://tsutaj.hatenablog.com/entry/2017/03/29/204841
    def __init__(self, size, fn=operator.add, default=None, initial_values=None):
        """
        :param int size:
        :param callable fn: 区間に適用する関数。引数を 2 つ取る。min, max, operator.xor など
        :param default:
        :param list initial_values:
        """
        default = default or 0

        # size 以上である最小の 2 冪を size とする
        n = 1
        while n < size:
            n *= 2
        self._size = n
        self._fn = fn

        self._tree = [default] * (self._size * 2 - 1)
        if initial_values:
            i = self._size - 1
            for v in initial_values:
                self._tree[i] = v
                i += 1
            i = self._size - 2
            while i >= 0:
                self._tree[i] = self._fn(self._tree[i * 2 + 1], self._tree[i * 2 + 2])
                i -= 1

    def set(self, i, value):
        """
        i 番目に value を設定
        :param int i:
        :param value:
        :return:
        """
        x = self._size - 1 + i
        self._tree[x] = value

        while x > 0:
            x = (x - 1) // 2
            self._tree[x] = self._fn(self._tree[x * 2 + 1], self._tree[x * 2 + 2])

    def add(self, i, value):
        """
        もとの i 番目と value に fn を適用したものを i 番目に設定
        :param int i:
        :param value:
        :return:
        """
        x = self._size - 1 + i
        self.set(i, self._fn(self._tree[x], value))

    def get(self, from_i, to_i=None, k=0, L=None, r=None):
        """
        [from_i, to_i) に fn を適用した結果を返す
        :param int from_i:
        :param int to_i:
        :param int k: self._tree[k] が、[L, r) に fn を適用した結果を持つ
        :param int L:
        :param int r:
        :return:
        """
        if to_i is None:
            return self._tree[self._size - 1 + from_i]

        L = 0 if L is None else L
        r = self._size if r is None else r

        if from_i <= L and r <= to_i:
            return self._tree[k]

        if to_i <= L or r <= from_i:
            return None

        ret_L = self.get(from_i, to_i, k * 2 + 1, L, (L + r) // 2)
        ret_r = self.get(from_i, to_i, k * 2 + 2, (L + r) // 2, r)
        if ret_L is None:
            return ret_r
        if ret_r is None:
            return ret_L
        return self._fn(ret_L, ret_r)


N, Q = list(map(int, sys.stdin.buffer.readline().split()))
CXY = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(Q)]

st = SegmentTree( N, fn=min, default=2**31 - 1)
for c, x, y in CXY:

    if c == 0:
        st.set(x, y)
    else:
        print(st.get(x, y + 1))



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    vector<ll> A(N);
    for (int i=0;i<N;++i) cin >> A[i];
    sort(A.begin(),A.end());
    ll ub=1e18,lb=-ub; ++ub,--lb;
    while(ub-lb>1){
        ll mid=(ub+lb)>>1LL,cnt=0;
        for (int i=0;i<N;++i){
            if (A[i]==0){
                if (0<=mid) cnt+=N-1;
                continue;
            }
            int lbb=-1,ubb=N;
            while(ubb-lbb>1){
                int midd=(ubb+lbb)>>1;
                if (A[i]>0) (A[i]*A[midd]<=mid?lbb:ubb)=midd;
                else (mid<A[i]*A[midd]?lbb:ubb)=midd;
            }
            cnt+=(A[i]>0?lbb+1:N-ubb);
            if (A[i]*A[i]<=mid) --cnt;
        }
        cnt/=2;
        (K<=cnt?ub:lb)=mid;
    }
    cout << ub << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong(), k = sc.nextLong(), d = sc.nextLong();
        x = Math.abs(x);
        if(x/d >= k){
            System.out.println(x-k*d);
        }else{
            long newX = x % d;
            long newK = k - x / d;
            if(newK % 2 == 0){
                System.out.println(Math.min(newX, 2 * d - newX));
            }else{
                System.out.println(Math.min(newX + d, d - newX));
            }
        }
    }
}


Measured memory_bytes: 27016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    bool flag=true;
    ll res=0;
    while(flag){
        flag=false;
        rep(i,n-1){
            if(a[i]>a[i+1]){
                swap(a[i],a[i+1]);
                flag=true;
                res++;
            }
        }
    }
    rep(i,n) {cout<<a[i]; if(i<n-1) cout<<' ';}
    cout<<endl;
    cout<<res<<endl;
    return 0;
}


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

int main(){
    int n, c, k;
    cin >> n >> c >> k;

    vector<int> t(n);
    for (auto i = 0; i < n; i++) cin >> t[i];
    sort(t.begin(), t.end());

    int front = 0, count = 1, ans = 0;
    while(front < n){
        if(t[front + count] <= t[front] + k) count++;
        else {
            ans++;
            front += min(c, count);
            count -= min(c, count);
        }
        if(count == c) {
            ans++;
            count -= c;
            front += c;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int N;
	cin >> N;
	double sum = 0;
	for (int i = 0; i < N; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY") {
			sum += x;
		}
		else {
			sum += x * 380000.0;
		}
	}
	printf("%.15lf\n", sum);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    int n,c1=0,c2=0;
    char s[100010];
    scanf("%s",s);
    n=strlen(s);
    for(int i=0;i<n;i++){
        if(i%2){
            if(s[i]=='0'){
                c1++;
            }
            else{
                c2++;
            }
        }
        else{
            if(s[i]=='0'){
                c2++;
            }
            else{
                c1++;
            }
        }
    }
    printf("%d\n",min(c1,c2));
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::ops::Bound::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

const M: u64 = 1_000_000_007u64;

#[fastout]
fn main() {
    input! {
        s: u64
    }

    let lim = s / 3;
    if lim == 0 {
        println!("0");
        return;
    }

    let fact = &fact_table(30000, M);

    let mut ans = 1u64;
    for i in 2..=lim {
        let s = s - 3*i;
        ans += mod_comb_repetition(i, s, M, fact);
        ans %= M;
    }
    println!("{}", ans);
}

#[allow(dead_code)]
pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
#[allow(dead_code)]
pub fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}
#[allow(dead_code)]
/// (gcd, x, y)
pub fn extgcd(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (gcd, x, y) = extgcd(b, a % b);
        (gcd, y, x - (a / b) * y)
    }
}
#[allow(dead_code)]
/// x ^ n % m
pub fn mod_pow(x: u64, n: u64, m: u64) -> u64 {
    let mut res = 1;
    let mut x = x % m;
    let mut n = n;
    while n > 0 {
        if n & 1 == 1 {
            res = (res * x) % m;
        }
        x = (x * x) % m;
        n >>= 1;
    }
    res
}
#[allow(dead_code)]
pub fn mod_inverse(a: u64, m: u64) -> u64 {
    let (_, x, _) = extgcd(a as i64, m as i64);
    ((m as i64 + x) as u64 % m) % m
}
#[allow(dead_code)]
pub fn fact_table(len: usize, m: u64) -> Vec<u64> {
    let mut res = vec![1; len + 1];
    for i in 1..len + 1 {
        res[i] = (i as u64 * res[i - 1]) % m;
    }
    res
}
#[allow(dead_code)]
/// Factorial and Inverse factorial table
pub fn fact_inv_table(size: usize, m: u64) -> (Vec<u64>, Vec<u64>) {
    let mut fact = vec![1; size];
    let mut fact_inv = vec![1; size];
    for i in 2..size {
        fact[i] = fact[i - 1] * i as u64 % m;
        fact_inv[i] = m - ((m / i as u64) * fact_inv[(m % i as u64) as usize] % m);
    }
    for i in 1..size {
        fact_inv[i] = fact_inv[i - 1] * fact_inv[i] % m;
    }
    (fact, fact_inv)
}
#[allow(dead_code)]
/// (a mod p, e when n! = a p\^e)
pub fn mod_fact(n: u64, p: u64, fact: &[u64]) -> (u64, u64) {
    if n == 0 {
        (1, 0)
    } else {
        let (a, b) = mod_fact(n / p, p, fact);
        let pow = b + n / p;
        if n / p % 2 != 0 {
            (a * (p - fact[(n % p) as usize]) % p, pow)
        } else {
            (a * fact[(n % p) as usize] % p, pow)
        }
    }
}
#[allow(dead_code)]
/// C(n, k) % p
pub fn mod_comb(n: u64, k: u64, p: u64, fact: &[u64]) -> u64 {
    if n < k {
        0
    } else {
        let (a1, e1) = mod_fact(n, p, fact);
        let (a2, e2) = mod_fact(k, p, fact);
        let (a3, e3) = mod_fact(n - k, p, fact);
        if e1 > e2 + e3 {
            0
        } else {
            a1 * mod_inverse(a2 * a3 % p, p) % p
        }
    }
}
#[allow(dead_code)]
/// H(n, k) % p
pub fn mod_comb_repetition(n: u64, k: u64, p: u64, fact: &[u64]) -> u64 {
    mod_comb(n - 1 + k, n - 1, p, fact)
}

Measured memory_bytes: 2324
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
const int AMAX = 100000; 
using namespace std;
#define rep(i, n) for (i64 i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (i64 i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define down(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
using LL = long long;
using ULL = unsigned long long;
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()
{
   string a , b, c;
   int n;
   LL ans=1;
   cin >> n>>a;
   rep(i,n-1){
   if(a[i]!=a[i+1])
       ans++;
   }
   cout << ans;
}


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

int main(){
	int n;
	cin >> n;
	double ans = 0;
	rep(i,n){
		double u;
		cin >> u;
		string s;
		cin >> s;
		if(s == "JPY"){
			ans += u;
		}else{
			ans += 380000.000*u;
		}
	}
	printf("%.10f", ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <assert.h>
#include <sstream>
#include <type_traits>
#define SET(x,y) x |= (1 << y)
#define CLEAR(x,y) x &= ~(1<< y)
#define READ(x,y) ((0u == (x & (1<<y)))?0u:1u)
#define TOGGLE(x,y) (x ^= (1<<y))
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pF first
#define pS second
#define CL(a,b) memset(a,b,sizeof(a))
#define sqr(x) ((x)*(x))
#define intLIMIT numeric_limits<int>
#define longLIMIT numeric_limits<long long>
#define GCD(a,b) __gcd((a),(b))
#define dbl(x) (double)(x)
#define vi vector <int>
#define vii vector < pair <int, int> >
#define vll vector <long long>
#define allof(x) (x).begin(), (x).end()
#define fastCin cin.sync_with_stdio(0);cin.tie(0)
#define scanUnsigned(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#define printArr(a,l) cout<<#a<<": ";for(int i=0;i<(l);i++){cout<<a[i]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(int i=0;i<(r);i++){for(int j=0;j<(c);j++){cout<<a[i][j]<<" ";}cout<<endl;}
char _;
using namespace std;
void PRINT (int x, int y) { for (int i = y-1; i >= 0; i--) { cout << READ(x,i); } cout << endl; }

vector<string>vec_splitter(string s){s+=',';vector<string>res;while(!s.empty()){res.push_back(s.substr(0,s.find(',')));s=s.substr(s.find(',')+1);}
return res;}
void debug_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,__attribute__((unused))int LINE_NUM){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(vector<string>args,int idx,int LINE_NUM,Head H,Tail...T){if(idx>0)cerr<<", ";else cerr<<"Line("<<LINE_NUM<<") ";stringstream ss;ss<<H;cerr<<args[idx]<<" = "<<ss.str();debug_out(args,idx+1,LINE_NUM,T...);}
#ifdef LOCAL_DBG
#define dbg(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define dbg(...) 42
#endif

int main () {
	fastCin;
	int t;
	cin >> t;
	if (t >= 30) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}

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

int main(){
  string S,T;
  cin >> S >> T;
  for(int i=0; i<S.size(); i++){
    if(S[i]!=T[i]){
      cout << "No" << endl;
      break;
    }
    if(i==S.size()-1) cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

ll n;
vector<string> s;
void dfs(string t, char a){
  if(sz(t) == n){
    s.pb(t);
    return;
  }else{
    for(char c = 'a'; c <= a; c++){
      dfs(t+c, (a == c ? char(c+1) : a));
    }
  }

  return;
}

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

  cin >> n;
  dfs("", 'a');
  for(auto i : s){
    cout << i << endl;
  }
  return 0;
}

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

using i64 = int64_t;

constexpr i64 MAX_V = 10000;
constexpr i64 INF = 1e9;

// 辺を表す構造体 (行き先, 容量, 逆辺)
struct edge {
    int to, cap, rev;
};

vector<edge> G[MAX_V]; // グラフの隣接リスト表現
bool used[MAX_V];           // DFSですでに調べたかのフラグ

// fromからtoへ向かう容量capの辺をグラフに追加する
void add_edge(int from, int to, int cap) {
    G[from].push_back((edge){to, cap, (int)G[to].size()});
    G[to].push_back((edge){from, 0, (int)G[from].size() - 1});
}

// 増加パスをDFSで探す
int dfs(int v, int t, int f) {
    if (v == t)
        return f;
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

// sからtへの最大流を求める
int max_flow(int s, int t) {
    int flow = 0;
    for (;;) {
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if (f == 0)
            return flow;
        flow += f;
    }
}

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    vector<int> c;
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        c.push_back(tmp);
    }
    for(int i=1;i<=n;++i){
        add_edge(0, i, v[i-1]-c[i-1]);
        add_edge(i, n+1, INF);
    }

    cout << max_flow(0, n+1) << endl;

    return 0;
}


Measured memory_bytes: 512
// Problem : C - gacha
// Contest : AtCoder - AtCoder Beginner Contest 164
// URL : https://atcoder.jp/contests/abc164/tasks/abc164_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


// Problem : B - Battle
// Contest : AtCoder - AtCoder Beginner Contest 164
// URL : https://atcoder.jp/contests/abc164/tasks/abc164_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b
#define LCM(a,b)    (a*b)/__gcd(a,b)
#define all(v)  v.begin(),v.end()
#define alls(s,v)  s.begin(),s.end(),v
#define gena(arr,n,nxt)  generate(arr,arr+n, nxt)
#define genv(v,nxt)  generate(v.begin(),v.end(), nxt)
#define base ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define exit return 0;
using namespace std;
const int N=1000000;
bool prime[N];
void sieve(){memset(prime, true, sizeof(prime));for (int p=2; p*p<100000000; p++)
{if (prime[p] == true){for (int i=p*p; i<100000; i += p)prime[i] = false;}}}
int power(int x, int y){int res = 1;while (y > 0){if (y & 1)res = res * x;y = y >> 1;x = x*x;}return res;}
int nxt(){int x;cin >> x;return x;}
int32_t main(){
    base
    int n=nxt();
    set<string>st;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        st.insert(s);
    }
    cout<<st.size();
    exit
}


Measured memory_bytes: 19216
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val s = sc.next

  case class Memo[I, O](f: I => O) extends (I => O) {

    import collection.mutable.{Map => Dict}

    val cache = Dict.empty[I, O]

    override def apply(x: I): O = cache getOrElseUpdate(x, f(x))
  }

  type Calc = Memo[String, (Long, Int)]

  lazy val f: Calc = Memo {
    case "" => (0L, 1)
    case str: String =>
      val len = str.length
      (for {
        i <- 1 to len
        (sum, cnt) = f(str.substring(i))
      } yield {
        (str.substring(0, i).toLong * cnt + sum, cnt)
      }).reduce((t1, t2) => (t1._1 + t2._1, t1._2 + t2._2))
  }
  println(f(s)._1)
}


Measured memory_bytes: 25504
n, m = map(int, input().split())
py = [[0] * 4 for _ in range(m)]

for i in range(m):
    p, y = map(int, input().split())
    py[i][0] = i
    py[i][1] = p
    py[i][2] = y

py.sort(key=lambda x:(x[1], x[2]))

now_pre = py[0][1]
now_idx = 0
for i in py:
    num_p = str(i[1]).zfill(6)
    if i[1] == now_pre:
        now_idx += 1
    else:
        now_idx = 1
        now_pre = i[1]
    num_y = str(now_idx).zfill(6)
    i[3] = num_p + num_y

py.sort(key=lambda x:x[0])

for i in py:
    print(i[3])

Measured memory_bytes: 32424
/**
 *   author: Shubham Srivastava
 *   created: 04 February 2019  02:16:07
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    long long n,sum;
    cin>>n>>sum;
    long long w[n],v[n];
    for(int i=0;i<n;i++)
    {
    	cin>>w[i]>>v[i];
    }

    long long dp[n+1][sum+1];

    for(int i=0;i<=n;i++)
    	for(int j=0;j<=sum;j++)
    		dp[i][j] = 0;
    for(int i=1;i<=n;i++)
    {
    	for(int j=1;j<=sum;j++)
    	{
    		if(j >= w[i-1])
    			dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1]);
    		else
    			dp[i][j] = dp[i-1][j];
    	}
    }

    cout<<dp[n][sum];
return 0;
}

Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 1 << 30;
int dp[2010][2010], ub[4010][2010], uw[4010][2010];
int N, B[2010], W[2010];

int solve(){
    for(int i = 0; i <= 2 * N; i++){
        for(int j = 0; j <= N; j++){
            ub[i + 1][j] += ub[i][j];
            uw[i + 1][j] += uw[i][j];
        }
    }

    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            dp[i][j] = inf;
        }
    }
    dp[0][0] = 0;
    for(int i= 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            int dist = i + j + 1;
            int cost = dp[i][j] + ub[B[i + 1]][i + 1] + uw[B[i + 1]][j];
            dp[i + 1][j] = min(dp[i + 1][j], cost);
            cost = dp[i][j] + ub[W[j + 1]][i] + uw[W[j + 1]][j + 1];
            dp[i][j + 1] = min(dp[i][j + 1], cost);
        }
    }
    return dp[N][N];
}

void init(){
    cin >> N;
    for(int i = 1; i <= 2 * N; i++){
        char c;
        int idx;
        cin >> c >> idx;
        if(c == 'B'){
            B[idx] = i;
            for(int j = 0; j < idx; j++){
                ub[i][j]++;
            }
        }
        else{
            W[idx] = i;
            for(int j = 0; j < idx; j++){
                uw[i][j]++;
            }
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    init();
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 78976
//AOJ DSL_3_C(The Number of Windows)

//しゃくとり法の典型(x以下となるとき)
//O(N)で求める

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

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repr(i,a,b) for(int i=(a); i>=(b); i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int,int> P;
const int INF=1<<29;

//区間の左端がどこかで場合分けを行う
//左端で場合分けO(N^2)
int N,Q;

int main(){
    cin>>N>>Q;
    vector<ll> a(N);
    rep(i,0,N)cin>>a[i];
    
    //Q回分のクエリを処理
    rep(i,0,Q){
        ll x;
        cin>>x;//各クエリ
        
        //合計値
        ll res=0;
        
        //区間の左端で場合分けを行う
        int right=0;
        ll sum=0;
        
        rep(left,0,N){
            //sum,rightは使いまわす
            //[left,right)の総和がx以下という条件を満たす最大のrightを求める
            
            //sumにa[right]を加えても大丈夫ならrightをインクリメント
            while(right<N && sum+a[right]<=x){
                sum+=a[right];
                right++;
            }
            
            //breakした時、rightは条件を満たす最大[left,right)の大きさ
            res+=(right-left);
            
            //leftをインクリメントする準備
            if(right==left) right++;
            //leftのみがインクリメントされるので範囲から引く
            else sum-=a[left];
        }
        
        cout<<res<<endl;
    }
    
    
    return 0;
}


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

unsigned long long ull[45];

int main(){
  int i;
  int n;
  ull[0]=1;
  ull[1]=1;
  cin >> n;
  for(i=2;i<=n;i++){
    ull[i]=ull[i-1]+ull[i-2];
  }
  cout << ull[n] << endl;
  return 0;
}

Measured memory_bytes: 3084
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

const int dm = 1 << 17;
char dn[dm], * di = dn;

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


	int N = getint(), K = getint(), Q = getint();

	int P[100001];
	rep1(i, N) {
		P[i] = K - Q;
	}
	rep(i, Q) {
		P[getint()]++;
	}
	rep1(i, N) {
		if (P[i] > 0) {
			*di++ = 'Y';
			*di++ = 'e';
			*di++ = 's';
			*di++ = '\n';
		}
		else {
			*di++ = 'N';
			*di++ = 'o';
			*di++ = '\n';
		}
		if (i % 25000 == 0) {
			fwrite(dn, 1, di - dn, stdout);
			di = dn;
		}
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h> 
#define int long long
using namespace std;
void print (vector<int>&v){
	int k=0;
	for (int i:v) cout<<(i==INT_MAX?0:i)<<" ";
	cout<<endl;
}
void printv (vector<vector<int>>&v){
	for (vector<int> i:v) print(i);
	cout<<endl;
}
string solve(string s1, string s2){
	int m=s1.size();
	int n=s2.size();
	vector<vector<int>> dp(m+1,vector<int> (n+1,0));
	for (int i=1;i<=m;i++){
		for (int j=1;j<=n;j++){
			if (s1[i-1]==s2[j-1]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	int lcs=dp.back().back();
	string ans="";
	while(m>0 and n>0){
		if (s1[m-1]==s2[n-1]){
			ans=s1[m-1]+ans;
			m--;
			n--;
		}		
		else if (dp[m-1][n]>dp[m][n-1]){
			m--;
		}
		else n--;
	}
	return ans;
}
signed main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    string s1;
    string s2;
    cin>>s1>>s2;
	cout<< solve(s1,s2)<<endl;
    return 0; 
}


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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

void split_int(vector<int> &v,string s){
    for(auto item:s){
        v.emplace_back(item-'0');
    }
}

signed main(){
    CIN(N);
    ll sum=0;
    RepS(i,1,N){
        RepS(j,1,N){
            RepS(k,1,N){
                sum+=GCD(i,GCD(j,k));
            }
        }
    }
    printf("%lld\n",sum);

    return 0;
}

Measured memory_bytes: 3772
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    string S, T;
    cin >> S >> T;
    sort(S.begin(), S.end());
    sort(T.rbegin(), T.rend());
    if (S < T)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math

c1x,c1y,c1r = [int(i) for i in input().split()]
c2x,c2y,c2r = [int(i) for i in input().split()]

dist=math.sqrt((c1x-c2x)**2+(c1y-c2y)**2)

if (c1r<c2r):
    temp=c1r
    c1r=c2r
    c2r=temp
    temp=c1x
    c1x=c2x
    c2x=temp
    temp=c1y
    c1y=c2y
    c2y=temp
    
if (dist > c1r+c2r):
    print(4)
    
elif (dist == c1r+c2r):
    print(3)
    
elif (dist < c1r+c2r and (dist+c2r)>c1r):
    print (2)
 
elif (dist<c1r and (dist+c2r)==c1r):
    print(1)
    
elif ((dist < c1r+c2r) and dist+c2r<c1r):
    print(0)
else:
    print ("error")


Measured memory_bytes: 5672
#include <bits/stdc++.h>
using namespace std;
int n, a;
deque<int> q;
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a);
        if (i & 1)
            q.push_back(a);
        else
            q.push_front(a);
    }
    if (n & 1)
        reverse(q.begin(), q.end());
    for (deque<int>::iterator it = q.begin(); it != q.end(); it++)
        printf("%d ", *it);
    printf("\n");
    return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define int  long long 
#define speedrap ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
double be(double a,int b,int mod) {if(b == 0) return 1; if(b%2 == 1) return (a*be(a,b-1,mod)); else return (be(a,b/2,mod)*be(a,b/2,mod));}
const int mod = 1e9 + 7;
#define PI 3.14159265359
#define pf push_front
#define pb push_back
#define bitcount __builtin_popcount
#define sc(a) scanf("%d", &a);
#define sz(s) (int)s.size()
#define eb emplace_back
#define pf push_front
#define mkp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
const int siz = 2*(1e5 + 10);
const int logi = 21;
const double epsilon = 1e-6;
int prime[siz];
int has[siz];
bool cmp(const int &a,const int &b)
{
  return (abs(a-b)>1);
}

vector<int> vt[siz];


signed main()
{
	#ifndef ONLINE_JUDGE
 	freopen("in.txt", "r", stdin);
 	freopen("out.txt", "w", stdout);
 	#else
// // online submission
 	#endif 
	speedrap
	int t;
	t = 1;
	//cin>>t;
	while(t--)
	{	
		int n;
		cin>>n;
		int a[n+1];
		map<int,int> aj;
		for(int i = 1 ; i <= n ; i++)
		{
			cin>>a[i];
			aj[i-a[i]]++;
		}


		int sum = 0;
		for(int i = 1 ; i <= n ; i++)
		{
			aj[i-a[i]]--;
			sum += aj[i+a[i]];
		}

		cout<<sum<<"\n";
	}
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n],dp[n];
    for(int i=0;i<n;i++)
  {
        cin>> a[i];
    }
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        int l;
        if(i-k>=0)
        l=i-k;
        else
        l=0;

        int minm=INT_MAX;
        for(int j=i-1;j>=l;j--)
        {
           
           int p=dp[j]+abs(a[i]-a[j]);
          // cout<<p<<" ";
           minm=min(minm,p);
        }
      //  cout<<a[i]<<" "<<minm<<endl;
        dp[i]=minm;
    }
    cout<<dp[n-1];

}

Measured memory_bytes: 1792
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, W] =  [long(input_raw[0]), long(input_raw[1])]
    v = []
    item = {}
    v_sum = {}
    for i in range(N):
        input_raw = read_func().strip().split()
        [wi, vi] =  [long(input_raw[0]), long(input_raw[1])]
        if wi not in item:
            item[wi] = [vi]
        else:
            item[wi].append(vi)

    for i in range(4 - len(item)):
        item[long(-(i + 1))] = [0L]

    w_list = []
    for wi in item:
        item[wi].sort(reverse = True)
        w_list.append(wi)
        v_sum[wi] = [0L for i in range(len(item[wi]) + 1)]
        v_sum[wi][1] = item[wi][0]
        for i in range(1, len(item[wi])):
            v_sum[wi][i + 1] = v_sum[wi][i] + item[wi][i]

    max_value = 0L
    for i in range(len(item[w_list[0]]) + 1):
        for j in range(len(item[w_list[1]]) + 1):
            for k in range(len(item[w_list[2]]) + 1):
                for l in range(len(item[w_list[3]]) + 1):
                    if W - (i * max(0L, w_list[0]) + j * max(0L, w_list[1]) + k * max(0L, w_list[2]) + l * max(0L, w_list[3])) >= 0:
                        value = v_sum[w_list[0]][i] + v_sum[w_list[1]][j] + v_sum[w_list[2]][k] + v_sum[w_list[3]][l]
                        if max_value < value:
                            max_value = value
    print max_value

##    W_ = long(N * 4 + 1)
##    dp = [[0L for j in range((W_) + 1)] for i in range(N + 1)]
##
##    for i in range(N):
##        for j in range(W_ + 1):
##
##            k = ((j - 1)%4 +  ((j - 1)/4 +1) * w[0]) - w[i]
##            #print k, j, w[i]
##            if k  < 0 or j == 0:
##                dp[i + 1][j] = dp[i][j]
##            else:
##                if k >= w[0]:
##                    l = k / w[0] + 3 * (k / w[0] - 1)
##                else:
##                    l = 0
##                print i ,w[i], k, l
##                dp[i + 1][j] = max(dp[i][j], dp[i][l] + v[i])
##
##    maximum = 0
##    for i in range(1, W_ + 1):
##        if maximum < dp[N][i] and (i - 1)%4 +  ((i - 1)/4 +1) * w[0] <= W:
##            maximum = dp[N][i]
##
##    print maximum


if __name__ == '__main__':
    main()


Measured memory_bytes: 2936