akhauriyash/Code-Regression huggingface dataset:
from math import gcd

N = int(input())
num_lis = list(map(int, input().split()))
c1 = True
c2 = True

def osa_k(max_num):
  lis = [i for i in range(max_num+1)]
  p = 2
  while p**2 <= max_num:
    if lis[p] == p:
      for q in range(2*p, max_num+1, p):
        if lis[q] == q:
          lis[q] = p
    p += 1
  return lis

hoge = 0
for i in num_lis:
  hoge = gcd(hoge, i)
if hoge > 1:
  c1 = False

if c1:
  d_lis = osa_k(max(num_lis))
  tmp = set()
  for i in num_lis:
    num = i
    new_tmp = set()
    while num > 1:
      d = d_lis[num]
      new_tmp.add(d)
      num //= d
    for j in new_tmp:
      if j in tmp:
        c2 = False
        break
      else:
        tmp.add(j)
    else:
      continue
    break
else:
  c2 = False

if c2:
  print("pairwise coprime")
elif c1:
  print("setwise coprime")
else:
  print("not coprime")

Measured memory_bytes: 126840
S = str(input())

S_list = S.split("/")

if int(S_list[0]) < 2019:
    print('Heisei')
elif int(S_list[0]) == 2019:
    if int(S_list[1]) < 5:
        print('Heisei')
    else:
        print('TBD')
else:
    print('TBD')

Measured memory_bytes: 3060
n = int(input())
cnt = 0
for i in range(1, n + 1,2):
    temp = 0
    j = 1
    while j * j <= i:
        if i % j == 0:
            temp += 1
            if j != i // j:
                temp += 1
        j += 1
    if temp == 8:
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int a, b, x;
	cin >> x >> a >> b;
	if (abs(x - a) < abs(x - b))cout<<"A" << endl;
	else cout << "B" << endl;
	int z;
	cin >> z;
}

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

char ss[5010];
int k, s[5010], sa[5010], rk[5010], height[5010];

int g(int x, int n0)
{
	return x < n0 ? x * 3 + 1 : (x - n0) * 3 + 2;
}
void radix(int *a, int *b, int *s, int n, int K)
{
	int *hh = new int[K + 1];
	for (int i = 0; i <= K; i++)
		hh[i] = 0;
	for (int i = 0; i < n; i++)
		hh[s[a[i]]]++;
	for (int i = 1; i <= K; i++)
		hh[i] += hh[i - 1];
	for (int i = n - 1; i >= 0; i--)
		b[--hh[s[a[i]]]] = a[i];
}
void dc3(int *s, int *sa, int n, int K)
{
	int n0 = (n + 2) / 3, n1 = (n + 1) / 3, n2 = n / 3, n02 = n0 + n2;
	int *s12 = new int[n02 + 3];
	s12[n02] = s12[n02 + 1] = s12[n02 + 2] = 0;
	int *sa12 = new int[n02 + 3];
	sa12[n02] = sa12[n02 + 1] = sa12[n02 + 2] = 0;
	int *s0 = new int[n0];
	int *sa0 = new int[n0];
	for (int i = 0, hh = 0; i < n; i++)
		if (i % 3)
			s12[hh++] = i;
	if (n % 3 == 1)
		s12[n02 - 1] = n;
	radix(s12, sa12, s + 2, n02, K);
	radix(sa12, s12, s + 1, n02, K);
	radix(s12, sa12, s, n02, K);
	int name = 0, c1 = -1, c2 = -1, c3 = -1;
	for (int i = 0; i < n02; i++)
	{
		if (c1 != s[sa12[i]] || c2 != s[sa12[i] + 1] || c3 != s[sa12[i] + 2])
		{
			c1 = s[sa12[i]];
			c2 = s[sa12[i] + 1];
			c3 = s[sa12[i] + 2];
			name++;
		}
		if (sa12[i] % 3 == 1)
			s12[sa12[i] / 3] = name;
		else
			s12[sa12[i] / 3 + n0] = name;
	}
	if (name < n02)
	{
		// s12[n02] = s12[n02 + 1] = s12[n02 + 2] = 0;
		dc3(s12, sa12, n02, name);
		for (int i = 0; i < n02; i++)
			s12[sa12[i]] = i + 1;
	}
	else
	{
		for (int i = 0; i < n02; i++)
			sa12[s12[i] - 1] = i;
	}
	for (int i = 0, hh = 0; i < n02; i++)
		if (sa12[i] < n0)
			s0[hh++] = sa12[i] * 3;
	radix(s0, sa0, s, n0, K);
	int i = n0 - n1, j = 0, hh = 0;
	while (i < n02 && j < n0)
	{
		if (sa12[i] < n0 && make_pair(s[g(sa12[i], n0)], s12[sa12[i] + n0]) < make_pair(s[sa0[j]], s12[sa0[j] / 3]) ||
			sa12[i] >= n0 && make_tuple(s[g(sa12[i], n0)], s[g(sa12[i], n0) + 1], s12[sa12[i] + 1 - n0]) < make_tuple(s[sa0[j]], s[sa0[j] + 1], s12[sa0[j] / 3 + n0]))
			sa[hh++] = g(sa12[i++], n0);
		else
			sa[hh++] = sa0[j++];
	}
	while (i < n02)
		sa[hh++] = g(sa12[i++], n0);
	while (j < n0)
		sa[hh++] = sa0[j++];
	delete[] s12;
	delete[] sa12;
	delete[] s0;
	delete[] sa0;
}
int main()
{
    scanf("%s%d", ss, &k);
    int n = strlen(ss);
    for (int i = 0; i < n; i++) s[i] = ss[i] - 'a' + 1;
    dc3(s, sa, n, 26);/*
    for (int i = 0; i < n; i++)
    {
        for (int j = sa[i]; j < n; j++) printf("%c", ss[j]);
        puts("");
    }*/
    sa[n] = n;
    for (int i = 0; i < n; i++)
        rk[sa[i]] = i;
    for (int i = 0, k = 0; i < n; i++)
    {
        if (k) k--;
        int j = sa[rk[i] + 1];
        while (s[i + k] == s[j + k])
            k++;
        height[rk[i]] = k;
    }
    for (int i = 0; i < n; i++)
    {
        int hh = i ? height[i - 1] : 0;
        if (k > n - sa[i] - hh) k -= n - sa[i] - hh;
        else
        {
            // printf("%d %d %d\n", i, sa[i], k);
            for (int j = 0; j < k + hh; j++)
                printf("%c", ss[sa[i] + j]);
            break;
        }
    }
    puts("");
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  double h,m;
  char c;
  rep(i,n){
    cin >> h >> c >> m;
    h = 30 * h + 0.5*m;
    m = 6 * m;
    double angle = min(360-abs(h-m),abs(h-m));
    if(angle < 30.0){
      cout << "alert"<<endl;
    }
    else if(angle< 90.0){
      cout << "warning"<<endl;
    }
    else{
      cout << "safe"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3208
N,M=map(int,input().split())
s,t=[],[[] for j in range(N)]
for i in range(M):
    xx,yy=map(int,input().split())
    x,y=xx-1,yy-1
    s+=[[x,y]]
    t[x].append(y)
    t[y].append(x)
def loop(q,j,k):
    w.append(q)
    for kk in t[q]:
        if kk not in w and not (q==j and kk==k)and not(q==k and kk==j):
            loop(kk,j,k)
ans=0            
for ii in range(M):
    w=[]
    [j,k]=s[ii]
    loop(j,j,k)
    if len(w)!=N:
        ans+=1
print(ans)        
        
            



Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int N;
	vector<int>x;
	cin >> N;
	int g = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> g;
		x.push_back(g);
	}
	sort(x.begin(), x.end());
	int count=1;
	for (int i = 1; i < N; i++) {
		if (x[i]!=x[i-1]) {

			count++;
		}
	}
	cout << count;
}


Measured memory_bytes: 256
n, x = map(int, input().split())
a = list(map(int, input().split()))
 
ans = 0
for i in range(n-1):
    total = a[i] + a[i+1]
    if total > x:
        diff = total - x
        ans += diff
        a[i+1] = max(0, a[i+1] - diff)
print(ans)

Measured memory_bytes: 63984
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;


int main(void){
  int n;
  cin>>n;
  vector<long long> a(3*n);

  for(int i = 0 ; i < 3 * n ; i ++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());

  long long s = 0;
  for(int i = 3 * n - 1 ; i > n ; i -= 2){
    s += a[i-1];
  }
  cout<<s<<endl;
}

Measured memory_bytes: 2560
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

const ll MOD=998244353;

main(){
    int n=in(),k=in();
    vecll a;
    rep(i,n){
        a.pb(in());
    }
    ll ans=0;
    vecll l,r;
    l.pb(0);
    rep(i,n){
        l.pb(l.back()+max(0ll,a[i]));
    }
    r.pb(0);
    rep3(i,n-1,0)r.pb(r.back()+max(0ll,a[i]));
    reverse(all(r));
    ll tmp=0;
    rep(i,k)tmp+=a[i];
    rep(i,n-k+1){
        ans=max(ans,max(0ll,tmp)+l[i]+r[i+k]);
        tmp-=a[i];
        tmp+=a[i+k];
    }
    // print(l);print(r);
    cout<<ans;
}

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

int main() {
  int k;
  cin >> k;
  int cur = 0;
  int ans = -1;
  for (int i = 1; i <= k; i++) {
    cur = (cur * 10 + 7) % k;
    if (cur == 0) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
N = int(input())
lst = ["3", "5", "7"]
ans = 0
while lst:
    a = lst.pop(0)
    if int(a) <= N:
        for c in ["3", "5", "7"]:
            if int(a + c) <= N:
                lst.append(a + c)
        if all(a.count(c) > 0 for c in ["3", "5", "7"]):
            ans += 1
            
print(ans)

Measured memory_bytes: 45660
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  int i = 0;
  int g = N / 10;
  int f = N % 10;
  while (i < 7) {
    f += g % 10;
    g /= 10;
    i++;
  }
  if (N % f == 0) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}


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

int main(){
    int N;
    cin >> N;
    int jud =1;
    bool jud2 = false;

    vector<int> a(N);

    rep(i,N){
        cin >> a[i];
    }

    rep(i,N){
        if(a[i] == jud){
            jud++;
            jud2 = true;
        }
    }

    if(jud2 == false){
        cout << -1 << endl;
    }

    else{
        cout << N - jud + 1 << endl;
    }
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main(){
  int ans=0;
  char s[4];
  scanf("%s",s);
  if(s[0]=='M'){
    ans=6;
  }
  else if(s[0]=='T'){
    if(s[1]=='U'){
      ans=5;
    }
    else{
      ans=3;
    }
  }
  else if(s[0]=='W'){
    ans=4;
  }
  else if(s[0]=='F'){
    ans=2;
  }
  else if(s[0]=='S'){
    if(s[1]=='A'){
      ans=1;
    }
    else{
      ans=7;
    }
  }

  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll = long long;

int main(){
  int a, b;
  cin >> a >> b;
  if(a >= 13){ cout << b << endl;}
  else if(a <= 5){cout << 0 << endl;}
  else{cout << b/2 << endl;}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ll long long
#define pb push_back
#define PII pair<int,int>
#define X first
#define Y second
#define MP make_pair
#define PI acos(-1.0)
#define eps 1e-8
const int maxn=3e5+10;
const int mod=998244353;
using namespace std;

int n,m;
int a[maxn];

int main()
{
    ll x,y;
    scanf("%lld%lld",&x,&y);
    printf("%lld",min(x%y,y-x%y));
    // system("pause");
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val P = readLine()!!.split(" ").map(String::toInt)
    var max = 1000000007
    var cnt = 0;
    for (p in P) {
        if (p <= max) {
            cnt++
            max = p
        }
    }
    println(cnt)
}

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

using namespace std;

int main()
{
	int a;
	int b;
	int c;

	cin >> a >> b >> c;

	if (a == b) {
		cout << c << endl;
	}
	else if (a == c) {
		cout << b << endl;
	}
	else {
		cout << a << endl;
	}
	
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for (ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> s(M+1, 0);
    FOR (i, 1, M+1) {
        int k;
        cin >> k;
        REP (j, k) {
            int x;
            cin >> x;
            s[i] |= 0x1 << (x - 1);
        }
    }
    vector<int> p(M+1);
    FOR (i, 1, M+1) {
        cin >> p[i];
    }

    int ans = 0;
    REP (bit, 0x1 << N) {
        bool isLight = true;
        FOR (i, 1, M+1) {
            int valid = s[i] & bit;
            int count = 0;
            while (valid > 0) {
                count += valid & 0x1;
                valid >>= 1;
            }
            if ((count & 0x1) != p[i]) {
                isLight = false;
            }
        }
        if (isLight) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
import scala.io.StdIn.readInt

object Main {
  val r = Array(2,3,5,7)

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = BigInt(a).modPow(d,n).toLong

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,BigInt(x).modPow(2,n).toLong, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,BigInt(x).modPow(2,n).toLong,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n<5000) (2 to Math.sqrt(n).toInt).forall(n%_ != 0)
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    println((0 until n).count{ _=> isPrime(readInt) })
  }
}

Measured memory_bytes: 68188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int n, m;
vector<i64> x, d;
int main() {
  cin >> n >> m;
  read_n(x, m);
  sort(begin(x), end(x));
  d.resize(m - 1);
  for (int i = 0; i < m - 1; ++i) {
    d[i] = x[i + 1] - x[i];
  }
  sort(begin(d), end(d));

  i64 ans = 0;
  for (int i = 0; i < m - n; ++i) {
    ans += d[i];
  }

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {

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

    int d;
    cin>>d;
    cout<<"Christmas";
    for(;d<25;d++){
        cout<<" Eve";
    }
    cout<<endl;
    

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;
int a[50], b[50], c[50], d[50];

int main(){
    int n, m, q;
    cin >> n >> m >> q;
    int ans = 0;
    for (int i = 0; i < q;i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    int nums[10];
    for (int i = 1; i <= m;i++){
        for (int i1 = i; i1 <= m;i1++){
            for (int i2 = i1; i2 <= m; i2++)
            {
                for (int i3 = i2; i3 <= m; i3++)
                {
                    for (int i4 = i3; i4 <= m; i4++)
                    {
                        for (int i5 = i4; i5 <= m; i5++)
                        {
                            for (int i6 = i5; i6 <= m; i6++)
                            {
                                for (int i7 = i6; i7 <= m; i7++)
                                {
                                    for (int i8 = i7; i8 <= m; i8++)
                                    {
                                        for (int i9 = i8; i9 <= m; i9++)
                                        {
                                            nums[0] = i;
                                            nums[1] = i1;
                                            nums[2] = i2;
                                            nums[3] = i3;
                                            nums[4] = i4;
                                            nums[5] = i5;
                                            nums[6] = i6;
                                            nums[7] = i7;
                                            nums[8] = i8;
                                            nums[9] = i9;
                                            int tmp = 0;
                                            for (int j = 0; j < q;j++){
                                                if(nums[b[j]-1] - nums[a[j]-1] == c[j]){
                                                    tmp += d[j];
                                                }
                                            }
                                            if(tmp > ans){
                                                ans = tmp;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3632
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)
B = [0]
C = [0]
for i in range(N+1):
    C.append(abs(A[i+1] - A[i]))
S = sum(C)
for i in range(N):
    print(S-C[i+1]-C[i+2] + abs(A[i]-A[i+2]))

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int f;
  cin>>S;
  int L=S.size();
  for(int i=2;i<L;i+=2){
    f=0;
    for(int j=0;j<(L-i)/2;j++){
      if(S[j]!=S[(L-i)/2+j]){
        f=1;
        break;
      }
    }
    if(f==0){
      f=L-i;
      break;
    }
  }
  cout<<f<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define test(t) int t; cin>>t; while(t--)
#define p1(x) { cout << " [" << #x << ": " << x << "]\n"; }
#define p2(x) { cout << " [" << #x << ": "; for(auto it:x) cout << it << " "; cout << "]\n"; }
#define pb push_back
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
 
 
void solve()
{
	int n, ans=0;
	string s, t;
	cin>>s>>t;
	for(int i; i<s.length(); i++) {
		if(s[i] != t[i]) {
			ans++;
		}
	}
	cout<<ans<<endl;
}
 
int main() {
	// your code goes here
	// test(t)
		solve();
	return 0;
}
 

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

#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i, a, b) for (int i=a;i>=b;--i)

const int MX_N = 2e5+5;
const int MX_M = 2e5+5;
const int MOD = 1e9+7;

int N, M;
string S;

int dp[MX_N];

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

    cin >> N >> M;
    cin >> S;

    bool same = true;
    FOR(i,0,M-1){
        same &= S[i] == S[0];
    }

    if (same) {
        // dp[i]: no of ways to color s.t. no 2 consec is B & i-th is R
        int ans = 0;
        dp[1] = 0; dp[2] = 1;   // 1st is B
        FOR(i,3,N){
            dp[i] = (dp[i-1] + dp[i-2]) % MOD;
        }
        ans = (ans + dp[N]) % MOD;           // Nth is R
        dp[1] = 1; dp[2] = 1;   // 1st is R
        FOR(i,3,N){
            dp[i] = (dp[i-1] + dp[i-2]) % MOD;
        }
        ans = (ans + (dp[N] + dp[N-1]) % MOD) % MOD; // Nth is R and B
        cout << ans;
        return 0;
    }

    if (N&1) {
        cout << 0;
        return 0;
    }

    int k = N, kp = N, cur = 0;
    FOR(i,0,M-1){
        if (S[i] != S[0]) {
            if (k == N) {
                if (cur&1) k = cur;
                else k = cur+1;
            } else if (cur&1) kp = min(kp,cur);
            cur = 0;
        } else ++cur;
    }

    int L = min({N-1,k,kp});
    N /= 2, L /= 2;

    //cout << "L is " << L << endl;

    dp[0] = 0; dp[1] = 1;
    int sum = 0;
    FOR(i,2,N){
        if (i-(L+2) >= 1) {
            sum = (sum - dp[i-(L+2)] + MOD) % MOD;
        }
        if (i-1 >= 1) {
            sum = (sum + dp[i-1]) % MOD;
        }
        dp[i] = sum;
    }

    int ans = 0;
    FOR(i,0,L){
        ans = (ans +  1LL * (i+1) * dp[N-i] % MOD) % MOD;
    }
    cout << ans * 2 % MOD;
}



Measured memory_bytes: 1360
f = lambda : raw_input().rstrip()
f1 = lambda : f().split()
f2 = lambda t : map(t, f1())

def main1():
    A, B, C = f2(int)
    print 0 if B + C <= A else (B + C) - A

def main2():
    n = int(f())
    p = 0
    ans = 0
    while 10**p <= n:
        if 10**(p+1) > n:
            ans = ans + n - 10**p + 1
        else:
            ans = ans + 10**(p+1) - 10**p 
        p = p + 2
    print ans
    
def main3():
    n = int(f())
    a = f2(int)
    m = 0
    for i in xrange(1,n):
        if a[i] < a[i-1]:
            m = m + 1#(a[i-1] - a[i])
  
    print "Yes" if m < 2 else "No"

def main4():
    s = f()
    n = len(s)
    ans = [0]*n
    m = 1
    i = 1
    st = 0
    s = s + ("L" if s[-1]=="R" else "R")
    while i <= n:
        if s[i] != s[i-1]:
            #print i, st,
            j = st if s[i-1]=="L" else i
            #print j
            if m&1:
                ans[j-1] = ans[j-1] + m/2 + (1 if s[i-1] == "R" else 0) 
                ans[j] = ans[j] + m/2 + (1 if s[i-1] == "L" else 0)
            else:
                ans[j-1] =  ans[j-1] + m/2
                ans[j] = ans[j] + m/2
            m = 0
            st = i
        #print ans
        i = i + 1
        m = m + 1
    print " ".join(map(str,ans)) 
         
if __name__=="__main__":
    main2()

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;

int main(){
  int A, B;
  cin >> A >> B;
  if(A <= 5){
    cout << 0 << endl;
  }
  else if(A > 12){
    cout << B << endl;
  }
  else{
    cout << B/2 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main 
{   
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
 
        int[] n = new int[6];
        for(int i=0; i<6; i++)
        {
            n[i] = scanner.nextInt();
        }
         
        String str = scanner.next();
        for(int i=0; i<str.length(); i++)
        {
            String s = str.substring(i, i+1);
             
            int[] buf = new int[6];
            for(int j=0; j<6; j++)
            {
                buf[j] = n[j];
            }
             
            switch(s)
            {
                case "S":
                    n[0] = buf[4];
                    n[1] = buf[0];
                    n[5] = buf[1];
                    n[4] = buf[5];
                    break;
                case "N":
                    n[0] = buf[1];
                    n[1] = buf[5];
                    n[5] = buf[4];
                    n[4] = buf[0];
                    break;
                case "W":
                    n[0] = buf[2];
                    n[2] = buf[5];
                    n[5] = buf[3];
                    n[3] = buf[0];
                    break;
                case "E":
                    n[0] = buf[3];
                    n[3] = buf[5];
                    n[5] = buf[2];
                    n[2] = buf[0];
                    break;
            }
        }
        System.out.println(n[0]);
    }
}


Measured memory_bytes: 26424
#include<stdio.h>
int main()
{
int a;
float b,c;
  scanf("%d",&a);
  if(a%2==0) {printf("0.500000");}
  else{
  b=(a+1)/2;
  c=b/a;
  printf("%f",c);
  }
  
return 0;
}

Measured memory_bytes: 128
import heapq

n = int(input())
s = list(map(int, input().split()))

q = []
for x in s:
  heapq.heappush(q, x)

for i in range(n//2):
  abc_max = heapq.heappop(q)
arc_min = heapq.heappop(q)
print(arc_min - abc_max)

Measured memory_bytes: 14428
#include <map>
#include <cstdio>
using namespace std;
int main(){
	int n;
	scanf("%d", &n);
	int x[n], y[n], ans = 0;
	for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
	map<pair<int, int>, int> m;
	for (int i = 0; i < n - 1; i++){
		for (int j = i + 1; j < n; j++){
			pair<int, int> p = {x[i] - x[j], y[i] - y[j]};
			m[p]++;
			ans = max(ans, m[p]);
			p.first = -p.first;
			p.second = -p.second;
			m[p]++;
			ans = max(ans, m[p]);
		}
	}
	printf("%d\n", n - ans);
}

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

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

		int N = sc.nextInt();
		int D = sc.nextInt();
		int[] x = new int[N];
		for(int i=0; i<N; i++)
			x[i] = sc.nextInt();
		int Q = sc.nextInt();
		long[] qq = new long[Q];
		for(int i=0; i<Q; i++)
			qq[i] = (sc.nextLong()-1)<<30 | i;
		
		Arrays.sort(qq);
		
		int[] rest = new int[N+1];
		rest[0] = D;
		for(int i=0; i<N; i++)
			rest[i+1] = Math.min(rest[i], Math.abs(rest[i]-x[i]));
		
		boolean[] ans = new boolean[Q];
		long range = 0;
		int idx = Q-1;
		for(int i=N-1; i>=0; i--) {
			while(idx>=0 && (qq[idx]>>30)==i) {
				if(rest[i] > range) {
					ans[(int)(qq[idx]&((1<<30)-1))] = true;
				}
				idx--;
			}
			if(x[i]<=range*2+1) {
				range += x[i];
			}
		}
		
		for(int i=0; i<Q; i++)
			pw.println(ans[i] ? "YES" : "NO");
		
		sc.close();
		pw.close();
	}
}


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

using namespace std;
#define set_precision(ans,l) cout << fixed << setprecision(l)<<ans;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<ll>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<ll>())
#define init(a)  memset((a),0,sizeof(a))
#define pi pair<int,int>
#define pb push_back
#define pl pair<ll,ll>
#define ll long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
long double EPS = 1e-9;

/*struct comp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs<rhs;}
};*/

ll cel(ll a,ll b){return((a-1)/b+1);} 
ll gcd(ll a, ll b){
    if (a < b)swap(a, b);
    return (b == 0)? a: gcd(b, a % b);
}
ll MIN(ll a,int b){ll ans;(a>=b)?ans=b:ans=a;return ans;}
ll MAX(ll a,int b){ll ans;(a>=b)?ans=a:ans=b;return ans;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll po(ll x,ll y){
    ll ans=1;
    while(y){
        if(y&1){ans=(ans*x)%mod;}
        y>>=1;x=(x*x)%mod;
    }
    return ans;
}

int main()
{
    FIO;
    ll n,t,x,y,m=10,k;
    cin>>n;
    if(n<2)cout<<0;
    //else if(n==2)cout<<2;
    else {
        ll ans=0;
        /*rep(i,0,n){
            ans=(ans+(po(m-2,i)*po(m-1,n-i-1))%mod)%mod;
        }*/
        ans=(ans+ans)%mod;
        cout<<(mod+po(m,n)+po(m-2,n)-(2*po(m-1,n)%mod)%mod)%mod;
    }
    return 0;
}

Measured memory_bytes: 3648
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using Graph=vector<vector<int>>;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}

signed main(){
	int a[3];cin>>a[0]>>a[1]>>a[2];
	
	if(a[0]&1||a[1]&1||a[2]&1){
		cout<<0<<endl;
		return 0;
	}
	else if(a[0]==a[1]&&a[1]==a[2]){
		cout<<-1<<endl;
		return 0;
	}
	int n=0,s=a[0]+a[1]+a[2];
	while(++n){
		rep(i,3){
			a[i]=(s-a[i])/2;
			if(a[i]&1){
				cout<<n<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int,input().split()))

c = collections.Counter(a)
d = {}
# print(c)
sum_num = 0
for k, v in c.items():
    d[k] = v*(v-1)//2 - (v-1)*(v-2)//2
    sum_num += v*(v-1)//2
# print(sum_num)
# print(d)
for i in a:
    print(sum_num-d[i])



Measured memory_bytes: 33916
#include <bits/stdc++.h> 
using namespace std; 
#define for_(i, s, e) for (int i = s; i < e; i++)
#define for__(i, s, e) for (ull i = s; i < e; i++)
#define SSTR(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x)).str()
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define endl "\n"


int main() {
    #ifndef ONLINE_JUDGE
	freopen("test.in", "r", stdin);
    #endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m; ll k; cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    for_(i, 0, n) cin >> a[i];
    for_(i, 0, m) cin >> b[i];
    for_(i, 1, n) a[i] += a[i-1];
    for_(i, 1, m) b[i] += b[i-1];

    ll ans = upper_bound(b.begin(), b.end(), k) - b.begin();
    for__(i, 0, n) {
        if (a[i] > k) break;
        ans = max(ans, (ll) i + 1 + (ll) (upper_bound(b.begin(), b.end(), k - a[i]) - b.begin()));
    }

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 6348
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

struct point{
	double x,y;
	point operator+(point p){
		return point{x+p.x,y+p.y};
	}
	point operator-(point p){
		return point{x-p.x,y-p.y};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
	}
};
 
typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};
 
class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	int Convex_Concave(VP p){
		p.push_back(p[0]);
		double cp;
		for(VP::iterator i=p.begin()+1;i!=p.end()-1;i++){
			cp=CP(*i-*(i-1),*(i+1)-*(i-1));
			if(cp<0) return 0;
		}
		return 1;
	}
	double Heron(point A,point B,point C){
		double a=Length(B,C),b=Length(C,A),c=Length(A,B),s=(a+b+c)/2;
		return sqrt(s*(s-a)*(s-b)*(s-c));
	}
	double Area(VP p){
		double sum=0,cp;
		p.push_back(p[0]);
		for(VP::iterator i=p.begin()+1;i!=p.end();i++){
			cp=CP(*(i-1),*i);
			if(cp>0) sum+=Heron(O,*(i-1),*i);
			else if(cp<0) sum-=Heron(O,*(i-1),*i);
		}
		return sum;
	}
/*	string Containment_polyon_point(VP p,point x){
		string s;
		p.push_back(p[0]);
		double sum,area=Area(p);
		for(VP::iterator i=p.begin()+1;i!=p.end();i++){
			
		}
	}*/
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
};

int N;
VP p;
point q;

int main(){
	cout<<syosu(1);
	Geom geo;
	cin>>N;
	p=VP(N);
	for(VP::iterator i=p.begin();i!=p.end();i++) geo.Point_in(*i);
/*	cin>>Q;
	for(int i=0;i<Q;i++){
		geo.Point_in(q);
		string s=geo.Containment_polyon_point(p,q);
		if(s=="Containment") cout<<2<<endl;
		else if(s=="On_side") cout<<1<<endl;
		else cout<<0<<endl;
	}*/
	cout<<geo.Convex_Concave(p)<<endl;
}

Measured memory_bytes: 1260
n=int(input())
ans=0
import itertools
for i in range(3,10):
  blist=itertools.product(['3','5','7'], repeat=i)
  for j in blist:
    if '3' in j and '5' in j and '7' in j:
      if int(''.join(j))<=n:
        ans+=1
print(ans)

Measured memory_bytes: 9144
K, N = map(int, input().split())

A = list(map(int, input().split()))

c = abs(K - A[N-1] + A[0])

for i in range(N-1):
  d = abs(A[i] - A[i+1])
  if c < d:
    c = d
  else:
    c = c
    
print(K-c)

Measured memory_bytes: 32264
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String}, 1})=map(parseInt, x)
function main()
A=[]
N,K,Q=parseMap(split(readline()))
for k in 1:Q
  push!(A,parseInt(readline()))
end
score=fill(K,N)
for i in A
  score[i]=score[i]+1
end

score=score.-Q
for j in score
  if j>0
    println("Yes")
  else
    println("No")
  end
end
end
main()





Measured memory_bytes: 128596
import java.util.Scanner;
    public class Main {
        public static void main(String[] args){
          	Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		sc.close();
            int M=0;
            int i=357;
            while(i<=N){
                int a=0;
                int b=0;
                int c=0;
                int d=0;
                for(int j=i;j>0;j/=10){
                    if(j%10==3){
                        a++;
                    }else if(j%10==5){
                        b++;
                    }else if(j%10==7){
                        c++;
                    }else{
                        d++;
                        break;
                    }
                }
                if(a!=0&&b!=0&&c!=0&&d==0){
                    M++;
                }
                if(i%100==37||i%10==57){
                  i+=16;
                }else if(i%100==77){
                  i+=56;
                }else {
                  i+=2; 
                }
            }
            System.out.println(M);
        }
    }

Measured memory_bytes: 25044
# Input
a, b, k = map(int, input().split())

# Loop K Times
for idx in range(k):
    if idx % 2 == 0:
        # Mr.Takahashi Section
        if a % 2 == 1:
            a = a - 1

        b = b + a / 2
        a = a / 2
    else:
        # Mr.Aoki Section
        if b % 2 == 1:
            b = b - 1

        a = a + b / 2
        b = b / 2

print(str(int(a)) + " " + str(int(b)))


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

using namespace std;

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n;
	cin>>n;

	map<string,lli> ans;
	for(lli i=0;i<n;i++){
		string s;
		cin>>s;

		//ここで受け取った文字列sを辞書順最小にソートする
		sort(s.begin(),s.end());
		//ここで受け取った文字列sを辞書順最小にソートする

		ans[s]++;
	}
	lli sum = 0;

  for(map<string,lli>::iterator e=ans.begin();e!=ans.end();++e){
		lli tmp = e->second*(e->second-1)/2;
		sum += tmp;
	}
	cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 11136
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))

A.sort()

L1=0
L2=0
used=[False for i in range(N)]
for i in range(1,N):
    if A[i]==A[i-1] and not used[i-1] and not used[i]:
        if L1<=A[i]:
            used[i-1]=True
            used[i]=True
            L2=L1
            L1=A[i]

print(L1*L2)


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

using namespace std;

const int MAXN = 3000;
long double dp[MAXN][MAXN];
long double p[MAXN];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i];
    dp[0][0] = 1 - p[0];
    dp[0][1] = p[0];
    for (int i = 1; i < n; i++)
    {
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
        for (int j = 1; j <= n; j++)
        {
            dp[i][j] = (1 - p[i]) * dp[i - 1][j] + p[i] * dp[i - 1][j - 1];
            //cout << i << " " << j << " " << dp[i][j] << endl;
        }
    }
    long double ans = 0;
    for (int i = (n + 1) / 2; i <= n; i++)
        ans += dp[n - 1][i];
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 140800
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    F = "ABC".index
    S = [0]*3
    S[0] = 1
    for line in readlines():
        a, b = map(F, line.strip().split(","))
        S[a], S[b] = S[b], S[a]
    write("%s\n" % "ABC"[S.index(1)])
solve()



Measured memory_bytes: 5568
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll MOD = 1000000007;  // 1e9 + 7

// Digit DP.

// In each digit, x and y is in one of the three.
// - x=0, y=0
// - x=0, y=1 (In this case, most significant bit must appear in the left bits)
// - x=1, y=1

// (digit)
// (L <= x is already satisfied by the left bits)
// (y <= R is already satisfied by the left bits)
// (most significant bit already appeared)
ll dp[61][2][2][2];

int main(int argc, char** argv) {
  ll L, R;
  cin >> L >> R;

  dp[0][0][0][0] = 1; // dp[i] represents the result of top-i digits. i-0 is initialized.
  for (ll i = 0; i < 60; ++i) {
    ll lb = (L >> (59-i)) & 1;
    ll rb = (R >> (59-i)) & 1;
    rep(j, 2) rep(k, 2) rep(s, 2) { // previous state
      ll pre = dp[i][j][k][s];
      rep(x, 2) rep(y, 2) {
        if (x && !y) { continue; } // x 1, y 0

        int nj = j, nk = k, ns = s; // next state.

        // Calculate the next state.
        if (!s && x != y) { continue; }
        if (x && y) { ns = 1; } // x = 1, y = 1, bit appeared
        // j: L <= x
        if (!j && !x && lb) { continue; } // x = 0, lb = 1, invalid
        if (x && !lb) { nj = 1; } // x = 1, lb = 0, L <= x is satisfied
        // k: y <= R
        if (!k && y && !rb) { continue; } // y = 1, rb = 0, invalid
        if (!y && rb) { nk = 1; } // y = 0, rb = 1, y <= R is satisfied
        dp[i+1][nj][nk][ns] += pre;
        dp[i+1][nj][nk][ns] %= MOD;
      }
    }
  }
  ll ans = 0;
  rep(j, 2) rep(k, 2) rep(s, 2) {
    ans += dp[60][j][k][s];
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    double height;
    double max, min, diff, count = 0;
    
    while(scanf("%lf\n", &height) != EOF) {
        count++;
        if(count == 1) {
            max = height;
            min = height;
        } else {
            if(height > max)
                max = height;
            else if(height < min)
                min = height;
        }
    }
    
    diff = max - min;
    
    printf("%f\n", diff);
    
    return(0);
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,y;
    cin>>x>>y;
    if(x==2||y==2){cout<<"No"<<endl;}
    else if(x==4||x==6||x==9||x==11){if(y==6||y==9||y==11){cout<<"Yes"<<endl;}
                                     else{cout<<"No"<<endl;}}
    else{if(y==3||y==5||y==7||y==8||y==10||y==12){cout<<"Yes"<<endl;}
         else{cout<<"No"<<endl;}}
    return 0;
    }

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

#include<bits/stdc++.h>
 using namespace std;

 int main() {
     string s;
     cin >> s;
     for (int i=1;i<s.length()+1;i++){
         if( i%2 ==1){
             cout << s.at(i-1);
         }
     }
 }

Measured memory_bytes: 512
N;
double x[50],y[50];
double cx,cy,cr;
double norm(double x1,double y1,double x2,double y2)
{
	return(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
int in(int id)
{
	return norm(x[id],y[id],cx,cy)<cr+1e-10;
}
void make2(int ia,int ib)
{
	cx=(x[ia]+x[ib])/2;
	cy=(y[ia]+y[ib])/2;
	cr=norm(x[ia],y[ia],cx,cy);
}
void make3(int ia,int ib,int ic)
{
	double A=norm(x[ib],y[ib],x[ic],y[ic]);
	double B=norm(x[ic],y[ic],x[ia],y[ia]);
	double C=norm(x[ia],y[ia],x[ib],y[ib]);
	double S=(x[ib]-x[ia])*(y[ic]-y[ia])-(x[ic]-x[ia])*(y[ib]-y[ia]);
	S=4*S*S;
	cx=(A*(B+C-A)*x[ia]+B*(C+A-B)*x[ib]+C*(A+B-C)*x[ic])/S;
	cy=(A*(B+C-A)*y[ia]+B*(C+A-B)*y[ib]+C*(A+B-C)*y[ic])/S;
	cr=norm(x[ia],y[ia],cx,cy);
}
main()
{
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%lf%lf",&x[i],&y[i]);
	make2(0,1);
	for(int i=2;i<N;i++)
	{
		if(!in(i))
		{
			make2(0,i);
			for(int j=1;j<i;j++)
			{
				if(!in(j))
				{
					make2(i,j);
					for(int k=0;k<j;k++)
					{
						if(!in(k))
						{
							make3(i,j,k);
						}
					}
				}
			}
		}
	}
	printf("%.16f\n",sqrt(cr));
}


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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

void solve() {
    int n, s;
    cin >> n >> s;

    vector<int> v(n);
    for (int i = 0; i < n; i++)
        cin >> v[i];
    int sum = 0, ans = n + 10;
    for (int j = 0, i = 0; i < n and j < n; i++) {
        sum += v[i];
        while (j < n and sum - v[j] >= s and j < i) {
            sum -= v[j];
            j++;
        }
        if (sum >= s and (ans > i - j + 1))
            ans = min(ans, i - j + 1);
    }
    if (ans == n + 10)
        ans = 0;
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;

vector<int> factors;
void factorize(int n){
    factors.clear();

    while (n % 2 == 0){
        factors.push_back(2); n /= 2;
    }

    for (int i = 3; i <= sqrt(n); i += 2){
        while (n % i == 0){
            factors.push_back(i); n /= i;
        }
    }

    if (n > 2) factors.push_back(n);

    //factors.erase(unique(factors.begin(), factors.end()), factors.end());
}

int main(){
    int n; cin >> n; factorize(n); cout << n << ':';
    for (int i = 0; i < factors.size(); i++) cout << ' ' << factors[i];
    cout << endl;
    return 0;
}



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

int main(){
  int N;
  cin >> N;
  
  int a, b;
  a = (int)(N / 1.08);
  
  if ((int)(a * 1.08) == N) cout << a;
  else if ((int)((a + 1) * 1.08) == N) cout << a + 1;
  else cout << ":(";
  
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int h[n];
  rep(i,n) cin >> h[i];
  bool can = true;
  for(int i = n-2; i >= 0; i--) {
    if(h[i] > h[i+1] + 1) can = false;
    if(h[i] == h[i+1] + 1) h[i]--;
  }
  cout << (can? "Yes" : "No") << endl;
  return 0;
}

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

using namespace std;
#define ll long long int

int main() {
    int n,m;
    cin >> n >> m;
    int l,r;
    int last=-1;
    int r1,l1;
    for(int i=0;i<m;i++){
        cin >> l >> r;
        if(last !=-1){
            if(r1<l1 || r1 < l){cout<<0;return 0;}
            else{
                l1=max(l1,l);
                r1=min(r1,r);
            }
        }
        else l1=l,r1=r,last=1;
        
    }
    cout << min(n,r1-l1+1);
    //cout<<"Sum of x+y = " << z;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	ll n;
	cin>>n;
	ll l = 0;
	ll r = n;
	while(r-l>1){
		ll mid = (r+l)/2;
		if(mid*(mid+1)/2 >= n) r = mid;
		else l = mid;
	}
	vint ans;
	for(int i = r; i >= 1; i--){
		if(n-i>=0){
			ans.PB(i);
			n-=i;
		}
	}
	sort(ALL(ans));
	rep(i,ans.size()){
		cout << ans[i] << endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 384