akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


int main() {
	double PI = 3.1415926535897932;
	double r; std::cin >> r;
	printf("%.15f\n", 2 * PI*r);
	return 0;
}


Measured memory_bytes: 3788
import abc


class AdjacentGraph:
    """Implementation adjacency-list Graph.
    Beware ids are between 1 and size.
    """
    def __init__(self, size):
        self.size = size
        self._nodes = [[0] * (size+1) for _ in range(size+1)]

    def set_adj_node(self, id_, adj_id):
        self._nodes[id_][adj_id] = 1

    def __iter__(self):
        self._id = 0
        return self

    def __next__(self):
        if self._id < self.size:
            self._id += 1
            return (self._id, self._nodes[self._id][1:])

        raise StopIteration()

    def dfs(self, handler=None):

        visited = []
        while len(visited) < self.size:
            for id_ in range(1, self.size+1):
                if id_ not in visited:
                    stack = [(id_, 0)]
                    break
            while len(stack) > 0:
                i, j = stack.pop()
                if j == 0:
                    if handler:
                        handler.visit(i)
                    visited.append(i)
                    yield i
                try:
                    j = self._nodes[i].index(1, j+1)
                    stack.append((i, j))
                    if j not in visited:
                        stack.append((j, 0))
                except ValueError:
                    if handler:
                        handler.leave(i)


class EventHandler(abc.ABC):
    @abc.abstractmethod
    def visit(self, i):
        pass

    @abc.abstractmethod
    def leave(self, i):
        pass


class Logger(EventHandler):
    def __init__(self, n):
        self.log = [(0, 0)] * n
        self.step = 0

    def visit(self, i):
        self.step += 1
        self.log[i-1] = (self.step, 0)

    def leave(self, i):
        self.step += 1
        (n, m) = self.log[i-1]
        self.log[i-1] = (n, self.step)

    def by_node(self):
        i = 1
        for discover, finish in self.log:
            yield (i, discover, finish)
            i += 1


def run():
    n = int(input())
    g = AdjacentGraph(n)
    log = Logger(n)

    for i in range(n):
        id_, c, *links = [int(x) for x in input().split()]
        for n in links:
            g.set_adj_node(id_, n)

    for i in g.dfs(log):
        pass

    for node in log.by_node():
        print(" ".join([str(i) for i in node]))


if __name__ == '__main__':
    run()



Measured memory_bytes: 5684
def solve():
    R,G,B,N = map(int,input().split())
    ans = 0
    for r in range(N // R + 1):
        for g in range(N // G + 1):
            rest = N - r * R - g * G
            if rest >=0 and rest % B == 0:
                ans += 1
                #print(r,g,rest//B)
    return ans

print(solve())


Measured memory_bytes: 40684
#include "bits/stdc++.h"

using namespace std;
// jebote stupidast
int main() {
    long long n, k;
    cin >> n >> k;
    long long sum = 0;
    vector <pair<long long, long long>> v(n);
    for(long long i = 0; i < n; ++i){
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());
    for(auto x:v){
        sum += x.second;
        if(sum >= k){
            cout << x.first;
            return 0;
        }
    }
	return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define dump(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  vector<ll> B(M);
  vector<ll> C(M);
  REP(i, M) cin >> B[i] >> C[i];
  map<ll, ll> st;

  sort(A.begin(), A.end());
  ll tmp = 1;
  for(ll i = 0; i < N; i++) {
    if(A[i + 1] == A[i]) {
      tmp++;
    } else {
      st[A[i]] = tmp;
      tmp = 1;
    }
  }

  for(ll i = 0; i < M; i++) {
    if(!st.count(C[i])) {
      st[C[i]] = B[i];
    } else {
      st[C[i]] += B[i];
    }
  }
  // for(auto x : st) {
  //   dump(x.first);
  //   dump(x.second);
  // }
  ll ans = 0;
  ll wow = 0;
  for(auto it = st.rbegin(); it != st.rend(); it++) {
    ll f = it->first;
    ll s = it->second;
    while(wow < N && s > 0) {
      // dump(f);
      ans += f;
      s--;
      wow++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15104
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD =1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        lld n;
        cin>>n;
        lld ar[n],br[n];
        lld s=0;
        for(i=0;i<n;i++)
            cin>>ar[i],s+=ar[i],br[i]=ar[i];
        for(i=1;i<n;i++)
            br[i]+=br[i-1];
        lld ans=0;
        for(i=0;i<n;i++)
        {
            ans=add(ans,mul(ar[i],s-br[i]));
        }
        cout<<ans<<endl;

    }
}





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

int main() {
    int N;
    cin >> N; //入力の個数

    int p[N];
    for (int i = 0; i < N; i++) cin >> p[i]; //p配列に入力

    int maxPrice = 0;
    int sum = 0;
    //最大値がどれかを求めたい、解説文のMはmax Sはsum
  for(int i = 0; i < N; i++) {
      sum += p[i];
      maxPrice = max(maxPrice, p[i]);
  }
  cout << sum - maxPrice/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
  int l, r, d; cin >> l >> r >> d;
  int ans = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0) ans++;
  }
  cout << ans << endl;
}


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

int main()
{
	int n,k,i,j,sum=0,l;
	cin>>k>>n;
	int ar[n];
	
	for(i=0;i<n;i++)
	{
		cin>>ar[i];
	}
	
	int ans=k;
	for(i=1;i<n;i++)
	{
		ans=min(ans,(k-(ar[i]-ar[i-1])));
		//cout<<ans<<endl;
    	}
	
    	ans=min(ans,(k-(ar[0]+k-ar[n-1])));
    	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

void dfs(ll now, int &ans, int digit, const ll n) {
	if( now > n ) return;
	
	if( digit >= 1 && now <= n ) {
		bool a = false;
		bool b = false;
		bool c = false;
		string t = to_string(now);
		
		for(int i = 0; i < (int)t.size(); ++i) {
			if( t[i] == '3' ) a = true;
			if( t[i] == '5' ) b = true;
			if( t[i] == '7' ) c = true;
		}
		
		if( a && b && c ) ans++;
	}
	
	vector<ll> dd = {3, 5, 7};
	for(auto& x : dd) {
		ll v = now;
		v *= 10;
		v += x;
		dfs(v, ans, digit + 1, n);
	}
}

int main(void) {
	ll n;
	cin >> n;
	
	int ans = 0;
	dfs(0, ans, 0, n);
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3620
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	colors := [8]int{}
	ct3200Over := 0
	for _, a := range as {
		switch {
		case a < 400:
			colors[0]++
		case a < 800:
			colors[1]++
		case a < 1200:
			colors[2]++
		case a < 1600:
			colors[3]++
		case a < 2000:
			colors[4]++
		case a < 2400:
			colors[5]++
		case a < 2800:
			colors[6]++
		case a < 3200:
			colors[7]++
		default:
			ct3200Over++
		}
	}

	ct := 0
	for i := range colors {
		if colors[i] != 0 {
			ct++
		}
	}

	mn, mx := ct, ct
	if ct3200Over != 0 {
		if ct == 0 {
			mn = 1
		}
		mx += ct3200Over
	}
	fmt.Println(mn, mx)
}


Measured memory_bytes: 512
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
typedef long long lnt;
const lnt INF = (~0U) >> 2;
const lnt INFLL = (~0ULL) >> 2;
lnt gcd(lnt a, lnt b) {
	return b ? gcd(b, a % b) : a;
}
int t;
lnt A, B, C, D;
int main() {
	scanf("%d", &t);
	while (t--) {
		scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
		if (A < B) {
			puts("No");
			continue;
		}
		A %= B;

		if (A > C) {
			puts("No");
			continue;
		}
		if (B > D) {
			puts("No");
			continue;
		}
		lnt G = gcd(B, D);
		lnt a = A % B;
		if ((a + ((B - a - 1) / G) * G) % B > C) {
			puts("No");
			continue;
		} else {
			puts("Yes");
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
// #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 = 0;
  cin >> n;
  vector<int> v(n);
  queue<double> q;
  rep(i,n) cin >> v.at(i);
  rep(i,n){
    if(v.at(i) % 2 ==0){
      if(v.at(i) % 3 !=0 && v.at(i) % 5 != 0){
        cout << "DENIED";
        return 0;
      }
    }
  }
cout << "APPROVED";

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a=1,b=1;
	while(!(a==0&&b==0)){
		cin >> a >> b;
		for (int i=1;i<=a;i++){
			for(int j=1;j<=b;j++)
				cout << '#';
			cout << endl;
		}
		if(!(a==0&&b==0))
			cout << endl;
	}
    return 0;
}


Measured memory_bytes: 3096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  string S;
  cin>>S;
  ll N=(ll)S.size();
  
  char X=S[0],Y=S[N-1];
  ll cntX=0,cntY=0;
  
  REP(i,N){
    if(S[i]==X) cntX++;
    else if(S[i]==Y) cntY++;
  }
  
  ll cnt=N-2*min(cntX,cntY);
  if(X==Y) cnt++;
  
  if(cnt%2==0) cout<<"Second"<<endl;
  else cout<<"First"<<endl;
  return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long int;
using namespace std;
int main() {
    fastIO;
    string s, t;
    cin >> s >> t;
    s += s;
    for (size_t i = 0; i < s.size() / 2; i++) {
        if (s.substr(i, s.size() / 2) == t) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
	vector<int> x; 
	vector<int> y;

	int num1, num2;

	int cnt = 0;
	int tmp;

	//Input x, y
	while(1)
	{
		cin >> num1 >> num2;
		
		if( (num1 == 0) && (num2 == 0) )
		{
			break;
		}

		x.push_back(num1);
		y.push_back(num2);
		
		cnt++;
	}

	for(int i = 0; i < cnt; i++)
	{
		if( x[i] >= y[i])
		{
			cout << y[i] << " " << x[i] << endl;
		}
		else
		{
			cout << x[i] << " " << y[i] << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rd(x) getline(cin, x)
#define _itr ::iterator
#define optf ios_base::sync_with_stdio(0); cin.tie(0);
#define rdarr(x, y) for (ll i = 0; i < y; ++i) cin >> x[i];
#define frop freopen("INPUT.inp", "r", stdin)
#define frcl fclose(stdin)
#define X first
#define Y second

#define MaxN 1000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
typedef pair<pi, pi> pii;

string st;

void Solve()
{
    getline(cin, st);
    if (st == "AAA" || st == "BBB") cout << "No";
    else cout << "Yes";
}

int main()
{
    optf;
    Solve();
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
M=0
for k in range(100):
    for i in range(N):
        if A[i]%(2**k)==0:
            M=k
        else:
            break
    else:
        M+=1
if M==0:
    print(0)
else:
    print(M-1)

Measured memory_bytes: 3060
while True:
    n=int(input())
    if n==0:
        break
    else:
        c=[int(input()) for i in range(n)]
        j=0
        for j in range(10):
            j+=1
            x=c.count(j-1)
            if x==0:
                print("-")
            else:
                print("*"*x)


Measured memory_bytes: 5716
import scala.collection.mutable.ListBuffer
import scala.util.Try
object Main extends App {
  val sr = new StdinReader
  val n, m = sr.nextInt
  val conditions = Array.fill(n + 1)(new ListBuffer[(Int, Int)])
  (1 to m).foreach{i => 
    val l, r, d = sr.nextInt
    conditions(l) += ((r, d))
    conditions(r) += ((l, -d))
  }

  val checked = Array.fill(n + 1)(Int.MaxValue)

  case class Check(index: Int, position: Int)

  @scala.annotation.tailrec
  def check(cs: List[Check]): Unit = {
    val checks = new ListBuffer[Check]
    if (cs.nonEmpty) {
      cs.foreach{c =>
        if (checked(c.index) == Int.MaxValue) {
          checked(c.index) = c.position
          checks ++= conditions(c.index).map{case (to, d) => Check(to, c.position + d)}
        } else if (checked(c.index) != c.position) {
          throw new Exception
        }
      }
      check(checks.toList)
    }
  }

  val result = try{
    (1 to n).foreach{i => if (checked(i) == Int.MaxValue) check(List(Check(i, 0)))}
    true
  } catch {
    case e: Throwable => e.printStackTrace;false
  }
  println(if (result) "Yes" else "No")
}

class StdinReader {
  val buffer = new Array[Byte](1024)
  var size = 0
  var pos = 0

  private def readByte: Byte = {
    if (pos >= size) {
      pos = 0;
      size = System.in.read(buffer);
    }
    if (size < 0) -1
    else {
      val ret = buffer(pos)
      pos += 1
      ret
    }
  }

  def next: String = {
    @scala.annotation.tailrec
    def r(sb: StringBuilder, reading: Boolean): String = {
      readByte match {
        case b if ('!' <= b && b <= '~') => r(sb.append(b.asInstanceOf[Char]), true)
        case _ => if (reading) sb.toString else r(sb, false)
      }
    }
    r(new StringBuilder, false)
  }

  def nextInt: Int = {
    @scala.annotation.tailrec
    def r(i: Int, reading: Boolean): Int = {
      readByte match {
        case '-' => r(i * -1, true)
        case b if '0' <= b && b <= '9' => r(i * 10 + (b - '0'), true)
        case _ => if (reading) i else r(i, false)
      }
    }
    r(0, false)
  }
}


Measured memory_bytes: 102548
char s[18];
t,q[100],d[100],dn;
main(){
	char*p;
	int g,gn;
	memset(s,'~',17);
	for(t=0;!d[99];t++){
		for(g=0;g<dn;g++){
			if(t==d[g]+17*(g%2)+3*(g%3)+19)
				while(p=strchr(s,g+1))
					*p='~';
		}
		if(t%5==0){
			g=t/5;
			if(g<100)
				q[g]=1;
		}
		for(g=dn;g<100&&q[g]&&(gn=g%5==1?5:2,p=strstr(s,"~~~~~"+5-gn));g++){
			q[g]=0;
			memset(p,g+1,gn);
			d[dn++]=t;
		}
	}
	for(;~scanf("%d",&g);){
		printf("%d\n",d[g]-g*5);
	}
}

Measured memory_bytes: 0
n,m = map(int,input().split())
a = []
for i in range(n):
    k = list(map(int,input().split()))
    a.append(k[1:])
ans = [i for i in range(1,m+1)]
for i in a:
    for j in range(m):
        if ans[j] not in i:
            ans[j] = 0
print(m-ans.count(0))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  vector<pair<int, int>> data(3);
  int a, b;
  for(int i = 0; i < 3; i++) {
    cin >> a >> b;
    data.at(i).first = b - a;
    a = b;
    cin >> b;
    data.at(i).second = b - a;
  }
  if (data.at(0).first == data.at(1).first && data.at(1).first == data.at(2).first && data.at(0).second == data.at(1).second && data.at(1).second == data.at(2).second) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

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

// 操作を繰り返していけば最終的には
// 数列の全要素のgcdが生成できるボールの最小値になる

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++)  cin >> a[i];
    int g = a[0];
    for(int i = 1; i < n; i++)  g = gcd(g, a[i]);
    for(int i = 0; i < n; i++){
        if(a[i] >= k && (a[i]-k)%g == 0){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}


vector<bool> prime(100010, true);

void init(){
	prime[0] = false;
	prime[1] = false;
	for(int i = 2; i <= 100000; i++){
		if(prime[i]){
			for(int j = i * 2; j <= 100000; j += i){
				prime[j] = false;
			}
		}
	}
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	init();
	vector<int> a(100100);
	for(int i = 1; i < 100000; i += 2){
		if(prime[i] && prime[(i + 1) / 2]) a.at(i)++;
	}
	rep(i,100000) a.at(i + 1) += a.at(i);
	int q;cin >> q;
	rep(i,q){
		int l,r;cin >> l >> r;
		cout << a.at(r) - a.at(l - 1) << endl;
	}
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

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


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

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

typedef long long llint;

const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 10;

int n;
int a[MAXN];

llint hi[MAXN], tot[MAXN];

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

  hi[0] = 1;
  for (int i = 0; i <= n; ++i) {
    if ((llint) a[i] > hi[i]) {
      printf("-1\n");
      return 0;
    }
    hi[i + 1] = 2LL * (hi[i] - (llint) a[i]);
    hi[i + 1] = min(hi[i + 1], (llint) 1e17);
  }

  tot[n] = a[n];
  for (int i = n - 1; i >= 0; --i) {
    assert(2LL * (hi[i] - (llint) a[i]) >= tot[i + 1]);
    tot[i] = (llint) a[i] + min(hi[i] - (llint) a[i], tot[i + 1]);
  }

  llint sol = 0;
  for (int i = 0; i < n + 1; ++i)
    sol += tot[i];

  printf("%lld\n", sol);

  return 0;
}


Measured memory_bytes: 5712
first="MARCH".split("").map(&:to_s)
result={"M"=>0,"A"=>0,"R"=>0,"C"=>0,"H"=>0}

n=gets.to_i
n.times.each do
    v=gets.chomp.to_s
    if first.index(v[0])!=nil
        
        result[v[0]]+=1
    end
    
end

values=result.values
count=0
for i in 0..values.length-3
    for j in i+1..values.length-2
        for k in j+1..values.length-1
            count+=values[i]*values[j]*values[k]
        end
    end
end
p count

Measured memory_bytes: 14152
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  ll a,b;cin>>a>>b;
  vector<ll>va,vb;

  for(ll i=1;i*i<=a;i++){
    if(a%i==0){
      va.push_back(i);
    }
  }
  for(ll i=va.size()-1;i>=0;i--){
    if(a/va[i]!=va[i])va.push_back(a/va[i]);
  }
  // if(va[va.size()-1]!=a)va.push_back(a);
  // rep(i,0,va.size())out(va[i]);
  for(ll i=1;i*i<=b;i++){
    if(b%i==0){
      vb.push_back(i);
    }
  }
  for(ll i=vb.size()-1;i>=0;i--){
    if(b/vb[i]!=vb[i])vb.push_back(b/vb[i]);
  }
  // if(vb[vb.size()-1]!=b)vb.push_back(b);


  map<ll,ll>mp;
  vector<ll>ko;
  rep(i,0,va.size())mp[va[i]]++;
  rep(i,0,vb.size()){
    mp[vb[i]]++;
    if(mp[vb[i]]==2)ko.push_back(vb[i]);
  }

  // rep(i,0,ko.size())out(ko[i]);


  for(ll i=1;i<ko.size()-1;i++){
    for(ll j=i+1;j<ko.size();j++){
      if(ko[j]%ko[i]==0){
        ko.erase(ko.begin()+j);
        j--;
      }
    }
  }

  out(ko.size());

  return 0;
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var h=new int[s[0]+1];
		var w=new int[s[1]+1];
		var a=new int[s[2]][];
		var li=new List<int>[s[0]+1];
		for(int i = 1;i<=s[0];i++) {li[i]=new List<int>();}
		int p=0,u=0,z=0;
		for(int i = 0;i<s[2];i++) {
			a[i]=sc.Ia;
			h[a[i][0]]++;
			w[a[i][1]]++;
			p=Max(p,h[a[i][0]]);
			u=Max(u,w[a[i][1]]);
			li[a[i][0]].Add(a[i][1]);
		}
		for(int i = 1;i<=s[1];i++) {
			if(w[i]==u){z++;}
		}
		var g=new int[s[1]+1];
		for(int i = 1;i<=s[0];i++) {
			if(h[i]==p){
				int d=0;
				for(int j = 0;j<li[i].Count;j++) {
					if(w[li[i][j]]==u){d++;}
				}
				if(d<z){
					Console.WriteLine(p+u);
					return;
				}
			}
		}
		Console.WriteLine(p+u-1);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 79920
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    A = [Scanner.map_int() for _ in range(N)]
    dp = [[0 for _ in range(3)] for _ in range(N)]
    dp[0][0], dp[0][1], dp[0][2] = A[0]
    for i in range(1, N):
        for c in range(3):
            dp[i][c] = max(dp[i][c], dp[i-1][(c+1) % 3] + A[i][c])
            dp[i][c] = max(dp[i][c], dp[i-1][(c+2) % 3] + A[i][c])
    print(max(dp[N-1]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 71256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  ll ans=inf;
  for(int i=a[0]; i<=a[n-1]; i++){
    ll tmp=0;
    rep(j,n){
      tmp += (a[j]-i)*(a[j]-i);
    }
    ans = min(ans,tmp);
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

def bomb_count(hi, wi):
    cnt = 0
    for i in range(-1, 2):
        for j in range(-1, 2):
            if (0 <= (hi + i) <= (H-1)) and (0 <= (wi + j) <= (W-1)):
                if S[hi+i][wi+j] == "#":
                    cnt += 1
    return cnt


for hi in range(H):
    for wi in range(W):
        masu = S[hi][wi]
        if masu == ".":
            S[hi][wi] = str(bomb_count(hi, wi))

for hi in range(H):
    row = S[hi]
    print("".join(row))

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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める

int main()
{
	cout <<setprecision(10);
	//累積最公倍数
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i,n) cin >> v[i];

	ll L =v[0];//最小公倍数
	ll G =v[0];//最大公約数
	For(i,1,n){
		G = __gcd(L,v[i]);
		L *=  v[i] / G;
	}
	cout << L << endl;


}


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

int main()
{

    int  X, Y ,Z;
 // 整数の入力
    scanf("%d %d %d", &X, &Y, &Z);
    
   printf("%d", (X -Z) / (Y + Z )  );

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7,INF=1e18;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    // cin>>t;
    while(t--)
    {
        ll n,ans=INF;
        cin>>n;
        vector<ll> a(n);
        for(ll i=0;i<n;i++)
        cin>>a[i];
        for(ll i=-100;i<=100;i++)
        {
            ll count=0;
            for(ll j=0;j<n;j++)
            {
                count+=(abs(i-a[j])*abs(i-a[j]));
            }
            ans=min(ans,count);
        }
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>

using namespace std;


#define rep(i,x,y) for(int i = x; i <= y; ++i)
#define repr(i,x,y) for(int i = x; i >= y; --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define endl "\n" // TODO: remove
#define int long long

const int N = (int)(1e6) + 322;
const long long inf = (long long)(2e18) + 322;
const int mod = (int)(1e9) + 7; // check modulo


void solve() {
    char a, b, c; cin >> a >> b >> c;
    if (a == 'R' && b == 'R' && c == 'R') {cout << 3; return;}
    if ((a == 'R' && b == 'R') || (b == 'R' && c == 'R')) {cout << 2; return;}
    if (a == 'R' || b == 'R' || c == 'R') {
        cout << 1;
        return;
    }
    cout << 0;
}

signed main () {
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    int test = 1;//  cin >> test;
    for(int t = 1; t <= test; ++t) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3172
#include<stdio.h>
#include<stdlib.h>

int main(){
  int N,K,sum=0;
  scanf("%d %d",&N,&K);
  int *a=(int*)malloc(sizeof(int)*N);
  for(int i=0;i<N;i++){
  	scanf("%d",&a[i]);
    if(a[i]>=K)sum++;
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int MAXN=10001;
int a[MAXN],b[MAXN];
int main()
{
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	for(int i=0;i<n;i++)
	scanf("%d",&a[i]);
	for(int i=0;i<m;i++)
	scanf("%d",&b[i]);
	sort(a,a+n);
	sort(b,b+m);
	int flag=0;
	if(b[0]>a[n-1]&&x<b[0]&&y>b[0])
	{
		cout<<"No War"<<endl;
	}
	else
	cout<<"War"<<endl;
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long int
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
ll n,k,a[105];
int dp[100005];



int main()
{ quick;

	cin>>n>>k;
	fab(0,n,i)
	cin>>a[i];
	memset(dp,-1,sizeof(dp));
	sort(a,a+n);
	ll sm=a[0];
	fab(0,sm+1,i)
	dp[i]=1;
	
		fab(0,n,i)
		{
			
			dp[a[i]]=1;
			fab(0,sm and a[i]+j<=k,j)
			{
				dp[a[i]+j]=1;
			}
		}
			/*	fab(0,k+1,i)
		cout<<dp[i]<<" ";
		cout<<endl;*/

		fab(0,k+1,i)
		{
			if(dp[i]!=-1)
				continue;
			bool flag=false;
			fab(0,n and a[j]<=i,j)
			{
				if(dp[i-a[j]]==0)
				{
					dp[i]=1;
					flag=true;
				}
			}
			if(dp[i]==-1 and !flag)
				dp[i]=0;
		}
		/*fab(0,k+1,i)
		cout<<dp[i]<<" ";
		cout<<endl;*/
		if(dp[k]==1)
		{
			cout<<"First";
		}
		else
			cout<<"Second";

	


	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,sum = 0;
    cin >> n;
    vector<int> s(n);
    for(int i = 0; i < n; i++){
        cin >> s[i];
        sum += s[i];
    }
    if(sum%10) cout << sum << endl;
    else{
        int ans = 0;
        sort(s.begin(),s.end());
        for(int i = 0; i < n; i++){
            if(s[i]%10){
                ans = sum-s[i];
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main() {

	int N;
	cin >> N;
	vector<int> h(N);
	for (int i = 0; i < N; i++)cin >> h[i];
	
	int dp[1000000];
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);

	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i - 2] + abs(h[i - 2] - h[i]), dp[i - 1] + abs(h[i - 1] - h[i]));
	}

	cout << dp[N-1] << endl;

	return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES 
#include <algorithm> 
#include <cstdio> 
#include <functional>
#include <iostream>
#include <cstring>
#include <climits> 
#include <cmath>
#include <map>
#include <queue> 
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h> 
#include <vector>
using namespace std; 
typedef long long ll; 
typedef unsigned long long ull; 
typedef pair<int, int> i_i; 
typedef pair<ll, int> ll_i; 
typedef pair<double, int> d_i; 
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d; 
struct edge { int u, v; ll w; }; 
int MOD = 1000000007;
int main() {
	double r; cin >> r;
	printf("%f %f\n", r * r * M_PI, r * M_PI * 2); 
} 


Measured memory_bytes: 3156
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int K = scan.nextInt();
        long[] A = new long[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextLong();
        }
        for (int i = K + 1; i <= N; i++) {
            long target = A[i-K-1];
            long current = A[i-1];
            if (target < current) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}


Measured memory_bytes: 61364
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x7fffffff
#define INFL 0x7fffffffffffffffLL

int main() {
	ll		r,g,b,i,j,k,n,m,x,y,ans = 0;
	string	s;

	cin >> n >> s;
	r = g = b = 0;
	vector<int> R(n),G(n),B(n);
	for(i=0;i<n;i++) {
		if (s[i] == 'R') R[r++] = i;
		if (s[i] == 'G') G[g++] = i;
		if (s[i] == 'B') B[b++] = i;
 	}
	ans = r*g*b;

	for(i=0;i<n-1;i++) {
		for(j=i+1;j<n;j++) {
			if ((j-i) % 2 == 1) continue;
			k = (i+j)/2;
			if ( (s[i]!=s[j]) && (s[i]!=s[k]) && (s[j]!=s[k]) ) ans--;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 3672
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,x,t = inpm()

ans = math.ceil(n/x)*t
print(ans)

Measured memory_bytes: 31160
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int n = sc.nextInt();
            double[] student = new double[n];
            double sum = 0, m = 0;
            if (n == 0) {
                break;
            }
            for (int i = 0; i < n; i++) {
                double s = sc.nextDouble();
                student[i] = s;
                sum += s;
            }
            m = sum / n;

            double sum2 = 0;
            for (int i = 0; i < n; i++) {
                student[i] = (student[i] - m) * (student[i] - m);
                sum2 += student[i];
            }

            double a = Math.sqrt(sum2 / n);
            System.out.println(a);
        }
    }
}


Measured memory_bytes: 40476
using System;

namespace Contest148
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			long a = long.Parse(str[0]);
			long b = long.Parse(str[1]);

			Console.WriteLine(CommonMultiple(a, b));
		}

		static long CommonMultiple(long a, long b)
		{
			return a / CommonDivisor(a, b) * b;
		}

		static long CommonDivisor(long a, long b)
		{
			if(a < b)
			{
				return CommonDivisor(b, a);
			}

			while(b != 0)
			{
				long c = a % b;
				a = b;
				b = c;
			}
			
			return a;
		}
	}
}


Measured memory_bytes: 11092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int X;
    cin >> X;
    cout << (2199-X)/200 << endl;
}

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

int main(int argc,char **argv) {
	string s;
	cin>>s;
	int n=s.length();
	int array[n][2];
	memset(array,0,sizeof(array)); 
	
	for(int i=0;i<n;i++) 
		array[i][0]=i,array[i][1]=(s[i]=='L'? i-1:i+1);
	
	int now=1,last;
	for(int time_1=0;time_1<100;time_1++) {
		if(now==1) now=0,last=1;
		else now=1,last=0;
		for(int i=0;i<n;i++)
			array[i][now]=i;
		for(int time_2=0;time_2<10;time_2++)
			for(int i=0;i<n;i++)
				array[i][now]=array[array[i][now]][last];
	}
	int ans[n];memset(ans,0,sizeof(ans));
	for(int i=0;i<n;i++)
		ans[array[i][now]]++;
	for(int i=0;i<n;i++)
		cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}


Measured memory_bytes: 1792
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-12;
const double INF = 1e12;


int main(){
	int N;
	while(cin>>N){
		if(N==0)break;
		REP(i,9){
			int t;
			cin>>t;
			N-=t;
		}
		cout<<N<<endl;
	}
	return 0;
}

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

int main() {
    int n;
    cin>>n;
    n-=400;
    cout<<8-(n/200)<<endl;
}



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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,s,e) for(int (i)=(s);(i)<(e);i++)
#define endl "\n"

typedef long long ll;

void use_cio(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
//----------------------------------------//
ll n,x;

ll solve(ll a, ll b){
	if(a==b) return a;
	if(a>b) swap(a,b);
	if(b%a==0) return 2*a*(b/a)-a;
	return 2*a*(b/a) + solve(b%a, a);
}
int main(){
	use_cio();
	cin >> n >> x;
	cout << n+solve(x,n-x);
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
res=n
for i in range(n):
    if a[i]==1:
        res=i
        break

x=(res+k-2)//(k-1)
y=(max([0,n-1-x*(k-1)])+k-2)//(k-1)
print(x+y)


Measured memory_bytes: 20584
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n,h,w;

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
#ifdef LOCAL_DEFINE
	ifstream cin("input.in");
#endif
	
	cin >> n >> h >> w;
	cout << (n-h+1)*(n-w+1) << '\n';
	
#ifdef LOCAL_DEFINE
	cerr << "\nTime elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << " \n";
#endif
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <list>
#include <set>
#include <queue>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
#include <vector>
#include <cctype>
#include <algorithm>
#define ll             long long
#define _              ios_base::sync_with_stdio(0);cin.tie(0);
#define loop           for(i=0;i<n;i++)
#define pb             push_back
#define tc()           int t;cin>>t;while(t--) 
#define pi             acos(-1)         
 
using namespace std;
 
ll i,j,temp;

 
int main(){_

	int a,b,c;
	cin>>a>>b>>c;

	temp = a;
	a = b;
	b = temp;

	temp = a;
	a = c;
	c = temp;

	cout<<a<<" "<<b<<" "<<c<<endl;

	return 0;

}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




int main() {
  map<int,int> mp;
  int N,K; cin >> N >> K;
  int ans = 0;
  rep(i,N) {
    int a;cin >> a;
    mp[a]++;
  }
  int cnt = 0;
  vector<int> v; 
  for(auto itr : mp){
    v.push_back(itr.second);
    cnt++;
  }
  sort(all(v));
  if(cnt <= K) cout << 0 << endl;
  else {
    int ans = 0;
    rep(i,cnt - K) {
      ans += v[i];
    }
    cout << ans << endl;
  }
  return 0;
}


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

int main(int argc, char const* argv[])
{
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            scanf("%d", &A[i][j]);
        }
    }
    int N;
    scanf("%d", &N);
    int tmp;
    for (int i = 0; i < N; i++) {
        scanf("%d", &tmp);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (tmp == A[i][j]) {
                    A[i][j] = 0; //0にする
                }
            }
        }
    }
    char ans_flag = 0;
    char check3 = 0;
    char check4 = 0;
    for (int i = 0; i < 3; i++) {
        char check1 = 0;
        char check2 = 0;
        check3 |= A[i][i];
        check4 |= A[i][2-i];
        for (int j = 0; j < 3; j++) {
            check1 |= A[i][j];
            check2 |= A[j][i];
        }
        if (check1 * check2 == 0) {
            ans_flag = 1;
        }
    }
    if (check3 * check4 == 0) {
        ans_flag = 1;
    }

    if (ans_flag) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 128