akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
        using namespace std;
        #define mod 1000000000000000000
        #define MOD 		1000000007
        #define ll long long
        #define ull unsigned ll
        #define mp 		make_pair
        #define pb 		push_back
        #define forn(i,n) 	for(ll i=0;i<n;i++)
        #define for1(i,n) 	for(ll i=1;i<=n;i++)
        #define forn1(i,n) 	for(int i=1;i<n;i++)
        #define rep(i,x,n)  for(ll i=x;i<=n;i++)
        #define repr(i,x,j) for(ll i=x;i>=j;i--)
        #define vi vector<ll>
        #define mii map<ll,ll>
        #define vii vector<pair<int,int>>
        #define vvi vector<vector<ll>>
        #define pii pair<ll,ll>
        #define F first
        #define S second
        #define fill(a,x) memset(a,x,sizeof a);
        #define all(x) x.begin(),x.end()
        #define test ll t;cin>>t;while(t--)
        #define yes cout<<"Yes"<<endl
        #define no cout<<"No"<<endl
        #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        ll flag[1000000];
        #define R return 0
   
        int main()
        {
            IOS;
            ll a,b,c;
            cin>>a>>b>>c;
            if(b*c>=a)
            yes;
            else 
            no;
            R;
        }

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

int main(){
    long long N, sum_=0L;
    cin >> N;
    for (int i = 1; i < N+1; i++) {
        if (i % 3 != 0 && i % 5 != 0) { sum_ += i; }
    }
    cout << sum_ << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <algorithm>
// #include <atcoder/all>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
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;
}

long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// v ector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
// vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(w + 1,
// vector<int>(k+1, 0)));

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int mx = *max_element(all(a));
    int mn = *min_element(all(a));
    print(abs(mx-mn));

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N;

vector<long long int> A, B;

long long int C[400000];

int p, q;

int main(void) {

	cin >> N;
	long long int tmp;
	for (int i = 1; i <= N; i++) {
		cin >> tmp;
		A.push_back(tmp);
	}

	sort(A.begin(), A.end());

	int p = 0; 
	int q = N - 1;


	long long int TOTAL = A[p++];
	long long int T1 = A[0];
	long long int T2 = A[0];

	long long int ans1 = 0;
	int count = 1;
	while (p<=q) {
		//cout << ans1 << endl;
		if (p == q) { ans1 += max(abs(A[p] - T1), abs(A[p] - T2)); p++; q--; break; }
		if (count % 2 == 1) {
			ans1 += abs(T1+T2 - A[q] - A[q - 1]);
			T1 = A[q]; T2 = A[q - 1]; q -= 2;
			TOTAL = T1 + T2;
		}
		else {
			ans1 += abs(T1+T2 - A[p] - A[p + 1]);
			T1 = A[p]; T2 = A[p + 1]; p += 2;
			TOTAL = T1 + T2;
		}
		count++;
	}

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

	p = 0; q = N - 1;
	 TOTAL = A[q--];
	 T1 = A[N-1];
      T2 = A[N-1];

	long long int ans2 = 0;
	  count = 1;
	while (p<=q) {
		//cout << ans2 << endl;
		//cout << "T1= " << T1 << "  T2= " << T2 << endl;
		if (p == q) { ans2 += max(abs(A[p] - T1), abs(A[p] - T2)); p++; q--; break; }
		if (count % 2 == 0) {
			//cout << " q  " << endl;
			ans2 += abs(T1 + T2 - A[q] - A[q - 1]); //cout << "ans2=      " <<ans2<< endl;
			T1 = A[q]; T2 = A[q - 1]; q -= 2;
			TOTAL = T1 + T2;
		}
		else {
			//cout << " p  " << endl; cout << "ans2=      " << ans2 << endl;
			ans2 += abs(T1+T2 - A[p] - A[p + 1]);// cout << "      " << T1 + T2 - A[q] - A[q - 1] << endl;
			T1 = A[p]; T2 = A[p + 1]; p += 2;
			TOTAL = T1 + T2;
		}
		count++;
	}

	




	cout << max(ans1,ans2) << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 1400
N, M = list(map(int, input().split()))
T = [0] * (M)
for i in range(N):
    A = list(map(int, input().split()))
    for j in range(1, len(A)):
        T[A[j] - 1] += 1

ans = 0
for i in range(M):
    if T[i] == N:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  ll n;cin>>n;
  ll a[n];
  map<ll,ll> b,c;
  rep(i,n){
    cin>>a[i];
    b[a[i]+i]++;
    if(i-a[i]>=0) c[i-a[i]]++;
    
  }
  ll ans=0;
  for(auto x:b){
    ans+=x.se*c[x.fi];
  }
  cout<<ans<<endl;
}
  


Measured memory_bytes: 30560
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    S = input()
    for i in range(len(S)):
        if i % 2 == 0:
            if S[i] == 'L':
                print('No')
                return
        else:
            if S[i] == 'R':
                print('No')
                return
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String u, nl = System.getProperty("line.separator");
		StringBuilder 
			p = new StringBuilder(1000),
		  	d = (new StringBuilder(100)).append(".."),
		  	s = (new StringBuilder(100)).append("##"),
		  	k = new StringBuilder(100);
		Scanner r = new Scanner(System.in);
		int h, w, ww = 0;
		while (4 > ww++) {
			d.append(d);
			s.append(s);
		}
		ww = d.length();
		while (0 != ((h = r.nextInt()) | (w = r.nextInt()))) {
			while (w > ww) {
				d.append(d);
				s.append(s);
				ww += ww;
			}
			p.append(u = s.substring(0, w)).append(nl);
			k.setLength(0);
			k.append(d.substring(0, w)).append(nl)
			.replace(0, 1, "#").replace(w - 1, w, "#");
			while (2 < h--) {
				p.append(k);
			}
			p.append(u).append(nl).append(nl);
		}
		System.out.print(p);
	}
}

Measured memory_bytes: 18384
N, M = map(int, input().split())
nC2 = int(N * (N - 1) / 2)
mC2 = int(M * (M - 1) / 2)

if N == 1 and M == 1 :
    ans = 0
elif N > 1 and M == 1 :
    ans = nC2
elif N == 1 and M > 0 :
    ans = mC2
else :
    ans = nC2 + mC2

print(ans)


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int s(long long n) {
    int s = 0;
    while (n != 0) {
        s += n % 10;
        n /= 10;
    }
    return s;
}

double f(long long n) {
    return (double)n / s(n);
}

int main() {
    long long k;
    cin >> k;

    long long num = 1;
    long long base = 1;
    for (long long i = 1; i <= k; i++) {
        cout << num << endl;
        double next1 = f(num + base);
        double next2 = f(num + base * 10);
        if (next1 > next2) {
            base *= 10;
        }
        num += base;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    int a, b;
    cin >> a >> b;
    cout << ((a*b%2)?"Odd" :"Even") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//ユークリッドの互除法
//最大公約数
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

//最小公倍数
ll lcm(ll x, ll y){
	ll g = gcd(x,y);
	return x/g*y;
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main() {
	int n;cin>>n;
	vector<int> v(n);
	rep(i,n){
		cin>>v[i];
	}
	sort(all(v));
	double ans = 0;
	rep(i,n){
		if(i==0){
			ans = v[i];
		}else{
			ans = (ans+v[i])/2;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x, y; cin >> x >> y;
  if(x % y == 0) {
    cout << -1 << endk;
  } else {
    cout << x * (y-1) << endk;
  }
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main() {
  int age, price;
  cin >> age >> price;
  if (age >= 13) {
    cout << price << endl;
  } else if (6 <= age && age <= 12) {
    cout << price / 2 << endl;
  } else {
    cout << 0 << 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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*
    s.find_by_order(k) ---> returns iterator to the element at index(from 0) k
    s.order_of_key(val) ---> number of elements that are strictly smaller than the given value
*/
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int tc; cin >> tc; cin.ignore(); while(tc--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}

ll h, n;
vll a;
bool vis[100005];
ll dp[100005];

ll solve(ll ind){
    if(ind>=h){
        return 0ll;
    }
    if(vis[ind]){
        return dp[ind];
    }
    vis[ind] = 1;
    ll x = 1e18;
    for(auto i:a){
        x = min(x, i.ss+solve(ind+i.ff));
    }
    return dp[ind] = x;
}

int main() {
	fast();

    /*NA – JEONG – MO – SA – JI – MI – DA – CHAE – TZU*/
    
    cin >> h >> n;
    a.resize(n);
    for(int i=0; i<n; i++){
        cin >> a[i].ff >> a[i].ss;
    }
    cout << solve(0);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
 map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main() {
 long long int n; cin >> n;
  int ans=0;
  for(auto p : prime_factor(n)) {
    for(int i=1;p.second>=i;i++){
      ans++;
      p.second-=i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> even, odd;
    rep(i,n){
        int a;
        cin >> a;
        if(i%2 == 0) even[a]++;
        else odd[a]++;
    }
    int em = 0, om = 0, em2 = 0, om2 = 0, e1 = -1, o1 = -1;
    for(auto p : even){
        if(p.second > em){
            em2 = em;
            em = p.second;
            e1 = p.first;
        }
        else if(p.second > em2){
            em2 = p.second;
        }
    }
    for(auto p : odd){
        if(p.second > om){
            om2 = om;
            om = p.second;
            o1 = p.first;
        }
        else if(p.second > om2){
            om2 = p.second;
        }
    }
    int ans;
    if(e1 != o1){
        ans = n - em - om;
    }
    else{
        ans = min(n-em-om2, n-em2-om);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
const int MAX = 101;

int n,k,t;
vector<int> c;

int judge(){
  int max_ = -1<<28;
  for(int i = 0 ; i <= n - k ; i++){
    t = 1;
    for(int j = i ; j < i + k ; j++){
      t *= c[j];
    }
    max_ = max(max_,t);
  }
  return max_;
}

int main(){

  while(cin >> n >> k , n){
    int in;
    c.clear();

    for(int i = 0 ; i < n ; i++){
      cin >> in;
      c.push_back(in);
    }

    int tmx = judge() ,smx = -1<<28;
   

    for(int i = 0 ; i < n ; i++){
      for(int j = i + 1 ; j < n ; j++){
	swap(c[i],c[j]);
	smx = max(smx,judge());
	swap(c[i],c[j]);
      }
    }

    if(tmx > smx) cout << "NO GAME" << endl;
    else cout << smx - tmx << endl;
  }

  return 0;
}

Measured memory_bytes: 1216
import java.util.Arrays;
import java.util.PriorityQueue;

public class Main {

  private static void solve() {
    int n = ni();
    int m = ni();
    int[][] p = ntable(n, 2);

    Arrays.sort(p, (o1, o2) -> o1[0] - o2[0]);

    PriorityQueue<int[]> q = new PriorityQueue<>((o1, o2) -> o2[1] - o1[1]);
    int ptr = 0;
    long ret = 0;
    for (int i = m - 1; i >= 0; i--) {
      while (ptr < n && p[ptr][0] + i <= m) {
        q.add(p[ptr++]);
      }
      if (q.size() > 0) {
        ret += q.poll()[1];
      }
    }

    System.out.println(ret);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 46944
#include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);

    int c = 0;
    c += (a[2] - a[0]) / 2;
    c += (a[2] - a[1]) / 2;

    if( (a[2]-a[0]) % 2 and (a[2]-a[1]) % 2) {
        c++;
    }
    else if( (a[2]-a[0]) % 2 or (a[2]-a[1]) % 2) {
        c += 2;
    }
    cout << c << endl;
}


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

int main() {
  std::string s, t;

  std::cin >> s >> t;

  if (t.size() == (s.size() + 1) && std::equal(s.begin(), s.end(), t.begin())) {
    std::cout << "Yes\n";
  } else {
    std::cout << "No\n";
  }
}


Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <cassert>

#include <algorithm>

using namespace std;

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

void Main()
{
	int W, H, N;
	cin >> W >> H >> N;

	int left = 0;
	int right = W;
	int bottom = 0;
	int top = H;
	rep(i, N)
	{
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) left = max(left, x);
		else if (a == 2) right = min(right, x);
		else if (a == 3) bottom = max(bottom, y);
		else if (a == 4) top = min(top, y);
	}
	if (left >= right || bottom >= top)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << (right - left) * (top - bottom) << endl;
	}
}

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

	Main();
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define mkp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
int main()
{
	ll n,m,q;
	cin>>n>>m>>q;
	vector<int> A,B,C,D;
	for(int i=0;i<q;i++)
	{
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		a--;
		b--; 
		A.push_back(a);
		B.push_back(b);
		C.push_back(c);
		D.push_back(d);
	}
	int ma = -1234;
	for(int a=1;a<=m;a++)
		for(int b=a;b<=m;b++)
			for(int c=b;c<=m;c++)
			for(int d=c;d<=m;d++)
			for(int e=d;e<=m;e++)
			for(int f=e;f<=m;f++)
			for(int g=f;g<=m;g++)
			for(int h=g;h<=m;h++)
			for(int i=h;i<=m;i++)
			for(int j=i;j<=m;j++)
			{
				vector<int> now;
				int by = n;
				int all[10] = {a,b,c,d,e,f,g,h,i,j};
				while(by>0)
					now.push_back(all[10-by]) , by--;
				int sum = 0;
				for(int pos = 0;pos<q;pos++)
				{
					ll tmp = now[pos];
					ll p1,p2;
					p1 = now[A[pos]];
					p2 = now[B[pos]];
					if(p2-p1 == C[pos])
						sum+=D[pos]; 
				}
				ma = max(ma,sum);
			}
	cout<<ma<<endl;
	return 0; 
}


Measured memory_bytes: 3580
unittest
{
	assert( [ "8" ].parse.expand.solve == 2 );
	assert( [ "2" ].parse.expand.solve == 0 );
	assert( [ "9" ].parse.expand.solve == 3 );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return n / 3;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int ans,m,len,a,x[30],y[30];
    string s;
    cin >> len;
    cin >> s;
    ans = a= 0;
    m = 1;
    while(m<len)
    {
        memset(x,0,sizeof(x));
        memset(y,0,sizeof(y));
        for (int i = 0 ;i < m ;i++)
        {
            x[s[i]-'a']++;
        }
        for (int i = m ;i < len ;i++)
        {
            y[s[i]-'a']++;
        }
        for (int i = 0 ; i < 30;i++)
        {
            if(x[i]&&y[i])
                a++;
        }
        if(ans<a)
            ans=a;
        a = 0;
        m++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
        int N, A;
        cin >> N;
        for(int i = 0; i < N; i++){
                cin >> A;
                if(!(A % 2)){
                        if(A % 3 == 0 || A % 5 == 0) continue;
                        else{
                                cout << "DENIED" << endl;
                                return 0;
                        }
                }
        }

        cout << "APPROVED" << endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
    int N,a,b,c,d;
    cin >> N >> a >> b >> c >> d;
    string s;
    cin >> s;
    bool ok=true;
    a--;b--;c--;d--;
    for(int i=a+1;i<c&&i+1<N;i++){
        ok&=!((s[i]=='#')&&(s[i+1]=='#'));
    }
    for(int i=b+1;i<d&&i+1<N;i++){
        ok&=!((s[i]=='#')&&(s[i+1]=='#'));
    }
    if(!ok){cout << "No" << endl;return 0;}
    if(d<c){
        for(int i=b-1;i<d&&i+2<N;i++){
            if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
    }
    else{cout << "Yes" << endl;}


    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef pair < int , int > T;

inline void read(int &x) {
    char ch;
    bool flag = false;
    for (ch = getchar(); !isdigit(ch); ch = getchar())if (ch == '-') flag = true;
    for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
    x = flag ? -x : x;
}


inline void read(long long  &x) {
    char ch;
    bool flag = false;
    for (ch = getchar(); !isdigit(ch); ch = getchar())if (ch == '-') flag = true;
    for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
    x = flag ? -x : x;
}

const int maxn = 3100000;
int n;
struct zy{
long long x,y;
int op;
}a[maxn];

bool cmp( zy A ,zy B){
if (A.x!=B.x)
    return A.x<B.x;
return A.y < B.y;
}


long long  d[maxn],top;

int get_num( long long x ){
int l=1;
int r=top+1;
int ans=1;
while ( l <= r )
    {
        int mid=(l+r)/2;
        if ( d[ mid ] > x )
            {
                r=mid-1;
                ans=mid;
            }
        else
            l=mid+1;
    }
return ans;
}



int doit (int st,int ed ){
for (int i=1;i<maxn;i++)
    d[i]=120000000ll;
d[1]=a[st].y; top=1;
for (int i=st+1;i<ed;i++)
    {
        if ( a[i].y < a[st].y )
            continue;
        int tmp=get_num( a[i].y);
        d[tmp]=a[i].y;
        if (tmp > top )
            top++;
    }
int tmp=get_num( a[ed].y);
return tmp;
}

int main() {
    //printf("%.17f\n",40-( 900- 891.415926535897938 )  ) ;
    //printf("%.17f\n",acos(-1)  ) ;
    read(a[0].x); read(a[0].y); read(a[1].x); read(a[1].y);
    if (a[0].x > a[1].x )
        swap( a[0] ,a[1]);
    a[0].op=-1; a[1].op=1;
    read(n);
    n++;
    for (int i = 2;i<= n;i++)
    {
        read( a[ i ].x);
        read( a[ i ].y);
        a[i].op=0;
    }
    if ( a[0].y > a[1].y )
        {
            for (int i=0;i<=n;i++)
                a[i].y=-a[i].y;
        }
    sort ( a, a+n+1 , cmp );
    int st=0,ed=0;
    for (int i=0;i<=n;i++)
        if (a[i].op==-1)
        {
            st=i;
            break;
        }
    for (int i=0;i<=n;i++)
        if (a[i].op==1)
        {
            ed=i;
            break;
        }
    int tot=doit(st,ed)-2;
    long double PI=acos(-1);
    //long double PI=3.141592653589793827l;
    long double tmp=5.0l*PI*tot*1.0l -20.0l*tot*1.0l;
    long long ans=( (long long ) trunc( abs( a[st].x -a[ed].x) ) )*100ll + ( (long long ) trunc( abs( a[st].y - a[ed].y ) ) )*100ll ;
    if ( (tot*1ll) == ( min ( a[ed].x- a[st].x ,  (long long )abs( a[ ed ].y - a[st].y) )+1ll )  )
        tmp=tmp+5.0l*PI*1.0l;
    if (  ( a[st].x == a[ed].x ) || ( a[st].y == a[ed].y ) )
        if ( tot != 0 )
            tmp=10.0l*PI*tot*1.0l -20.0l*tot*1.0l;
    cout << fixed << setprecision(25) << ans+tmp << endl;
    /*long long LLtmp=(long long ) round( tmp-0.5 +1e-15 );
    long long ans_10=( (long long ) (  ans + LLtmp ) ) /10ll;
    long long k=ans-ans_10*10ll;
    cout << ans_10 ;
    tmp = 1.0l*k + tmp  ;
    cout << fixed << setprecision(25) << tmp << endl;
    */
    return 0;
}


Measured memory_bytes: 30976
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <functional>

using namespace std;

int main(){
  int N;
  vector<pair<string,int>> SP;
  vector<pair<string,int>> SPa;
  string s;
  int p;
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> s >> p;
    SP.push_back(make_pair(s,1000-p));

    SPa.push_back(make_pair(s,1000-p));
  }
  sort(SP.begin(), SP.end());
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(SP[i] == SPa[j]){
        cout << j+1 << endl;
        break;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	s <- getLine
	let
		l = length s
		zeros = length $ filter ( == '0' ) s
	print $ ( * 2 ) $ min zeros $ l - zeros

Measured memory_bytes: 7164
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;
int mod2=998244353;

signed main(){
  int h,w;
  cin>>h>>w;
  vector<string> hw(h);
  for(int i=0;i<h;i++)cin>>hw[i];
  vector<vector<int> > dp(h+1,vector<int>(w+1,0));
  dp[0][0]=1;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(hw[i][j]=='#')continue;
      (dp[i+1][j]+=dp[i][j])%=mod;
      (dp[i][j+1]+=dp[i][j])%=mod;
    }
  }
  cout<<dp[h-1][w-1]<<endl;
}


Measured memory_bytes: 9216
import java.util.*;
import java.io.*;
public class Main {
    static long gcd(long a, long b) {
        if (a < b) {
            long t = a;
            a = b;
            b = t;
        }
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int times = Integer.parseInt(br.readLine());
        StringTokenizer st;
        long first = 1;
        long second = 1;
        for (int i = 1; i <= times; i++) {
            st = new StringTokenizer(br.readLine());
            int n = Integer.parseInt(st.nextToken());
            int m = Integer.parseInt(st.nextToken());
            if ((first % n) != 0) {
                if (n > first) first = n;
                else {
                    first = n * (first / n) + n;
                }
            }
            if (second % m != 0) {
                if (m > second) second = m;
                else
                    second = (second / m) * m + m;
            }
            long gcd = gcd(first, second);
            if ((first / n) * m  > second)
                second = (first / n)* m;
            if ((first / n) * m < second)
                first = (second / m) * n;
        }
        System.out.print(first + second);
    }
}

Measured memory_bytes: 8916
N,M,X=map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]

C=10**7
for i in range(2**N):
  P,T=[0]*M,0
  for j in range(N):
    if i&2**j:
      T+=A[j][0]
      for k in range(M):
        P[k]+=A[j][k+1]
  for j in range(M):
    if P[j]<X:
      break
  else:
    C=min(C,T)

print(-1 if C==10**7 else C)


Measured memory_bytes: 9180
import collections

n = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


ans = 0
if n > 1:
    tmp = collections.Counter(prime_factorize(n))
    for v in tmp.values():
        i = 1
        while v > 0:
            if v - i >= 0:
                v -= i
                ans += 1
                i += 1
            else:
                break
print(ans)

Measured memory_bytes: 9464
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    mod = 10**9+7
    g = [[] for _ in range(n)]
    for i in range(n-1):
        x, y = map(int, input().split())
        x, y = x-1, y-1
        g[x].append(y)
        g[y].append(x)

    dp = [[1, 1] for _ in range(n)]
    # dp[v][0]: white
    # dp[v][1]: black

    s = []
    order = []
    par = [-1]*n
    s.append(0)
    while s:
        v = s.pop()
        order.append(v)
        for u in g[v]:
            if u == par[v]:
                continue
            par[u] = v
            s.append(u)

    order.reverse()
    for v in order:
        if par[v] == -1:
            continue
        dp[par[v]][0] *= (dp[v][0]+dp[v][1])%mod
        dp[par[v]][1] *= dp[v][0]%mod
    ans = dp[0][0]+dp[0][1]
    #print(dp)
    print(ans%mod)

if __name__ == '__main__':
    main()


Measured memory_bytes: 39360
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  string S;
  while (cin >> S) {
    bool res = true;
    res &= S[0] == 'A';
    res &= !!islower(S[1]);
    int C = 0;
    for (int i = 2; i < S.size() - 1; i++) {
      if (S[i] == 'C') {
        ++C;
      } else {
        res &= !!islower(S[i]);
      }
    }
    res &= C == 1;
    res &= !!islower(S.back());
    cout << (res ? "AC" : "WA") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))

p = sum(x)//n
p2 = round(sum(x)/n)
ans = 0
ans2 = 0
for i in range(n):
    ans += (x[i]-p)**2
for i in range(n):
    ans2 += (x[i]-p2)**2
print(min(ans, ans2))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define SORTPairSecond(v, n) sort(v, v+n, pairCompareSecond);
#define int long long    // %d=>%lld, 1<<n  => 1LL<<n
#define pb push_back

using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
bool pairCompareSecond(const pii& firstEl, const pii& secondEl) {
    return firstEl.second > secondEl.second;
}

const ll MOD = 1000000007;
const int INF = 1000000007;
// const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
// const ll LLINF = 1LL << 50;
const double PI = acos(-1);
const double EPS = 0.000000001;


string s;


signed main(){
    ios::sync_with_stdio(0);

    cin >> s;
    if(std::string::npos == s.find("AC")){
        cout<< "No\n";
        
    }else{
        cout<< "Yes\n";
        
    }



    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define Fail puts("NO"), exit(0);
#define eps 1e-10
#define maxn 100010
#define maxm 4010
#define inf 1000000007
#define mod 1000000007
#define G 3
#define pi acos(-1)
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef bitset<maxn> bit;
int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch - '0' < 0 || ch - '0' > 9) {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (ch - '0' >= 0 && ch - '0' <= 9) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
int primesize, prime[maxn], miu[maxn];
bool notprime[maxn];
void init() {
    notprime[1] = 1;
    miu[1] = 1;
    for (int i = 2; i <= 100000; i++) {
        if (!notprime[i]) {
            prime[++primesize] = i;
            miu[i] = mod - 1;
        }
        for (int j = 1; j <= primesize && i * prime[j] <= 100000; j++) {
            notprime[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
                miu[i * prime[j]] = 0;
                break;
            }
            miu[i * prime[j]] = mod - miu[i];
        }
    }
}
int n, K, ans;
int quick_pow(int x, int p) {
    int an = 1, po = x;
    while (p) {
        if (p & 1)
            an = 1ll * an * po % mod;
        po = 1ll * po * po % mod;
        p >>= 1;
    }
    return an;
}
int main() {
    init();
    n = read();
    K = read();
    for (int i = 1; i <= K; i++) {
        int sum = 0;
        for (int j = 1; j * i <= K; j++) {
            sum = (sum + 1ll * miu[j] * quick_pow(K / (i * j), n)) % mod;
        }
        ans = (ans + 1ll * sum * i) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4168
#%%
n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr



tmp = [0] * (10**6+1)
for i in range(n):
    t = factorization(a[i])
    for j in range(len(t)):
        tmp[t[j][0]] = max(tmp[t[j][0]], t[j][1])

#print(tmp[:20])

lcm = 1
for i in range(1, 10**6+1):
    x = i 
    y = tmp[i] 
    for j in range(y):
        lcm *= x
        lcm %= mod

#print(lcm)

ans = 0
for i in range(n):
    q = lcm * pow(a[i], mod-2, mod)
    ans += q
    ans %= mod
print(ans)



Measured memory_bytes: 54364
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define stpr setprecision
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

class DisjointSet{
    public:
        vector<int> rank,p;

        DisjointSet(){}

        //初期化
        DisjointSet(int size){
            rank.resize(size,0);
            p.resize(size,0);
            rep(i,size){
                makeSet(i);
            }
        }        
        void makeSet(int x){
            p[x]=x;
            rank[x]=0;
        }

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

        void unite(int x,int y){
            link(findSet(x),findSet(y));
        }

        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y]=x;
            }
            else{
                p[x]=y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }

        int findSet(int x){
            if(x!=p[x]){
                p[x]=findSet(p[x]);
            }
            return  p[x];
        }
};

int main(){
    ll N,Q,com,a,b;cin >> N >> Q;
    DisjointSet ds = DisjointSet(N);

    rep(i,Q){
        cin >> com >> a >> b ;
        if(com==0){
            ds.unite(a,b);
        }
        else if(com==1){
            if(ds.same(a,b)){
                cout << 1 << endl;
            }
            else{
                cout << 0 << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3192
#include<iostream>
    #include<string>
    using namespace std;
     
    int main()
    {
      string s;
      int n;
      cin>>n;
      cin>>s;
      int c[n+1][26];
      for(int i=0; i<26; i++)
      {
        c[0][i]=0;
      }
      for(int i=1; i<=n; i++)
      {
        for(int j=0; j<26; j++)
          c[i][j]=c[i-1][j];
        c[i][(int)s[i-1]-(int)'a']++;
      }
      int cur;
      int max=0;
      for(int i=0; i<=n; i++)
      {
        cur=0;
        for(int j=0; j<26; j++)
        {
          if(c[i][j]>0&&c[i][j]<c[n][j]) cur++;
        }
        if(cur>max) max=cur;
      }
      cout<<max<<endl;
      return 0;
    }

Measured memory_bytes: 256
//##MohK

#include<iostream>

using namespace std;

int main()

{

	long long a,coun=0;	cin>>a;

	string s;

	cin>>s;

	for(int i=0;i<a;i++){

		if (s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')

		coun++;

		}

		cout<<coun;

		return 0;

	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

template <typename T>
class SegmentTree {
   public:
    SegmentTree(vector<T> &base, function<T(T, T)> fn_, T e_) {
        fn = fn_; e = e_;
        n = 1; while (n < base.size()) n *= 2;

        node.resize(2 * n - 1, e);
        REP(i, 0, base.size()) node[n - 1 + i] = base[i];
        for (int i = n - 2; i >= 0; i--) node[i] = fn(node[2 * i + 1], node[2 * i + 2]);
    }

    // 0-origin
    void update(int i, T x) {
        i += n - 1;
        node[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;
            node[i] = fn(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    // 0-origin, [a, b)
    int query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return e;
        if (a <= l && r <= b) return node[k];

        T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return fn(vl, vr);
    }

    void print(int w = 4) {
        int prev = 0;
        for (int i = 1; i <= n; i *= 2) {
            for (int j = prev; j < prev + i; j++) {
                cout << setw(n * w / i) << setfill(' ') << node[j];
            }
            cout << endl;
            prev += i;
        }
    }

   private:
    int n;
    vector<T> node;
    function<T(T, T)> fn;
    T e;
};

int main() {
    int N, Q; string S; cin >> N >> S >> Q;
    vector<int> base(N);
    REP(i, 0, N) base[i] = (1 << (S[i] - 'a'));

    SegmentTree<int> seg(base, [](int l, int r) { return l | r; }, 0);
    while (Q--) {
        int q; cin >> q;
        if (q == 1) {
            int i; char c; cin >> i >> c;
            seg.update(i - 1, (1 << (c - 'a')));
        } else {
            int l, r; cin >> l >> r;
            int chars = seg.query(l - 1, r);
            cout << __builtin_popcount(chars) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 6916
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;
int main() {
    string s;
    getline(cin, s);
 
    for (int i = 0; i < s.length(); i++) {
        if (islower(s[i])) {
            s[i] = toupper(s[i]);
        }
        else if (isupper(s[i])) {
            s[i] = tolower(s[i]);
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3148
n,l=map(int,input().split())
aji=[]
for i in range(n):
    aji.append(l+i)
aji_abs=[]
for i in aji:
    aji_abs.append(abs(i))
e=aji_abs.index(min(aji_abs))

print(sum(aji)-aji[e])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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; }




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  
  int n; cin >> n;
  int f=0,m=n;
  while(m){
    m/=10;
    f++;
  }
  int ans=0;
  for(int i=0;i<f;i+=2){
    ans+=9*pow(10,i);
  }
  if(f%2!=0)  ans-=(pow(10,f)-n-1);
  cout << ans << endl;
}

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

int main(){
  int N;
  cin >>N;
  vector<int> L(N);
  
  for(int i=0;i<N;i++){
    int x;
    cin >>x;
    L[i] = x;
  }
  
  sort(L.begin(),L.end());
  
  int sum = 0;
  for(int i=0;i<N-1;i++){
    sum += L[i];
  }
  
  if(L[N-1] >= sum){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

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 ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define f first
#define sc second
void solve() {
    int n;
    cin >> n;
    int a[n];
    ll ans = 0;
    map<int, ll> mp;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mp[i - a[i]]++;
    }
    for (int i = 0; i < n - 1; i++) {
        ans += mp[i + a[i]];
        mp[i - a[i]]--;
    }
    cout << ans << "\n";
    return;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t = 1;
    while(t--) {
        solve();
    }
}



Measured memory_bytes: 27108
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    char C; cin >> C;
    cout << (char) (C+1) << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256