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

#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define debug(x) cerr << #x << " = " << x << endl;
#define puts_name() cerr << "\n\t\t\t\tAdson_S\n";
#define SET(c, v) memset(c, v, sizeof c)
#define pi 3.14159265358979323846264338
#define all(S) (S).begin(), (S).end()
#define INF 0x3f3f3f3f
#define mod 1000000007
#define pf push_front
#define pb push_back
#define mk make_pair
#define MAX 5010
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
typedef unsigned long long int ull;
int N, A, B, x;
int v[5];

int main(int argc, char ** argv) {
	scanf("%d%d%d", &N, &A, &B);
	rep(i, 0, N) {
		scanf("%d", &x);
		if(x <= A) v[0]++;
		else if(x <= B) v[1]++;
		else v[2]++;
	}
	printf("%d\n", min(v[0], min(v[1], v[2])));
	puts_name();
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        
        int[][] a = new int[n][m];
        int[] b = new int[m];
        int[] result = new int[n];
        
        // input
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++) {
                int num = scanner.nextInt();
                a[i][j] = num;
            }
        }
        for(int j=0; j<m; j++) {
            int num = scanner.nextInt();
            b[j] = num;
        }
        
        // calc
        for (int i=0; i<n; i++) {
            for (int j=0; j<m; j++) {
                result[i] += a[i][j] * b[j];
            }
        }
        
        // display
        for(int i=0; i<result.length; i++) {
            System.out.println(result[i]);
        }
        
    }
}


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

const int maxn = 11;

int n;
int a[maxn];

void luan(){
	int sum=0;
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for (int i=1;i<=n;i++){
		if (a[i]>=sum-a[i]){
			cout<<"No\n";
			return;
		}
	}
	cout<<"Yes\n";
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	luan();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), is_sorted(),

int n;
int a[100005];
int b[100005];

signed main(){
    FASTER;
    cin>>n;
    for(int i=1;i<=n+1;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    
    int ans=0,lst=0;
    for(int i=1;i<=n;i++){
        ans+=min(a[i],lst);
        a[i]-=min(a[i],lst);
        ans+=min(a[i],b[i]);
        lst=b[i]-min(a[i],b[i]);

    }
    if(lst)ans+=min(lst,a[n+1]);
    cout<<ans;
}



Measured memory_bytes: 5168
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;
using P = pair<int, int>;

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; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

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

  int n;
  cin >> n;
  map<int, int> odd, even;
  rep(i, n) {
    int v; cin >> v;
    if (i % 2 == 0) even[v]++;
    else odd[v]++;
  }

  int even_mx = 0;
  int even_mx_num;
  for (auto& p : even) {
    if (p.second > even_mx) {
      even_mx = p.second;
      even_mx_num = p.first;
    }
  }
  int odd_mx = 0;
  int odd_mx_num = 0;
  for (auto& p : odd) {
    if (p.second > odd_mx) {
      odd_mx = p.second;
      odd_mx_num = p.first;
    }
  }

  if (even_mx_num == odd_mx_num) {
    even[even_mx_num] = 0;
    odd[odd_mx_num] = 0;
    int mx = 0;
    for (auto& p : even) chmax(mx, p.second);
    for (auto& p : odd) chmax(mx, p.second);
    cout << n - odd_mx - mx << endl;
  } else {
    cout << n - odd_mx - even_mx << endl;
  }

  return 0;
}


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

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

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

vi to[100100];
vector<bool> used(1000100);
vvi dp(100100, vi(2));

void rec(int v, int p = -1) {
    used[v] = true;
    if (to[v].size() == 1 and to[v][0] == p) {
        dp[v][0] = dp[v][1] = 1;
        return;
    }

    int retb = 1, retw = 1;
    for (auto u : to[v]) {
        if (used[u]) continue;
        rec(u, v);
        retb = (retb * dp[u][0]) % mod;
        retw = (retw * (dp[u][1] + dp[u][0])) % mod;
    }
    dp[v][0] = retw;
    dp[v][1] = retb;
    return;
}

void solve(long long N, std::vector<long long> x, std::vector<long long> y) {
    rep(i, N - 1) {
        x[i]--, y[i]--;
        to[x[i]].push_back(y[i]);
        to[y[i]].push_back(x[i]);
    }
    if (N == 1) {
        cout << 2 << endl;
        return;
    }
    rec(0);
    // debug(dp[0][0]);
    // debug(dp[0][1]);
    cout << (dp[0][0] + dp[0][1]) % mod << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long N;
    scanf("%lld", &N);
    std::vector<long long> x(N - 1);
    std::vector<long long> y(N - 1);
    for (int i = 0; i < N - 1; i++) {
        scanf("%lld", &x[i]);
        scanf("%lld", &y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 19840
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++){
    cin >> S[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    vector<string> T(N);
    for (int j = 0; j < N; j++){
      T[j] = S[(i + j) % N];
    }
    bool ok = true;
    for (int j = 0; j < N; j++){
      for (int k = 0; k < N; k++){
        if (T[j][k] != T[k][j]){
          ok = false;
        }
      }
    }
    if (ok){
      ans += N;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3860
local N, T, A = io.read("*n", "*n", "*n")
local H = {}
for i = 1, N do
    H[i] = io.read("*n")
end

local near_index = 0
H[near_index] = 100000
for i = 1, N do
    if math.abs(A - (T - H[i] * 0.006)) 
    <  math.abs(A - (T - H[near_index] * 0.006)) then
        near_index = i
    end
end

print(near_index)

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int count(int m, int n, int s) {
    if (n == 0) {
        if (s == 0) return 1;
        return 0;
    }
    int c = 0;
    for (int i = m; i <= 9; i++) {
        c += count(i + 1, n - 1, s - i);
    }
    return c;
}

int main(void) {
    int n, s;
    while (true) {
        cin >> n >> s;
        if (n == 0 && s == 0) break;
        cout << count(0, n, s) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
ll md=2038077799,mul=1400312813;
int n;
ll ai[200010],bi[200010],a[200010],b[200010];
vector<int> v;
ll hasha,hashb,etc;
ll ksm(int x)
{
	if (!x) return 1ll;
	return (((ksm(x/2)*ksm(x/2))%md)*(x%2 ? mul : 1))%md; 
}
int main()
{
	cin >>n;
	for (int i=0;i<n;i++) cin >>ai[i];
	for (int i=0;i<n;i++) cin >>bi[i];
	for (int i=0;i<n;i++) a[i]=ai[i]^ai[(i+1)%n],b[i]=bi[i]^bi[(i+1)%n];
	etc=ksm(n-1);
	for (int i=0;i<n;i++)
	{
		hasha=(((hasha*mul)%md)+a[i])%md;
		hashb=(((hashb*mul)%md)+b[i])%md;
	}
	for (int i=0;i<n;i++)
	{
		if (hasha==hashb) v.push_back(i);
		hasha=(hasha+md-((a[i]*etc)%md))%md;
		hasha=(((hasha*mul)%md)+a[i])%md;
	}
	for (int i=0;i<v.size();i++) cout <<v[i]<<" "<<(ai[v[i]]^bi[0])<<"\n";
	return 0;
} 

Measured memory_bytes: 10612
#include<stdio.h>
#include<math.h>

int main(){
    int N;
    float T, A;
    int H[1100];
    int i;
    float def=0.006;
    float min=10000;
    float tmp;
    int num;

    scanf("%d", &N);
    scanf("%f %f", &T, &A);
    for(i=0; i<N; i++){
        scanf("%d", &H[i]);
        tmp = fabs(A- (T - (def*H[i])));
        if(tmp<min){
            min = tmp;
            num = i+1;
        }
    }

    printf("%d", num);

    return 0;
}

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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int a,b,c,d; cin >> a >> b >> c >> d;
  int l = a+b, r = c+d;
  if(l < r) cout << "Right" << endl;
  else if(l == r) cout << "Balanced" << endl;
  else cout << "Left" << endl;

  return 0;
}


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

int main(){
    ll n,k;
    cin>>n>>k;
    ll r,s,p;
    cin>>r>>s>>p;
    string t;
    cin>>t;
    vector<bool> used(n,false);
    ll ans=0;
    rep(i,n){
        if(used[i])continue;
        vector<ll> next;
        for(int j=i;j<n;j+=k){
            if(t[j]=='r'){
                next.push_back(0);
            }else if(t[j]=='s'){
                next.push_back(1);
            }else if(t[j]=='p'){
                next.push_back(2);
            }
            used[j]=true;
        }
        V a1(next.size(),0),a2(next.size(),0),a3(next.size(),0);
        if(next[0]==0){
            a3[0]+=p;
        }else if(next[0]==1){
            a1[0]+=r;
        }else if(next[0]==2){
            a2[0]+=s;
        }
        for(int i=1;i<next.size();i++){
            if(next[i]==0){
                a1[i]=max(a2[i-1],a3[i-1]);
                a2[i]=max(a1[i-1],a3[i-1]);
                a3[i]=max(a1[i-1],a2[i-1])+p;
            }else if(next[i]==1){
                a1[i]=max(a2[i-1],a3[i-1])+r;
                a2[i]=max(a1[i-1],a3[i-1]);
                a3[i]=max(a1[i-1],a2[i-1]);
            }else if(next[i]==2){
                a1[i]=max(a2[i-1],a3[i-1]);
                a2[i]=max(a1[i-1],a3[i-1])+s;
                a3[i]=max(a1[i-1],a2[i-1]);
            }
        }
        ans+=max(a1[next.size()-1],max(a2[next.size()-1],a3[next.size()-1]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <string.h>
int main(){
	char str[101]={};
	scanf("%s", str);
	for (int i = 0; i < strlen(str); i++) {
		if((i%2==0)&&(str[i]=='L')){
			printf("No\n");
			return 0;
		}else if((i%2==1)&&(str[i]=='R')){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 128
def isKaibun(str):
  result = True
  for i in range(len(str)-1//2):
    if str[i] != str[-i-1]:
      result = False
      break
  return result

S = input().strip()
#N, M = list(map(int, input().strip().split()))
result = 'No'
N = len(S)
"""
print(S[0:(N-1)//2])
print(isKaibun(S[0:(N-1)//2]))
print(S[(N+3)//2-1::])
print(isKaibun(S[(N+3)//2-1::]))
"""
if isKaibun(S) and isKaibun(S[0:(N-1)//2]) and isKaibun(S[(N+3)//2-1::]):
  result = 'Yes'
print(result)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll charToBit(char c) {return 1<<(c-'a');}

class SegmentTree {
    int _sz;
    vector<ll> v;
    ll near_pow(ll sz) {
        ll k = 1;
        while(sz>k) k*=2;
        return k;
    }

public:
    SegmentTree(int sz) {
        _sz = near_pow(sz);
        v.resize((2*_sz)-1,0);
        string s; cin >> s;
        REP(i,sz) v[_sz-1+i] = charToBit(s[i]);
        FOR(i,sz,_sz) v[_sz-1+i] = v[_sz+sz-2]; //残りを最後の要素で埋める
        // 葉以外の要素を求める。
        REPR(i,_sz-2) v[i] = v[(2*i)+1] | v[(2*i)+2];

    }
    string lltoStr(ll k) {
        string s;
        REP(i,26) if((1<<i) & k) s.push_back((char)i+'a');
        return s;
    }
    void print() {
        REP(i,v.size()) cerr << i << ": " << lltoStr(v[i]) << endl;
    }
    void update(int key,ll val) {
        // 最下位のノードにアクセス
        key += _sz-1;
        // 最下位のノードを更新
        v[key] = val;
        // 上位ノードの更新
        while(key > 0) {
            key = (key-1)/2;
            v[key] = v[(2*key)+1] | v[(2*key)+2];
        }
        // cerr << "update! key: " << key << " val: " << val << endl;
        // print();
    }
    // 区間[a,b)の要素数を求める。 [l,r)は自分の今いるノードの区間、kは自分の今いるノードのインデックス・
    ll get(int a,int b,int l = 0,int r = -1,int k = 0) {
        // 初期化処理 最初は[l,r) = [0,N)
        if (r<0) r = _sz;

        // if(a==b) return v[_sz-1+a];

        // 欲しい区間と今いるノードの区間が交わらないなら答えに影響のない値を適当に返す
        if ( l >= b || r<= a ) return 0;

        //今いるノードの区間が全て欲しい区間の中だったらそれを答えに使う
        if ( a <= l && r <=  b) return v[k];

        // 今いるノードの区間の一部が欲しい場合は探索を進める。
        // 自分の今いるノードの区間を半分に分けて探索する。
        ll vl = get(a,b,l,(l+r)/2,2*k+1);
        ll vr = get(a,b,(l+r)/2,r,2*k+2);

        return vl | vr;
    }

};
ll count(ll k) {
    int cnt = 0;
    REP(i,26) if((1<<i) & k) cnt++;
    return cnt;
}
void solve() {
    int N;
    cin >> N;
    SegmentTree s(N);
    int Q;
    cin >> Q;
    REP(_,Q) {
        int typ;
        cin >> typ;
        if(typ == 1) {
            int i; char c;
            cin >> i >> c;
            s.update(i-1,charToBit(c));
        }
        if (typ == 2) {
            int l,r;
            cin >> l >> r;
            cout << count(s.get(l-1,r)) << endl;
        }
    }

}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 9092
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;

int main(){
	int a,b,c; cin>>a>>b>>c;
	bool ans=false;
	for(int i=a;i<=a*b;i+=a){
		if(i%b==c)ans=true;
	}
	if(ans){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 768
# include"stdio.h"
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int four=0,two=0,need=n/2;
    for(int i=0;i<n;i++)
        if(a[i]%4==0) four++;
        else if(a[i]%2==0) two++;
    if((four+two/2)>=need)
        printf("Yes\n");
    else
        printf("No\n");
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int a,b;cin>>a>>b;

  if(a!=2&&b!=2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    
    cin >> a >> b >> c;
    
    int count = 0;
    for (int i=a; i<=b; i++){
        if(c%i==0){
            count++; 
        }
    }
    cout << count << endl;
}



Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, a, b, c;
signed main() {
	cin >> n >> a >> b >> c;
	cout << (n - (a + b - c)) << endl;
	endre;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int L, R, d;
  cin >> L >> R >> d;

  int sum = 0;
  for(int i = L; i <= R; i++){
    if(i%d == 0) sum++;
  }

  cout << sum << endl;
}


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

int main()
{
  ifstream fIn("input.txt");
  if (fIn.is_open())
    cin.rdbuf(fIn.rdbuf());

  string S;
  cin >> S;
  
  for(int i = 1; i < S.length(); ++i){
    if(S[i - 1] == S[i]){
      cout << "Bad" << endl;
      return 0;
    }
  }

      cout << "Good" << 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;
typedef pair<int,int> P;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
    mint choose(int n, int a){
        mint x = 1 ,y = 1;
        for(int i = 0; i < a; ++i){
            x *= n-i;
            y *= i+1;
        }
        return x / y;
    }
    friend istream& operator>>(istream& is, mint& m){
        is >> m.x;
        return is;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

mint dp[4010];

int main(){
  int n;
  cin>>n;
  
  dp[0]=1;
  for(int i=0; i<=n; ++i){
    for(int j=3; j<=n; ++j){
      dp[i+j]+=dp[i];
    }
  }
  cout<<dp[n]<<endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp> 
  #include <ext/pb_ds/tree_policy.hpp>
  #pragma comment(linker, "/stack:200000000")
  #pragma GCC optimize("O3")
  #pragma GCC optimize("Ofast")
  #pragma GCC optimize("unroll-loops")
    using namespace std;
  using namespace __gnu_pbds;
    #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define endl "\n"
    #define int long long
    #define all(v) v.begin(),v.end()
    #define rep(i,a,b) for(int i = a; i <=b; i++)
    #define rep2(i,a,b) for(int i = a; i>=b; i--)
    #define PB push_back
    #define MP make_pair
    #define db long double
    #define trace1(x)                cerr<<#x<<": "<<x<<endl
    #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
    #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
    #define trace3race4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
    #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
    #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
    #define cases int testcases;cin>>testcases; while(testcases--)
    #define INF 2000000000
    const double PI = acos(-1);
    const int N = 100005;


  int32_t main() 
  {
    IOS


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

    return 0;
      }

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var dc = ReadInts();
            WriteLine(dc[0] * dc[1]);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数

        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}



Measured memory_bytes: 15944
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    srand(time(0));
    int n;
    cin>>n;
    set<string>s;
    for(int i=0;i<n;i++){
        string s1;
        cin>>s1;
        s.insert(s1);
    }
    cout<<s.size();
    return 0;
}


Measured memory_bytes: 19260
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<bool> b(10);
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        b[d] = true;
    }
    while(true){
        string s = to_string(n);
        bool flag = true;
        for(int i = 0; i < 10; i++){
            int res = s.find(to_string(i));
                if(b[i] == true && res != -1){
                    flag = false;
                    break;
            }
        }
        if(flag){
            break;
        }
        n++;
    }
    cout << n << "\n";
    return 0;
}

Measured memory_bytes: 3640
s = input()
ans = 0
count = 0
for i in range(len(s)):
    if i == 0:
        if s[i] == 'A':
            ans += 1
    elif i == 1:
        if s[i].islower():
            ans += 1
    elif 2 <= i and i <= len(s)-2:
        if s[i].islower():
            continue
        else:
            if s[i] == 'C':
                count += 1
            else:
                print('WA')
                break
    else:
        if s[i].islower():
            ans += 1
if ans == 3 and count == 1:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 38384
n,t = gets.split(' ').map { |e| e.to_i }
xs = gets.split(' ').map { |e| e.to_i }

prev = 0
sum = 0
xs.each { |x|
  if (x - prev) > t
    sum += t
  else
    sum += (x - prev)
  end
  prev = x
}

puts sum + t

Measured memory_bytes: 15876
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
#include <stack>
using namespace std;

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


int main() {
int yoko,tate,px,py;
while(cin>>yoko>>tate &&yoko){

	int m[25][25];

string st;
//cin>>yoko>>tate;
for(int i=1;i<tate+1;i++){
cin>>st;
for(int j=1;j<yoko+1;j++){
if(st[j-1]=='#') m[i][j]=-1;
else if(st[j-1]=='.') m[i][j]=0;
else if(st[j-1]=='@'){
 m[i][j]=1;
px=i;
py=j;
}
}
}
int ans=1;
stack<pair<int,int> > s;
s.push(make_pair(px,py));
//cout<<"pxpy "<<px<<" "<<py<<endl;
while(s.empty()==false){
px=s.top().first;
py=s.top().second;
s.pop();

for(int i=0;i<4;i++){
//cout<<px+dx[i]<<" "<<py+dy[i]<<endl;
	if(0<px+dx[i] && px+dx[i]<tate+1 && py+dy[i]>0 && py+dy[i]<yoko+1){
	
		if(m[px+dx[i]][py+dy[i]]==0){
			m[px+dx[i]][py+dy[i]]=1;
			s.push(make_pair(px+dx[i],py+dy[i]));
			ans++;
//cout<<px+dx[i]<<" "<<py+dy[i]<<" "<<ans<<endl;
		}

	}}
}

cout<<ans<<endl;

}



	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

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

  string res;
  if(a+b+c<22) res = "win";
  else res = "bust";

  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        String a = stdIn.next();

        //文字列を小文字に
        if(a.toLowerCase() == a){
            System.out.println("a");
        }else {
            System.out.println("A");
        }
    } 
}

Measured memory_bytes: 35688
S = input()
dancable = True
for i in range(len(S)):
  if i % 2 == 1:
    dancable &= (S[i] == 'L') or (S[i] == 'U') or (S[i] == 'D')
  else:
    dancable &= (S[i] == 'R') or (S[i] == 'U') or (S[i] == 'D')
print('Yes' if dancable else 'No')

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const ll INF=1000000000000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	static int n,m,q;
	static int a[100010];
	scanf("%d%d%d",&n,&m,&q);
	rep(i,q)scanf("%d",&a[i]);
	
	static int b[100010];
	rep1(i,m)b[i] = q+1;
	rep(i,q)b[a[i]] = q-i;
	
	vector<P> vec;
	rep1(i,m){
		vec.pb(P(b[i],i));
	}
	sor(vec);
	static int c[100010];
	int k = 0;
	rep(i,vec.size()){
		c[vec[i].sc] = i+1;
		if(vec[i].fr != q+1)k ++;
	}
	int t = vec.size()-1;
	while(t > 0 && vec[t-1].sc < vec[t].sc)t --;
	
	//rep(i,vec.size())printf("%lld %lld\n",vec[i].fr,vec[i].sc);
	
	
	//cout << c[1] << " " << c[2] << " " << c[3] << endl;
	//cout << t << " " << k << endl;
	
	static int cnt[100010] = {};
	static bool used[100010];
	rep(i,100010)used[i] = false;
	cnt[0] = n;
	used[0] = true;
	rrep(i,q){
		if(cnt[c[a[i]]-1] > 0){
			cnt[c[a[i]]-1] --;
			cnt[c[a[i]]] ++;
			used[c[a[i]]] = true;
		}
		else {
			if(!used[c[a[i]]]){
				puts("No");
				return 0;
			}
		}
	}
	
	//cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << " " << cnt[3] << endl;
	
	int ret = 0;
	for(int i = t ; i <= k ; i ++)ret += cnt[i];
	if(ret == n)puts("Yes");
	else puts("No");
}


Measured memory_bytes: 3696
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let mut ab: Vec<(usize, usize)> = vec(n, |_| (scan(tokens), scan(tokens)));
    ab.sort_by_key(|&(_ai, bi)| bi);
    let mut cumsum: usize = 0;
    for &(ai, bi) in &ab {
        cumsum += ai;
        if cumsum > bi {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 13560
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

N,A,B,C = map(int, input().split())
LS = [int(input()) for _ in range(N)]

def dfs(idx,a,b,c):
    if idx == N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else float('inf')
    first = 10+dfs(idx+1,a+LS[idx],b,c)
    second = 10+dfs(idx+1,a,b+LS[idx],c)
    third = 10+dfs(idx+1,a,b,c+LS[idx])
    fourth = dfs(idx+1,a,b,c)
    return min(first,second,third,fourth)

def main():
    """ main """
    print(dfs(0,0,0,0))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3952
use std::cmp;

const INF: u32 = 1e7 as u32;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s = sc
        .chars()
        .into_iter()
        .map(|c| c as usize - 'a' as usize)
        .collect::<Vec<_>>();
    let n = s.len();

    let mut min = vec![INF; 1 << 26];
    min[0] = 0;
    let mut hash = 0;
    for i in 0..n {
        hash ^= 1 << s[i];
        let split_min = (0..26)
            .map(|i| {
                let palindrome_prefix = 1 << i;
                let suffix = hash ^ palindrome_prefix;
                min[suffix] + 1
            })
            .min()
            .unwrap();

        let dp = cmp::min(split_min, min[hash] + 1);
        min[hash] = cmp::min(min[hash], dp);
        if i == n - 1 {
            println!("{}", dp);
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 268668
class Node(object):
    def __init__(self, key=None, parent=None, left=None, right=None):
        self.parent = parent
        self.left = left
        self.right = right

def print_nodes(nodes, n):    
    for i in range(1, n+1):
        p = "parent key = {}, ".format(nodes[i].parent)
        l = "left key = {}, ".format(nodes[i].left)
        r = "right key = {}, ".format(nodes[i].right)
        if nodes[i].parent == None:
            p = ""
        if nodes[i].left == None:
            l = ""
        if nodes[i].right == None:
            r = ""
        print("node {0}: key = {1}, {2}{3}{4}".format(i, nodes[i].key, p, l, r))

n = int(input())
A = [int(i) for i in input().split()]
A.insert(0, None)
nodes = [Node() for _ in range(n+1)]
for i in range(1, n+1):
    nodes[i].key = A[i]
    if 2*i < n+1:
        nodes[i].left = A[2*i]
    if 2*i+1 < n+1:
        nodes[i].right = A[2*i+1]
    if i == 1:
        pass
    else:
        nodes[i].parent = A[i >> 1]

print_nodes(nodes, n)


Measured memory_bytes: 5628
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <time.h>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

const int MAXN = 100;
ll cb[MAXN+5][MAXN+5];

void pre_comb()
{
    int i,j;
    for(i=0; i<=MAXN; i++) {
        for(j=0; j<=i; j++) {
            if(j==0 || j==i) cb[i][j]=1;
            else             cb[i][j]=cb[i-1][j-1]+cb[i-1][j];
        }
    }
}

ll comb(int n, int a)
{
    if(n>=0 && n<=MAXN && a>=0 && a<=n) {
        return cb[n][a];
    }
    return 0;
}

void solve()
{
    pre_comb();
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    vector<ll> v(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%lld", &v[i]);
    }
    sort(v.rbegin(), v.rend());
    ll s = 0;
    int cnt0 = 0;
    int bgn = -1;
    for (i = 0; i < a; i++) {
        s += v[i];
        if (bgn < 0 && v[i] == v[a - 1]) bgn = i;
    }
    double ans0 = (double)s / a;
    int end = a - 1;
    for (i = a; i < n; i++) {
        if (v[i] == v[a - 1]) end = i;
        else break;
    }
    if (bgn == 0) {
        ll ans = 0;
        for (i = a; i <= MIN(b,end+1); i++) {
            ans += comb(end+1, i);
        }
        printf("%.10lf\n%lld\n", ans0, ans);
    }
    else {
        int num = end - bgn + 1;
        int sel = a - bgn;
        ll ans = comb(num, sel);
        printf("%.10lf\n%lld\n", ans0, ans);
    }

    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


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

using namespace std;

typedef long long ll;

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

int main(void){
    string S;
    cin >> S;
    int size = S.size();
    bool N = false;
    bool SS = false;
    bool W = false;
    bool E = false;
    rep(i,size){
        if (S[i] == 'N') N = true;
        if (S[i] == 'S') SS = true;
        if (S[i] == 'W') W = true;
        if (S[i] == 'E') E = true;
    }
    if ( ((N && SS) || (!N && !SS)) && ((W && E) || (!W && !E)) ){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N,L;
  cin>>N>>L;
  ll ans=N*(N-1)/2+L*N;
  if(L<=0&&L+N-1>=0) cout<<ans<<endl;
  else if(L>0) cout<<ans-L<<endl;
  else cout<<ans-L-N+1<<endl;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vi l(n);
    rep(i, 0, n) { cin >> l[i]; }

    sort(all(l));

    int ans = 0;
    rrep(i, 2, n) {
        int a = 0;
        rrep(b, 1, i) {
            while (a < b && l[a] + l[b] <= l[i]) { ++a; }
            if (a == b) { break; }
            ans += b - a;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

template <int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if ((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if ((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while (n > 0) {
            if (n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

const int mod = 1e9 + 7;
using mint = ModInt<mod>;

mint C(int n, int r) {
    mint ret = 1;
    rep(i, r) {
        ret *= (n - i);
        ret /= (i + 1);
    }
    return ret;
}

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

    mint ans = mint(2).pow(n) - 1;
    for (int i : {a, b}) ans -= C(n, i);
    cout << ans << "\n";
    return 0;
}


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

int main(void){
	string S;
	cin >> S;
	int Slength = S.size();
	int count = 0;
	for(int i=0;i<Slength;i++){
		while(S[i]==S[i+1]){
			i++;
		}
		count ++;
	}
	cout << count-1;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
  string date;
  cin >> date;
  
  size_t strPos = date.find("2017");
  if(strPos != string::npos){
    date.replace(strPos, strPos + 4, "2018");
    cout << date << endl;
  }
  else{
    cout << date << endl;
  }
}

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

using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

int A[3];

int main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  rep(i, 3)cin>>A[i];
  
  cout<<max({A[0], A[1], A[2]})-min({A[0], A[1], A[2]})<<endl;

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
char s[N];
char t[N];

int main() {
  scanf("%s", s);
  int m = 0, n = strlen(s);
  vector<int> A;
  for (int i = 0; s[i]; ++i) {
    if (s[i] != 'x') {
      t[m++] = s[i];
      A.push_back(i);
    }
  }
  if (m == 0) {
    puts("0");
    return 0;
  }
  bool found = false;
  for (int i = 0; i < m / 2; ++i) {
    if (t[i] != t[m - 1 - i]) {
      found = true;
      break;
    }
  }
  if (found) {
    puts("-1");
    return 0;
  }
  // for (auto& it : A) {
  //   cout << it << " ";
  // }
  // cout << endl;
  int ret = 0;
  if (m % 2 == 1) {
    int mid = m / 2;
    for (int i = 0; i < m / 2; ++i) {
      int x = abs(A[mid + i + 1] - A[mid + i]);
      int y = abs(A[mid - i - 1] - A[mid - i]);
      ret += abs(x - y);
    }
  } else {
    int u = m / 2 - 1, v = u + 1;
    for (int i = 0; i < m / 2 - 1; ++i) {
      int x = abs(A[u - i - 1] - A[u - i]);
      int y = abs(A[v + i + 1] - A[v + i]);
      ret += abs(x - y);
    }
  }
  int x = A[0], y = n - 1 - A[m - 1];
  ret += abs(x - y);
  printf("%d\n", ret);
  return 0;
}


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


Measured memory_bytes: 2592
#include<stdio.h>
#define EPS 0.0000001
 int main(void){
     double a,b,c,d,e,f,x,y,i,j,g;
      while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        i=(c*e-f*b);
        j=(a*e-b*d);
        x=i/j;
        g=(a*f-d*c);
        y=g/j;
        if(-EPS<x && x<=0)x=0;
        if(-EPS<y && y<=0)y=0;
        printf("%.3f %.3f\n",x,y);
      }

 return 0;
 }

Measured memory_bytes: 652
#include <stdio.h>
int main()
{
    int N,A,B;
    scanf("%d",&N);
    if(N==1)
    {
        printf("Hello World\n");
    }
    else if(N==2)
    {
        scanf("%d%d",&A,&B);
        printf("%d\n",A+B);
    }
    return 0;
}


Measured memory_bytes: 128
s=input()

flag=True
for i in range(len(s)):
  if (i+1)%2==1:
    if s[i]=="L":
      flag=False
      break
  if (i+1)%2==0:
    if s[i]=="R":
      flag=False
      break
 
if flag==True:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	int p[alength]={},q[alength]={},r[alength*3]={};
	fori(a){cin>>p[i];}
	fori(b){cin>>q[i];}
	fori(c){cin>>r[i];}
	sort(p,p+a,greater<int>());sort(q,q+b,greater<int>());
	fori(x){
		r[c+i]=p[i];
	}
	fori(y){
		r[c+x+i]=q[i];
	}
	sort(r,r+c+x+y,greater<int>());
	ll ans=0;
	fori(x+y){
		ans+=r[i];
	}
	cout<<ans;
}

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

#define  __  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define  int  long long
#define  endl  '\n'
const double pi = acos(-1);
const int mod = 1e9 + 7;
//______________________



int32_t main()
{ 

  
  
  int a;
  string s;
  cin >> a >> s;
  cout << (a < 3200 ? "red" : s);

 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		int x = i;
		if(x % 3 == 0){
			cout << " " << i;
		}
		else{
			while(x != 0){
				if(x % 10 == 3){
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout << "\n";
}


Measured memory_bytes: 3084