akhauriyash/Code-Regression huggingface dataset:
s = input()
n = len(s)

i = n
while i > 0:
    if i >= 7 and s[i-7:i] == 'dreamer':
        i -= 7
    elif i >= 5 and s[i-5:i] == 'dream':
        i -= 5
    elif i >= 6 and s[i-6:i] == 'eraser':
        i -= 6
    elif i >= 5 and s[i-5:i] == 'erase':
        i -= 5
    else:
        print('NO')
        exit()
print('YES')

Measured memory_bytes: 68196
#include <iostream>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
//rep(i, v.size()) v[i]=i;
//#define int long long
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>

using namespace std;

bool isPrime(int x){
  if(x <= 1) return 0;
  else if(x == 2) return 1;
  if(x % 2 == 0) return 0;
  //Nが素数の時，1とN以外の約数がないので，判定したいときは約数の有無を確かめる．
  //ある約数iがあったとき，N/iもNの約数となる．
  //ここで，i=N/iとなるiは√Nなので，iの候補は1~√Nとなる.
  for(int i = 3; i * i <= x; i += 2) if(x % i == 0) return 0;
  return 1;
}

signed main(){
  int A;
  cin >> A;

  while (!isPrime(A)) {
    A++;
    //cout << A << endl;
  }

  cout << A << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) fOR(i,n,0)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

string s;
int ans;

int main(){
  cin>>s;

  int i=0,j=s.length()-1;

  while(i<=j){
    if(s[i]==s[j]){
      i++; j--;
    }
    else{
      if(s[i]=='x'){
        ans++;
        i++;
      }
      else if(s[j]=='x'){
        ans++;
        j--;
      }
      else{
        cout<<-1<<endl;
        return 0;
      }
    }
  }

  cout<<ans<<endl;

  return 0;
}




Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);    //標準入力システム
        int x = sc.nextInt();  //入力呼び出し
        int y = sc.nextInt();
        int size = x*y;
        int per = 2*(x+y);
        System.out.println(size +" "+ per);  //出力
    }
}



Measured memory_bytes: 26172
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute21_2();
	}

	private static void execute21_2() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			String t = sc.next();

			int ans = 999999;

			for (int x = 0; x <= s.length() - t.length(); x++) {
				int a=0;
				for (int i = 0; i < t.length(); i++) {

					if (t.charAt(i) != s.charAt(i + x)) {
						a++;
					}
				}
				ans=Math.min(ans, a);
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 27088
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
ll l, r;
ll ans=0;
rep(i,n){
    cin >> l >> r;
    ans += r - l + 1;
}
cout << ans << endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import qualified Data.Vector.Unboxed as VU

solve :: Int -> Int -> Int
solve 0 0 = 0
solve 0 1 = 1
solve n x
  | x <= 1
  = 0
  | x <= 1 + lPrev
  = solve (n-1) (x-1)
  | x == 1 + lPrev + 1
  = pPrev + 1
  | x <= 1 + lPrev + 1 + lPrev
  = pPrev + 1 + solve (n-1) (x - (1 + lPrev + 1))
  | x == 1 + lPrev + 1 + lPrev + 1
  = pPrev + 1 + pPrev
  where lPrev = nLayer VU.! (n-1)
        pPrev = nPatty VU.! (n-1)

nLayer :: VU.Vector Int
nLayer = VU.fromListN 51 $ unfoldr f 1
  where f k = Just (k, 2*k + 3)

nPatty :: VU.Vector Int
nPatty = VU.fromListN 51 $ unfoldr f 1
  where f k = Just (k, 2*k + 1)

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n,bs_x]:remLines1 = remLines0
      n = readBInt bs_n
      x = readBInt bs_x
  in solve n x

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


Measured memory_bytes: 508
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int N = S.Length;
		int[] cnt = new int[26];
		for(int i=0;i<N;i++){
			cnt[S[i] - 'a']++;
		}
		
		long ans = 0;
		for(int i=0;i<26;i++){
			for(int j=i+1;j<26;j++){
				ans += (long)cnt[i] * (long) cnt[j];
			}
		}
		Console.WriteLine(ans+1);
	}
	
	String S;
	public Sol(){
		S = rs();
	}
	
	int[] Manachar(List<char> L){
		int[] Ret=new int[L.Count];
		int i=0;
		int j=0;
		while(i<L.Count){
			while(i-j>=0 && i+j <L.Count && L[i-j]==L[i+j])++j;
			Ret[i]=j;
			int k=1;
			while(i-k>=0 && i+k <L.Count && k+Ret[i-k]<j){Ret[i+k]=Ret[i-k];++k;}
			i+=k;j-=k;
		}
		return Ret;
	}
	

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11616
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 1000000007
#define ff first
#define ss second
#define pb push_back  
#define INF 10000000000

 

 int main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   ll n,k,ans = 0,i;
   double f;
   cin>>n>>k;
   ll a[n];
   for(i=0;i<n;i++){
   	cin>>a[i];
   }
  
  for(i=0;i<k;i++){
  	ans+=a[i];
  }
  f = ((ans+k)/2.0);
  for(;i<n;i++){
  	ans += a[i] - a[i-k];
  	f = max(f, (ans+k)/2.0);
  }
  
  cout<<fixed<<setprecision(12)<<f;
}

Measured memory_bytes: 1792
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll L, R;
    cin >> L >> R;
    //あまりが同じ数は定数倍してもあまりの数が同じ状態を保つ
    //そのため探索範囲は最大2019×2019になる
    if (R - L >= 2019)
        R = L + 2018;

    ll ans = 2019;
    FOR(i, L, R)
    FOR(j, L, R)
    {
        if (i == j)
            continue;

        ll current = (i * j) % 2019;
        if (current < ans)
            ans = current;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    vector<int> D[25];
    D[0].push_back(0);
    D[24].push_back(0);
    for (int i = 1; i <= N; i++) {
        int x;
        cin >> x;
        if (x == 12) {
            D[x].push_back(i);
        }
        else {
            D[x].push_back(i);
            D[24-x].push_back(i);
        }
    }
    for (int k = 12; k >= 0; k--) {
        if (k == 0) {
            puts("0");
            break;
        }
        set<int> used;
        int x = 0;
        while (1) {
            bool f = 0;
            for (int i = x; i <= 24; i++) {
                for (auto e: D[i]) {
                    if (used.find(e) == used.end()) {
                        used.insert(e);
                        f = 1;
                        x = i+k;
                        break;
                    }
                }
                if (f) break;
            }
            if (!f) break;
        }
        if (x > 24) continue;
        if (used.size() == N+1) {
            cout << k << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,m;
    scanf("%d %d",&a,&b);
    if(a>=1&&a<=9 && b>=1&&b<=9)
    {
        printf("%d\n",a*b);
    }
    else
    {
        printf("-1\n");
    }

    return 0;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define N 1023
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define pb push_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define oo 1000000123
#define mod 1000000007

using namespace std;

string s;

int main(){
    ios_base::sync_with_stdio(0);
    cin >> s;
    if(s == "ABC") cout << "ARC\n";
    else cout << "ABC\n";
    return 0;
}


Measured memory_bytes: 3548
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

struct dice
{
	string o;
	vs a;
	dice(string _a)
	{
		o = _a;
		init();
	}
	string & operator[](int n) { return a[n]; }

	void init()
	{
		string s;
		int d[6][10] = { { -1 },{ 1,-1 },{ 0,0,0,1,-1 },{ 0,1,-1 },{ 0,0,1,-1 },{ 1,1,-1 } };
		FOR(i, 6)
		{
			s = o;
			FOR(j, 10)
			{
				if (d[i][j] == -1)break;
				if (d[i][j] == 1)sn(s);
				else se(s);
			}
			FOR(j, 4)
			{
				a.push_back(s);
				se(s);
			}
		}
	}

	void sn(string &s)
	{
		swap(s[1], s[5]);
		swap(s[2], s[1]);
		swap(s[6], s[2]);
	}
	void se(string &s)
	{
		swap(s[2], s[3]);
		swap(s[4], s[2]);
		swap(s[5], s[4]);
	}
};

int main()
{
	int n;
	while (cin >> n, n)
	{
		vector<dice> a;
		FOR(i, n)
		{
			string o=" ";
			FOR(j, 6)
			{
				string s; cin >> s;
				o += s[0];
			}
			dice d(o);
			bool ok = true;
			FOR(j, a.size())
			{
				FOR(k, a[j].a.size())
				{
					if (o == a[j][k])ok = false;
				}
			}
			if (ok)a.push_back(d);
		}
		cout << n - a.size() << endl;
	}
}

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())

#define REP(a, b) for (int a = 0; a < (b); a++)
#define FOR(a, b, c) for (int a = (b); a <= (c); a++)
#define REPD(a, b) for (int a = (b) - 1; a >= 0; a--)
#define FORD(a, b, c) for (int a = (b); a >= (c); a--)

#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))

#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif

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

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2> &p) {
  return is >> p.fi >> p.se;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  V<double> p(n);
  REP(i, n) cin >> p[i];
  VV<double> dp(n + 1, V<double>(n + 1, 0));
  dp[0][0] = 1;
  REP(i, n) REP(j, n) if (dp[i][j]) {
    dp[i + 1][j] += dp[i][j] * (1 - p[i]);
    dp[i + 1][j + 1] += dp[i][j] * p[i];
  }
  double ans = 0;
  FOR(i, 0, n) {
    int rem = n - i;
    if (i > rem) ans += dp[n][i];
  }
  cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 70784
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#include<climits>
#define MOD 1000000007
signed main() {
    long long int n;
    cin >> n;
    vector<long long int> v(n);
    for(long long int i = 0; i < n; ++i){
        cin >> v[i];
    }
    vector<long long int> s(n);
    s[n-1] = v[n-1] % MOD;
    for(long long int i = n-2; i >= 0; --i){
        s[i] = (s[i+1] + v[i]) % MOD;
    }
   long long int ans = 0;
    for(long long int i = 0; i < n - 1; ++i){
        ans += ((v[i] * s[i+1])) % MOD;
    }
    cout << ans%MOD << endl;
    return 0;
}


Measured memory_bytes: 6428
s = input()
t = input()

for i in range(len(s) - len(t), -1, -1):
    for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != "?": break
    else:
        print((s[:i] + t + s[i+len(t):]).replace("?", "a"))
        break
else: print("UNRESTORABLE")        


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<n;i++)
#define revrep(i,n) for(int i=n;i>=0;i--) 
#define MOD 1e9+7;
#define EPS 1e-8
typedef long long ll;
using namespace std;
int main()
{
    int A,B; 
    cin >> A >> B;
    cout << max(0,A-(2*B)) << endl;
    return 0;
                                   
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> W(N);
	for (auto& e: W) scanf("%d", &e);
	for (int i{1}; i < N; i++)
		W[i] += W[i - 1];
	int min{1 << 30};
	for (int i{1}; i < N - 1; i++)
		min = std::min(min, std::abs(W[i] - (W[N - 1] - W[i])));
	printf("%d\n", min);

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  cin >> n;
  int dp[10001];
  mem(dp);
  dp[0]=1;
  rep(i,n) {
    int x;
    R x;
    rrep(j,10000) {
      if(j+x<=10000) dp[j+x]|=dp[j];
    }
  }
  int ans=0;
  rep(i,10001) if(i%10&&dp[i]) ans=i;
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (n*a < b) {
		cout << n*a << endl;
	}
	else {
		cout << b << endl;
	}
	return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

Int n;
double dp[301][301][301];

double rec(Int i, Int j, Int k) {
    if (i < 0 or j < 0 or k < 0) return 0.0;
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 and j == 0 and k == 0) return 0.0;
    double a = rec(i - 1, j, k) * (double)i;
    double b = rec(i + 1, j - 1, k) * (double)j;
    double c = rec(i, j + 1, k - 1) * (double)k;
    return dp[i][j][k] = (a + b + c + (double)n) / (double)(i + j + k);
}

int main() {
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
    }
    Int c1, c2, c3;
    c1 = c2 = c3 = 0;
    for (Int i = 0; i < n; i++) {
        if (a[i] == 1) {
            c1++;
        }
        if (a[i] == 2) {
            c2++;
        }
        if (a[i] == 3) {
            c3++;
        }
    }
    for (Int i = 0; i <= n; i++) {
        for (Int j = 0; j <= n; j++) {
            for (Int k = 0; k <= n; k++) {
                dp[i][j][k] = -1;
            }
        }
    }
    printf("%.12lf\n", rec(c1, c2, c3));
    return 0;
}

Measured memory_bytes: 213376
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.Remoting.Contexts;
using System.Security.Cryptography.X509Certificates;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    class HashMap<K, V> : Dictionary<K, V>
    {
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }

    class Program
    {
        private int N, M;
        private string[] s, t;

        private void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            s = new string[N];
            for (int i = 0; i < N; i++)
            {
                s[i] = sc.Next();
            }

            M = sc.NextInt();
            t=new string[M];
            for (int i = 0; i < M; i++)
            {
                t[i] = sc.Next();
            }
        }

        public void Solve()
        {
            Scan();
        var map = new HashMap<string,int>();
            foreach (var s1 in s)
            {
                map[s1]++;
            }

            foreach (var s1 in t)
            {
                map[s1]--;
            }

            int ans = 0;
            foreach (var i in map)
            {
                ans = Math.Max(ans, i.Value);
            }
            Console.WriteLine(ans);
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 11220
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		    String c1 = scanner.nextLine();
		    String c2 = scanner.nextLine();
		    
		    c1 = c1.substring(2, 3) + c1.substring(1, 2) + c1.substring(0, 1);
		    if( c1.equals(c2) ) 
		    {
		    	System.out.println("YES");
		    }
		    else 
		    {
		    	System.out.println("NO");
		    }
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 21844
#include<stdio.h>
#include<stdbool.h>

int main(void)
{
    int n;
    if (scanf("%d", &n));

    bool ret = false;
    if ((n % 10) == 7) ret = true;
    if (((n/10) % 10) == 7) ret = true;
    if (((n/100) % 10) == 7) ret = true;

    printf("%s", (ret)? "Yes":"No");

    return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  double r;
  cin >> r;
  cout << 2 * acos(-1.0) * r << '\n';
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<ll> bfs(ll N, vector<vector<ll>> &g) {
    vector<ll> d(N + 10, LLINF);
    queue<ll> que;
    que.push(0);
    d[0] = 0;
    while(que.size()) {
        ll now = que.front();
        que.pop();
        for(auto nxt : g[now]) {
            if(d[nxt] > d[now] + 1) {
                d[nxt] = d[now] + 1;
                que.push(nxt);
            }
        }
    }
    return d;
}

ll pow_mod(ll n, ll k, ll mod) {
    if(k == 0) {
        return 1;
    } else if(k % 2 == 1) {
        return pow_mod(n, k - 1, mod) * n % mod;
    } else {
        ll t = pow_mod(n, k / 2, mod);
        return t * t % mod;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    string s;
    cin >> N >> s;
    vector<vector<ll>> g(N + 10);
    for(ll i = 1; i < N + 1; i++) {
        ll pcnt = __builtin_popcountll(i);
        g[i % pcnt].emplace_back(i);
    }
    auto cnt = bfs(N, g);
    // debugVector(cnt);
    ll pcnt = 0;
    for(ll i = 0; i < N; i++) {
        pcnt += (s[i] == '1');
    }
    if(pcnt == 0) {
        for(ll i = 0; i < N; i++) {
            cout << 1 << "\n";
        }
        return 0;
    }
    map<ll, ll> sum;
    for(ll mod = pcnt - 1; mod <= pcnt + 1; mod++) {
        if(mod == 0) {
            sum[mod] = 0;
            continue;
        }
        ll res = 0;
        for(ll i = 0; i < N; i++) {
            if(s[i] == '1') {
                res += pow_mod(2, (N - i - 1), mod);
                res %= mod;
            }
        }
        sum[mod] = res;
    }
    for(ll i = 0; i < N; i++) {
        ll res;
        if(s[i] == '1') {
            ll mod = pcnt - 1;
            if(mod == 0) {
                cout << 0 << "\n";
                continue;
            }
            res = sum[mod] - pow_mod(2, (N - i - 1), mod) + mod;
            res %= mod;
            assert(0 <= res && res < cnt.size());
            cout << cnt[res] + 1 << "\n";
        } else {
            ll mod = pcnt + 1;
            res = sum[mod] + pow_mod(2, (N - i - 1), mod);
            res %= mod;
            assert(0 <= res && res < cnt.size());
            cout << cnt[res] + 1 << "\n";
        }
    }
}

Measured memory_bytes: 12848
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:30:26 2020

@author: HP
"""


s = input()

if s=="RRR":
    print("3")
elif s=="RRS" or s=="SRR":
    print("2")
elif s=="SSS":
    print("0")
else:
    print("1")

Measured memory_bytes: 9032
from collections import defaultdict
from heapq import heappush, heappop

N, M = list(map(int, input().split()))
jobs = defaultdict(list)
heap = []
ans = 0
for _ in range(N):
    a, b = list(map(int, input().split()))
    if a <= M:
        jobs[a].append(b)

for m in range(1, M+1):
    for b in jobs[m]:
        heappush(heap, -b)
    if heap:
        maxb = -heappop(heap)
        ans += maxb
print(ans)



Measured memory_bytes: 33040
#include <cstdio>
#include <cstdlib>

using namespace std;
int main (){

    char s[3];
    scanf("%s",s);
    if      (s[0]=='S'&&s[1]=='U') printf("7\n");
    else if (s[0]=='M'&&s[1]=='O') printf("6\n");
    else if (s[0]=='T'&&s[1]=='U') printf("5\n");
    else if (s[0]=='W'&&s[1]=='E') printf("4\n");
    else if (s[0]=='T'&&s[1]=='H') printf("3\n");
    else if (s[0]=='F'&&s[1]=='R') printf("2\n");
    else if (s[0]=='S'&&s[1]=='A') printf("1\n");

}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 100000007

int main() {
	multiset<int> s;
	set<int>ss;
	int n, k,ans=0;
	cin >> n >> k;
	vector<int>a;
	rep(i, n)
	{
		int tmp;
		cin >> tmp;
		s.insert(tmp);
		ss.insert(tmp);
	}
	if (ss.size() > k) {
		rep(i, n)
			if (s.count(i+1))
				a.push_back(s.count(i+1));

		sort(a.begin(), a.end());
		rep(i, ss.size() - k)
			ans += a[i];
	}
	cout << ans << endl;

}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename FI,typename Compare>
pair<FI,FI> search_continuous(FI first,FI last,Compare comp){
	FI top = find_if(first,last,comp);
	if(top==last){
		return make_pair(last,last);
	}
	FI end = find_if_not(top,last,comp);
	return make_pair(top,end);
}

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

	string S=in<string>();
	int N=S.size();
	ll K=in<ll>();
	vector<int> C(N),C2(2*N);
	REP(i,N){
		C[i] = S[i];
	}
	REP(i,2*N){
		C2[i] = S[i%N];
	}

	auto start = C.begin(),end = C.end();
	ll sum1=0;
	ll first=-1;
	while(start!=end){
		auto res = search_continuous(start,end,[&](int c){return c==*start;});
		ll dist = distance(res.first,res.second);
		if(dist>0){
			ll num = (dist)/2LL;
			sum1 += num;
		}
		if(first==-1) first = dist; 

		start = res.second;
	}

	start = C2.begin(),end = C2.end();
	ll sum2=0;
	ll last = 0;
	while(start!=end){
		auto res = search_continuous(start,end,[&](int c){return c==*start;});
		ll dist = distance(res.first,res.second);

		if(dist>0){
			ll num = (dist)/2LL;
			sum2 += num;
			last = dist;
		}
		start = res.second;
	}

	ll num1=K%2LL;
	ll num2=K/2LL;
	ll offset = (C.front()==C.back() && first%2 && last%2) ? 1LL : 0LL;
	ll offset1 = (num1>0 && num2>0)?offset:0;
	ll offset2 = (num2>1) ? (num2-1)*offset : 0;
	out(num1*sum1+num2*sum2+offset1+offset2);
	
	return 0;
}


Measured memory_bytes: 256
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
  I.each {|i| if i!=(z||=i); s[z]<s[i] ? (s[z]=0; z=i) : (s[i]=0) end }
}
L,M,N = [-1]*27,3,5
def calc(d,n)
  s,x = S[d],0
  t = (0..25).map {s[_1] > 0 ? C[_1]*(d-L[_1])+s[_1] : 0}
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    next t[i]  if n == 0 || d+1 >= D || t[i]==0
    l,L[i] = L[i],d
    c = calc(d+1,n-1) >> 5
    L[i] = l
    x < c ? x=c : c
  }
  ((t[i]+x) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

Measured memory_bytes: 14836
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    int mx=0;
    int sum=0;
    rep(i,n){
        cin >> v[i];
        mx=max(mx,v[i]);
        sum+=v[i];
    }
    //cout << sum-mx << endl;
    //cout << mx << endl;
     if (mx < sum-mx) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX_G 10
#define MAX_K 2000
typedef long long ll;
 
int K,L[MAX_G];
ll value[MAX_G][MAX_K];
ll dp[MAX_G][MAX_K];
 
ll solve(int g,int k){
    if(k == K) return 0LL;
    if(g == MAX_G) return 0LL;
    ll &res = dp[g][k];
    if(res >= 0LL) return res;
    res = max(res,solve(g+1,k));
    for(int i = 0 ; i < L[g] ; i++){
	if(k+i+1 <= K){
	    res = max(res,solve(g+1,k+i+1)+value[g][i]);
	}else{
	    break;
	}
    }
    return res;
}
 
int main(){
    int N,C,G;
    vector<int> books[MAX_G];
    cin >> N >> K;
    for(int i = 0 ; i < N ; i++){
	cin >> C >> G; G--;
	books[G].push_back(C);
    }
    for(int i = 0 ; i < MAX_G ; i++){
	sort(books[i].rbegin(),books[i].rend());
	L[i] = books[i].size();
	if(L[i] > 0) value[i][0] = books[i][0];
	for(int j = 1 ; j < L[i] ; j++){
	    books[i][j] += books[i][j-1];
	    value[i][j] = books[i][j]+j*(j+1);
	}
    }
    memset(dp,-1,sizeof(dp));
    cout << solve(0,0) << endl;
    return 0;
}

Measured memory_bytes: 3384
n = input()
n = int(n)
p = list(map(float,input().split()))

l = [1]

for i in range(n):
    t1 = [j*(1-p[i]) for j in l]
    t1.append(0)
    t2 = [0]+[j*p[i] for j in l]
    l = [t1[j] + t2[j] for j in range(len(t1))]

l.reverse()
print(sum([l[i] for i in range((n+1)//2)]))


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

int main() {
  int a, b;
  cin >> a >> b;
  int aa = a % 2;
  int bb = b % 2;
  if(a == b) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << (a + b + 1) / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
mod = 1000000000000001
def num2alpha(num):
    if num<=26:
        return chr(64+num).lower()
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90).lower()
    else:
        return num2alpha(num//26)+chr(64+num%26).lower()

print(num2alpha(int(input())))

Measured memory_bytes: 9176
#include <stdio.h>
int main(){
    int n;
    
    while(scanf("%d",&n)!=EOF){
        int a,b,c,d,k=0;
        
        for(a=0;a<=9;a++){
            for(b=0;b<=9;b++){
                for(c=0;c<=9;c++){
                    for(d=0;d<=9;d++){
                        if(a+b+c+d==n)k++;
                    }
                }
            } 
            
        } 
        
        printf("%d\n",k); 
        
    } 
    
    return 0;
    
    
} 


Measured memory_bytes: 2104
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define ull unsigned long long
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;
const int MOD=1e9+7;

int main()
{
  int x,y;
  in x>>y;
  bool flag=true;
  if(y%2==1)
  {
    pn;
    return 0;
  }

  if(x>=y)
  {
      pn;
      return 0;
  }

  if(x==1)
  {
    if(y==2||y==4)
    {
      py;
      return 0;
    }
    else
    {
      pn;
      return 0;
    }
  }

  rep(i,101)
  {
    rep(j,101)
    {
      if(i+j==x&&2*i+4*j==y)flag=false;
    }
  }

  if(flag==false)py;
  else pn;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  unordered_set<int> xs,ys;
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  REP(i,f){
    REP(j,f){
      if(100*a*i+100*a*j<=f){
        xs.insert(100*a*i+100*a*j);
      }
    }
  }
  REP(i,f){
    REP(j,f){
      if(c*i+d*j<=f){
        ys.insert(c*i+d*j);
      }
    }
  }
  xs.erase(0);
  int suger=0,water=0;
  double conc=0;
  for(auto x:xs){
    for(auto y:ys){
      if(x+y<=f && 100*y<=x*e){
        double tmp=double(y)/double(x);
        if(tmp>=conc){
          water=x;suger=y;
          conc=tmp;
        }
      }
    }
  }
  cout<<water+suger<<' '<<suger<<endl;
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main() {
    FAST
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int A=(a+d-1)/d;
    int B=(c+b-1)/b;
    if(A>=B) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_M = 1e5 + 10;
int64_t N, M;
int64_t P[MAX_M], Y[MAX_M];
int64_t cnt[MAX_M] = {};
int64_t num[MAX_M] = {};

int main(int argc, char **argv) {
    std::cin >> N >> M;
    
    std::vector<int> vec;
    for (int i = 1; i <= M; i++) {
        std::cin >> P[i] >> Y[i];
        vec.push_back(i);
    }

    std::sort(vec.begin(), vec.end(), [&](const int i, const int j){
        return Y[i] < Y[j];
    });

    for (int i : vec) {
        num[i] = cnt[P[i]];
        cnt[P[i]]++;
    }

    for (int i = 1; i <= M; i++) {
        std::ostringstream sout, tout;
        sout << std::setfill('0') << std::setw(6) << P[i];
        std::string s = sout.str();
        tout << std::setfill('0') << std::setw(6) << (num[i]+1);
        std::string t = tout.str();
        std::cout << s << t << std::endl;
    }
    
    return 0;

}



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

int main(){
    int L, R;
    cin >> L >> R;
    int a, b, min=2019;
    for(int i=L; i<R; i++){
      for(int j=i+1; j<=R; j++){
        a = i %2019;
        b = j %2019;
        if((a*b)%2019 <min) min = (a*b)%2019;
        if(min ==0){
          cout << min << endl;
          return 0;
        }
      }
    }
    cout << min << endl;
    return 0;
}

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


int main(void) {
  int change;
  cin>>change;
  int i=0,j=0,k=0,m=0;

  for(;i*25<=change;i++);i--;
  change-=i*25;
  if(change==0) goto last;

  for(;m*10<=change;m++);m--;
  change-=m*10;
  if(change==0) goto last;

  for(;j*5<=change;j++);j--;
  change-=j*5;
  if(change==0) goto last;

  for(;k<=change;k++);k--;
  goto last;
last:
  cout<<i+j+k+m<<endl;

  return 0;


}



Measured memory_bytes: 3116
#include<stdio.h>
#include<stdio.h>
#define MAX_V  1000000
int prime[MAX_V+1];
int a[MAX_V];
int data[30];
int n,count=0,k=0;

int main(void)
{
  int i, k, v;
  for(i = 2; i <= MAX_V; i++)
    prime[i] = 1;

  for(i = 2; i*i <= MAX_V; i++)
    if(prime[i])
      {
        for(k = 2 * i; k <= MAX_V; k += i)
           prime[k] = 0;
      }
  int isprime = prime[n];

  for (int i = 1; i < MAX_V; i++)
    {
      prime[i] = prime[i] + prime[i-1];

    }
  while(scanf("%d",&n)!=EOF)
  {
    printf("%d\n",prime[n]);
  }

}

Measured memory_bytes: 5772
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll ans=longinf;
  int n;
  cin >> n;
  ll a[n+1];
  ll sum[n+1]={};
  a[0]=0;
  rep(i,n)cin >> a[i+1];
  for(int i=1;i<=n;i++){
    sum[i]=sum[i-1]+a[i];
  }
  vector<ll> v;
  for(int mid=2;mid<=n-2;mid++){
    v.clear();
    ll* it=lower_bound(sum,sum+n+1,sum[mid]*0.5);
    ll x=it-sum;
    if(x>=2 && abs(sum[mid]-2*sum[x])>abs(sum[mid]-2*sum[x-1]))x--;
    v.push_back(sum[x]);
    v.push_back(sum[mid]-sum[x]);
    ll* it2=lower_bound(sum,sum+n+1,(sum[n]+sum[mid])*0.5);
    ll y=it2-sum;
//    cout << y << ' ' << (sum[n]+sum[mid])/2 << endl;
//    if(mid==4)cout << sum[y-1]-sum[mid] << ' ' << sum[n]-sum[y-1] << endl;
    if(y>=2 && abs(sum[n]-2*sum[y]+sum[mid])>abs(sum[n]-2*sum[y-1]+sum[mid]))y--;
    v.push_back(sum[y]-sum[mid]);
    v.push_back(sum[n]-sum[y]);
    sort(v.begin(),v.end());
    ans=min(ans,v[3]-v[0]);
/*
    cout << "mid:" << mid << endl;
    rep(i,v.size())cout << v[i] << endl;
    cout << endl;
    cout << endl;
*/
    
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<math.h>
 
int main(void){
	int a,n,b;
	long  s;
	scanf("%d %d",&a,&n);
	b=pow(100,a);
	
	if(n==100)
	s=b*(n+1);
	
	else
		s=b*n;
	
	
	printf("%ld",s);
	}
		
		

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

a, b = mi()

if a <= b:
    print(a)
else:
    print(a-1)

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

int main() {
    int N;
    cin >> N;
    vector<char> S(N);
    set<char> se;
    for (int i = 0; i < N; i++) {
        cin >> S[i];
        se.insert(S[i]);
    }
    if (se.size() == 3) {
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }
}

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

int la, lb, lc, ld, ra, rb, rc, rd;
double l[40], r[40];
int n = 0;

int main() {
  
  for(int i=0; cin >> l[i] >> r[i]; i++, n++);
  
  for(int i=0; i<n; i++) {
    if( 1.1 <= l[i] ) la ++;
    else if( 0.6 <= l[i] ) lb ++;
    else if( 0.2 <= l[i] ) lc ++;
    else if( l[i] < 0.2  ) ld ++;
    if( 1.1 <= r[i] ) ra ++;
    else if( 0.6 <= r[i] ) rb ++;
    else if( 0.2 <= r[i] ) rc ++;
    else if( r[i] < 0.2  ) rd ++;
  }
    cout << la << " " << ra << endl;
    cout << lb << " " << rb << endl;
    cout << lc << " " << rc << endl;
    cout << ld << " " << rd << endl;
  
  return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	int n, t0, x0, y0, t, x, y;
	scanf("%d", &n);
	t0 = x0 = y0 = 0;
	REP(i, 0, n){
		scanf("%d%d%d", &t, &x, &y);
		int dd = abs(x0 - x) + abs(y0 - y);
		int dt = t - t0;
		if (dd > dt || dd % 2 != dt % 2){
			printf("No\n");
			return;
		}
		t0 = t;
		x0 = x;
		y0 = y;
	}
	printf("Yes\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int P = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, m, a[MAXN], sum[MAXN], dp[MAXN];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int main() {
	read(m);
	for (int i = 1; i <= m; i++) {
		int x; read(x);
		if (x != a[n]) a[++n] = x;
	}
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		update(sum[a[i]], dp[i - 1]);
		dp[i] = sum[a[i]];
	}
	writeln(dp[n]);
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;
	long long int cc = 0;
	long long int sz = s.size();
	for (long long int i = 0; i < sz; i++) {
		if (s[i] == 'J') {
			long long int jj = 1;
			for (long long int j = i+1; j < sz; j++) {
				if (s[j] == 'J') {
					jj++;
					i++;
				} else {
					break;
				}
			}
			long long int oo = 0;
			for (long long int j = i+1; j < sz; j++) {
				if (s[j] == 'O') {
					oo++;
					i++;
				} else {
					break;
				}
			}
			if (oo > 0 && jj >= oo) {
				long long int ii = 0;
				for (long long int j = i+1; j < sz; j++) {
					if (s[j] == 'I') {
						ii++;
						i++;
					} else {
						break;
					}
				}
				if (ii > 0 && ii >= oo) {
					cc = max(cc, oo);
				}
			}
		}
	}
	cout << cc << endl;
	return 0;
}

Measured memory_bytes: 2048
# ABC143D - Triangles
def main():
    # fix the longest edge -> binary search
    N, *L = map(int, open(0).read().split())
    L.sort()
    ans = 0
    for i in range(N - 1, 1, -1):
        x, ng, ok = L[i], 0, i - 1
        while ng < ok:
            if L[ng] + L[ok] > x:
                ans += ok - ng
                ok -= 1
            else:
                ng += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

long long n;
long long ta[90] = {};

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

Measured memory_bytes: 256