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

#define REP(i,n) for (int i=0;i<(n);++i)
#define MOD 1000000007

using namespace std;

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

template <class T, T M>
class modulo {
public:
    T data;

    modulo(T data = 0) : data(data % M) {
    }

    modulo operator+(const modulo &x) const {
        return modulo(data + x.data);
    }

    modulo operator-(const modulo &x) const {
        return modulo(data + (M - x.data));
    }

    modulo operator*(const modulo &x) const {
        return modulo(data * x.data);
    }

    modulo operator/(const modulo &x) const {
        return modulo(data * x.inv().data);
    }

    modulo operator+=(const modulo &x) {
        return data = (data + x.data) % M;
    }

    modulo operator-=(const modulo &x) {
        return data = (data + (M - x.data)) % M;
    }

    modulo operator*=(const modulo &x) {
        return data = (data * x.data) % M;
    }

    modulo operator/=(const modulo &x) {
        return data = (data * x.inv().data) % M;
    }

    modulo inv() const {
        return _pow(M - 2);
    }

    template <class Integer>
    modulo operator^(Integer n) const {
        if (n >= 0) {
            return _pow(n);
        } else {
            return _pow(M - 1 - (-n) % (M - 1));
        }
    }

    friend std::ostream& operator<<(std::ostream &os, const modulo &x) {
        os << x.data;
        return os;
    }

private:
    template <class NonNegativeInteger>
    modulo _pow(NonNegativeInteger n) const {
        modulo result(1);
        modulo x(*this);
        while (n) {
            if (n & 1) {
                result *= x;
            }
            x *= x;
            n >>= 1;
        }
        return result;
    }
};

ll gcd(ll x, ll y) {
    while (y != 0) {
        ll r = x % y;
        x = y;
        y = r;
    }
    return x;
}

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

    using Mod = modulo<ll, MOD>;

    int N;
    cin >> N;
    map<P, ll> m;
    Mod result = 1;
    int n_zero = 0;
    REP(i, N) {
        ll A, B;
        cin >> A >> B;
        if (A == 0 && B == 0) {
            ++n_zero;
        } else {
            ll d = gcd(A, B);
            A /= d;
            B /= d;
            if (A < 0) {
                A *= -1;
                B *= -1;
            }
            ++m[P(A, B)];
        }
    }

    set<P> used;
    for (auto [AB, k]: m) {
        auto [A, B] = AB;
        ll A_ = B;
        ll B_ = -A;
        if (A_ < 0) {
            A_ *= -1;
            B_ *= -1;
        }
        if (used.count(P(A, B)) == 0 && used.count(P(A_, B_)) == 0) {
            result *= ((Mod(2) ^ m[P(A, B)]) + (Mod(2) ^ m[P(A_, B_)]) - 1);
            used.insert(P(A, B));
            used.insert(P(A_, B_));
        }
    }

    result += n_zero;
    result -= 1;

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 53576
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  int n=s.size();
  int k[n];
  rep(i,n){
    char c=s[i];
    if(c=='A'||c=='C'||c=='G'||c=='T')k[i]=1;
    else k[i]=0;
  }
  int ans=0;
  int cnt=0;
  rep(i,n){
    cnt=(cnt+k[i])*k[i];
    ans=max(cnt,ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>
#include <list>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;

typedef vector<lint> vl;
typedef pair<lint,lint> pll;

lint gcd(lint a, lint b){

    if (a>b) swap(a, b);
    if (b%a == 0) return a;
    return gcd(b%a, a);
}

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

    int x; cin>>x;

    cout<<360 / gcd(360, x);


}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
/*unordered_map <int, vector<int>> adj;
 
void dfs(int s, int *vis)
{
    vis[s] = true;
    for(autp i = adj[s].begin(); i != adj[s].end(); i++)
    {
        if(vis[*i] == false)
        {
            dfs(*i, vis);
        }
    }
}*/
 
 
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
	ll n, s = 0;
	cin >> n;
	
	vector<int> ptr(n);
	vector<int> res;
	
	for(ll i = 0; i < n; i++)
	{
	    cin>>ptr[i];
	}
	
	sort(ptr.begin(), ptr.end(), greater<int>());
	
	res.push_back(ptr[0]);
	
	for(ll i = 1; i < n; i++)
	{
	    res.push_back(ptr[i]);
	    res.push_back(ptr[i]);
	}
	
	for(ll i = 0; i < n-1; i++)
	{
	    s += res[i];
	}
	
	cout<<s;
	return 0;
}


Measured memory_bytes: 6080
package main

import (
	"bufio"
	"os"
	"fmt"
)

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B&lang=jp>
 */

func init() {
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for {
		scanner.Scan()
		str := scanner.Text()
		if str == "0" {
			break
		}
		sum := 0
		for _, c := range str {
			sum += int(c - '0')
		}
		fmt.Println(sum)
	}
}

Measured memory_bytes: 1096
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
  
def solve():
  n = int(input())
  a = list(int(i) for i in input().split())
  ans = [0]*n
  for i in range(n-1,-1,-1):
    if a[i] == 0:
      continue
    else:
      ans[i] = 1
      tmp = i+1
      div = make_divisors(tmp)
      ##print(div)
      for j in div:
        a[j-1] = 1^a[j-1]
        
  print(sum(ans))
  for i in range(len(ans)):
    if ans[i] == 1:
      print(i+1,end = " ")
solve()

Measured memory_bytes: 63720
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
#define INF (1<<29)*2
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define ffor(i, a, b, c) for(i=a;i<=b;i+=c)
#define rep(i, n) for(i=0;i<n;i++)
#define max(a, b) ((a)>(b) ? (a) : (b))
#define min(a, b) ((a)<(b) ? (a) : (b))
#define bit(n) (1LL<<(n))
#define median(a, b) (a+b)/2.0
#define ABS(a) (a >= 0 ? (a) : (-a))
#define zt(a, b) max(a,b)-min(a,b)
ll swap(ll *a,ll *b){ll tmp;tmp=*a;*a=*b;*b=tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll sum(ll *a,ll n){ll total=0,i;if(n<=0){return 0;}else{rep(i,n) total+=a[i];return total;}}
ld avg(ll *a,ll n){if(n<=0){return 0;}else{return (ld)sum(a,n)/n;}}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int stack[LIMIT2];//stack[0]=count;
int queue[LIMIT2];//queue[0]=start,queue[1]=length;
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
//qsort(s,n,sizeof(s[0]),upchar);
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
//qsort(s,n,sizeof(s[0]),downchar);
int push(int n){
    if(stack[0]>=LIMIT2) return -1;
    stack[0]++;
    stack[stack[0]] = n;
    return 1;
}
int pop(){
    if(stack[0]<=0) return -1;
    stack[0]--;
    return stack[stack[0]+1];
}
int enqueue(int n){
    if(queue[0]+queue[1]>=LIMIT2) return -1;
    queue[queue[0]+queue[1]] = n;
    queue[1]++;
    return 1;
}
int dequeue(){
    int result;
    if(queue[1]<=0) return -1;
    result = queue[queue[0]];
    queue[0]++;
    queue[1]--;
    if(queue[1]==0){
        queue[0] = 2;//queue reset
    }else if(queue[1]==1){
        queue[2] = queue[queue[0]];//only oneth
        queue[0] = 2;
    }
    return result;
}

void initialize(){
    stack[0] = 0;//stack size
    queue[0] = 2;//queue start
    queue[1] = 0;//queue length
}
int main(void){
    initialize();
    ll n,m,p,i,j;
    ll a[LIMIT1]={0},b[LIMIT1]={0},c[LIMIT1]={0};
    ll result=0;
    char s[LIMIT1];
    scanf("%s", s);
  
  if(s[2]==s[3] && s[4]==s[5]) printf("Yes");
  else printf("No");
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout  << std::endl;
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2000000000;
const ll INF64 = 9223372036854775807ll;
//const ll INF64 = 9223372036854775ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;
map< ll, int > prime_factor(ll n) {//素因数分解
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}




int main(){
    ll n;
    std::cin >> n;
    map< ll, int >  di=prime_factor(n);
    int ans=0;
    erep(i,di){
        itn du=i.se;
        rrep(i,1,200){
            if(du-i>=0)ans++;
            else continue;
            du-=i;
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string str;
    cin >> str;
    if(str.length() == 1){
        cout << 1 << endl;
    }else if(str.length() == 2){
        if(str[0] == str[1]){
            cout << 1 << endl;
        }else{
            cout << 2 << endl;
        }
    }else{
        int C[str.length()];
        C[0] = 0;
        C[1] = 1;
        if(str[0] == str[1]) C[2] = 1;
        else C[2] = 2;
        for(int i=2;i<str.length();i++){
            if(str[i] == str[i-1]){
                C[i+1] = C[i-2] + 2;
            }else{
                C[i+1] = C[i] + 1;
            }
        }
        cout << C[str.length()] << endl;

    }
    return 0;
} 

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;
const int MOD = 998244353;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int fact[N], invfact[N];

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
	invfact[N-1]=modinv(fact[N-1]);
	for(int i=N-2;i>=0;i--)
	{
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
}

int nCr(int x, int y)
{
	if(y>x)
		return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=MOD;
	num*=invfact[x-y];
	num%=MOD;
	return num;
}

int n, m, k;

int32_t main()
{
	IOS;
	precompute();
	cin >> n >> m >> k;
	int ans = 0;
	for(int i = 0; i <= k; i++)
	{
		int cur = m * pow(m - 1, n - 1 - i, MOD);
		cur %= MOD;
		cur *= nCr(n - 1, i);
		cur %= MOD;
		ans += cur;
	}
	ans %= MOD;
	cout << ans;
	return 0;
}

Measured memory_bytes: 6760
#include<stdio.h>
int search(int key);

int a[10001],n;

int main(){
  int i,m,q,sum=0;

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

  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&q);
    a[n]=q;
    if(search(q)){sum++;}
  }
  printf("%d\n",sum);
  return 0;
}



int search(int key){
  int i=0;
  while(a[i]!=key)i++;
  if(i==n)return 0;
  else return 1;
}


Measured memory_bytes: 2056
#include<iostream>
#include<string>
using namespace std;
int n;

string hantei(int n) {
	int sum = 0;
	for (int i = 1; i <= n / 4; i++) {
		if (n%i == 0) { sum += i; }
	}
	if (n % 3 == 0) { sum += n / 3; }
	if (n % 2 == 0) { sum += n / 2; }
	if (sum < n) { return "deficient number"; }
	if (sum == n) { return "perfect number"; }
	return "abundant number";
}

int main() {
	while (true) {
		cin >> n;
		if (n == 0) { break; }
		cout << hantei(n) << endl;
	}
}

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

#define rep(i, n)     for(int i = 0;      i < int(n); ++i)
#define rep3(i, a, b) for(int i = int(a); i < int(b); ++i)
#define all(x)        (x).begin(),(x).end()
#define sz(x)         int(x.size())

typedef long long ll;

using namespace std;

int main(){
  int n;
  vector<int> vx, vy, vh;

  cin >> n;
  rep(i, n){ 
    int x, y, h;
    cin >> x >> y >> h;
    if(h != 0){
      vx.push_back(x);
      vy.push_back(y);
      vh.push_back(h);
    }
  }

  if(sz(vx) == 1){
    cout << vx[0] << " " << vy[0] << " " << vh[0] << endl;
    return 0;
  }

  rep(cx, 101){
    rep(cy, 101){
      bool flag = true;
      int tmp_h = vh[0] + abs(vx[0] - cx) + abs(vy[0] - cy);
      rep3(i, 1, sz(vx)){
        if(vh[i] != tmp_h - abs(vx[i] - cx) - abs(vy[i] - cy)){
          flag = false;
          break;
        }
      }
      if(flag){
        cout << cx << " " << cy << " " << tmp_h << endl;
        return 0;
      }
    }
  }

  return 0;
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <unordered_set>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 10;
double EPS = 1e-10;

bool f(int u, int p, vector<vector<int> >& G, vector<int>& a) {
	for (int v: G[u]) {
		if (v == p) continue;
		if (a[u] <= a[v]) continue;
		if (!f(v, u, G, a)) return true;
	}
	return false;
}

int main() {
	int N; cin >> N;
	vector<int> a(N);
	rep(u, N) scanf("%d", &a[u]);
	vector<vector<int> > G(N);
	rep(i, N - 1) {
		int u, v; scanf("%d%d", &u, &v);
		u--; v--;
		G[u].pb(v); G[v].pb(u);
	}
	vector<int> ans;
	rep(u, N) if (f(u, -1, G, a)) ans.pb(u);
	rep(i, ans.size()) printf("%d%c", ans[i] + 1, i + 1 < ans.size() ? ' ' : '\n');
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, vector<long long> a) {
  ll count[10] = {};
  ll ans = 0;
  REP(i, N) a[i] = min(3200LL, a[i]);
  REP(i, N) { count[a[i] / 400]++; }
  REP(i, 8) if (count[i] > 0) ans++;

  if (ans == 0 && count[8] > 0) {
    cout << "1 ";
  } else {
    cout << ans << " ";
  }

  cout << ans + count[8] << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> a(N - 1 + 1);
  for (int i = 0; i <= N - 1; i++) {
    cin >> a[i];
  }
  solve(N, a);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>

using namespace std;
//debug

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

#define pb push_back

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;



#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()



int main() {
	int N;
	cin >> N;
	vector<ll> A(N), B(N),C(N),S(N),res,l(N),r(N);
	rep(i, N) cin >> A[i];
	vector<int> pt(3);
	S[0] = A[0];
	
	for(int i=1;i<N;i++) S[i] =S[i-1]+ A[i];

	auto h = [&](int a, int b, int c) {
		vector<ll> v;
		v.push_back(S.at(N - 1) - S.at(c));
		v.push_back(S.at(c ) - S.at(b));
		v.push_back(S.at(b ) - S.at(a));
		v.push_back(S.at(a ) - 0);
		return *max_element(all(v)) - *min_element(all(v));
	};
	int j=N-2;
	for (int md = N - 3; md >0; md--) {
		while (abs(S[N - 1] - S[j - 1] - (S[j - 1] - S[md])) < abs(S[N - 1] - S[j] - (S[j] - S[md])) &&j-1>md){
			j--;
		}
		r[md] = j;
	}
	j = 0;
	for (int md = 1; md <N-2; md++) {
		while (abs(S[md] - S[j + 1] - (S[j + 1])) < abs(S[md] - S[j] - (S[j] ))&& j+1<md) {
			j++;
		}
		l[md] = j;
	}

	for(int md=1;md<N-2;md++) {
		res.push_back(h(l[md],md,r[md]));
	}
	cout << *min_element(all(res));


	//rep(i, N) B.at(i) = A.at(i) - i - 1;
	//sort(all(B));

	//int low=0;
	//int high = N-1;
	//
	//auto f = [&](int k) {
	//	ll sum = 0;
	//	rep(i, N) sum += abs(B.at(i) - B.at(k));
	//	return sum;
	//};

	//C.at(0) = f(0);

	//for(int i=1;i<N;i++) {
	//	C.at(i) =C.at(i-1)+ (i)*(B.at(i) - B.at(i-1))-(N-i)*(B.at(i) - B.at(i - 1));
	//}
	//cout << *min_element(all(C));

	return 0;
}


Measured memory_bytes: 11764
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

string RD() { return chomp(readln()); }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = RD.split;
	auto N = tokens[0].to!long;
	auto S = RD;

	auto e = new long[](N+1);
	auto w = new long[](N+1);
	foreach (i, c; S)
	{
		w[i+1] = w[i] + (c == 'W' ? 1 : 0); 
	}
	foreach_reverse (i, c; S)
	{
		e[i] = e[i+1] + (c == 'E' ? 1 : 0); 
	}

	long ans = long.max;
	foreach (i; 0..N)
	{
		ans = min(ans, w[i] + e[i+1]);
	}

	writeln(ans);
	stdout.flush();
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n, m);
  vector<vector<bool>> connected(m, vector(n, false));
  rep(i, m) {
    in(int, k);
    while (k--) {
      in(int, s);
      connected[i][s - 1] = true;
    }
  }
  vector<int> p(m);
  rep(i, m) cin >> p[i];
  int ans = 0;
  rep(s, 1 << n) {
    rep(i, m) {
      int cnt = 0;
      rep(j, n) {
        if (connected[i][j] && ((s >> j) & 1)) {
          ++cnt;
        }
      }
      if (cnt % 2 != p[i]) goto next;
    }
    ++ans;
  next:
    continue;
  }
  out(ans);
}


Measured memory_bytes: 3612
def int_input():
    i = list(map(int, input().split()))
    if len(i) == 1:
        return i[0]
    return i


n = int_input()

c = [0, 0, 0, 0]
for i in range(n):
    s = input()
    if s == 'AC':
        c[0] += 1
    if s == 'WA':
        c[1] += 1
    if s == 'TLE':
        c[2] += 1
    if s == 'RE':
        c[3] += 1

print('AC x', c[0])
print('WA x', c[1])
print('TLE x', c[2])
print('RE x', c[3])

Measured memory_bytes: 8912
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int read()
{
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
const int inf=0x3f3f3f3f;

int n,v[110];

int main()
{
	int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for(int i=a;i<=b;i++)v[i]++;
    for(int i=c;i<=d;i++)v[i]++;
    int ans=0;
    for(int i=0;i<=100;i++)if(v[i]==2)ans++;
    if(ans>0)ans--;
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    int x,y;
    scanf("%d",&x);
    if(x<1 || 100<x){
        printf("error\n");
    }
    else{
        y=x*x*x;
        printf("%d\n",y);
    }
    
    return 0;
}


Measured memory_bytes: 2100
import Queue
dic = {
        'rg':'bb', 'gr':'bb',
        'gb':'rr', 'bg':'rr',
        'br':'gg', 'rb':'gg',
        }
while True:
    s = raw_input()
    if s=='0':
        break
    que = Queue.PriorityQueue()
    l = len(s)
    cost = {s: 0}
    que.put((0, s))
    aa = ['r'*l, 'g'*l, 'b'*l]
    ans = -1
    while not que.empty():
        nn, ss = que.get()
        if ss in aa:
            ans = nn
            break
        if cost[ss] < nn:
            continue
        for i in xrange(l-1):
            cc = ss[i:i+2]
            if cc[0]!=cc[1]:
                sa = ss[:i] + dic[cc] + ss[i+2:]
                if sa not in cost or nn+1 < cost[sa]:
                    cost[sa] = nn+1
                    que.put((nn+1, sa))
    print "NA" if ans<0 else ans

Measured memory_bytes: 6744
n=int(input())
xyh=[]

x,y,h=-1,-1,-1
nonzero=-1

for i in range(n):
    xyh.append(list(map(int,input().split())))
    if xyh[i][2] != 0:
        nonzero = i

for px in range(101):
    for py in range(101):
        nh = xyh[nonzero][2]+abs(xyh[nonzero][0]-px)+abs(xyh[nonzero][1]-py)
        ok = True

        for nn in range(n):
            if xyh[nn][2] > 0 and nh != xyh[nn][2]+abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py):
                ok=False
            if xyh[nn][2] == 0 and nh > abs(xyh[nn][0]-px) +abs(xyh[nn][1]-py):
                ok=False
        
        if ok:
            x,y,h = px,py,nh
            print(x,y,h)
            exit()

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <iostream>

using namespace std;
const int MAX = 200000;

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

    int n;
    cin >> n;

    array<int, MAX> R;
    for (int i = 0; i < n; i++) {
        cin >> R[i];
    }

    int minv = R[0];
    int maxv = -2000000000;
    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}

Measured memory_bytes: 3932
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//最大公約数と最小公倍数
int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N; cin >> N;
    int n_c = 0;
    VI C(N, -1);
     
    REP(i,N)
    {
        int a; cin >> a;
        if (i==0)
        {
            C[0] = a; n_c++;
            continue;
        }
        
        else if (C[n_c-1] >= a)
        {
            C[n_c] = a;
            n_c++;
            continue;
        } 
        REP(j,n_c)
        {
            if (C[j] < a)
            {
                C[j] = a;
                break;
            }
        }
    }
    cout << n_c << endl;
  
    return 0;
}



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

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int T=1;
    //cin >> T;
    while(T--){
        ll k,n;
        cin>>k>>n;
        ll a[n];
        rep(i,n) cin>>a[i];
        sort(a,a+n);
        ll mx=a[0]+k-a[n-1];
        rep_a(i,1,n) mx=max(mx,a[i]-a[i-1]);

        cout<<k-mx<<el;
    }

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define lowb(x) x&-x
const int offset=100010;
int n,a[offset],s[offset*10],bit[offset*10];
void add(int x)
{
    while(x<=2*offset)
    {
    	bit[x]++;
    	x+=lowb(x);
	}
}
long long cal(int x)
{
    long long sum=0;
    while(x>=1)
    {
    	sum+=bit[x];
    	x-=lowb(x);
	}
    return sum;
}
bool check(int x)
{
	memset(bit,0,sizeof(bit));
    for(int i=1;i<=n;i++)
        s[i]=s[i-1]+(a[i]>=x?1:-1);
    long long sum=0;
    for(int i=0;i<=n;i++)
	{
        sum+=cal(s[i]+offset);
        add(s[i]+offset);
    }
    return sum>=1ll*n*(n+1)/4;
}
int main(){
    cin>>n;
    int l=0,r=0;
    for(int i=1;i<=n;i++)
	{
        cin>>a[i];
        r=max(r,a[i]);
    }
    while(l<=r){
        int mid=(l+r)/2;
        if(check(mid))
			l=mid+1;
        else
			r=mid-1;
    }
    cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 8448
#include <stdio.h>

int main() {

char a[11]={0},b[11]={0},c[11]={0};

scanf("%s %s %s",a,b,c);

if (check(a,b) && check(b,c)){
puts("YES");
} else {
puts("NO");
}

}


int check(char a[], char b[]) {
int i;
while (a[i]!=0) {
i++;
}

if(b[0]==a[i-1]){
return 1;
} else {
return 0;
}


}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

class Dice{
  private:
    int d_1,d_2,d_3,d_4,d_5,d_6;
  public:
    void setDice(int a,int b,int c,int d,int e,int f){
      d_1 = a;
      d_2 = b;
      d_3 = c;
      d_4 = d;
      d_5 = e;
      d_6 = f;
    }
    void roll_w(){
      int tmp = d_1;
      d_1 = d_3;
      d_3 = d_6;
      d_6 = d_4;
      d_4 = tmp;
    }
    void roll_e(){
      int tmp = d_1;
      d_1 = d_4;
      d_4 = d_6;
      d_6 = d_3;
      d_3 = tmp;
    }
    void roll_n(){
      int tmp = d_1;
      d_1 = d_2;
      d_2 = d_6;
      d_6 = d_5;
      d_5 = tmp;
    }
    void roll_s(){
      int tmp = d_5;
      d_5 = d_6;
      d_6 = d_2;
      d_2 = d_1;
      d_1 = tmp;
    }
    int getDice(){
      return d_1;
    }
};


int main(){
  int a,b,c,d,e,f;
  string cmd;
  Dice D;
  cin >> a >> b >> c >> d >> e >> f;
  D.setDice(a,b,c,d,e,f);
  cin >> cmd;
  for(int i=0;i < cmd.size();i++){
    switch(cmd[i]){
      case 'N':
      D.roll_n();
      break;
      case 'S':
      D.roll_s();
      break;
      case 'W':
      D.roll_w();
      break;
      case 'E':
      D.roll_e();
      break;
    }
  }
  cout << D.getDice() << endl;
  return 0;
}


Measured memory_bytes: 3228
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var num = Input.num;
        var str = ReadLine();
        var res = 1L;
        var dic = new Dictionary<char, int>();
        for (var i = 0; i < num; i++)
            if (!dic.ContainsKey(str[i]))
                dic[str[i]] = 1;
            else dic[str[i]]++;
        foreach (var  val in dic.Values)
        {
            res *= val + 1;
            res %= Input.MOD;
        }
        WriteLine(res - 1);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  
static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13664
def is_palindrome(s):
    n = len(s)
    is_palindrome = True
    for i in range(n // 2):
        if s[i] != s[-(i + 1)]:
            is_palindrome = False
    
    return is_palindrome

S = input()
is_strong_palindrome = True

if not is_palindrome(S):
    is_strong_palindrome = False

if not is_palindrome(S[:(len(S) - 1) // 2]):
    is_strong_palindrome = False

if not is_palindrome(S[(len(S) + 3) // 2 - 1:]):
    is_strong_palindrome = False

if is_strong_palindrome:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	n := len(s)
	ss := make([]string, 0)
	for i := 0; i < n; i++ {
		if s[i] == 'B' {
			if len(ss) == 0 {
				continue
			}
			ss = ss[:len(ss)-1]
			continue
		}
		ss = append(ss, s[i:i+1])
	}
	fmt.Fprintln(writer, strings.Join(ss, ""))
}


Measured memory_bytes: 1820
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	static Node[] V;
	
	public static void main(String[] args) {
		int Vn = sc.nextInt();
		int En = sc.nextInt();
		
		V = new Node[Vn]; 
		for(int i=0; i<Vn; i++) {
			V[i] = new Node();
		}
		
		int[][] d = new int[Vn][Vn];
		for(int i=0; i<Vn; i++) {
			for(int j=0; j<Vn; j++) {
				if(i == j) {
					d[i][j] = 0;
				} else{
					d[i][j] = Integer.MAX_VALUE;
				}
			}
		}
		
		for(int i=0; i<En; i++) {
			d[sc.nextInt()][sc.nextInt()] = sc.nextInt();
		}
		
		for(int k=0; k<Vn; k++) {
			for(int i=0; i<Vn; i++) {
				for(int j=0; j<Vn; j++) {
					if(d[i][k] != Integer.MAX_VALUE && d[k][j] != Integer.MAX_VALUE && d[i][j] > d[i][k] + d[k][j]) {
						d[i][j] = d[i][k] + d[k][j];
					}
				}
			}
		}
		
		for(int k=0; k<Vn; k++) {
			for(int i=0; i<Vn; i++) {
				for(int j=0; j<Vn; j++) {
					if(d[i][k] != Integer.MAX_VALUE && d[k][j] != Integer.MAX_VALUE && d[i][j] > d[i][k] + d[k][j]) {
						System.out.println("NEGATIVE CYCLE");
						return;
					}
				}
			}
		}
		
		StringBuilder ans = new StringBuilder();
		for(int i=0; i<Vn; i++) {
			for(int j=0; j<Vn; j++) {
				if(d[i][j] == Integer.MAX_VALUE) {
					ans.append("INF");
				} else {
					ans.append(d[i][j]);
				}
				if(j != Vn-1) {
					ans.append(" ");
				}
			}
			ans.append("\n");
		}
		System.out.print(ans);
	}
	
	static class Node {
		int min = Integer.MAX_VALUE;
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 33108
#include "iostream"
using namespace std;

long sec(long long j);

int main(int argc)
{
	long long X, Y;
	cin >> X >> Y;
	long long temp = Y / X;
	cout << sec(temp) << endl;
	return 0;
}

long sec(long long j){
	long res = 1;
	while (j > 1){
		j /= 2;
		res++;
	}
	return res;
}

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

int main(){
  int N;
  cin >> N;
  long long X[N];
  long long L[N];
  vector<pair<long, long>> SE(N);
  for(int i=0; i<N; i++){
    cin >> X[i] >> L[i];
    SE[i] = make_pair(X[i] + L[i], X[i] - L[i]);
  }
  
  sort(SE.begin(), SE.end());
  int cnt=0;
  long long t=-1000000001; 
  for(int j=0; j<N; j++){
    if(t <= SE[j].second){
      cnt++;
      t = SE[j].first;
    }
  }
  
  cout << cnt;
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll m,f,b;
    cin >> m >> f >> b;
    if(m+f < b)cout << "NA\n";
    else if(m > b){
        cout << 0 << endl;
    }else{
        cout << b-m << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    char ans='A',p,q;
    while(scanf("%c,%c",&p,&q)!=EOF){
        if(p==ans)ans=q;
        else if(q==ans)ans=p;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

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

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  string s;
  cin >> s;

  if(!(s[0] == s[1] && s[1] == s[3]) &&
      ((s[0] == s[1] && s[2] == s[3]) ||
      (s[0] == s[2] && s[1] == s[3]) ||
      (s[0] == s[3] && s[1] == s[2]))){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[55];
int N,M;
int rez;
bool viz[55];
int low[55];
void dfs(int nod,int tata,int lvl)
{
    viz[nod]=1;
    low[nod]=lvl;
    for(auto it:G[nod])
    {
        if(!viz[it])dfs(it,nod,lvl+1);
        if(it!=tata)low[nod]=min(low[nod],low[it]);
    }
    if(low[nod]==lvl)rez+=(tata!=0);
}
int main()
{
    cin>>N>>M;
    for(int i=1;i<=M;i++)
    {
        int x,y;
        cin>>x>>y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dfs(1,0,1);
    cout<<rez;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	
	int a,b;
	cin >> a >> b;
	if(a>b){
		cout<< "a > b"<<endl;	
	}else if (a < b){
		cout<<"a < b"<<endl;
	}else if (a==b){
		cout<<"a == b"<<endl;
	}

    return 0;

}


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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

typedef long double ld;

int main(){ _

	int n; cin >> n;
	vector<ld> p(n);
	for(auto& i : p) cin >> i;
	
	vector<vector<ld>> memo(2, vector<ld>(n+1, 0)); // prob heads
	memo[0][0] = memo[1][0] = 1;
		
	for(int i=0; i<n; i++) {
		memo[i&1][i] = memo[(i&1)^1][i];

		for(int j=0; j <= n; j++) {
			memo[i&1][j] = memo[(i&1)^1][j]*(1.0-p[i]);
			
			if(j) memo[i&1][j] += memo[(i&1)^1][j-1]*p[i];
		}
	}

	ld ans = 0;
	for(int i=0; i<=n; i++) if(n-i < i) ans += memo[(n-1)&1][i];
	cout << fixed << setprecision(10);
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3992
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)

int main(){
	int n;
	int m[]={2,3,5,10,12,15,};
	int v[]={380,550,850,1520,1870,2244,};
	int dp[5000];
	rep(i,51)dp[i]=99999;
	rep(i,6)dp[m[i]]=v[i];
	rep(i,51){
		rep(j,6){
			int t=dp[i]+v[j];
			dp[i+m[j]]=min(dp[i+m[j]],t);
		}
	}
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		printf("%d\n",dp[n/100]);
	}
	return 0;
}

Measured memory_bytes: 1196
import collections
import scipy.misc
import sys
import numpy as np
from operator import itemgetter

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())
"""


X, Y = map(int, input().split())
print(X + int(Y/2))

Measured memory_bytes: 24524
import fractions
# fractions.gcd(x,y)

def div(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)

    return divisors
a,b=map(int,input().split())
x=div(a)
y=div(b)
#z=x&y
z=list(x&y)
z.sort()
t=len(z)
ans=1
for i in range(1,t):
    f=1
    for j in range(1,i):
        if (z[i]%z[j]==0):
            f=0
            break
    if f:
        ans+=1
print(ans)


Measured memory_bytes: 66356
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		String w = s.nextLine();
		int na = w.length();
		int i = 0;
		int j = 0;
		String ans = "";

		List<String> list = new ArrayList<String>();

		for (i = 0; i < na; i++) {
			list.add(w.charAt(i) + "");
		}

		i = 0;
		for (i = 0; list.size() != 0; i++) {
			List<String> set = new ArrayList<>();
			Collections.addAll(set, list.get(0));

			list.removeAll(set);
			int q = na - list.size();

			if (q % 2 == 0) {
				ans = "Yes";
			} else if (q % 2 != 0) {
				ans = "No";
				break;
			}
		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

long long pow_mod(long long a, long long b, long long mod) {
    long long ret = 1;
    while (b) {
        if (b & 1) ret = (a * ret) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ret;
}

int main(void) {
    unsigned long long x, y;
    cin >> x >> y;
    for (int i = 0; i < 64; i++) {
        if (x * (1ll << i) > y) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
s=str(input())
t=str(input())
s=list(s)+list(s)
t=list(t)
ans=0
for i in range(0,len(t)):
  count=0
  for j in range(0,len(t)):
    if s[i+j]==t[j]:
      count=count+1
  if count==len(t):
    ans=1
if ans==1:
  print("Yes")
else:
  print("No")



Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int i,n,m,a[100000],w,x;
	scanf("%d %d",&n,&m);
	w=0; x=0;
	for(i=0;i<m;i++){
		scanf("%d",&a[i]);
		w=w+a[i];
	}
	x=n-w;
	if(x<0){
		printf("-1\n");
	}
	else{
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 1728
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    x, y = map(int, input().split())
    for i in range(x+1):
        if i * 2 + (x-i)*4 == y:
            print('Yes')
            return
    print('No')


if __name__ == '__main__':
    main(sys.stdin.readline, print)


Measured memory_bytes: 61648