akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e5 + 10;
void deal(vector<int>& v) {
    string s;
    cin >> s;
    vector<int> sta;
    for(int i = 0; i < s.length(); i++) {
        if(sta.size() == 0) sta.push_back(s[i]-'A');
        else {
            sta.push_back(s[i]-'A');
            if(sta[0] == sta[1]) {
                int c = sta[0];
                sta.clear();
                sta.push_back(!c);
            } else {
                sta.clear();
            }
        }
        if(sta.size() == 0) v.push_back(-1);
        else v.push_back(sta[0]);
        // cout << v.back() << endl;
    }
}
vector<int> v[2];
int getans(int o, int l, int r) {
    l--; r--;
    if(l-1<0) return v[o][r];
    int c = v[o][l-1], g = v[o][r];
    if(c==g) return -1;
    if(g==-1) {
        return !c;
    } else if(g==0) {
        if(c==-1) return 0;
        return 1;
    } else {
        if(c==-1) return 1;
        return 0;
    }
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    deal(v[0]);
    deal(v[1]);
    // cout << getans(0, 1, 6) << " " << getans(0, 1, 9) << endl;
    // cout << getans(1, 1, 3) << endl;
    int q;
    cin >> q;
    while(q--) {
        int l0, r0, l1, r1;
        cin >> l0 >> r0 >> l1 >> r1;
        cout << (getans(0, l0, r0) == getans(1, l1, r1) ? "YES" : "NO") << '\n';
    }
    return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    long long input;
    long long lim = 1e18;
    long double temp = 1;
    for(int i = 0 ; i < t ; i++){
        cin >> input;
        if(input == 0){
            temp = 0;
            cout << 0 << "\n";
            return 0;
        }
        if(temp != -1)
        temp = temp * input;
        if(temp > lim || temp < 0){
            temp = -1;
        }
    }
 
    cout << (long long)temp << "\n";
}

Measured memory_bytes: 3616
import java.util.Scanner;
class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		Main app = new Main();
		int count=0;
		
		while(scan.hasNext()){
			String str = scan.nextLine();
			String rts = app.reverse(str);
			count += app.checkStr(str,rts);
		}
		System.out.println(count);
	}
	
	public String reverse(String str){
		StringBuffer sb = new StringBuffer(str);
		String rts = sb.reverse().toString();
		
		return rts;
	}
	
	public int checkStr(String str,String rts){
		if(str.equals(rts)){
			return 1;
		}
		
		return 0;
	}
}

Measured memory_bytes: 17156
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N;
  cin >> N;
  vi A(N);
  cin >> A;

  i64 ans = A[0];
  rep(i, 1, N){
    ans = __gcd(ans, A[i]);
  }
  cout << ans << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Measured memory_bytes: 1024
def e_balanced_path():
    # 参考: https://atcoder.jp/contests/abc147/submissions/8889160
    H, W = [int(i) for i in input().split()]
    A = [[int(i) for i in input().split()] for j in range(H)]
    B = [[int(i) for i in input().split()] for j in range(H)]

    # ビット列で集合を表現する場合、負の数をうまく扱えないので、バイアスをかける
    MAX_DIFF = (H + W) * 80  # 全マスで偏りが80変化するかもしれない

    diff = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]

    # dp[i][j]: マス (i, j) で取りうる偏りの集合をビット列で持つ
    # ただし、ビット列の基準は MAX_DIFF 桁目である
    dp = [[0] * (W + 1) for _ in range(H + 1)]
    # 左上のマスの更に上に、偏り0のマスがあることにする
    # (下から MAX_DIFF 桁目を1にする)
    dp[0][1] = 1 << MAX_DIFF

    for row in range(1, H + 1):
        for col in range(1, W + 1):
            k = diff[row - 1][col - 1]
            # マス (i, j) に対して左のマスで取りうる偏りに ±k したものが
            # マス (i, j) で取りうる偏り
            dp[row][col] |= dp[row][col - 1] << k
            dp[row][col] |= dp[row][col - 1] >> k
            # 上のマスについて同じことを行う
            dp[row][col] |= dp[row - 1][col] << k
            dp[row][col] |= dp[row - 1][col] >> k

    ans = MAX_DIFF
    # 右下のマスで取りうる偏りを抽出し、絶対値が0に最も近いもの
    # (1が立っているビットのうち、最も MAX_DIFF 桁目に近いもの) が解
    for k in range(2 * MAX_DIFF + 1):
        if (dp[H][W] >> k) & 1:
            # 下から k ビット目が1なら、|k - MAX_DIFF| の偏りを取りうる
            ans = min(ans, abs(k - MAX_DIFF))
    return ans

print(e_balanced_path())

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define btinpct(x) __builtin_popcountll((x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?b:gcd(b%a,a); }

#define ll long long int 
#define ld long double
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (300006)
ll n;
ll query(ll s, ll n, ll test=0) {
	cout<<"? ";
	FOR(i,s,s+n-1) cout<<i<<' ';
	if(test) cout<<test;
	cout<<endl;
	string x; cin>>x; assert(x!="-1");
	return x=="Red"?0:1;
}
ll query(set<ll> s) {
	assert(s.size()==n);
	cout<<"? ";
	for(auto i:s) cout<<i<<' ';
	cout<<endl;
	string x; cin>>x; assert(x!="-1");
	return x[0]=='R'?0:1;
}
int main()
{
	FAST
	cin>>n;
	ll c=query(1, n);
	ll st=1, en=n+1, mid=0;
	while(en-st>1) {
		mid=(st+en)>>1;
		if(query(mid, n) != c) en=mid;
		else st=mid;
	}
	vector<ll> ans(2*n+1, -1);
	ans[st]=c;
	ans[st+n]=!c;
	FOR(i,1,2*n) if(i<st||i>st+n) {
		ans[i]=query(en, n-1, i);
	}
	set<ll> s;
	s.ins(st);
	s.ins(st+n);
	FOR(i,en,en+n-2) s.ins(i);
	FOR(i,en,en+n-2) {
		s.erase(i);
		ans[i]=!query(s);
		s.ins(i);
	}
	cout<<"! ";
	FOR(i,1,2*n) cout<<(ans[i]?'B':'R');
	cout<<endl;
}


Measured memory_bytes: 724
#include<stdio.h>

int main()
{
	double v,h,n;
	int i;

	while(scanf("%lf",&v)!=EOF)
	{
		h=v*v/19.6;
		i=1;
		n=0.0;
		while(1)
		{
			i++;
			if(n<h && (double)(5*(i-1))>=h)
			{
				printf("%d\n",i);
				break;
			}
			n=(double)(5*(i-1));
		}
	}

	return 0;
}

Measured memory_bytes: 628
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
#include <cassert>
#include <complex>

using namespace std;
typedef long long ll;

const double eps = 1e-8;

typedef complex<double> P;

double dot(P a, P b){
  return (a * conj(b)).real();
}

double cross(P a, P b){
  return (conj(a) * b).imag();
}

int ccw(P a, P b, P c){
  if(cross(b-a, c-a) > eps) return 1;
  if(cross(b-a, c-a) < -eps) return -1;
  if(dot(b-a, c-a) < -eps) return -2;
  if(dot(a-b, c-b) < -eps) return 2;
  return 0;
}

bool isIntersectedLL(P a1, P a2, P b1, P b2){
  return abs(cross(a1-a2, b1-b2)) > eps;
}

bool isIntersectedSS(P a1, P a2, P b1, P b2){
  int a = ccw(b1, b2, a1);
  int b = ccw(b1, b2, a2);
  int c = ccw(a1, a2, b1);
  int d = ccw(a1, a2, b2);

  return a*b < 0 && c*d < 0;
}


P getCrosspointLL(P a1, P a2, P b1, P b2){
  P a = a2 - a1;
  P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

P p[10];
int l[10];
P pol[10][20];

int main(){
  int n, m;
  int x, y;

  scanf("%d%d", &n, &m);
  
  vector<P> vec, vec2;

  for(int i=0;i<n;i++){
    scanf("%d", l+i);
    for(int j=0;j<l[i];j++){
      scanf("%d%d", &x, &y);
      pol[i][j] = P(x,y);
      vec.push_back(pol[i][j]);
      vec2.push_back(pol[i][j]);
    }
  }

  for(int i=0;i<m;i++){
    scanf("%d%d", &x, &y);
    p[i] = P(x, y);
    //vec.push_back(p[i]);
  }



  for(int i=0;i<m;i++){
    for(int j=i+1;j<m;j++){
      for(int t=0;t<vec2.size();t++){
        for(int q=0;q<vec2.size();q++){
          if(isIntersectedLL(p[i], vec2[t], p[j], vec2[q])){
            vec.push_back(getCrosspointLL(p[i], vec2[t], p[j], vec2[q]));
          }
        }
      }
    }
  }

  int ans = 0;
  
  for(int i=0;i<vec.size();i++){
    int counter = 0;
    
    for(int j=0;j<m;j++){
      bool flag = true;
      for(int k=0;k<n;k++){
        for(int t=0;t<l[k];t++){
          flag &= !isIntersectedSS(pol[k][t], pol[k][(t+1)%l[k]], p[j], vec[i]);
        }
      }
      counter += flag;
    }

    ans = max(ans, counter);
  }

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



Measured memory_bytes: 3364
#include <iostream>
#include <string>

int main(){
    std::string s;
    std::string days[7]={
        "SUN","MON","TUE","WED","THU","FRI","SAT"
    };
    std::cin >> s;
    for(int i=0;i<7;++i){
        if(days[i]==s){
            std::cout << 7-i << std::endl;
            return 0;
        }
    }
}

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

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

constexpr int mod = 100000;

int main() {
    int N, M, S;
    while(cin >> N >> M >> S, N) {
        vector<vector<int>> dp(N * N + 1, vector<int>(S + 1));
        dp[0][0] = 1;
        for(int i = 1; i <= N * N; ++i) {
            for(int j = 0; j <= S; ++j) {
                if(i <= j) {
                    dp[i][j] += dp[i][j - i] + dp[i - 1][j - i];
                }
                if(j - M - 1 >= 0) {
                    dp[i][j] -= dp[i - 1][j - M - 1];
                }
                dp[i][j] = (dp[i][j] + mod) % mod;
            }
        }
        cout << dp[N * N][S] << endl;
    }
}


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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))

typedef long long ll;

int main()
{
    FastRead

    ll ans=0;
    string s;

    cin>>s;

    ll temp = 0;

    for(ll i=0;i<s.size();i++)
    {
        if(s[i]=='A')
            temp++;
        else if(s.substr(i,2)=="BC")
        {
            ans+=temp;
            i++;
        }
        else
            temp = 0;
    }

    cout<<ans;
}


Measured memory_bytes: 720
#include<iostream>

int main(){
    int A, B;
    bool cake[16];
    std::cin >> A >> B;
    for(int i = 0; i < A; i++){
        if(2 * i < 16){
            cake[2 * i] = false;
        }else{
            std::cout << ":(" << std::endl;
            return 0;
        }
    }
    for(int i = 0; i < B; i++){
        if(2 * i + 1 < 16){
            cake[2 * i + 1] = false;
        }else{
            std::cout << ":(" << std::endl;
            return 0;
        }
    }
    std::cout << "Yay!" << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n,x;
    cin >> n >> x;
    int l[n];
    rep(i,n)cin >> l[i];
    int d = 0;
    int ans = 0;
    rep(i,n){
        if(d<=x)ans++;
        d += l[i];
    }
    if(d<=x)ans++;
    cout <<ans << endl;
}

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;
using P  = pair<int, int>;

int main() {
    int N,M;
    cin >> N >> M;
    if (N== M) {
        cout << "Yes" << endl;
    }else {
         cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back
#define in(x) int x; cin>>x;
#define ln(x) long long x; cin>>x;
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
int main()
{
	fast
	string s,t;
	cin>>s>>t;
	int globans=s.length();
	for(int i=0;i<=((int)s.length()-(int)t.length());i++)
	{
		int ans=0;
		for(int j=0;j<t.length();j++)
		{
			if(s[i+j]!=t[j])
				ans++;
		}
		globans=min(ans,globans);
	}
	cout<<globans;
	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
int main()
{
    unsigned long long int N,A,B;
    scanf("%llu%llu%llu",&N,&A,&B);
    unsigned long long int count,sum,k,j,t;
    if(A==0){
        count=0;
        printf("%llu",count);
    }
    else if(N<A+B){
            if(A>=N){
            printf("%llu",N);
            }
            else{
                printf("%llu",A);
            }

    }
    else{
        k=A+B;
        sum=N/k;
        j=sum*k;
        if(N-j>=A){
            t=A;
        }
        else{
            t=N-j;
        }
        count=(sum*A)+t;
        printf("%llu",count);
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, l;
  cin >> n >> l;
  int sum = n * l + ((0 + (n - 1)) * n / 2);
  int mint = 100000;
  int mini = 0;
  for (int i = 0; i < n; i++) {
    if (mint > abs(l + i)) {
      mint = abs(l + i);
      mini = i;
    }
  }
  cout << sum - (l + mini) << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
	int N;
	std::cin >> N;

	int count = 0;

	for (int i = 0; i < N; ++i) {
		int a;
		std::cin >> a;
		if (i % 2)
			continue;
		if (a % 2)
			count++;
	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 3588
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

ans = [[0] * w for i in range(h)]

direction = 'e'

h_now = 0
w_now = 0


def distribute():
    for i in range(n + 1):
        if a[i] > 0:
            a[i] -= 1
            return i + 1


finish = 0
ans[0][0] = 1
a[0] -= 1
while finish <= 4:
    if direction == 'e':
        if w_now + 1 < w and ans[h_now][w_now + 1] == 0:
            w_now += 1
            ans[h_now][w_now] = distribute()
            finish = 0
        else:
            direction = 's'
            finish += 1

    if direction == 's':
        if h_now + 1 < h and ans[h_now + 1][w_now] == 0:
            h_now += 1
            ans[h_now][w_now] = distribute()
            finish = 0
        else:
            direction = 'w'
            finish += 1

    if direction == 'w':
        if w_now - 1 >= 0 and ans[h_now][w_now - 1] == 0:
            w_now -= 1
            ans[h_now][w_now] = distribute()
            finish = 0
        else:
            direction = 'n'
            finish += 1

    if direction == 'n':
        if h_now - 1 >= 0 and ans[h_now - 1][w_now] == 0:
            h_now -= 1
            ans[h_now][w_now] = distribute()
            finish = 0
        else:
            direction = 'e'
            finish += 1
    # print(ans)

for i in range(h):
    for j in range(w):
        print(ans[i][j], end=' ')
    print()


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

int main(){
  string s;
  cin>>s;
  REP(i,3){
    if(s.at(i)=='1') cout<<'9';
    else if(s.at(i)=='9') cout<<'1';
    else cout<<s.at(i);
  }
}

Measured memory_bytes: 256
# C
n, q = map(int, input().split())
s = str(input())
s_flag = [0] * n
v = 0
for i in range(n-1):
    if s[i:i+2] == 'AC':
        v += 1
    s_flag[i+1] = v

for i in range(q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    ans = s_flag[r] - s_flag[l]
    print(ans)

Measured memory_bytes: 6060
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

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

def solve(X: int, Y: int):
    ret = NO
    for i in range(X + 1):
        if 4 * i + 2 * (X - i) == Y:
            ret = YES
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61728
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0);
int N,K;
ll p[5001];
ll c[5001];
ll ans;
ll ret,cnt;
int here;
ll path,ct;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> N >> K;
    rep1(i,0,N) cin >> p[i], --p[i];
    rep1(i,0,N) cin >> c[i];

    ans = -INF;
    rep1(i,0,N){
        here = i;
        ret = cnt = 0;

        while(1){
            cnt++;
            ret += c[here];
            here = p[here];
            if(i == here) break;
        }
        path = ct = 0;

        while(1){
            ct++;
            path += c[here];

            if(ct > K) break;

            ll t = (K - ct) / cnt;
            ll score = path + max(0LL,ret) * t;
            ans = max(ans,score);

            here = p[here];
            if(i == here) break;
        }
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 3724
/* In the name of God */

#include<bits/stdc++.h>

using namespace std;
//#define int long long
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Dec cout<<fixed<< setprecision
#define endl "\n"
#define nlp printf("\n")
#define nl cout << "\n"
#define MP(make_pair)
#define SZ(x) (int) x.size()
#define tc() int t; cin >> t ; while (t--)
#define debug(x , y) cout << "### " << y << " is : " << x << " ###" << endl
#define clr(a) memset(a , 0 , sizeof a)
#define endl "\n"
#define bit(i , x) ((x >> i) & 1)
#define all(v) v.begin() , v.end()
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef vector<int> VI ;
typedef vector<pii> VPI;

inline void smax(int &x , int y) { x = max(x , y) ; }
inline void smin(int &x , int y) { x = min(x , y) ; }

class FastIO{
public:
    inline FastIO & operator << (const int &a){ printf("%d" , a); return *this; }
//    inline FastIO & operator << (const long long &a){ printf("%I64d" , a); return *this; }
    inline FastIO & operator << (const double &a){ printf("%.9f" , a); return *this; }
    inline FastIO & operator << (const long double &a){ printf("%.9lf" , a); return *this; }
    inline FastIO & operator << (const char * const&a){ printf("%s" , a); return *this; }
    inline FastIO & operator << (const string &a){ printf("%s" , a.c_str()); return *this; }
    inline FastIO & operator >> (int &a){ scanf("%d" , &a); return *this; }
//    inline FastIO & operator >> (long long &a){ scanf("%I64d" , &a); return *this; }
    inline FastIO & operator >> (double &a){ scanf("%lf" , &a); return *this; }
    inline FastIO & operator >> (long double &a){ scanf("%lf" , &a); return *this; }
    inline FastIO & operator >> (char * const&a){ scanf("%s" , a); return *this; }
}fastIO;

const int MOD = 1e9 + 7 ;
const ld EPS = 1e-9 ;
const int INF = 1e9 + 10 ;
const ll LINF = 1e18 ;
const int N = 1e3 + 10 ;
const int maxn = 1e4 + 10 ;
const int MAXN = 1e5 + 10 ;
const int MN = 1e6 + 10 ;
inline int powmod(int x , int y){ ll res = 1 , a = x ; while(y){if(y&1) res = (res*a)%MOD ;  a = (a*a)%MOD ; y >>= 1 ;} return res ; }



int32_t main (){
	IOS() ;
	int a , b , c ;
	cin >> a >> b >> c ;
	cout << min({a+b , a+c , b+c})	; nl; return 0 ;
}


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

int top,s[100];

void push(int x)
{
    s[top++]=x;
    return;
}
int pop()
{
    int x=s[--top];
    return x;
}
int main()
{
    top=0;
    int a,b;
    char c;
    while((c=cin.get())!='\n')
    {
        if(c=='+')
        {
            a=pop();
            b=pop();
            push(a+b);
        }
        if(c=='-')
        {
            b=pop();
            a=pop();
            push(a-b);
        }
        if(c=='*')
        {
            a=pop();
            b=pop();
            push(a*b);
        }
        if(c>='0' && c<='9')
        {
            int num=c-'0';
            while(1)
            {
                scanf("%c",&c);
                if(c>='0'&&c<='9')
                    num=num*10+c-'0';
                else
                    break;
            }
            push(num);
        }
    }
    cout<<pop()<<endl;
    return 0;

}



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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	int n=s.size();	
	for (int i=0; i<n; i++)
	if (s[i]==',') s[i]=' ';
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define lll __int128
#define ull unsigned long long
#define fi first
#define se second
#define db double
#define ld long double
#define lld __float128

/// order_of_key, find_by_order

template<class T, class COMP>
using custom_set = tree<T, null_type, COMP, rb_tree_tag, tree_order_statistics_node_update>;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T, class U>
using ordered_map = tree<T, U, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd_64(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = 1e9 + 7;

int main()
{
    int n; cin >> n; string s; cin >> s;
    vector<ll> cnt(26, 0);
    for(int i = 0; i < n; i++)
    {
        cnt[s[i]-'a']++;
    }
    ll ans = 1;
    for(int i = 0; i < 26; i++)
    {
        ans = (ans * (cnt[i]+1ll)) % MOD;
    }
    cout << (ans - 1 + MOD) % MOD << '\n';
}






































/// shche ne vmerla Ykraina


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define NINF INT_MIN

#define nax 200005


void solve(){
	
	int n;
	cin>>n;
	string s="";
	while(n>0){
		int temp = n%26;
		if(temp==0){
			s+='z';
		}
		else
			s+= 'a' + temp-1;
		int flag= n/26;
		if(n%26==0){
			flag--;
		}
		n=flag;
	}
	reverse(all(s));
	cout<<s<<endl;
	
}	

signed main(){
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand (static_cast <unsigned> (time(0)));
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
x1, y1, x2 ,y2 = map(int,input().split())

if x2 >= x1:
    if y2 >= y1:
        print(x2-y2+y1,y2+x2-x1,x1-y2+y1,y1+x2-x1)
    else:
        print(x2+y1-y2,y2+x2-x1,x1+y1-y2,y1+x2-x1)
else:
    if y2 >= y1:
        print(x2-y2+y1,y2-x1+x2,x1-y2+y1,y1-x1+x2)
    else:
        print(x2+y1-y2,y2-x1+x2,x1+y1-y2,y1-x1+x2)

Measured memory_bytes: 38256
#include <vector>
#include <iostream>
#include <map>
#include <algorithm>
#include <random>
#include <complex>
#include <unordered_map>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const int MN = 501*1000*1000;

ll gcd(ll a, ll b) {
    if (!a) return b;
    return gcd(b%a, a);
}
ll ext_gcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b) {
        d = ext_gcd(b, a%b, y, x);
        y -= a / b*x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

int w, d, n, m, t, u, h;
int x, tu, th;
void init() {
    m = t-m%t;
    u = gcd(t, w+d), h = gcd(t, m);
    tu = t/u; th = t/h;
    ll xx, y;
    ext_gcd(m, t, xx, y);
    x = ((xx % th) + th) % th;
}
int solve() {
    init();

    int res = 0;
    int l = 0;

    int s = 0;
    int th = t/h;
    for (int i = 0; i < t; i += h) {
        if (s<n) {
            res += max(0, (i-w)/u - l);
            l = i/u;
        }
        s += x;
        if (s >= th) s -= th;
    }
    res += max(0, (t-w)/u - l);
    return res;
}

int main() {
    cin >> w >> d >> n >> m >> t; w++; d--;
    printf("%.20f\n", 1.0 * solve() / tu);
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 0; i < n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,0,n)cin >>p[i];
    rep(i,0,n)cin >>q[i];
    int cnt=0;
    int ans1 = 0;
    int ans2 = 0;
    vector<int> index(n);
    vector<int> index1(n);
    rep(i,0,n) index[i] = i+1;
    rep(i,0,n) index1[i] = i+1;
   do{  
        ans1++;
        cnt = 0;
        rep(i,0,n){
            if(index[i] == p[i]) cnt++;
        }
        if(cnt == n) break;
   }while(next_permutation(index.begin(),index.end()));
   do{  
        ans2++;
        cnt = 0;
        rep(i,0,n){
            if(index1[i] == q[i]) cnt++;
        }
        if(cnt == n) break;
   }while(next_permutation(index1.begin(),index1.end()));
   cout << abs(ans1-ans2) << endl;
}

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


int partition(int A[], int p, int r){
    int x = A[r];
    int i = p-1;
    for (int j=p; j<r; j++){
        if(A[j]<=x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

int main(){
    int n;
    cin >> n;
    int A[n];
    rep(i,n) scanf("%d", &A[i]);

    int sep = partition(A, 0, n-1);

    rep(i,n){
        if (i) printf(" ");
        if (i==sep) printf("[");
        printf("%d", A[i]);
        if (i==sep) printf("]");
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3592
// inputに入力データ全体が入る
function Main(input) {
	var count=0;
	var h=parseInt(input,10);
  	var ans=0;
  	if(h<=1){
    	if(h=0){
        	console.log('0');
        }else{
          	console.log('1');
        }
    }else{
    	for(;;){
          	h=Math.floor(h/2);
        	count=count+1;
          	if(h==1){
            	break;   
            }
        }
      	for(i=0;i<count+1;i++){
           	ans=ans+Math.pow(2, i);
          //console.log('%d %d %d',ans,i,count);
       	}
      console.log('%d',ans);
      
      
      
      
      
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
  double n,k,m=0.5;
  int s=0;
  cin>>n>>k;
  vector<double> p(n+1),sum(n+1),r(n+1);
  p[0]=0;
  sum[0]=0;
  for(int i=1; i<=n; i++) {
    cin>>p[i];
    sum[i]=p[i]+sum[i-1];
  }
  reverse(sum.begin(),sum.end());
  for(int i=0; i<n-k+1; i++){
    int x=sum[i]-sum[i+k];
    s=max(s,x);
  }
  double ans=s;
   cout<<setprecision(12)<<(double)(ans+k)/2;
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void){
  int i;

  int n;
  scanf("%d",&n);

  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  double sum=0.0;
  for(i=0;i<n;i++){
    sum+=(1/(double)a[i]);
  }

  printf("%lf\n",1/sum);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int mod = 1e9 + 7;

int main(){
	ll N, M; cin >> N >> M;
	ll S[N],T[M];
	for(int i=0; i<N; i++) cin >> S[i];
	for(int i=0; i<M; i++) cin >> T[i];
	ll dp[N][M], s = 0;
	if(S[0] == T[0]){ dp[0][0] = 2; s++; }
	else{ dp[0][0] = 1;}
	for(int i=1; i<M; i++){
		if(T[i] == S[0]) s++;
		dp[0][i] = (s + 1) % mod;
	}
	for(int i=1; i<N; i++){
		ll sum[100001];
		for(int j=0; j<100001; j++) sum[j] = 0;
		for(int j=0; j<M; j++){
			if(S[i] == T[j]){
				if(j != 0){
					dp[i][j] = (sum[S[i]] + dp[i-1][j-1] + dp[i-1][j]) % mod;
					sum[T[j]] = (sum[T[j]] + dp[i-1][j-1]) % mod;
				}else{
					dp[i][j] = (sum[S[i]] + 1 + dp[i-1][j]) % mod;
					sum[T[j]] = (sum[T[j]] + 1) % mod;
				}
			}else{
				if(j != 0){
					dp[i][j] = (sum[S[i]] + dp[i-1][j]) % mod;
					sum[T[j]] = (sum[T[j]] + dp[i-1][j-1]) % mod;
				}else{
					dp[i][j] = (sum[S[i]] + dp[i-1][j]) % mod;
					sum[T[j]] = (sum[T[j]] + 1) % mod;
				}
			}
		}
	}
	cout << dp[N-1][M-1] << endl;
	return 0;
}


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

using namespace std;
long long int n,k,a;
int main()
{
        cin >> n;
        for(int i=1; i<=n; i++)
        {
                cin >> a;
                if(a%2==1)
                        k++;
        }
        if(k%2==0)
                cout << "YES";
        else
                cout << "NO";
        return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
for i in range(n):
  a,b,c=map(int,input().split())
  l.append([a,b,c])
ans=0
for i in range(2):
  for j in range(2):
    for k in range(2):
      l1=[]
      for o in range(n):
        l1.append(l[o][0]*(-1)**i+l[o][1]*(-1)**j+l[o][2]*(-1)**k)
      l1=sorted(l1)
      s=0
      for o in range(m):
        s+=l1[-o-1]
      if s>ans:
        ans=s
print(ans)

Measured memory_bytes: 3188
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();

    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    line.trim()
        .split_whitespace()
        .map(|x| x.parse::<T>())
        .collect::<Result<Vec<T>, _>>()
        .map_err(|_| format!("{}", "parse error"))
}

fn main() {
    loop {
        let s = read_parameters::<String>().unwrap();
        let s = &s[0];

        if s == "0" {
            break;
        }

        let ans: usize = s
            .chars()
            .map(|c| c.to_string().parse::<usize>().unwrap())
            .sum();
        println!("{}", ans);
    }
}



Measured memory_bytes: 5032
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	long long n, a[100000], b[100000];
	long long ans = 0;
	long long ans2=0;
	cin >> n;
	int i, j;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort (b, b + n);
	long long c[100000];
	int m;
	m = n;
	if (m % 2 == 0) m = m - 1;
	long long e[4];
	int p, q, r, s;
	p = -1; q = 0; r = n - 1; s = n - 2;
	e[0] = b[0];
	e[1] = b[0];
	e[2] = b[n - 1];
	e[3] = b[n - 2];
	for (i = 1; i <= (m - 1) / 2; i++) {
		long long pre1, pre2;
		pre1 = e[2] - e[0];
		pre2 = e[3] - e[1];
		if (pre1 < 0) pre1 = -pre1;
		if (pre2 < 0) pre2 = -pre2;
		ans = ans + pre1 + pre2;
		if (i % 2 == 1) {
			p = p + 2;
			q = q + 2;
			e[0] = b[p];
			e[1] = b[q];
		}
		else {
			r = r - 2;
			s = s - 2;
			e[2] = b[r];
			e[3] = b[s];
		}
	}
	if (n % 2 == 0) {
			long long u;
			u = e[2] - e[0];
			if (u < 0) u = -u;
			ans = ans + u;
	}


	p = 0; q = 1; r = n ; s = n - 1;
	e[0] = b[0];
	e[1] = b[1];
	e[2] = b[n - 1];
	e[3] = b[n - 1];
	for (i = 1; i <= (m - 1) / 2; i++) {
		long long pre1, pre2;
		pre1 = e[2] - e[0];
		pre2 = e[3] - e[1];
		if (pre1 < 0) pre1 = -pre1;
		if (pre2 < 0) pre2 = -pre2;
		ans2 = ans2 + pre1 + pre2;
		if (i % 2 == 0) {
			p = p + 2;
			q = q + 2;
			e[0] = b[p];
			e[1] = b[q];
		}
		else {
			r = r - 2;
			s = s - 2;
			e[2] = b[r];
			e[3] = b[s];
		}
	}
	if (n % 2 == 0) {
		long long u;
		u = e[2] - e[0];
		if (u < 0) u = -u;
		ans2 = ans2 + u;
	}



	if (ans2 > ans)ans = ans2;



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

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
    class Program {
        static void Main(string[] args) {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }
		public void Solve(ConsoleInput cin) {
			var line = cin.ReadDoubleArray(4);
			double x1 = line[0], y1 = line[1], x2 = line[2], y2 = line[3];
			double dx = x2 - x1, dy = y2 - y1;
			var lenSq = dx * dx + dy * dy;
			var q = cin.ReadInt;
			for(int i = 0; i < q; i++) {
				var p = cin.ReadDoubleArray(2);
				var px = p[0] - x1;
				var py = p[1] - y1;
				var inner = dx * px + dy * py;
				var proj = new double[] { x1 + inner / lenSq * dx, y1 + inner / lenSq * dy };
				var refl = p.Zip(proj, (x, s) => s - (x - s));
				Console.WriteLine(refl.Join());
			}
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
	}
}



Measured memory_bytes: 20788
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, A[100001];
ll dp[3];

ll solve(){
    ll ret = 1;
    REP(i, N){
        ll t = 0;
        REP(j, 3){
            if(A[i] == dp[j]){
                if(t == 0) dp[j]++;
                t++;
            }
        }
        ret = (ret * t) % MOD;
    }
    return ret;
}

signed main(){
    cin >> N;
    REP(i, N) cin >> A[i];
    PRINT(solve());
    return 0;
}

Measured memory_bytes: 4336
<?php
//ガウスジョルダン法

$count = 2;	//未知数の数
$value = array();	//係数配列

while(1){
	$res =fscanf(STDIN, '%d %d %d %d %d %d', $a,$b,$c,$d,$e,$f);
	if ($res==0) break;
	
	$value[0][0]=$a;  $value[0][1]=$b;  $value[0][2]=$c;
	$value[1][0]=$d;  $value[1][1]=$e;  $value[1][2]=$f;
	
	for($i=0; $i<$count; ++$i){
		//注目式の未知数の係数を1にするためにその係数を格納
		$a = $value[$i][$i];
		
		//注目式の未知数の係数を1にするために注目式全体をaで割る
		for($j=$i; $j<=$count; ++$j){
			$value[$i][$j] = $value[$i][$j]/$a;
		}
		
		//注目式以外の未知数の係数を0にする
		for($j=0; $j<$count; ++$j){
			//注目式ならばスルー
			if ($j===$i) continue;
			//注目式以外の未知数の係数を格納
			$tmp = $value[$j][$i];
			//その値を0にするため、注目式との演算を行う
			for($k=0; $k<=$count; ++$k){
				//$value[$i][$k] が注目式の該当未知数の係数
				$value[$j][$k] = $value[$j][$k] - $tmp*$value[$i][$k];
			}
		}
	}
	
	//計算結果
	$x = $value[0][2];  $y = $value[1][2];
	$x = round($x, 3);  $y = round($y, 3);
	$x = sprintf('%.3f', $x);  $y = sprintf('%.3f', $y);
	echo $x.' '.$y.PHP_EOL;
}

Measured memory_bytes: 6692
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BIrohaLovesStringsABCEdition {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n, l;
        in >> n >> l;
        vector<string> vs(n);
        in >> vs;
        sort(all(vs));
        string res = accumulate(all(vs), string());
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BIrohaLovesStringsABCEdition solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3656
n=int(input())
s=input()
A=[int(i) for i in range(10)]
ans=0
import itertools
for a,b,c in itertools.product(A,repeat=3):
  a,b,c=str(a),str(b),str(c)
  chk=0
  for ss in s:
    if chk==0 and ss==a:
      chk=1
    elif chk==1 and ss==b:
      chk=2
    elif chk==2 and ss==c:
      chk=3
  if chk==3:
    ans+=1
print(ans)

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

typedef pair<int , int > P;
P data[101];
int in;

int main(void)
{

	for(int i = 0; i <= 100; i++)
		data[i].second = i;
	while(cin >> in, !cin.eof()){
		data[in].first++;
	}

	sort(data,data+101);
	int def = data[100].first;
	for(int i = 0; i <= 100; i++)
		if(data[i].first == def)
		cout << data[i].second << endl;

	return 0;
}

Measured memory_bytes: 1160
let n=read_int();;let rec($)i a=if i>n then Bytes.iter(fun c->for i=1to 13do if not(List.mem(c,i)a)then Printf.printf"%c %d
"c i;done)"SHCD"else(i+1)$(Scanf.scanf"%c %d
"(fun c n->c,n)::a);;1$[]

Measured memory_bytes: 2472
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }
ll lcm(ll a, ll b) { return a*b/gcd(a,b); }

int main() {
  ll a,b;
  cin >> a >> b;
  cout << lcm(a,b) << endl;

  return 0;
}


Measured memory_bytes: 3636
G = []
cnt = 0

def insertionSort(A, n, g):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
    A[j+g] = v

def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3)

A = []
n = int(input())

for i in range(n):
  A.append(int(input()))

shellSort(n, A)

print(len(G))
print(*G)
print(cnt)

for i in range(n):
  print(A[i])


Measured memory_bytes: 45516
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,pair<ll,ll> >
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define hell 1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree< ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
ll f( ll x )
{
    switch( x % 4 )
    {
        case 0 : 
            return x ;
        case 1 :
            return 1 ;
        case 2 :
            return x+1 ;
        case 3 :
            return 0 ;
    }
}
void solve() 
{
    ll a , b ;
    cin >> a >> b ;
    cout << (f(b)^f(a-1)) ;
}   
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


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

using ll = long long int;
using ull = unsigned long long int;
using P = pair<ll, ll>;
using P3 = pair<P,int>;
using PP = pair<P, P>;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = ll(1e9)+7;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr int di8[] = {0, 1, 1, 1, 0, -1, -1, -1};
constexpr int dj8[] = {1, 1, 0, -1, -1, -1, 0, 1};
constexpr double EPS = 1e-9;


int main(){
    ll n;
    cin >> n;
    constexpr ll MAX_X = 3500;
    for(ll x=1;x<=MAX_X;x++){
        for(ll y=1;y<=MAX_X;y++){
            ll a = 4*x*y - n*(x+y);
            if(a <= 0) continue;
            ll z = (n*x*y)/a;
            if(z >= 0 && z <= MAX_X && n*(x*y+y*z+z*x) == 4*x*y*z){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll n; std::cin >> n;

    std::string s="";
    while(n>=0){
        if(n==0) break;
        n--;
        s.push_back('a' + n%26);
        n/=26;
    }

    std::reverse(s.begin(),s.end());
    std::cout << s << "\n";
    return 0;
}


Measured memory_bytes: 3624
/*
* @author:  codancer
* @createTime:  2020-02-22, 20:13:02
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
typedef vector<int> VI;
typedef pair<int,int> pii;
ll qpow(ll a,ll b){
	ll ans=1;
	while(b){
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans%mod;
}
void sub(long long &a,long long b){
	a-=b;
	if(a<0) a+=mod;
	a%=mod;
}
long long C(long long n,long long m){
	long long ansa=1,ansb=1;
	for(ll i=n-m+1;i<=n;i++) ansa=ansa*i%mod;
	for(ll i=1;i<=m;i++) ansb=ansb*i%mod;
	return (ansa%mod*qpow(ansb,mod-2))%mod;
}
int main(){
	long long n,a,b;
	cin>>n>>a>>b;
	long long res=qpow(2,n);
	sub(res,1);
	sub(res,C(n,a));
	sub(res,C(n,b));
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256