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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

inline void proc_status ()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) << endl;
}

const int Maxn = 2e6 + 100;
const int Mod = 1e9 + 7;

int N, Hash[Maxn];
pii A[Maxn], Seg[Maxn];

inline void Add (int &a, int b) { if ((a += b) >= Mod) a -= Mod; } 

namespace BIT
{
#define lowbit(x) (x & (-x))
	int sum[Maxn];
	inline void add (int x, int val) { for (++x; x <= N + 1; x += lowbit(x))  Add (sum[x], val); }
	inline int query (int x) { int ans = 0; for (++x; x; x -= lowbit(x))  Add (ans, sum[x]); return ans; }
	inline int query (int x, int y) { return (query (y) - query (x - 1) + Mod) % Mod;}
}

int Dp[Maxn];

inline void Solve ()
{
	sort(Hash + 1, Hash + N + 1);
	sort(A + 1, A + N + 1);

	int Min = 1e9, Max = 0;
	for (int i = N; i >= 1; --i) Chkmin(Min, A[i].y), Seg[i].x = lower_bound (Hash + 1, Hash + N + 1, Min) - Hash;
	for (int i = 1; i <= N; ++i) Chkmax(Max, A[i].y), Seg[i].y = lower_bound (Hash + 1, Hash + N + 1, Max) - Hash;

	Dp[0] = 1;
	BIT :: add (0, 1);
	for (int i = 1; i <= N; ++i)
	{
		int sum = BIT :: query (Seg[i].x - 1, Seg[i].y);
		Add (Dp[Seg[i].y], sum);
		BIT :: add (Seg[i].y, sum);
	}

	cout << Dp[N] << endl;
}

inline void Input ()
{
	N = read<int>();
	for (int i = 1; i <= N; i++) A[i].x = read<int>(), A[i].y = Hash[i] = read<int>();
}

int main() 
{

	Input ();
	Solve ();

	return 0;
}

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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<bool> > vvb;
typedef vector<vector<bool> > vvb;
typedef map<int, bool> mib;

typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vpll;

typedef vector<string> vs;

typedef long double ld;

#define _GLIBCXX_DEBUG

#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n-1); i >= 0; --i)
#define FORE(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORED(i, s, n) for (int i = (s); i >= (int)(n); i--)
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << '\n'
#define debug3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << '\n'
#define debugs(s) cerr << s << "\n"
#define hyphen() cerr << "--\n"

#define ALL(vec) (vec).begin(), (vec).end()
#define REVALL(vec) (vec).rbegin(), (vec).rend()

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

#define fst first
#define snd second
#define pb push_back
#define mk(x,y) make_pair((x),(y))

// http://ehafib.hatenablog.com/entry/2015/12/23/164137
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qpm(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
// gcd : O(logN)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define sz(v) int(v.size())

// x1, x2ライブラリとの被りを避ける
#define x1 x192837465
#define x2 x123456789
#define y1 y192837465
#define y2 y123456789

// typo
#define itn int
#define reutrn return
#define reutnr return
#define srting string

#define make(type, x) type x; cin>>x;
#define make2(type, x, y) type x, y; cin>>x>>y;
#define make3(type, x, y, z) type x, y, z; cin>>x>>y>>z;
#define make4(type, x, y, z, t) type x, y, z, t; cin>>x>>y>>z>>t;

int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

#define uniq(v) (v).erase(unique(ALL((v))), (v).end());

// area of (0, 0)(a, b)(c, d)
double area(double a, double b, double c, double d){
    return abs(a * d - b * c) / 2.0;
}

const int PREC = 10;
#define coutf(val) cout << fixed << setprecision(PREC) << (val) << endl;

const int MOD = (int)1e9 + 7;
const int INF = numeric_limits<int>::max();

signed main() {
    make(int, N);

    int ans = N + N * N + N * N * N ;

    cout << ans << endl;

}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>

using namespace std;

int rev(int);

int main(){

	string str;

	cin >> str;

	int c = str.size()-2;
	cout << str.at(0) << c << str.at(str.size()-1) << endl;

return 0;
}


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

int main() {
  char n[3];
  int i;
  for (i = 0; i < 3; i++) {
    cin >> n[i];
  }
  for (i = 0; i < 3; i++) {
    if (n[i] == '1') {
      cout << 9;
    } else {
      cout << 1;
    }
  }
  cout << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  if (N%1110 <= 10 || N%1000%111 == 0) {
    cout << "Yes" << endl;
  }
  
  else { 
    cout << "No" << endl;
  }
}

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

const int N = 2e+5 + 5;
long long int n;
long long int a[N];
// long long int solve(long long int b)
// {
//     long long int ans = 0;
//     for (int i = 1; i <= n; i++)
//         ans += abs(a[i] - b);
//     return ans;
// }

int main()
{
    cin>>n;
    long long int ans=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]-=i;
    }
    sort(a+1,a+n+1);
    long long int b=a[(n+1)/2];
    for(int i=1;i<=n;i++)
        ans+=abs(a[i]-b);
    cout<<ans;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<char> picline(W+2, '#');
  // first line
  for (int i = 0; i < W+2; i++) cout << '#';
  cout << endl;
  // middle lines
  for(int j = 0; j < H; j++){
    for (int i = 0; i < W; i++) cin >> picline[i+1];
    for (int i = 0; i < W+2; i++) cout << picline[i];
    cout << endl;
  }
  // last line
  for (int i = 0; i < W+2; i++) cout << '#';
  cout << endl;
}


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

int main(){
  string s,t;
  cin >> s >> t;
  int ans = 0;
  rep(i,3)if(s[i]==t[i])ans++;
  cout << ans << endl;
  return 0;
}


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

int main() {
   int D, T, S;
   cin >> D >> T >> S;
   if( T*S < D ) cout << "No" << endl;
   else cout << "Yes" << endl;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] longArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            if (longArray.Contains(0))
            {
                Console.WriteLine(0);
                return;
            }
            long j = longArray[0];
            for (int i = 1; i < N; i++)
            {
                if (1000000000000000000 / j >= longArray[i])
                {
                    j *= longArray[i];
                }
                else
                {
                    Console.WriteLine(-1);
                    return;
                }
            }
            Console.WriteLine(j);
        }
    }
}


//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 41464
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
A = int(input())

print("Yes" if N % 500 <= A else "No")

Measured memory_bytes: 3572
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(q);
    vector<int> point(n, 0);
    for(int i=0; i<q; i++){
        cin >> a.at(i);
    }
    for(int i=0; i<q; i++){
        point.at(a.at(i) - 1) += 1;
    }
    for(int i=0; i<n; i++){
        if(k - q + point.at(i) > 0){
            cout << "Yes" << endl;
        }else {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, l, su, tmp, ab=999999, ans;
	vector<int> v;

	cin>> n >> l;

	su=n*(n+1)/2+n*(l-1);
	v.resize(n+1);

	for(int i=1;i<=n;i++){
		tmp=0;
		for(int j=1;j<=n;j++){
			if(i==j) continue;
			tmp+=l+j-1;
		}
		if(abs(su-tmp)<ab){
			ab=abs(su-tmp);
			ans=tmp;
		}
	}
		
	cout<< ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read() {
    LL x = 0, fh = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            fh = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = (x << 1) + (x << 3) + c - '0';
        c = getchar();
    }
    return x * fh;
}
const LL MOD = 1e9 + 7;
LL n, a1, a2, a3;
int main() {
	n = read();
	a1 = 1, a2 = 1, a3 = 1;
	while (n--) {
		a1 = a1 * 10 % MOD;
		a2 = a2 * 9 % MOD;
		a3 = a3 * 8 % MOD;
	}
	cout << (((a1 + a3) % MOD + MOD - a2) % MOD + MOD - a2) % MOD << '\n';
	return 0;
}

Measured memory_bytes: 3636
//FINISH WHAT YOU START!
#include<bits/stdc++.h>

#define fileIO freopen("input.txt", "r", stdin); freopen("output1.txt", "w", stdout);
#define IOS ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define inf ((long long) 1e18 )
#define mod 1000000007
#define int long long
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define debug(x) cout << '>' << #x << ':' << x << '\n';
#define debug2(x,y) cout << '>' << #x << " = " << x << " & "<< #y <<" = "<< y << '\n';

using namespace std;

const int N = 1e5 + 7;

int32_t main() {
	IOS
#ifndef ONLINE_JUDGE
	fileIO
#endif
	auto start = std::chrono::high_resolution_clock::now();
	int test;
	test = 1;
	// cin >> test;
	while (test--) {
		int d, t, s;
		cin >> d >> t >> s;
		if (t * s >= d)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	auto stop = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);

	cerr << "Time taken : " << ((long double)duration.count()) / ((long double) 1e9) << "s " << endl;

	return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int x,n ;
  cin >> x >> n;
  vector<int>d(102);
  rep(i,n){
    int p;
    cin >>p;
    d[p]=1;
  }
  p ans(99999,-1);
  for(int i=0; i <=101 ;i++){
    if(d[i]==1){
      continue;
    }
    int dif =abs(x-i);
    ans = min(ans,p(dif,i));
  }
  cout << ans.second << endl;

  return 0;

}


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

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    for (auto &i : x) cin >> i;
    vector<int> copy = x;
    sort(copy.begin(), copy.end());
    int m1 = copy[n/2-1], m2 = copy[n/2];
    for (int i = 0; i < n; i++) {
        if (x[i] <= m1) cout << m2 << endl;
        else cout << m1 << endl;
    }
    return 0;
}

Measured memory_bytes: 4732
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
list=[s.count(x) for x in alphabet]
for i in range(len(list)):
  if list[i]%2==0:
    list[i]=0
  else:
    list[i]=1
print("Yes" if sum(list)==0 else "No")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <time.h>
using namespace std;

int main() {
    int r,D,y;
    //x(i+1)=rxi-D
    cin >>r>>D>>y;
    //cout <<r<<D<<y;
    if (!(2<=r&&r<=5&&1<=D&&D<=100&&D<=y&&y<=200)){
      //cout <<"dame";
      //return 1;
      return 1;
    }
    //x2001=r*x2000-D
    int x[11]={0};
    x[0]=y;
    int i=0;
    int cnt=0;
    for(i=1;i<=10;i++){
      x[i]=r*x[i-1]-D;
      cout<<x[i]<<"\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int x,y;cin>>x>>y;
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            if(2*i+4*j==y and (i+j)==x) {cout<<"Yes"<<endl; return 0;}
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    int ans = 0;
    vector<int> B(n - 1);
    rep(i, n - 1) cin >> B[i];
    ans += B[0] + B.back();
    rep(i, n - 2) {
        ans += min(B[i], B[i + 1]);
    }
    cout << ans << endl;
}

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



Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(n);
  VIN(a,n);
  sort(ALL(a));
  if (n%3!=0 && a[n-1]!=0)
    cout<<"No";
  else if(a[n-1]==0)
    cout<<"Yes";
  else if(!(a[0]==a[n/3-1]&&a[n/3]==a[2*n/3-1]&&a[2*n/3]==a[n-1]))
    cout<<"No";
  else if((a[0] ^ a[n/3])==a[2*n/3])
    cout<<"Yes";
  else
    cout<<"No";

}


Measured memory_bytes: 640
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array
-- import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (n:k:_)
  | k == 1 = 0
  | otherwise = n - k


Measured memory_bytes: 508
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

Int gcd(Int x, Int y) {
    if(y == 0)
        return x;

    return gcd(y, x%y);
}

Int A,B,C,D;

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

    Int divc = B/C;
    Int divd = B/D;
    Int divcv = B/((C*D)/gcd(C,D));

    Int sumb = B-divc-divd+divcv;
    A--;
    divc = A/C;
    divd = A/D;
    divcv = A/((C*D)/gcd(C,D));
    Int suma = A-divc-divd+divcv;

    cout<<sumb-suma<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define int int64_t
int tot[55]={0},patty[55]={0};
int f(int n,int x){
	if(tot[n]==x)return patty[n];
	if(x<=1)return 0;
	if(x<=1+tot[n-1])return f(n-1,x-1);
	if(x<=2+tot[n-1])return 1+f(n-1,x-2);
	if(x<=2+tot[n-1]+tot[n-1])return f(n-1,tot[n-1])+1+f(n-1,x-tot[n-1]-2);
	else return 2*f(n-1,tot[n-1]);
}
int32_t main(){
	int n,x;cin>>n>>x;
	tot[0]=1;
	for(int i=1;i<=n;++i)tot[i]=2*tot[i-1]+3;
	patty[0]=1;
	for(int i=1;i<=n;++i)patty[i]=2*patty[i-1]+1;
	cout<<f(n,x);
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k,x;
    cin>>k>>x;
    if(k*500>=x)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
	return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define ll long long
#define INF 100000000000000000
#define MAX 100010
using namespace std;

struct edge{
  int to;
  ll cost;
};

typedef pair<ll, int> p;
ll dist[MAX];
vector<edge> graph[MAX];

void dijkstra(int r){
  priority_queue<p, vector<p>, greater<p> > que;
  bool color[MAX];
  for(int i = 0; i < MAX; i++){
    dist[i] = INF;
    color[i] = false;
  }
  dist[r] = 0;
  que.push(p(0, r));
  while(!que.empty()){
    p f = que.top(); que.pop();
    int v = f.second;
    color[v] = true;
    if(dist[v] < f.first) continue;
    for(int i = 0; i < graph[v].size(); i++){
      edge e = graph[v][i];
      if(color[e.to] == true) continue;
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        que.push(p(dist[e.to], e.to));
      }
    }
  }
}

int main(){
  int v, e, r;
  cin >> v >> e >> r;
  for(int i = 0; i < e; i++){
    int s, t, d;
    cin >> s >> t >> d;
    graph[s].push_back((edge){t, d});
    //graph[t].push_back((edge){s, d});
  }
  dijkstra(r);
  for(int i = 0; i < v; i++){
    if(dist[i] == INF){
      cout << "INF" << endl;
    }else{
      cout << dist[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 19624
from sys import exit
s=input()
x,y=map(int,input().split())

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2
s=groupby(s)
a,b=[],[]
turn=True
if s[0][0]=="F":
    x-=s[0][1]
    s.pop(0)
for i in s:
    if i[0]=="F":
        if turn:
            a.append(i[1])
        else:
            b.append(i[1])
    else:
        if i[1]%2==1:
            turn=not turn
a.sort(reverse=True)
b.sort(reverse=True)
for i in a:
    if x>0:
        x-=i
    else:
        x+=i
for i in b:
    if y>0:
        y-=i
    else:
        y+=i
if x!=0 or y!=0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 41200
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int[] p = new int[3];
		int[] j = new int[2];
		p[0] = stdIn.nextInt();
		p[1] = stdIn.nextInt();
		p[2] = stdIn.nextInt();
		j[0] = stdIn.nextInt();
		j[1] = stdIn.nextInt();
		Arrays.sort(p);
		Arrays.sort(j);
		System.out.println(p[0]+j[0]-50);
	}
}

Measured memory_bytes: 12000
# include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{


    int N, K;
    string S;
    cin >> N >> S >> K;
    char c = S.at(K-1);
    fx(N){
        if (S.at(x) != c) {

            S.at(x) = '*';
        }
    }
    ce(S)
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,R,M;
  cin>>N>>R>>M;
  if((N==R&&N!=M)||(N==M&&N!=R)||(M==R&&N!=M))
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}


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

typedef pair<int, int> II;
typedef vector< II > VII;
typedef vector<int> VI;

#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ll long long
#define fr(i,n) for(i=0;i<n;i++)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,y,i,j,k;
    cin>>n>>y;
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            k=n-i-j;
            if(k<0)
                continue;
            if(i*10000+j*5000+k*1000==y)
                break;
        }
        if(j<=n)
            break;
    }
    if(i<=n)
        cout<<i<<" "<<j<<" "<<k<<endl;
    else
        cout<<"-1 -1 -1\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;
  cin >> A >> B >> C;
  
  int ans=0;
  if(B>=A*C){
    ans=C;
  }else{
    while(B-A>=0){
      B-=A;
      ans++;
    }
  }
 
  cout << ans <<endl;
 
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	double r;
	scanf("%lf",&r);
	double s;
	s = 3.141592653589*r*r;
	double l;
	l = 2*3.141592653589*r;
	printf("%lf %lf\n",s,l);
	return 0;
}

Measured memory_bytes: 648
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

struct unionfind
{
    vector<int> d;

    unionfind(int n) : d(n, -1) {}

    int root(int x)
    {
        if (d[x] < 0)
        {
            return x;
        }
        else
        {
            return d[x] = root(d[x]);
        }
    }

    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);

        if (x == y)
        {
            return false;
        }

        if (d[x] > d[y])
        {
            swap(x, y);
        }

        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }

    int size(int x)
    {
        return -d[root(x)];
    }
};

int main(void)
{
    int n, m;

    cin >> n >> m;

    unionfind uf(n);

    set<int> ans;

    for (int i = 0; i < m; i++)
    {
        int x, y,z;

        cin >> x >> y>>z;

        x--;
        y--;

        uf.unite(x, y);
    }

    for (int i = 0; i < n; i++)
    {
        ans.insert(uf.root(i));
    }

    cout << ans.size() << endl;
}

Measured memory_bytes: 5376
void main() {
	auto ip = readAs!(int[]), a = ip[0], b = ip[1], c = ip[2];
	if(a < b && b < c) writeln("Yes");
	else writeln("No");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

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

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

int main() {
    int a;
    int b;
    int c;
    cin >> a;
    cin >> b;
    cin >> c;

  int t_count = 0;
  if(a == b) t_count++;
  if(a == c) t_count++;
  if(b == c) t_count++;

  if(t_count == 1){
    printf("Yes");
    return 0;
  }

  printf("No");
  return 0;
}


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 58;
const int mod = 1e9 + 7;

template< typename T >
inline bool chmin(T &a, T b)
{
  if(a > b) a = b;
  return a > b;
}

template< typename T >
inline bool chmax(T &a, T b)
{
  if(a < b) a = b;
  return a < b;
}

int main()
{
  int Q, H, S, D, N;

  cin >> Q >> H >> S >> D >> N;

  S = min(S, H + H);
  S = min(S, Q + H + H);
  S = min(S, Q + Q + Q + Q);

  int64 ret = INF;
  for(int i = 0; i * 2 <= N; i++) {
    int64 rest = N - i * 2;
    ret = min(ret, 1LL * D * i + rest * S);
  }
  cout << ret << endl;
}


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

int main()
{
    vector<int> h(11);
    for(int i=0;i<10;i++)cin >> h[i];

    sort(h.begin(),h.end(), greater<int>() );
    cout << h[0]<<endl;
    cout << h[1]<<endl;
    cout << h[2]<<endl;

    return 0;
}

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

int a,b;
int d,r;
double f;

int main(){
    scanf("%d %d", &a, &b);
    d = a / b;
    r = a % b;
    f = 1.0 * a / b;
    printf("%d %d %9.5lf\n", d, r, f);
    return 0;
}

Measured memory_bytes: 1232
import math
N, K = map(int, input().split())

obj = [K/i for i in range(1,N+1)]
prob = 0
for i, o in enumerate(obj):
	num = 0
	m = 0
	while m < o:
		m = math.pow(2, num)
		num += 1
	prob += (1/2)**(num - 1)*(1/N)

print(prob)

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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

bool check(char c) {
  if(c == 'A') return true;
  if(c == 'C') return true;
  if(c == 'G') return true;
  if(c == 'T') return true;
  return false;
}

void solve() {
  string s;
  cin >> s;

  int ans = 0;
  for(int i = 0; i < s.size(); ++i) {
    if(check(s[i])) {
      int count = 0;
      for(int j = i; j < s.size(); ++j) {
        if(!check(s[j])) break;
        count++;
      }
      ans = max(ans, count);
    }
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {
//	static int cnt = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		int min = 11;
		for (long a = 1; a * a <= n; a++) {
//			cnt++;
			if (n % a != 0) {
				continue;
			}
			long b = n / a;
			int tmp = func(a, b);
			if (tmp < min) {
				min = tmp;
			}
		}
//		System.out.println("cnt:" + cnt);
		System.out.println(min);
		sc.close();
	}

	static int func(long a, long b) {
//		cnt++;
		return Math.max(toDigit(a), toDigit(b));
	}

	static int toDigit(long n) {
//		cnt++;
		String str = "" + n;
		return str.length();
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
#define inf 100000000000000000
#define mod 1000000007
#define endl '\n'
#define omarshagar                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;

int main()
{

   omarshagar
  int x1,x2,y1,y2;
   cin>>x1>>y1>>x2>>y2;
   int a=x2-x1;
   int b=y2-y1;
   int x3=x2-b;
   int y3=y2+a;
   int x4=x3-a;
   int y4=y3-b;
   cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
}


Measured memory_bytes: 256
from heapq import heapify, heappop, heappush

N, *A = map(int, open(0).read().split())

Q = A[:N]
heapify(Q)

R = [sum(Q)]
for a in A[N:2 * N]:
    heappush(Q, a)
    R.append(R[-1] + a - heappop(Q))

Q = [-a for a in A[2 * N:]]
heapify(Q)

B = [sum(Q)]
for a in reversed(A[N:2 * N]):
    heappush(Q, -a)
    B.append(B[-1] - a - heappop(Q))

print(max(r + b for r, b in zip(R, reversed(B))))


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

int main()
{
  int n0, n, sum = 0;
  cin >> n;
  n0 = n;
  
  while (n) {
    sum += n % 10;
    n /= 10;
  }
  
  if (n0 % sum)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b)
{
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}



ll a[1000000];

int main(){
  priority_queue<ll> q;
  int N , M ;
  cin >> N >> M;
  rep(i,N){
    ll n;
    cin >> n;
    q.push(n);
  }
  rep(i,M){
    ll Ma = q.top()/2;
    q.pop();
    q.push(Ma);
  }
  ll ans = 0;
  while(!q.empty()){
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1400
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
using D = pair<double, double>;
//const long long mod = 998244353;
const long long mod = 1e9 + 7, inf = 3e18;
const string sp = " ";
const int dx[9] = { 1,1,1,0,0,0,-1,-1,-1 }, dy[9] = { 1,0,-1,1,0,-1,1,0,-1 };

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

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[1000000];
void f_init(int n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	if (n == r) return 1;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int nck[1010][1010];
void comb(int n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

map<int, int> factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

int h, w, n, cnt, sum;
vector<int>v;
unordered_map<int, bool>mp;
int ans[10];
signed main() {
	scanf("%lld %lld %lld", &h, &w, &n);
	rep(i, n) {
		int a, b;
		scanf("%lld %lld", &a, &b);
		--a; --b;
		v.emplace_back(w * a + b);
	}
	sort(all(v));
	for (int i : v) {
		int y = i / w, x = i % w;
		rep(j, 9) {
			int nx = x + dx[j], ny = y + dy[j];
			if (1 <= nx && nx < w - 1 && 1 <= ny && ny < h - 1) {
				if (!mp[w * ny + nx]) {
					mp[w * ny + nx] = true;
					rep(k, 9) {
						int nnx = nx + dx[k], nny = ny + dy[k];
						if (binary_search(all(v), w * nny + nnx)) {
							cnt++;
						}
					}
					++ans[cnt];
					cnt = 0; 
				}
			}
		}
	}
	rep(i, 10) {
		sum += ans[i];
	}
	ans[0] += (h - 2) * (w - 2) - sum;
	rep(i, 10) {
		printf("%lld\n", ans[i]);
	}
}


Measured memory_bytes: 37472
#include <iostream>

using namespace std;

int main(void)
{
    int A, B, K;
    cin >> A >> B >> K;

    int a = A + K - 1;
    a = a > B ? B : a;
    int b = B - K + 1;
    b = b < A ? A : b;

    if(a >= b) b = a + 1;

    for(int i = A; i <= a; ++i)
        cout << i << endl;

    for(int i = b; i <= B; ++i)
        cout << i << endl;

    return 0;
}

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

vector<int>to[100010];
int dp[100010];

int rec(int v){
  if(dp[v]!=0)return dp[v];
  vector<int>num;
  for(int u:to[v]){
    num.push_back(rec(u));
  }
  sort(num.begin(),num.end());
  int cnt=0;
  rep(i,num.size()){
    cnt=max(cnt,num[i]);
    cnt++;
  }
  dp[v]=cnt;
  return dp[v];
}

int main(){
  int n;
  cin>>n;
  for(int i=2; i<=n; ++i){
    int a; cin>>a;
    to[a].push_back(i);
  }
  rec(1);
  cout<<dp[1]<<endl;
}

Measured memory_bytes: 20300
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	int a[4];
	int b[4];
	
	while( cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		int hit = 0;
		int blow = 0;
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(b[i]==a[j]){
					if(i==j){
						hit++;
					}else{
						blow++;
					}
				}
			}
		}
		cout << hit <<" "<<blow <<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
def resolve():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    f = [0] * (n+1)
    f[0] += min(a[0],b[0])
    f[1] += min(a[1],b[0]-f[0])
    a[1] -= f[1]
    for i in range(1,n):
        f[i] += min(a[i],b[i])
        f[i+1] += min(a[i+1],b[i]-min(a[i],b[i]))
        a[i+1] -= f[i+1]
    print(sum(f))
resolve()

Measured memory_bytes: 24156
x,n=map(int,input().split())
if n==0:
    print(x)
    exit()
elif n==100:
    if abs(-1-x)<=abs(101-x):
        print(0)
    else:
        print(101)
    exit()
List=list(map(int,input().split()))
num=list(range(0,102))
min_num=1000000000
for i in range(len(List)):
    if num.count(List[i])>=1:
        num.remove(List[i])
for i in range(len(num)):
    if (abs(num[i]-x)<abs(min_num-x)) or (abs(num[i]-x)==abs(min_num-x) and num[i]<min_num):
        min_num=num[i]
print(min_num)

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

int main() {
  int n;cin >> n;
  vector<string> vs(n);
  for(int i=0;i<n;i++) cin >> vs[i];
  map<string,long long> mp;
  for(int i=0;i<n;i++) {
    sort(vs[i].begin(), vs[i].end());
    mp[vs[i]]++;
  }
  long long ans = 0;
  for(auto i : mp) ans += (i.second * (i.second-1)) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 18176
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

bool IsPrime(int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;

  const int m = (int)ceil(sqrt(n));
  for (int d = 3; d <= m; d += 2) {
    if (n % d == 0) return false;
  }
  return true;
}

int Is2007Like(int n) { return IsPrime(n) && IsPrime((n + 1) / 2); }

int main() {
  const int N = 100000;
  vector<int64_t> s(N + 1);
  for (int i = 2; i < N; i++) {
    s[i + 1] = s[i] + Is2007Like(i);
  }
  int q;
  cin >> q;
  int l, r;
  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    cout << s[r + 1] - s[l] << endl;
  }
  return 0;
}


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

using namespace std;
#define mx 200000
#define ll long long
ll res[mx+2];
int main()
{


    int n;
    cin>>n;

    res[0] =1;

    for(int i=100;i<=n;i++){
        for(int j=100;j<=105;j++){
            if(i-j>=0&&res[i-j]==1)res[i] =1;
        }
    }

    cout<<res[n]<<endl;

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

//二項係数（nCk mod.p;1<=k<=n<=1e7,pは素数）
struct Combination{
    const int MOD = 1000000007;
    vector<ll> fac,finv,inv;
    Combination(const int MAX):fac(MAX),finv(MAX),inv(MAX){
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    long long comb(int n, int k){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
};

int main(){
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    Combination com(200000);
    const int MOD = 1000000007;
    ll res = 0;
    for(int i=B;i<=W-1;i++){
        res+=com.comb(H-A-1+i,i)*com.comb(A-1+(W-i-1),A-1)%MOD;
        res%=MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <cctype>
#include <cstdio>
#include <cstdlib>
#define rep(i,x,y) for (int i=x; i<=y; ++i)

int get()
{
    char c;
    while (!isdigit(c=getchar()));
    int k=c-'0';
    for (; isdigit(c=getchar()); k=k*10+c-'0');
    return k;
}

const int N=1e5+10;
struct edge
{
    int v;
    edge *nxt;
} pool[N*2],*tp=pool,*fst[N];
int n,ans;

bool dfs(int x,int fa)
{
    int t=1;
    for (edge *i=fst[x]; i; i=i->nxt)
        if (i->v!=fa)
            t-=dfs(i->v,x);
    if (t<0)
        puts("First"),exit(0);
    return t;
}

int main()
{
    n=get();
    if (n&1)
        puts("First"),exit(0);
    rep(i,2,n)
    {
        int u=get(),v=get();
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    dfs(1,0);
    puts("Second");
    return 0;
}

Measured memory_bytes: 4096
#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;

	if (a == b)
		cout << c << endl;
	else if (b == c)
		cout << a << endl;
	else
		cout << b << endl;

}

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

t = A // D
a = C // B

if A % D == 0:
  t = A // D
else:
  t = (A // D) +1

if C % B == 0:
  a = C // B
else:
  a = (C // B) + 1

if a > t:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 9192
/*input
4
RRGB
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	int n, i, j, k;
	ll ret = 0;
	string s;
	cin >> n >> s;
	set<int> R, G, B;
	for(i=0; i<n; i++) {
		if(s[i] == 'R') R.insert(i);
		if(s[i] == 'G') G.insert(i);
		if(s[i] == 'B') B.insert(i);
	}
	for(auto it1 = R.begin(); it1 != R.end(); it1++) {
		for(auto it2 = G.begin(); it2 != G.end(); it2++) {
			int r = *it1, g = *it2;
			ret += B.size();
			int pos1, pos2;
			int gap = abs(g - r);
			if(r > g) {
				pos1 = g - gap;
				pos2 = r + gap;
			}
			else {
				pos1 = g + gap;
				pos2 = r - gap;
			}
			if(gap > 1 && gap%2==0) {
				int pos3 = min(r, g) + gap/2;
				if(B.count(pos3))
					ret--;
			}
			if(B.count(pos1))
				ret--;
			if(B.count(pos2))
				ret--;
		}
	}
	cout << ret << endl;
}

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


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

int main(){
    int x , y;
    cin >> x >> y;
    int cnt = 0;
    for(int i = x;i <= y;i++){
        int a = i/10000;
        int b = i%10000/1000;
        int c = i%100/10;
        int d = i%10;
        if(a == d && b == c) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if ((abs(a - c) <= d) || (abs(a - b) <= d && abs(b - c) <= d)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
const int N=1e6+5;
int n,ans;
char a[N];
map<int,int>mp;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		scanf("%s",a+1);
		sort(a+1,a+10+1);
		int x=0;
		for(int j=1;j<=10;j++)x=x*26+a[j]-'a';
		ans+=mp[x];
		mp[x]++;
	}
	cout<<ans;
	
}

Measured memory_bytes: 6528
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# restore the tree


from collections import deque
n, m = map(int, input().split())


in_node = [0 for i in range(n + 1)]

# in_node[x]=xに入るノードの数

parent_node = [0 for i in range(n + 1)]

# parent[i]=ねつき木における頂点iの親を返す

in_graph = {i: [] for i in range(1, n + 1)}

out_graph = {i: [] for i in range(1, n + 1)}

# graph[i]=頂点iに入るノードの集合リスト

# out_graph[i]=頂点iから出るノードの集合リスト

for _ in range(n + m - 1):
    a, b = map(int, input().split())
    in_graph[b].append(a)
    out_graph[a].append(b)
    in_node[b] += 1

root = -1


for i in range(1, n + 1):
    if in_node[i] == 0:
        parent = i
        break



flag = True
d = deque()
d.append(parent)
while d:
    x = d.popleft()
    not_yet = False
    for node in out_graph[x]:
        in_node[node] -= 1
        if in_node[node] == 0 and parent_node[node] == 0:
            parent_node[node] = x
            d.append(node)
            not_yet = True

    if not_yet:
        flag = True
    else:
        flag = False

for i in range(1,n+1):
    print(parent_node[i])


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

long long dp[100002];
int a[100002];
long long MOD = 1e9 + 7;
map<int,int> ma;
int main() {
	int n, m;
	cin>>n>>m;
	int i;
	dp[0] = 1;
	for(i=1;i<=n;i++) cin >> a[i], ma[a[i]]++;
	for(i=1;i<=n;i++) {
	    if(ma[i]) continue;
	    if(i-2>=0)
	        dp[i]+=dp[i-2];
	   dp[i]+=dp[i-1];
	   dp[i]%=MOD;
	}
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
 
using namespace std;
 
#define cel(n, k) ((n-1)/k+1)
#define sets(a) memset(a, -1, sizeof(a))
#define clr(a) memset(a, 0, sizeof(a))
 
 
#define fr(i, n) for(int i=0; i<n;i++)
#define fr1(i, n) for(int i=1; i<=n;i++) 
 
#define readf(f) freopen(f, "r", stdin)
#define writef(f) freopen(f, "w", stdout)
 
#define fastio() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file() readf("in.txt"),writef("out.txt")
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define nl "\n"
#define sp " "
 
template< class T > T sq(T x) { return x * x; }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
 
typedef long long ll;
typedef pair<int,int> pii;
 

int main()
{
	
	//file();
    
    fastio();
 
    string s;

    cin>>s;

    int flg = 0;

    fr(i,s.length())
    	if(s[i] == '7'){
    		flg = 1;
    		break;
    	}
   	if(flg)
   		puts("Yes");
   	else
   		puts("No");
 
   
    return 0;
}

Measured memory_bytes: 3644
//Name: Prime Number II
//Level: 1
//Category: f,Tõ,upper_bound,lower_bound
//Note:

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    vector<int> primes;
    vector<int> is_prime(50001, 1);
    is_prime[0] = is_prime[1] = 0;
    int lim = (int)sqrt(50000);
    for(int i = 2; i <= lim; ++i) {
        if(is_prime[i]) {
            if(i <= lim) {
                for(int j = i*i; j <= 50000; j += i) is_prime[j] = 0;
            }
        }
    }
    for(int i = 2; i <= 50000; ++i) 
        if(is_prime[i]) primes.push_back(i);

    while(true) {
        int n;
        cin >> n;
        if(!n) break;

        int cnt = 0;
        for(int i = 0; i < primes.size() && primes[i] <= n/2; ++i) 
            if(is_prime[n-primes[i]]) ++cnt;
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1156