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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 10010;
bool prime[limit];

vector<int> ans;
	

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

	rep(i, limit) prime[i] = true;
	prime[0] = prime[1] = false;

	for(int i = 2; i < limit; ++i){
		if(prime[i]){
			for(int j = i * i; j < limit; j += i){
				prime[j] = false;
			}
		}
	}

	{
		int g = 0;
		rep(i, n + 1) g = __gcd(g, abs(a[i]));
		for(int i = 2; i * i <= g; ++i){
			if(g % i) continue;
			ans.push_back(i);
			while(g % i == 0) g /= i;
		}
		if(g != 1) ans.push_back(g);
	}


	rep(p, 2, n + 1){
		if(prime[p] == false) continue;
		vector<int> coef = a;
		const int step = p - 1;

		rep(i, n + 1){
			const int ni = i + step;
			if(ni >= n) break;
			coef[ni] += coef[i];
			coef[i] = 0;
		}

		int g = 0;
		rep(i, n + 1) g = __gcd(g, abs(coef[i]));
		if(g % p == 0) ans.push_back(p);
	}


	sort(begin(ans), end(ans));
	ans.erase(unique(begin(ans), end(ans)), end(ans));
	for(auto &elem:ans) cout << elem << endl;

	return 0;
}

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

#define sz(s) (int)(s).size()
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin,(x).end()
#define Sor(x) sort(all(x))
#define REV(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 222222
#define MOD 100000007

using namespace std;

typedef long long ll;
vector <ll> vll;
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}

string x;
int main()
{	
	int n;
	string s;
	cin >> n;
	cin >> s;
	for (int i = 0; i < sz(s); i ++)
	{
		if (s[i] != s[i + 1])
			x += s[i];
	}
	cout << sz(x);









	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <stack>
#include <vector>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <set>
#include <limits>
#include <numeric>
#include <array>
using namespace std;

int main()
{
	string str1;
	string str2;
	getline(cin, str1);
	getline(cin, str2);
	vector<string> prev(str1.size() + 1);
	vector<string> current(prev.size());
	for (int i = 0; i < str2.size(); ++i)
	{
		for (int j = 0; j < str1.size(); ++j)
		{
			if (str1[j] == str2[i])
			{
				current[j + 1] = prev[j];
				current[j + 1] += str2[i];
			}
			else if(prev[j + 1].size() > current[j].size())
			{
				current[j + 1] = prev[j + 1];
			}
			else
			{
				current[j + 1] = current[j];
			}
		}
		prev = current;
	}


	cout << current.back();
	return 0;
}

Measured memory_bytes: 16864
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef UNICODE
#define UNICODE
#endif

#include <stdio.h>
#include <wchar.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define P second
#define SZ(X) ((int64_t)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define S1(X) scanf("%d", &(X))
#define S2(X, Y) scanf("%d%d", &(X), &(Y))
#define S3(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define P1(X) printf("%lld", (X))
#define P2(X) printf("%lld\n", (X))
#define _ printf(" ");
#define __ printf("\n");
#define LEN(X) strlen(X)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define EPS 1e-9
#define gcd(a, b) __gcd(a, b)
#define IOS ios_base::sync_with_stdio(0);
#define EACH(I, V) for (auto I : V)
#define REP(I, N) for (int64_t I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int64_t I = (A); I < (B); ++I)
#define REPPP(i, begin, end)                                                   \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

template<class T>
size_t choose(T a, T b, size_t src1, size_t src2) {
#if defined(__clang__) && defined(__x86_64)
  size_t res = src1;
  asm("cmpq %1, %2; cmovaeq %4, %0"
  :
  "=q" (res)
  :
  "q" (a),
  "q" (b),
  "q" (src1),
  "q" (src2),
  "0" (res)
  :
  "cc");
  return res;
#else
  return b >= a ? src2 : src1;
#endif
}

#define FOR(x, xs) for (__typeof( (xs).begin() ) x = (xs).begin(); x != (xs).end(); x++)

int64_t u = pow(10, 11) * 2;
int v = pow(u, 2.0 / 3);
int w = sqrt(u);

int64_t sum = 0;
vector<bool> isPrime(v + 1);

int nextPrime(int p) {
  while (!isPrime[++p]) {
  }
  return p;
}

vector<int64_t> divisors(vector<int64_t> &ps) {
  vector<int64_t> ds(1, 1), tmp; // 1 is divisor
  int64_t q = 1;
  FOR(p, ps) {
    if (*p != q) {
      tmp.clear();
      FOR(d, ds) {
        tmp.push_back(*d);
      } // tmp <- ds
    }
    FOR(t, tmp) {
      *t *= *p; // tmp <- map (p*) tmp
      ds.push_back(*t);
    }
    q = *p;
  }
  sort(ds.begin(), ds.end());
  return ds;
}

using namespace std;

int main() {

  string str;
  cin >> str;
  cout << (str == "ABC" ? "ARC" : "ABC") << '\n';
}


Measured memory_bytes: 6848
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

using namespace std;

inline ll int max(ll int a,ll int b) { return a>b?a:b; }
inline ll int min(ll int a,ll int b) { return a<b?a:b; }

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int n;
	double d;
	
	while(cin>>n>>d)
	{
		double x,y;
		
		int ans=0;
		
		for(int i=0;i<n;i++)
		{
			cin>>x>>y;
			
			if( sqrt(x*x+y*y) <= d)
			{
				ans++;
			}
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3816
(n,x,y)=gets.split.map(&:to_i)
x-=1
y-=1
tmp=(0..n-1).map{0}
(0...n).each{|i|
    (i...n).each{|k|
        a = [(x-i).abs + (y-k).abs + 1, k-i ].min
        tmp[a]+=1
    }
}

(1..n-1).each{|i|
    print tmp[i],"\n"
}

Measured memory_bytes: 1788
fun main(args: Array<String>) {
    val (n) = readLine()!!.split(' ').map(String::toInt)
    val xs = (1..n).map { readLine()!!.toInt() }
    val ret = Array(n){Int.MIN_VALUE}
    ret[0] = xs[0]
    var maxPointer = 0

    for(i in 1 until n){
        if(xs[i] <= ret[maxPointer]){
            ret[++maxPointer] = xs[i]
            continue
        }
        var max = maxPointer
        var min = 0
        val v = xs[i]
        while(max - min >= 0){
            val pos = (max + min) / 2
            val cur = ret[pos]
            if(v > cur){
                max = pos - 1
            }else{
                min = pos + 1
            }
        }
        ret[min] = v
    }
    print(maxPointer + 1)
}

Measured memory_bytes: 47284
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#include <iomanip>
#define REP(i,x,y) for(ll i=x;i<y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>x;i--)
typedef long long ll;
using namespace std;

int main(){
    ll N;
    cin>>N;
    vector<ll> A(N);
    REP(i,0,N){
        cin>>A.at(i);
    }
    ll I=0;
    ll J=0;
    ll K=0;
    REP(i,0,N){
        if (A.at(i)==1){
            I+=1;
        }
        if (A.at(i)==2){
            J+=1;
        }
        if(A.at(i)==3){
            K+=1;
        }
        
    }
    ll L,M;
    L=I+J+K;
    M=J+K;
    vector<vector<vector<double>>> dp(L+1,vector<vector<double>>(M+1,vector<double>(K+1,0)));
    REP(n,1,L+1){
        REP(m,0,min(n,M)+1){
            REP(k,0,min(m,K)+1){
                ll i,j;
                j=m-k;
                i=n-m;
                double ret=(double)N/(i+j+k);
                if (i>0){
                    ret+=dp.at(i-1).at(j).at(k)*(double)i/(i+j+k);
                }
                if (j>0){
                    ret+=dp.at(i+1).at(j-1).at(k)*(double)j/(i+j+k);
                }
                if (k>0){
                    ret+=dp.at(i).at(j+1).at(k-1)*(double)k/(i+j+k);
                }
                dp.at(i).at(j).at(k)=ret;
            }
        }
    }
    cout<<setprecision(12)<<dp.at(I).at(J).at(K)<<endl;
    
    
    
}






Measured memory_bytes: 216832
#include <iostream>
#include <algorithm>
#include <queue>

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

int t[100000], d[100000];
vector<P> p;
vector<int> v[100000];

int main(){
    int N, K;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> t[i] >> d[i];
        t[i] --;
        p.push_back(P(d[i], t[i]));
    }
    sort(p.begin(), p.end(), greater<P>());
    int cnt = 0;
    priority_queue<P, vector<P>, greater<P>> que;
    ll ans = 0;
    for(int i = 0; i < K; i++){
        if(v[p[i].second].size() == 0){
            cnt++;
        }else{
            que.push(p[i]);
        }
        ans += p[i].first;
        v[p[i].second].push_back(p[i].first);
    }
    ans += (ll)cnt*cnt;
    ll out = ans;
    int cur = K;
    for( ; cur < N; cur++){
        if(que.empty()) break;
        int idx = p[cur].second;
        if(v[idx].size() == 0){
            P top = que.top();
            que.pop();
            v[idx].push_back(p[cur].first); 
            cnt++;
            ans += 2*cnt-1;
            ans -= top.first;
            ans += p[cur].first;
            out = max(ans, out);
        }
    } 
    cout << out << endl;
}

Measured memory_bytes: 6644
def main():
    n = int(input())
    f = []
    for _ in range(n):
        x = [int(s) for s in input().split()]
        p = 0
        for y in x:
            p <<= 1
            p |= y
        f.append(p)
    p = [[int(s) for s in input().split()] for _ in range(n)]
    print(solve(n, f, p))

def solve(n, f, p):
    m = float('-inf') 
    for i in range(1, 1024):
        q = 0
        for j in range(n):
            c = ones(f[j] & i)
            q += p[j][c]
        m = max(m, q)
    return m

def ones(n):
    m = 0
    while n != 0:
        if n & 0x01 != 0:
            m += 1
        n >>= 1
    return m

main()


Measured memory_bytes: 3064
def main():
    s = input()
    if s == 'SSS':
        print(0)
    elif s == 'SRR':
        print(2)
    elif s == 'SSR':
        print(1)
    elif s == 'SRS':
        print(1)
    elif s == 'RSS':
        print(1)
    elif s == 'RSR':
        print(1)
    elif s == 'RRS':
        print(2)
    elif s == 'RRR':
        print(3)
        
if __name__ == '__main__':
    main()



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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front ///for list
#define     mp             make_pair
#define     is             insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));



int main()
{
	int n,q,l,r,ac=0;
	string str;
	cin>>n>>q>>str;
	int pre[n+5];
	mem(pre,0);
	for(int i=0;i<n;){
		if(str[i]=='A'&&str[i+1]=='C'){
			ac++;
			pre[i+2]=ac;
			pre[i+1]=ac-1;
			i+=2;
		}
		else{
			pre[i+1]=ac;
			i++;
		}
	}
	/*for(int i=1;i<=n;i++)cout<<pre[i]<<" ";
	cout<<endl;*/
	while(q--){
		cin>>l>>r;
		cout<<pre[r]-pre[l]<<endl;
	}
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vector<int>a,b,c;
  int x,y,z;
  while(1){
    cin >> x >> y >> z;
    if(x==0&&y==0&&z==0)break;
    a.push_back(x-1);
    b.push_back(y-1);
    c.push_back(z);
  }
  int l;
  cin >> l;
  vector<int>d(m);
  for(int i=0;i<l;i++){
    vector<int>co(n,0);
    for(int j=0;j<m;j++){
      int bu;
      cin >> bu;
      d[j]=bu;
    }
    for(int j=0;j<a.size();j++){
      co[a[j]]+=d[b[j]]*c[j];
    }
    for(int j=0;j<n;j++){
      cout << co[j] ;
      if(j+1!=n){
	cout << ' ';
      }
    }
    cout << endl;
  }
  return 0;
}

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

int main()
{
            lint n;cin>>n;
            vector<lint >arr(n+1);
            lint i=1;
            for(i;i<=n;i++)
            cin>>arr[i];
            arr[0]=0;
            for(i=1;i<=n;i++)
            {
                  arr[i]+=arr[i-1];
            }
           unordered_map<lint,lint>mp;
           
           arr[0]=0;
           for(i=0;i<=n;i++)
           mp[arr[i]]++;
           
           lint ans=0;
           lint tt;
           unordered_map<lint,lint>::iterator it;
           
           for(it=mp.begin();it!=mp.end();it++)
           {
              tt=it->second;
              ans+=(tt*(tt-1))/2;
           }
            cout<<ans<<endl;
      return 0;
}

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

int main(){
  ll a;
  double b;
  cin >> a >> b;
  ll bi = b * 100 + 0.5;
  a *= bi;
  a /= 100;
  cout << a << endl;
  return 0;
}

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

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
*/

using namespace std;

#if DEBUG && !ONLINE_JUDGE
    #include "debug.h"
#else
    #define debug(...)
#endif

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vector<int> > vvi;
typedef vector<vector<ii> > vvii;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define ff first
#define ss second
#define trav(a, x) for(auto& a : x) 
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
const ll INF = 1e18;
const int mod =  1e9 + 7;
const int N = 1e5;
ll gcd(ll a,ll b){if (a==0) return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return a*(b/gcd(a,b));}
ll Abs(ll a){if(a>0)return a;return -a;}
ll Ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
double Abs(double a){if(a>0)return a;return -a;}

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
*/

inline int pow_(ll x, ll y,ll p){
  int r = 1; while(y){if(y & 1) r = r * x % p; y >>= 1; x = x * x % p;} return r;
}
inline int inv_(int x){return pow_(x, mod - 2, mod);}
inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int mul(int a, int b){return a * 1LL * b % mod;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}



int main()
{
	#ifdef LOCAL_TEST
    freopen("in.txt","r",stdin);
    //freopen("out.txt", "w", stdout);
    #else
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #endif
   	ll n;
   	cin>>n;
   	ll f = 1;
   	if(n%2)f = 0;
   	ll a[3005] = {0};
   	ll sum[3005] = {0};
   	for(int i=1;i<=n;i++)
   	{
   		cin>>a[i];
   		sum[i] = a[i] + sum[i-1];
   	}

   	ll dp[3005][3005] = {0};
   	for(int i=1;i<=n;i++)
   	{
   		dp[i][i] = a[i];
   	}

   	for(int l=1;l<=n;l++)
   	{
   		for(int i=1;i<=n-l;i++)
   		{
   			int j = i+l;
   			dp[i][j] = max(a[i] + ((sum[j]-sum[i])-dp[i+1][j]) , a[j] + ((sum[j-1]-sum[i-1])-dp[i][j-1]));
   		}
   	}

   	cout << 2*dp[1][n]-sum[n] << "\n";

	return 0;
}

Measured memory_bytes: 70912
using System;
namespace inonoa{
    class Main1{
        static void Main(){
            int n = int.Parse(Console.ReadLine());
            int[] a= new int[n];
            int i = 0;
            foreach(string s in Console.ReadLine().Split(' ')){
                a[i] = int.Parse(s);
                i++;
            }

            if(n==2){
                if(a[0]>a[1]){Console.WriteLine(a[0]);return;}
                else{Console.WriteLine(a[1]);return;}
            }
            
            int[] gcd_l = new int[n];
            int[] gcd_r = new int[n];
            gcd_l[0] = a[0];
            gcd_r[n-1] = a[n-1];
            gcd_l[1] = Gcd(a[0],a[1]);
            gcd_r[n-2] = Gcd(a[n-1],a[n-2]);
            for(int j=2;j<n;j++){
                gcd_l[j] = Gcd(a[j],gcd_l[j-1]);
                gcd_r[n-j-1] = Gcd(a[n-j-1],gcd_r[n-j]);
            }

            int ans = 0;
            int t_ans;

            for(int j=0;j<n;j++){
                if(j==0){
                    t_ans = gcd_r[1];
                    if(t_ans>ans)ans=t_ans;
                }else if(j==n-1){
                    t_ans = gcd_l[n-2];
                    if(t_ans>ans)ans=t_ans;
                }else{
                    t_ans = Gcd(gcd_l[j-1],gcd_r[j+1]);
                    if(t_ans>ans)ans=t_ans;
                }
            }
            Console.WriteLine(ans);
        }
        static int Gcd(int b, int c){
            if(b>c){
                while(true){
                    b = b%c;
                    if(b==0){
                        return c;
                    }
                    c = c%b;
                    if(c==0){
                        return b;
                    }
                }
            }else{
                while(true){
                    c = c%b;
                    if(c==0){
                        return b;
                    }
                    b = b%c;
                    if(b==0){
                        return c;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 27868
#include <stdio.h>

int main(){
    float x, y, x1, x2;
    int aux1, aux2;
    scanf("%f%f", &x, &y);

    float m[2][3] = {{1, 1, x}, {2, 4, y}};
    float k = m[1][0]/m[0][0];

    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 3; j++){
            if(i == 1){
                m[1][j] = (m[1][j] - (k*m[0][j]));
            }
        }
    }

    x2 = m[1][2]/m[1][1];
    aux2 = x2;
    x1 = (m[0][2] - (m[0][1]*x2))/m[0][0];
    aux1 = x1;

    if(x2 == aux2 && x1 == aux1 && 4*x >= y && y >= 2*x){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 1748
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define exists(s,x) (s).find(x)!=(s).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define fi first
#define se second
typedef long long ll;
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

inline ll add(ll x, ll y) {return (x+y)%MOD;}
inline ll mul(ll x, ll y) {return (x*y)%MOD;}
inline ll sub(ll x, ll y) {
    ll res = x - y;
    if(res < 0) res += MOD;
    return res;
}
inline ll modpow(ll x, ll y) {
    ll res = 1;
    while(y) {
        if(y&1) res = mul(res,x);
        y >>= 1;
        x = mul(x,x);
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int k, q; cin >> k >> q;
    vector<ll> d(k);
    REP(i,k) cin >> d[i];
    while(q--) {
        ll n, x, m; cin >> n >> x >> m;
        vector<ll> v(d);
        REP(i,k) v[i] %= m;
        ll s = 0;
        REP(i,k) s += v[i];
        ll kyori = ((n-1)/k) * s + x%m;
        REP(i,(int)(n-1)%k) kyori += v[i];
        ll kaisuu = kyori / m;
        ll cnt = 0;
        REP(i,k) if(v[i]==0) cnt ++;
        ll tmp = cnt * ((n-1)/k);
        REP(i,(int)(n-1)%k) if(v[i]==0) tmp++;
        ll ans = n-1 - kaisuu - tmp;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int length = sc.nextInt(), q = sc.nextInt();
		String s = sc.next();
		
		int[] pSum = new int[length];
		
		for (int i = 1; i < length; i++) {
			pSum[i] = pSum[i - 1];
			if (s.charAt(i - 1) == 'A' && s.charAt(i) == 'C') pSum[i]++;
		}
		
		for (int i = 0; i < q; i++) {
			int l = sc.nextInt() - 1, r = sc.nextInt() - 1;
			
			if (l == 0) System.out.println(pSum[r]);
			else System.out.println(pSum[r] - pSum[l]);
		}
		

	}
}

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

#define fo1(i, n) for (int i = 0; i < n; i++)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
using ll = long long; using vi = vector<int>; using ii = pair<int,int>;
const int oo = 0x3f3f3f3f; const ll OO = ll(oo)*oo;
#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif
const int N = 100005;

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

    int n; cin >> n;
    string s; cin >> s;

    if (n& 1) {
        cout << "No" << endl;
        return 0;
    }

    fo1(i, n/2) {
        if (s[i] != s[i+n/2]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef pair<int,int> pii;
typedef long long int ll; 
typedef tree<pii,null_type,less<pii>,rb_tree_tag, \
tree_order_statistics_node_update> ordered_set;

#define int ll   
#define long int
#define pb push_back
#define all int i=0; i<n; i++
#define INF LLONG_MAX

#define Nirvana ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define mod 1000000007
#define pii pair<int, int> 
long expo(long base, long exp) 
{ 
    long t = 1L; 
    while (exp > 0)  
    { 
        if (exp % 2 != 0)  t = (t * base); 
        base = (base * base) ; 
        exp /= 2; 
    } 
    return t; 
} 
#define pow expo
#define pi acos(-1.00)

int dig(int n){
	int cur = 0;
	while(n!=0){
		cur++;
		n/=10;
	}
	return cur;
}

int f(int i){
	string s = to_string(i);
	return int(s[0] - '0');
}
int l(int i){
	string s = to_string(i);
	return int(s[s.length()-1] - '0');
}
int32_t main(){
	
	//cout<<calc(2, 2, 3)<<endl;
	int n;
	cin>>n;

	
	int num = dig(n);
	//cout<<num<<endl;
	int ans = 0;
	for(int i=1; i<=n; i++){
		//int k = i;
		if(i%10 == 0)continue;
		string s = to_string(i);
		//reverse(s.begin(), s.end());
		
		int first = int(s[0] - '0');
		int last = int(s[s.length()-1] - '0');
		if(last==0 || first==0)continue;
		
		if(first == last){
			ans++;
			//cout<<i<<endl;
		}
	
		for(int i=2; i<=num-1; i++){
			ans+=pow(10, i-2);
		}
		if(num==1)continue;
		
		if(f(n) < last)continue;
		
		if(f(n) > last){
			ans+=pow(10, num-2);
		}
		
		if(f(n)==last){
			int k = n;
			while(true){
				if(l(k) == first || k==0)break;
				k--;
			}
			if(k==0 || f(k)!=last || dig(k)<dig(n))continue;
			
			int cont = 0;
			string s= to_string(k);
			for(int j=1; j<s.length()-1; j++){
				cont*=10;
				cont+=int(s[j]-'0');
			}
			ans+=cont+1;
		}
	
	}
	cout<<ans<<endl;
}


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}

int main() {
    int i,n,m,k,c=0,sum=0;
    c_p_c();

 	string s;
 	cin>>s;
 	int s1,e;
 	// watch(s);
 	for (int i = 0; i < (int)s.size(); ++i)
 	{
 		/* code */
 		if(s[i]=='A'){
 			s1=i;
 			break;
 		}
 	}
 	// watch(s1);
 	n=(int)s.size();
 	for (int i = n-1; i>=0; --i)
 	{
 		/* code */
 		if(s[i]=='Z'){

 			e=i;
 			break;
 		}
 		// cout<<s[i];

 	}
 	// watch(e);
 	// watch2(s1,e);
 	cout<<e-s1+1<<endl;


 	return 0;

   }

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

#define debug(x) cerr << #x << ": " << x << endl;

#define iosbase ios_base::sync_with_stdio(false)
#define tie cin.tie();cout.tie();

#define endl '\n'

typedef pair<int, int> ii;
typedef long long ll;

int n, m;
int main(){
  iosbase;
  tie;

  string s;
  cin >> s;

  s = ' ' + s;
  bool flag = true;

  for(int i = 1 ; i < s.size(); i++){
    if(i & 1){
      if(s[i] == 'L') {
        flag = false;
        break;
      }
    }else{
      if(s[i] == 'R'){
        flag = false;
        break;
      }
    }
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
S = input()
if S == "SUN":
  print(7)
elif S == "MON":
  print(6)
elif S == "TUE":
  print(5)
elif S == "WED":
  print(4)
elif S == "THU":
  print(3)
elif S == "FRI":
  print(2)
else:
  print(1)

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

using namespace std;

int main(){
    char c1,c2;
    int y,m,d;

    cin >> y >> c1 >> m >> c2 >> d;

    if(m <= 4 && d <= 30)cout << "Heisei" << endl;
    else cout << "TBD" << endl;



    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,d,x,a[100],i,sum=0;
  scanf("%d",&n);
  scanf("%d %d",&d,&x);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(d%a[i]==0) sum+=d/a[i];
    else sum+=d/a[i]+1;
  }
  sum+=x;
  printf("%d\n",sum);
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string.h>

#define N_MAX 20

using namespace std;

double f[N_MAX][N_MAX];
int sele[N_MAX];
double sum;
double MAX;
int n;
int m;

void dfs(int color,int count);

int main(void)
{

	int i1,i2,i3;
	double c[20][3];

	cin>>n>>m;
	for(i1=0;i1<n;i1++){
		for(i2=0;i2<3;i2++){
			cin>>c[i1][i2];
		}
	}

	memset(f,0,sizeof(f));
	for(i1=0;i1<n;i1++){
		for(i2=i1;i2<n;i2++){
			for(i3=0;i3<3;i3++){
				f[i1][i2]+=((c[i1][i3]-c[i2][i3])*(c[i1][i3]-c[i2][i3]));
			}
		}
	}

	MAX=0;
	dfs(0,0);
	printf("%lf\n",MAX);
	return 0;	
}

void dfs(int color,int count)
{
	int i1,i2;
	if(count==m){
		sum=0;
		for(i1=0;i1<m-1;i1++){
			for(i2=i1;i2<m;i2++){
				sum+=f[sele[i1]][sele[i2]];
			}
		}
		if(MAX<sum) MAX=sum;
	}
	//else if(color>=n) return;
	else{
		for(i1=color;i1<n;i1++){
			sele[count]=i1;
			dfs(i1+1,count+1);
		}
	}
}

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

using namespace std;

int main(void){
    int n, m;
    cin >> n;
    set<int> data;
    for(int i = 0; i < n; i++){
        cin >> m;
        if(data.count(m)){
            cout << "NO" << endl;
            return 0;
        }
        data.insert(m);
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>

enum {
	B = 4,
	F = 3,
	R = 10,
};

int
main()
{
	//       [b][f][r]
	int rooms[B][F][R] = {0};
	int b, f, r, v;

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

	int i;
	for (i = 0; i < n; i++)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		rooms[b-1][f-1][r-1] += v;
		if (rooms[b-1][f-1][r-1] < 0)
			rooms[b-1][f-1][r-1] = 0;
	}

	for (b = 0; b < B; b++)
	{
		if (b != 0)
		{
			printf("####################\n");
		}

		for (f = 0; f < F; f++)
		{
			for (r = 0; r < R; r++)
			{
				printf(" %d", rooms[b][f][r]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
text = gets.chomp
n = text.length
hels = ['A', 'T', 'G', 'C']
max = 0

n.times do |i|
    tmp = 0
    (i...n).each do |j|
        if hels.include?(text[j])
            tmp += 1
        else
            break
        end
    end
    max = tmp if max<tmp
end

p max

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

int main(){
  int n;
  cin >> n;
  VI p(n);
  rep(i,n) cin >> p[i];
  
  int cnt=0;
  int min=n+1;
  rep(i,n){
    if(p[i] < min){
      cnt++;
      min = p[i];
    }
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 1024
/**
 * @Author:      G_bg
 * @DateTime:    2019-04-27 21:25:33
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn=1e5+10;
int a[maxn];
int main(int argc, char const *argv[]) {
    ios::sync_with_stdio(0);cin.tie(0);
    int n;cin >> n;
    int sum_ = 0;
    int mi = INF;
    LL ans = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        if(a[i] < 0) sum_++;
        ans += abs(a[i])*1LL;
        mi = min(mi,abs(a[i]));
    }
    if(sum_ & 1) ans -= 2*mi;
    cout << ans << endl;
    //system("pause");
    return 0;
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    vector<int> res(N, 0);
    int prev = -1;
    for(int i=0; i<N; ++i) {
        if(i + 1 < N && S[i] != S[i + 1]) {
            int cnt = i - prev;
            if(S[i] == 'R') {
                res[i] += cnt / 2 + cnt % 2;
                res[i + 1] += cnt / 2;
            } else {
                res[prev] += cnt / 2;
                res[prev + 1] += cnt / 2 + cnt % 2;
            }
            prev = i;
        } else if(i + 1 == N) {
            int cnt = N - 1 - prev;
            res[prev] += cnt / 2;
            res[prev + 1] += cnt / 2 + cnt % 2;
        }
    }

    for(int i=0; i<N; ++i) cout << res[i] << (i + 1 == N ? '\n' : ' ');
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	Int lenS = S.size();
	char temp = S[0];
	
	vector<Int> a;
	Int cnt = 1;
	for (Int i =1; i < lenS; i++) {
		if (S[i] == temp)cnt++;
		else {
			a.push_back(cnt);
			temp = S[i];
			cnt = 1;
		}
	}
	a.push_back(cnt);

	Int lena = a.size();

	vector<Int> sub(5 * 100000 + 1);
	for (Int i = 0; i < 5*100000; i++) {
		sub[i + 1] = sub[i] + i+1;
	}
	
	Int ans = 0;
	if (S[0] == '<') {
		for (Int i = 0; i < lena/2; i++) {
			if (a[2 * i] - a[2 * i + 1] < 0) {
				//ans += sub[a[2 * i] - 1] + sub[a[2 * i + 1]] + (a[2 * i + 1] + 1) * (a[2 * i + 1] - a[2 * i]);
				ans += sub[a[2 * i + 1]] + sub[a[2 * i] - 1];
			}
			else {
				ans += sub[a[2 * i]] + sub[a[2 * i + 1] - 1];
			}
		}
		if (lena % 2) {
			ans += sub[a[lena - 1]];
		}
		cout << ans << "\n";

	}
	else {

		ans += sub[a[0]];

		for (Int i = 0; i < (lena+1) / 2-1; i++) {
			if (a[2 * i+1] - a[2 * i + 2] < 0) {
				//ans += sub[a[2 * i] - 1] + sub[a[2 * i + 1]] + (a[2 * i + 1] + 1) * (a[2 * i + 1] - a[2 * i]);
				ans += sub[a[2 * i + 2]] + sub[a[2 * i+1] - 1];
			}
			else {
				ans += sub[a[2 * i+1]] + sub[a[2 * i + 2] - 1];
			}
		}
		if (lena % 2==0) {
			ans += sub[a[lena - 1]];
		}
		cout << ans << "\n";

	}

}


Measured memory_bytes: 7188
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){
    int n; cin >> n;
    unordered_map<string, int> ss;
    for(int i=0; i<n; ++i){
        string s; cin >> s;
        ++ss[s];
    }
    int m; cin >> m;
    unordered_map<string, int> ts;
    for(int i=0; i<m; ++i){
        string s; cin >> s;
        ++ts[s];
    }
    int ans=0;
    for(auto& p : ss){
        int score=p.second;
        if(ts.find(p.first)!=ts.end()) score-=ts[p.first];
        ans=max(ans, score);
    }
    cout << ans << 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 rep1(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

int main(){
  int x;
  cin >> x;
  if(x>=1200)cout << "ARC" << endl;
  else cout << "ABC" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007

void dfs(int s, Graph &G, vector<int> &prev, vector<int> &visited){
    visited[s] = 1;
    if(G[s].size() != 1 or s == 0){
        int idx = 0;
        for(auto v:G[s]){
            if(visited[v]) idx++;
            else break;
        }
        if(idx != G[s].size()){
            int v = G[s][idx];
            prev[s] = v;
            visited[v] = 1;
            dfs(v, G, prev, visited);
        }
    }
}   

int main(){
    int N, M;
    cin >> N >> M;
    Graph G(N);
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> prev(N, 0);
    vector<int> visited(N, 0);
    vector<int> ans1;
    dfs(0, G, prev, visited);
    int v = 0;
    ans1.push_back(0);
    while(true){
        int n_v = prev[v];
        v = n_v;
        if(v == 0) break;
        ans1.push_back(n_v);
    }
    for(int i = 0; i < N; i++) prev[i] = 0;
    vector<int> ans2;
    dfs(0, G, prev, visited);
    while (true){
        int n_v = prev[v];
        v = n_v;
        if (v == 0) break;
        ans2.push_back(n_v);
    }
    reverse(ans2.begin(), ans2.end());
    int ans = ans1.size() + ans2.size();
    cout << ans << endl;
    for(int i = 0; i < ans2.size(); i++){
        cout << ans2[i] + 1 << ' ';
    }
    for (int i = 0; i < ans1.size(); i++){
        if (i == ans1.size() - 1) cout << ans1[i] + 1 << endl;
        else cout << ans1[i] + 1 << ' ';
    }
}

Measured memory_bytes: 10180
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	String str=scan.next();
	int ans=0;
	for(int i=1;i<str.length();i++) {
		int count=0;
		String A=str.substring(0,i);
		String B=str.substring(i,str.length());
		for(char c='a';c<='z';c++) {
			String S=String.valueOf(c);
			if(A.indexOf(S)!=-1&&B.indexOf(S)!=-1) {
				count++;
			}
		}
		if(ans<count) {
			ans=count;
		}
	}
	System.out.println(ans);
	scan.close();
}
}

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

int main(){
   int n, m;
   cin >> n >> m;

   vector<int> x(n+1);
   vector<int> y(m+1);

    cin >> x.at(0) >> y.at(0);

   for(int i = 1; i < n+1; i++){
       cin >> x.at(i);
   }
   for(int i = 1; i < m+1; i++){
       cin >> y.at(i);
   }


   sort(x.begin(),x.end());
   sort(y.begin(),y.end());

   if (y.at(0) > x.at(n)){
       cout << "No War" << endl;
   }
   else{
       cout << "War" << endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
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; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, K;
vi D;

int main(){
    cin >> N >> K;
    D.resize(K);
    rep(i, K) cin >> D[i];

    vector<char> forbidden;
    rep(i, K) forbidden.push_back(D[i] + '0'); 

    rep(n, N, 100000){
        string s = to_string(n);
        bool allowed = true;
        rep(i, K) if (s.find(forbidden[i]) != string::npos) allowed = false;

        if (allowed) {
            write(n);
            return 0;
        }
    }
}

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

int main(){
    int n;
    string S,T;
    cin>>n>>S>>T;
    for(int i=0;i<n;i++){
        string s=S.substr(i,n-i);
        string t=T.substr(0,n-i);
        if(s==t){
            cout<<2*n-(n-i)<<endl;
            return 0;
        }
    }
    cout<<2*n<<endl;
}

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

using namespace std;

const int N = 123;
int A[N];

int main(){
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n + n; i++){
		scanf("%d", A + i);
	}
	sort(A, A + n + n);
	int ans = 0;
	for (int i = 1; i < n + n; i+=2){
		ans += min(A[i], A[i - 1]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools

#Union-Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

n,m,k = map(int,input().split())
Fri = [list(map(int, input().split())) for i in range(m)]
Bro = [list(map(int, input().split())) for i in range(k)]
dir = [0]*n
ans = [0]*n
temp = 0

ufF = UnionFind(n)

for i in range(m):
    ufF.union(Fri[i][0]-1, Fri[i][1]-1)
    dir[Fri[i][0]-1] += 1
    dir[Fri[i][1]-1] += 1

for i in range(k):
    if(ufF.same(Bro[i][0]-1, Bro[i][1]-1)):
        ans[Bro[i][0]-1] -= 1
        ans[Bro[i][1]-1] -= 1

for i in range(n):
    ans[i] += ufF.size(i) - 1 - dir[i]
    if(ans[i]<0):
        ans[i] = 0

L=[str(a) for a in ans]
L=" ".join(L)
print(L)


Measured memory_bytes: 126420
import numpy as np

N,M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]
order = [[] for _ in range(N)]
for p,y in X:
    order[p-1].append(y)
#X = np.array(X, dtype=int)
for i in range(N):
    order[i] = np.argsort(np.argsort(order[i]))
cnts = [0 for _ in range(N)]
for i in range(M):
    p = X[i][0]
    print('{:06}{:06}'.format(p, order[p-1][cnts[p-1]]+1) )
    cnts[p-1] += 1

Measured memory_bytes: 56728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 +7;
const ll MAXN = 1e6 + 5;

ll p=mod;

inline ll qpow(ll a,ll b){
	ll base=a%p;
	ll ans=1;
	while(b){
		if(b&1) ans=(ans*base)%p;
		base=base*base%p;
		b>>=1;
	}
	return ans;
}

inline ll C(ll n,ll m){
	if(n<m) return 0;//组合数n<m特判
	if(m>n-m) m=n-m;//组合数性质
	ll a=1,b=1;
	for(int i=0;i<m;i++){
		a=(a*(n-i)%p);//组合数分子 a 
		b=(b*(i+1))%p;//组合数分母 b
	} 
	return a*qpow(b,p-2)%p;//费马小定理 a/b=a*b^(p-2) 
}

inline ll Lucas(ll n,ll m){
	if(m==0) return 1;
	return Lucas(n/p,m/p)*C(n%p,m%p)%p;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,a,b;
	cin>>n>>a>>b;
	cout<<(mod+qpow(2,n)-1-(C(n,a)+C(n,b))%mod)%mod;
	return 0;
}


Measured memory_bytes: 256