akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
bool pairCompare(const P& firstElof, const P& secondElof)
{
	return firstElof.second > secondElof.second;
}

int main() {
	//入力
	int n;
	cin >> n;
	vector<int> v(n), v_e(0), v_o(0);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		if (i % 2 == 0) {
			v_e.push_back(v[i]);
		}
		else {
			v_o.push_back(v[i]);
		}
	}

	//最頻値順にソートする
	sort(v_e.begin(), v_e.end());
	sort(v_o.begin(), v_o.end());

	vector<pair<int, int>> v_e_p(0), v_o_p(0);
	for (int i = 0; i < n / 2; i++) {
		if (i == 0) {
			v_e_p.push_back(make_pair(v_e[i], 1));
			v_o_p.push_back(make_pair(v_o[i], 1));
			continue;
		}

		if (v_e[i] != v_e[i - 1]) {
			v_e_p.push_back(make_pair(v_e[i], 1));
		}
		else {
			v_e_p[v_e_p.size() - 1].second++;
		}

		if (v_o[i] != v_o[i - 1]) {
			v_o_p.push_back(make_pair(v_o[i], 1));
		}
		else {
			v_o_p[v_o_p.size() - 1].second++;
		}
	}

	sort(v_e_p.begin(), v_e_p.end(), pairCompare);
	sort(v_o_p.begin(), v_o_p.end(), pairCompare);

	if (v_e_p[0].first != v_o_p[0].first) {//最初で決まった
		cout << n - v_e_p[0].second - v_o_p[0].second;
	}
	else {
		if (v_e_p.size() == 1 && v_o_p.size() == 1) {//全部同じ
			cout << v_e.size();
			return 0;
		}

		if (v_e_p[0].second + v_o_p[1].second > v_e_p[1].second + v_o_p[0].second) {
			cout << n - v_e_p[0].second - v_o_p[1].second;
		}
		else {
			cout << n - v_e_p[1].second - v_o_p[0].second;
		}
	}

	return 0;
}

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

int mytime(int a){
    if(a % 10 == 0){
        return a;
    }
    else{
        return (a + 10 - a%10);
    }
}
 
int main() {
    vector<int> vec(5);
    int maxtime = 0;
    for (int i=0; i<5; i++){
        cin >> vec.at(i);
        maxtime += mytime(vec.at(i));
    }

    int minamari=0;
    for(int i=1; i<=9; i++){
        for(int j=0; j<5; j++){
            if(vec.at(j) % 10 == i){
                minamari = vec.at(j) % 10;
                break;
            }
        }
        if(minamari != 0){
            break;
        }
    }

    int ans;
    if(minamari == 0){
        ans = maxtime;
    }
    else{
        ans = maxtime -10 + minamari;
    }
    
    cout << ans << endl;

}

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

int main() {
    int A,B,C,X;
    cin>>A>>B>>C>>X;
    int ans = 0;
    REP(i,A+1){
        REP(j,B+1){
            REP(k,C+1){
                if(i*500+j*100+k*50==X){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 200005
using namespace std;
typedef long long ll;
int n,a[N],b[N];
ll ans=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	b[n+1]=n+1;a[n+1]=1;
	for(int i=n;i;i--){
		if(a[i]) b[i]=i;
		else if(a[i+1]) b[i]=i;
		else b[i]=b[i+1];
	}
	for(int i=1;i<=n;i++){
		int sum=0,tot=0,now=0;
		for(int p=i;p<=n;p=b[p+1]){
			sum^=a[p];tot+=a[p];
			if(tot!=sum) break;
			now=p-i+1;
			if(p==n) break;
		}
		ans+=now;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll n;
    cin >> n;
    n %= 1000;
    if(n == 0){
        cout << 0 << endl;
    }else{
        cout << 1000 - n << endl;
    }
    return 0;
}


Measured memory_bytes: 3560
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI x;
VI sl;
multiset<in> vclos;
in bvfar;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,t,e;
  cin>>n>>e>>t;
  x.resize(n+2);
  x[0]=0;
  x[n+1]=e;
  forn(i,n)
    cin>>x[i+1];
  sl.resize(n+2);
  sl[0]=0;
  bvfar=1e18;
  in nxfar=0;
  vclos.insert(sl[0]-x[0]);
  sl[1]=x[1];
  vclos.insert(sl[1]-x[1]);
  for(in i=2;i<=n+1;++i){
    while((x[i-1]-x[nxfar])*2>=t){
      bvfar=min(bvfar,sl[nxfar]-3*x[nxfar]);
      vclos.erase(vclos.find(sl[nxfar]-x[nxfar]));
      ++nxfar;
    }
    sl[i]=bvfar+3*x[i-1]+(x[i]-x[i-1]);
    if(!(vclos.empty()))
      sl[i]=min(sl[i],*(vclos.begin())+t+x[i]);
    vclos.insert(sl[i]-x[i]);
  }
  cout<<sl[n+1]<<endl;
  return 0;
}


Measured memory_bytes: 3840
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var line = consoleReader.Split.Int;
            var N = line[0];
            var K = line[1];

            if (K == 1) return 0;

            return N - K;
        }


        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader()).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader { public class SplitLine { string[] splited; public SplitLine(string line) { splited = line.Split(); } public string[] String => splited.ToArray(); public int[] Int => splited.Select(int.Parse).ToArray(); public long[] Long => splited.Select(long.Parse).ToArray(); public ulong[] ULong => splited.Select(ulong.Parse).ToArray(); public double[] Double => splited.Select(double.Parse).ToArray(); } public class RepeatLine { ConsoleReader reader; int num; public RepeatLine(ConsoleReader reader, int num) { this.reader = reader; this.num = num; } public IEnumerable<string> String { get { for (int i = 0; i < num; i++) yield return reader.String; } } public IEnumerable<int> Int { get { for (int i = 0; i < num; i++) yield return reader.Int; } } public IEnumerable<long> Long { get { for (int i = 0; i < num; i++) yield return reader.Long; } } public IEnumerable<string[]> Split { get { for (int i = 0; i < num; i++) yield return reader.Split.String; } } public IEnumerable<int[]> SplitInt { get { for (int i = 0; i < num; i++) yield return reader.Split.Int; } } } public virtual string String => Console.ReadLine(); public int Int => int.Parse(String); public long Long => long.Parse(String); public ulong ULong => ulong.Parse(String); public double Double => double.Parse(String); public SplitLine Split => new SplitLine(String); public RepeatLine Repeat(int count) => new RepeatLine(this, count); }
}

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

#define int unsigned long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    
    int ans=0;
    REP(i,1,n+1){
        REP(j,1,k+1){
            if(i==(j%10)*(j/10) && j%10>=2 && j/10>=2){
                ans++;
//                cout<<i<<" "<<j<<endl;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
const int MAXN = 2e5 + 10;
const int inf = 1e9 + 10;

struct vec {
    double x, y;
    double p;
    vec()
    {
    }
    vec(double a, double b)
    {
        x = a, y = b;
    }
    bool operator>(const vec a) const
    {
        return x == a.x ? y > a.y : x > a.x;
    }
    vec operator-(const vec a) const
    {
        return vec(x - a.x, y - a.y);
    }
    vec operator+(const vec a) const
    {
        return vec(x + a.x, y + a.y);
    }
    bool operator<(const vec a) const
    {
        return x == a.x ? y < a.y : x < a.x;
    }
    friend ostream& operator<<(ostream& out, vec& a)
    {
        cout << a.x << ' ' << a.y;
        return out;
    }
    friend istream& operator>>(istream& in, vec& a)
    {
        in >> a.x >> a.y;
        return in;
    }

} p[MAXN];
int n;
double changdu(vec a)
{
    return sqrt(a.x * a.x + a.y * a.y);
}
bool cmp(vec a, vec b)
{
    return a.y < b.y;
}

vec temp[MAXN];
double cdq(int l, int r)
{
    if (l == r)
        return inf;
    int mid = (l + r) >> 1;

    double ans = cdq(l, mid);
    ans = min(ans, cdq(mid + 1, r));

    int tot = 0;
    for (int i = l; i <= r; i++)
        if (fabs(p[mid].x - p[i].x) <= ans)
            temp[tot++] = p[i];

    sort(temp,temp+tot, cmp);

    for (int i = 0; i < tot; i++)
        for (int j = i + 1; j <tot; j++) {
            if (temp[j].y - temp[i].y > ans)
                break;
            ans = min(ans, changdu(temp[j] - temp[i]));
        }
    return ans;
}
int main()
{
    // freopen("txt.txt", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> p[i];
    sort(p + 1, p + n + 1);
    double ans = cdq(1, n);
    printf("%.8f\n", ans);
    return 0;
}


Measured memory_bytes: 7156
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=200010;
int tt;
char w[N],s[N];
int head[N],to[N*2],nxt[N*2],v[N],in[N][2];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=='-'?o=-1:0,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return o*x;
}
int main() {
    int n,m,tp=0;
    cin>>n>>m;
    scanf("%s",s+1);
    for(int i=1;i<=m;i++) {
	int x=gi(),y=gi();
	++in[y][s[x]-'A'],++in[x][s[y]-'A'];
	to[++tt]=y,nxt[tt]=head[x],head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],head[y]=tt;
    }
    for(int i=1;i<=n;i++)
	if(!in[i][0]||!in[i][1]) v[++tp]=i,w[i]=1;
    while(tp) {
	int x=v[tp--];
	for(int i=head[x];i;i=nxt[i]) {
	    int y=to[i];
	    if(!w[y]&&!--in[y][s[x]-'A']) v[++tp]=y,w[y]=1;
	}
    }
    for(int i=1;i<=n;i++)
	if(!w[i]) return puts("Yes"),0;
    puts("No");
    return 0;
}

Measured memory_bytes: 6784
import java.security.KeyStore.TrustedCertificateEntry
import java.util
import java.util.{ArrayList, Collections, Comparator, List => JList}
import scala.math._

import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.{Failure, Success, Try}

object Main{
  val LINE_SEPARATOR = "\n"
  def main(args: Array[String]): Unit = {
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString(LINE_SEPARATOR);
      println(solve(input).trim());
    }
  }

  def init (nRows: Int, nCols: Int, default: Int) = Array.tabulate(nRows,nCols)( (x,y) =>  default)

  def sortIgnoreCase1(list: JList[String]): JList[String] = {
    val r = new ArrayList[String](list)
    Collections.sort(r, new Comparator[String] {
      override def compare(o1: String, o2: String): Int = o1.compareToIgnoreCase(o2)
    })
    r
  }

  def solve(input: String): String = {
    val a = input.split(" ").head.toInt
    val b = input.split(" ").tail.head.toInt
    val c = input.split(" ").tail.tail.head.toInt
    val x = input.split(" ").tail.tail.tail.head.toInt
    val y = input.split(" ").tail.tail.tail.tail.head.toInt

    val result = if (x == y) {
      min(a*x + b * y, 2 * c * x)
    }
    else if (x > y) {
      min(a * x + b * y, 2 * c * y + min(a * (x - y), 2 * c * (x - y)))
    } else {
      min(a * x + b * y, 2 * c * x + min(b * (y - x), 2 * c * (y - x)))
    }
    result.toString
  }

  def divisors(n: Long): Vector[Long] = {
    val halfList = (1 to sqrt(n).toInt).toVector.filter(_ % n == 0).map(_.toLong)
    val reversedList = if (sqrt(n).floor == sqrt(n)) halfList.reverse.tail.map(n/_) else halfList.reverse.map(n/_)
    halfList ++ reversedList
  }

  def gcd(m: Long, n: Long): Long = n match {
    case 0 => m
    case _ => gcd(n, m % n)
  }
  def lcm(a: Long, b: Long): Long = a * b / gcd(a, b)

  val tests=List(
    """1500 2000 1600 3 2""".stripMargin -> """7900
                                              |
                                         |""".stripMargin,
    """1500 2000 1900 3 2""".stripMargin -> """8500
                                              |
                                      |""".stripMargin,
    """1500 2000 500 90000 100000""" -> """100000000
                                          |""".stripMargin
  )

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}
      .zipWithIndex.map{
      case ((input,outputExpect),i)=>{
        val output=solve(input).trim();
        s"test${i+1}:"+(if(output==outputExpect){
          "Passed"
        }else{
          s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
        })
      }}
      .mkString("\n");
  }
}

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

using namespace std;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  int l = 1, r = n;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    if (l < a) {
      l = a;
    }
    if (b < r) {
      r = b;
    }
  }
  if (r < l) {
    cout << 0 << endl;
  } else {
    cout << r - l + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	ll n; cin >> n;
	ll ans = 0;
	rep(i, 101) if (pow(2, i) > n){
		ans = pow(2, i - 1);
		break;
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
const int N = 100005;

int r[N],g[N],b[N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
	
	int n;
	cin>>n;
	string s;
	cin>>s;
	ll ans = 0;
	
	if(s[0] == 'R')r[0]++;
	if(s[0] == 'G')g[0]++;
	if(s[0] == 'B')b[0]++;
	
	for(int i=1;i<n;i++){
		r[i] = r[i-1];
		g[i] = g[i-1];
		b[i] = b[i-1];
		if(s[i] == 'R')r[i]++;
		if(s[i] == 'G')g[i]++;
		if(s[i] == 'B')b[i]++;
	}
	
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(s[i] != s[j]){
				if(s[i] != 'G' && s[j] != 'G'){
					ans += g[n-1]-g[j];
					if(j + (j-i) <= n-1 && s[j+j-i] == 'G')ans--;
				}
				if(s[i] != 'R' && s[j] != 'R'){
					ans += r[n-1]-r[j];
					if(j + (j-i) <= n-1 && s[j+j-i] == 'R')ans--;
				}
				if(s[i] != 'B' && s[j] != 'B'){
					ans += b[n-1]-b[j];
					if(j + (j-i) <= n-1 && s[j+j-i] == 'B')ans--;
				}
			}
		}
	}
	
	cout<<ans;
	
	return 0;
}



Measured memory_bytes: 3668
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int n;
    cin >> n;

    cout << n / 3 << endl;

    return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import defaultdict

s = ns()
n = len(s)
m = 1
c = [0] * (n + 1)

for i in range(n - 1, -1, -1):
    t = int(s[i]) * m % 2019
    c[i] = (c[i + 1] + t) % 2019
    m *= 10
    m %= 2019

ans = 0
dic = defaultdict(int)
for i in range(n, -1, -1):
    ans += dic[c[i]]
    dic[c[i]] += 1

print(ans)

Measured memory_bytes: 16552
#include <iostream>

#include<cmath>

using namespace std;

int main()
{
  int n1,n2,a,b,c,d;
  cin>>n1>>n2;
  a=n1+n2;b=n1-n2;c=n1*n2;
  d=max(a,b);
  cout<<max(c,d);


    return 0;
}


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

int main() {
    ll X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
    vector<ll> red(A), green(B), none(C);
    for (ll i = 0; i < A; ++i) cin >> red[i];
    for (ll i = 0; i < B; ++i) cin >> green[i];
    for (ll i = 0; i < C; ++i) cin >> none[i];
    sort(red.begin(), red.end(), greater<ll>());
    sort(green.begin(), green.end(), greater<ll>());
    sort(none.begin(), none.end(), greater<ll>());
    vector<ll> v(X + Y + C);
    for (int i = 0; i < X; ++i) v[i] = red[i];
    for (int i = 0; i < Y; ++i) v[i + X] = green[i];
    for (int i = 0; i < C; ++i) v[i + X + Y] = none[i];
    sort(v.begin(), v.end(), greater<ll>());
    ll ans = 0;
    for (ll i = 0; i < X + Y; ++i) ans += v[i];
    cout << ans << endl;
}

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


int main(){
  int X ; 
  cin >> X ; 
  
  if(X >= 1800){
    cout << 1 << endl ; 
  }
  if(X >= 1600 && X <= 1799){
    cout << 2 << endl ; 
  }  
  if(X >= 1400 && X <= 1599){
    cout << 3 << endl ; 
  }
  if(X >= 1200 && X <= 1399){
    cout << 4 << endl ; 
  }  
  if(X >= 1000 && X <= 1199){
    cout << 5 << endl ; 
  }  
  if(X >= 800 && X <= 999){
    cout << 6 << endl ; 
  }
  if(X >= 600 && X <= 799){
    cout << 7 << endl ; 
  }
  if(X >= 400 && X <= 599){
    cout << 8 << endl ; 
  }  
  
}

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

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

const int mod = 1e9 + 7;

void add(int &a, int b){
    a += b;
    if(a >= mod)
        a -= mod;
}

int n;
const int maxn = 2e5 + 5;
ll a[maxn], b[maxn];

map<pair<ll, ll>, int> cnt, vis;

int power[maxn];

ll gcd(ll a, ll b){
    return b == 0 ? a : gcd(b, a % b);
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    int C = 0;
    for(int i = 1;i <= n;i++){
        cin >> a[i] >> b[i];
        if(a[i] == 0 and b[i] == 0){
            C++;
            continue;
        }
        ll A = abs(a[i]), B = abs(b[i]);
        ll g = gcd(A, B);
        a[i] /= g;
        b[i] /= g;
        if(a[i] < 0 or (a[i] == 0 and b[i] < 0)){
            a[i] = -a[i];
            b[i] = -b[i];
        }
        cnt[mp(a[i], b[i])]++;
    }
    power[0] = 1;
    for(int i = 1;i <= n;i++){
        power[i] = power[i - 1] * 2 % mod;
    }
    int ans = 1;
    for(auto p : cnt){
        if(vis.count(p.fi))
            continue;
        int cnt1 = p.se;
        ll x = p.fi.fi;
        ll y = p.fi.se;
        pair<ll, ll> to;
        if(y > 0)
            to = mp(y, -x);
        else
            to = mp(-y, x);
        int cnt2 = cnt[to];
        int tmp = (power[cnt1] + power[cnt2]) % mod;
        tmp = (tmp + mod - 1) % mod;
        ans = 1LL * ans * tmp % mod;
        vis[p.fi] = true;
        vis[to] = true;
    }
    ans = (ans + mod - 1) % mod;
    ans = (ans + C) % mod;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int INF = 1e9 + 5;

int a[100005];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        if (i+1 < n) {
            dp[i+1] = min(dp[i+1], dp[i] + abs(a[i+1] - a[i]));
        }
        if (i+2 < n) {
            dp[i+2] = min(dp[i+2], dp[i] + abs(a[i+2] - a[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
dp = [0] * (N + 1)
dp[0] = 0
for i in range(1, N + 1):
    cnt = i
    for j in range(1, 7):
        q = 6 ** j
        if i >= q:
            cnt = min(cnt, dp[i - q] + 1)
    for j in range(1, 6):
        q = 9 ** j
        if i >= q:
            cnt = min(cnt, dp[i - q] + 1)
    dp[i] = cnt
print(dp[N])

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    #define double long double
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    void chmax(int &x,const ll y) {x=(x>y?x:y);}
    void chmin(int &x,const ll y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):0;}
    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;
        while(e)
        {
            if(e&1) ans=ans*x%MOD;
            x=x*x%MOD;e>>=1;
        }
        return ans;
    }
    inline int invm(int x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    char str[N];int n;
    int getmi(int a,int b)
    {
        int ta=a,tb=b;
        while(str[a]==str[b]) a++,b++;
        return str[a]<str[b]?ta:tb;
    }
    vc<char> ans,ans2;
    void main()
    {
        int n=qread(),k=qread()-1;scanf("%s",str);
        for(int i=n;i<n+n;i++) str[i]=str[i-n];reverse(str+n,str+n+n);
        int mi=0;for(int i=1;i<=n;i++) mi=getmi(mi,i);
        int cnt=0;while(cnt<n and str[mi]==str[mi+cnt]) cnt++;
        // printf("cnt=%d\n",cnt);
        mi=(n+n-1-mi)-n+1;for(int i=mi;i<mi+n;i++) ans.PB(str[i]);
        while(k--)
        {
            ans2.clear();
            if(cnt*2>=n)
            {
                int t=n;while(t--) ans2.PB(ans[n-1]);swap(ans,ans2);
                break;
            }
            int st=n-1-(n-cnt)+1,op=1;
            int pp=n;while(pp--) {ans2.PB(ans[st]);st+=op;if(st==n)st--,op=-1;}
            swap(ans,ans2);cnt*=2;
            // puts("");
        }
        for(int t=sz(ans)-1;t>=0;t--) putchar(ans[t]);
    }
};
int main()
{
    srand(time(0));
    mine::main();
}


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

int main(){
  int N;
  cin>>N;
  for(int n=0;n<N;n++){
    string a;
    cin>>a;
    if(a=="Y"){
      cout<<"Four"<<endl;
      break;
    }
    else if(n==N-1&&a!="Y"){
      cout<<"Three"<<endl;
      break;
    }
  }
}  

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

#define rep(N) for(int i = 0; i < N; i++)
typedef long long ll;

      
int main () {
   int n; cin >> n; 
   vector<ll> a(n);
   rep(n) {
       cin >> a[i];
   }

   ll sum = 0;
   rep(n) {
      if(a[i]%2 == 0) {
         while(a[i]%2 == 0) {
            a[i] /= 2;
            sum ++;
         }
      }
   }

   cout << sum << endl;

}

      

   


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int arr[5];
    int res = 0;
    for(int i = 0; i < 5; i++){
        cin>>arr[i];
        if(arr[i] == 0){
            res = i;
        }
    }
    cout<<res+1;
}

Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k,q;
    cin>>n>>k>>q;
    vector<int> a(q);
    for(int i=0;i<q;i++)cin>>a[i];
    int s[d5];
    for(int i=0;i<d5;i++)s[i]=0;
    for(auto it:a){
        s[it-1]++;
    }
    for(int i=0;i<n;i++){
        if(k+s[i]-q>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 2176
h,w = [int(i) for i in input().split()]
a = [[False for i in range(w)] for j in range(h)]
#print(a)

for i in range(h):
	v = input()
	for j in range(w):
		if v[j]=='.':
			a[i][j]=True
		else:
			a[i][j]=False

res = 0
ok = [[False for i in range(w)] for j in range(h)]
def bfs(x, y, d):
	q = []
	q.append((x,y,d))
	
	global res
	global ok

	while not len(q)==0:
		x, y, d = q[0]
		q.pop(0)

		if a[x][y] and not ok[x][y]:
			res = max(res, d)
			ok[x][y]=True

			if x-1>=0:
				q.append((x-1,y,d+1))
			if y-1>=0:
				q.append((x,y-1,d+1))
			if x+1<h:
				q.append((x+1,y, d+1))
			if y+1<w:
				q.append((x,y+1, d+1))


for i in range(h):
	for j in range(w):
		ok = [[False for i in range(w)] for j in range(h)]
		bfs(i,j,0)

print(res)



Measured memory_bytes: 74156
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り 0:ON 1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if (system == 0)
					param.add(sc.next());
				if (system == 1)
					param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {

		int[][] area = new int[num.get(0)][num.get(1)];

		for (int i = 3; i < num.size() - 2; i += 3) {
			if (num.get(i + 2) == 1) {
				for (int j = 0; j < num.get(i); j++) {
					for (int k = 0; k < area[0].length; k++) {
						area[j][k] = 1;
					}
				}
			} else if (num.get(i + 2) == 2) {
				for (int j = num.get(i); j < area.length; j++) {
					for (int k = 0; k < area[0].length; k++) {
						area[j][k] = 1;
					}
				}
			} else if (num.get(i + 2) == 3) {
				for (int j = 0; j < area.length; j++) {
					for (int k = 0; k < num.get(i+1); k++) {
						area[j][k] = 1;
					}
				}
			} else if (num.get(i + 2) == 4) {
				for (int j = 0; j < area.length; j++) {
					for (int k = num.get(i+1); k < area[0].length; k++) {
						area[j][k] = 1;
					}
				}
			}
		}
		
		int count = 0;
		
		for (int i = area[0].length-1; i >= 0; i--) {
			//System.out.println();
			for (int j = 0; j < area.length; j++) {
				//System.out.print(area[j][i]);
				if(area[j][i] == 0) count++;
			}
		}
		System.out.println(count);
	}
}

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

int main()
{
    int a,b,ans=0,cnt=0;
    string s;
    cin>>a>>b;
    cin>>s;
    for(int i=0; i<a; i++)
    {
        if(s[i]-'0'<0||s[i]-'0'>9)
        {
            cout<<"No";
                return 0;
        }
    }
    if(s[a]!='-')
    {
        cout<<"No";
            return 0;
    }
    for(int i= a+1 ; i <a+b+1 ; i++)
    {
        if(s[i]-'0'<0||s[i]-'0'>9)
        {
            cout<<"No";
                return 0;
        }
    }
    cout<<"Yes";
    return 0;
}



Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int n,m;
    int a[30][30];
    int b[30],c;
    cin >> n >> m >> c;
    rep(i,m){
        cin >> b[i];
    }
    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }

    int res = 0;
    rep(i,n){
        int check=0;
        rep(j,m){
            check+=a[i][j]*b[j];
        }
        check+=c;
        if(check>0)res++;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
//22:04 1:03
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N (1<<20)
ll n,m,a[N],cnt[N];
class RMQ{
private:
    ll dat[2*N];
    ll dfs(int l,int r,int a,int b,int k){
	if(l<=a&&b<=r)return dat[k];
	if(b<=l||r<=a)return 0;
	ll vl=dfs(l,r,a,(a+b)/2,k*2+1);
	ll vr=dfs(l,r,(a+b)/2,b,k*2+2);
	return max(vl,vr);
    }
public:
    void Init(){
	lol(i,2*N)dat[i]=0;
	lol(i,m)Update(i,cnt[i]);
    }
    void Update(int i,ll x){
	i+=N-1;dat[i]=x;
	while(i>0){
	    i=(i-1)/2;
	    dat[i]=max(dat[i*2+1],dat[i*2+2]);
	}
    }
    void Add(int i,ll x){
	Update(i,dat[i+N-1]+x);
    }
    ll Max(int l,int r){
	return dfs(l,r+1,0,N,0);
    }
};
vector<ll> v[N];
ll ans[N];
void Solve(){
    RMQ seg;seg.Init();
    lol(i,m){
	for(auto x:v[i])seg.Add(x,-1);
	ll res=0;
	res=max(res,seg.Max(0,i-1));
	res=max(res,seg.Max(i+1,m-1));
	ans[i]=max(ans[i],res+cnt[i]);
	for(auto x:v[i])seg.Add(x,1);
    }
}
int main(){
    cin>>n>>m;
    lol(i,m)cnt[i]=0,ans[i]=0;
    lol(i,n){scanf("%lld",&a[i]);a[i]--;cnt[a[i]]++;}
    for(int i=0;i+1<n;i+=2){
	ll x=i,y=i+1;
	v[a[x]].push_back(a[y]);
	v[a[y]].push_back(a[x]);
    }
    Solve();
    lol(i,m)v[i].clear();
    for(int i=1;i+1<n;i+=2){
	ll x=i,y=i+1;
	v[a[x]].push_back(a[y]);
	v[a[y]].push_back(a[x]);
    }
    Solve();
    lol(i,m){
	ans[i]=n-ans[i];
	printf("%lld\n",ans[i]);
    }
    return 0;
}



Measured memory_bytes: 98800
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
char in[110000];
int cnt[26];
int main(){
	int a;scanf("%d",&a);
	scanf("%s",in);
	for(int i=0;i<a;i++){
		cnt[in[i]-'a']++;
	}
	long long ret=1;
	for(int i=0;i<26;i++){
		ret=(ret*(cnt[i]+1))%mod;
	}
	ret=(ret+mod-1)%mod;printf("%lld\n",ret);
}

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

using namespace std;

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

int s[10];

int count(int n, int p) {
  if(n <= 0) return p == 0;
  else return count(n-1, p ^ s[n-1]) + count(n-1, p);
}

int main() {
  int n, m, p = 0;
  cin >> n >> m;
  rep(i,m) {
    int k;
    cin >> k;
    rep(j,k) {
      int b;
      cin >> b;
      s[b-1] += 1 << i;
    }
  }
  rep(i,m) {
    int b;
    cin >> b;
    p += b << i;
  }
  
  cout << count(n, p) << endl;
  return 0;
}

Measured memory_bytes: 256
import math
import collections
import fractions
import itertools
import functools
import  operator

def solve():
    n, a, b, c, d = map(int, input().split())
    s = input()
    for i in range(a, max(c,d)):
        if s[i-1:i+1] == "##":
            print("No")
            exit()
    if c < d:
        print("Yes")
        exit()
    for i in range(b-1, d):
        if s[i-1:i+2] == "...":
            print("Yes")
            exit()
    print("No")
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 77828
X, Y = gets.split.map &:to_i
kane = 0
if X == 1
	kane += 300000
elsif X == 2
	kane += 200000
elsif X == 3
	kane += 100000
end
if Y == 1
	kane += 300000
elsif Y == 2
	kane += 200000
elsif Y == 3
	kane += 100000
end
if X == 1 && Y == 1
	kane += 400000
end
p kane

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

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

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

int K;
string S;

signed main()
{
	cin >> K >> S;

	if (K >= S.size()) cout << S << endl;
	else {
		rep(i, K) cout << S[i];
		cout << "...\n";
	}
}




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

int main(){

    char input;
    cin >> input;

    if(input == 'A'){
        cout << "T";
    }
    else if(input == 'T'){
        cout << "A";
    }
    else if(input == 'C'){
        cout << "G";
    }
    else if(input == 'G'){
        cout << "C";
    }
    
    return 0;
}

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

int yaku(int a, int b){
    if(a>b) return yaku(b,a);
    else{
        if(b%a==0) return a;
        else return yaku(b%a,a);
    }
}

int main(){
    long long A,B,C,D;
    cin>>A>>B>>C>>D;

    A--;

    long long x=C*D/yaku(C,D);
    long long a=A%x, b=B%x, AA=A/x, BB=B/x;

    long long set=x-(x/C)-(x/D)+1;


    cout<<set*(BB-AA)+(b-b/C-b/D)-(a-a/C-a/D)<<endl;




}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int M = in.Int();
            int[] sw = new int[M];
            for (int i = 0; i < M; i++) {
                int k = in.Int();
                for (int s : in.Int(k)) {
                    sw[i] += (1 << (s - 1));
                }
            }
            int[] p = in.Int(M);

            int ans = 0;
            int max = (int) Math.pow(2, N);
            for (int i = 0; i < max; i++) {
                boolean f = true;
                for (int j = 0; j < M; j++) {
                    if ((Integer.bitCount(i & sw[j]) & 1) != p[j]) {
                        f = false;
                        break;
                    }
                }
                if (f) ans++;
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 22740
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	char map[55][55];
	int mx[4] = { 0,0,-1,1 }, my[4] = { 1,-1,0,0 };
	int h, w;
	cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> map[i][j];
		}
	}
	
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (map[i][j] == '#') {
				bool check = false;
				for (int k = 0; k < 4; k++) {
					if (i + mx[k] >= 1 && i + mx[k] <= h && j + my[k] <= w && j + my[k] >= 1 && map[i + mx[k]][j + my[k]] == '#') {
						check = true;
					}
				}
				if (!check) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}

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

Measured memory_bytes: 256
N = int(input())
ans, A = 0, []
for _ in range(N):
    a = int(input())
    if a > 2:
        if a % 2 == 0:
            ans += a // 2 - 1
            A.append(2)
        else:
            ans += a // 2
            A.append(1)
    else:
        A.append(a)

for i in range(N-1):
    if A[i] == 1 and (A[i+1] == 1 or A[i+1] == 2):
        A[i+1] -= 1
        ans += 1
    elif A[i] == 2:
        ans += 1

if A[-1] == 2:
    ans += 1

print(ans)

Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }

int main(){
    ll N, X;
    cin >> N >> X;

    ll res = N;
    ll a = max(X, N-X);
    ll b = min(X, N-X);

    while(b){
        ll q = a/b;
        ll r = a%b;

        res += 2*q*b;

        if(r == 0) res -= b;

        a = b;
        b = r;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];

  vector<ll> sum(n+1);
  sum[0] = 0;
  rep(i,n) sum[i+1] = sum[i] + a[i];

  vector<vector<ll>> dp(n+1, vector<ll>(n+1, -1));
  
  auto rec = [&](auto f, int l, int r)-> ll{
	       if(r - l == 1) return dp[l][r] = 0;
	       if(dp[l][r] > 0) return dp[l][r];
	       ll res = 1e+15;
	       for (int i = l+1; i < r; ++i) {
		 chmin(res, f(f, l, i) + f(f, i, r));
	       }
	       return dp[l][r] = res + sum[r] - sum[l];
	     };

  cout << rec(rec, 0, n) << "\n";
  
  return 0;
}


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

int main(){
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;i++){
        if(i!=x-k+1) cout<<" ";
        cout<<i;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
  int A,B;
  cin >> A >> B;
  if(A%3 == 0) cout << "Possible" << endl;
  else if(B%3 == 0) cout << "Possible" << endl;
  else if((A + B)%3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}


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

int main(){
    string S;
    int N;
    long long sum = 0;
    cin >> S;
    N = S.size();
    for(int i=0;i < 1<<N-1;i++){
        long long a=S[0]-'0';
        for(int j=0;j<N-1;j++){
            if(i & (1<<j)){
                sum += a;
                a=0;
            }
            a = a*10 + S[j+1] - '0';
        }
        sum += a;
    }
    cout << sum << endl;   
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n;
  cin >> n;
  ll m;
  cin >> m;
  vector<ll>b(n);
  ll bi=1;
  rep(i,n){
    cin >> b[i];
    b[i]/=2;
    bi=lcm(bi,b[i]);
  }
  bool ok = true;
  ll cnt=0;
  rep(i,n){
    ll num=0;
    while(b[i]%2==0){
      num++;
      b[i]/=2;
    }
    if(i==0){
      cnt=num;
    }
    else{
      if(cnt!=num)ok=false;
    }
  }
  if(ok) cout << (m/bi+1)/2 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 3912
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4 5
0 0 1 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 1 0

output:
4
"""
import sys


def solve():
    dp = [[0] * W for _ in range(H)]
    max_width = 0
    for m in range(H):
        for n in range(W):
            dp[m][n] = (int(carpet_info[m][n]) + 1) % 2
            max_width |= dp[m][n]

    for i in range(1, H):
        for j in range(1, W):
            if int(carpet_info[i][j]):
                dp[i][j] = 0
            else:
                dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]) + 1
                max_width = max(max_width, dp[i][j])

    return pow(max_width, 2)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    H, W = map(int, _input[0].split())
    carpet_info = list(map(lambda x: x.split(), _input[1:]))
    print(solve())

Measured memory_bytes: 60328
fun divCount(x: Int): Int{
    var count = 0
    var currentX = x
    while(currentX % 2 == 0){
        count++
        currentX /= 2
    }
    return count
}

fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    val xs = readLine()!!.split(" ").map(String::toInt)
    val ans = xs.map(::divCount).min()!!
    println(ans)
}

Measured memory_bytes: 38000
import math
if __name__ == '__main__':
    ans = input()
    a, b, C = ans.split()
    a, b, C = int(a), int(b), float(C)
    rad = math.radians(C)
    h = b * math.sin(rad)
    S = a * h / 2
    c = math.sqrt(a**2+b**2-2*a*b*math.cos(rad))
    L = a+b+c

    print(S)
    print(L)
    print(h)



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

int main() {
  int D;
  cin >> D;

  if ( D == 25 ) {
    cout << "Christmas" << endl;
  } else if ( D == 24 ) {
    cout << "Christmas Eve" << endl;
  } else if ( D == 23 ) {
    cout << "Christmas Eve Eve" << endl;
  } else {
    cout << "Christmas Eve Eve Eve" << endl;
  }

  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
ll dp[101][100005];
int main()
{
     ll n,we,i,j;
     cin>>n>>we;
  ll w[n+1],v[n+1];
  for(i=1;i<=n;i++)
  {
    cin>>w[i]>>v[i];
  }
    for(i=1;i<=n;i++)
    {
      for(j=we;j>=0;j--)
      {
        dp[i][j]=(j>=w[i])?max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]):dp[i-1][j];
      }
    }
  cout<<dp[n][we];
    return 0;
}


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

using namespace std;

int main (){
    string in;
    cin >> in;
    int ans = in.size();
    for(char c = 'a';c <= 'z';c++){
        string temp = in;
        if(temp.find(c) != string::npos){
            int prev = -1;
            int dist = 0;
            for(int i = 0;i < temp.size();i++){
                if(temp[i] == c){
                    dist = max(dist,i-prev-1);
                    prev = i;
                }
            }
            dist = max(dist,(int)temp.size()-prev-1);
            ans = min(ans,dist);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256