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

int main(){
 int i,j,a[10];
 int sum = 0;

for(i=0;i<3;i++){
cin >> j;
a[i]= j;
sum = sum + a[i];
}

 if(sum<22){
     cout << "win" << endl;
 }
 else{
     cout << "bust" << endl;
 }

}

Measured memory_bytes: 256
s = int(input())
nums = {s}
leng= 1
count = 1
while True:
    count += 1
    if s%2 == 0:
        s /= 2
    else:
        s = s*3+1
    nums.add(s)
    if len(nums) == leng:
        print(count)
        quit()
    else:
        leng = len(nums)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    For(i,0,n){
        cin >> a[i];
    }
    For(i,k,n){
        if(a[i]>a[i-k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 4056
$n = gets.to_i
def dfs (s)
  return 0 if s.to_i > $n
  ret = ["7","5","3"].all?{|i|s.include?(i)} ? 1:0
  ["7","5","3"].each do |c|
    ret  += dfs(s + c)
  end
  return ret
end
puts dfs("0")

 

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

using namespace std;

string s, T;
vector<string> V(0);

string ss;

void judge(int k, vector<string> &vec){
  bool x = true;
  rep(i, T.size()){
    if(ss[k+i] == '?'){
      ss[k+i]= T[i];
    }
    else if(ss[k+i] != T[i]){
      x = false;
      break;
    }    
  }
  
  if(x){
    rep(i, s.size()){
      if(ss[i] == '?'){
        ss[i] = 'a';
      }
    }
    vec.push_back(ss);
  }
  //cout << ss << endl;
  return;
}
    
int main(){
  cin >> s >> T;
  rep(i, s.size()-T.size()+1){
    ss = s;
    judge(i, V);
    //cout << ss << endl;
  }
  
  if(V.empty()){
    cout << "UNRESTORABLE" << endl;
    
  }
  else{
    sort(V.begin(), V.end());
    cout << V[0] << endl;
  }
}
  
  
  
  


  

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        int cnt = 0;
        REP(j, 1, i + 1) {
            cnt += ((i % j) == 0);
        }
        ans += (cnt == 8);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int d, n;
    cin >> d >> n;

    auto res = (n == 100 ? 101 : n);
    for (auto i = 0; i < d; i += 1) {
        res *= 100;
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_back
#define debug(a) cout << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> ii;
	

bool isPrime(int n){
	if(n<=1) return false;
	if(n==2) return true;
	int f = sqrt(n);
	rep(i, 2, f+1) if(n%i==0) return false;
	return true;
}

int N;
int a[200020];
vector <int> pos[200020];

int main(){
	
	scanf("%d", &N);
	rep(i, 0, N){
		scanf("%d", &a[i]);
		pos[a[i]].pb(i);
	}
	
	int ans = 0, p = 0, pp = 0;
	rep(i, 1, N+1){
		p = lower_bound(pos[ans+1].begin(), pos[ans+1].end(), pp)-pos[ans+1].begin();
		if(p==pos[ans+1].size()){
			ans = N-ans;
			if(ans==N) ans = -1;
			cout << ans << '\n';
			return 0;
		}
		pp = pos[ans+1][p];
		ans++;
	}
	
	cout << 0 << '\n';
	
	
	

	
	return 0;
}

Measured memory_bytes: 11904
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    s = S()
    s = s[::-1]
    ans = 0
    cnt = 0
    for i in range(len(s)):
        if s[i] == "W":
            cnt += 1
        else:
            ans += cnt
    print(ans)

Measured memory_bytes: 9332
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)

int main() {
  int num[105];
  int N, M;

  cin >> N >> M;
  Rep(i,N) {
    cin >> num[i];
  }

  for(int k = 1; k <= M; k++) {
    Rep(i,N - 1) {
      if( (num[i] % k) > (num[i + 1] % k) ) {
	swap(num[i],num[i + 1]);
      }
    }
  }

  Rep(i,N) {
    cout << num[i] << endl;
  }

  return 0;
}
	
  
  

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    string s; cin >> s;
    int n = s.size();
    //sort(s.begin(), s.end());
    int g = 0;
    rep(i, n) if(s[i]=='g') g++;
    int p = n - g;
    int kachi = min(g, n/2);
    int make = n - n/2 - max(0, g-n/2);
    cout << kachi - make;
}


Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

// NextLine reads a line text from stdin, and then returns its string.
func NextLine() string {
	sc.Scan()
	return sc.Text()
}

// NextIntsLine reads a line text, that consists of **ONLY INTEGERS DELIMITED BY SPACES**, from stdin.
// And then returns intergers slice.
func NextIntsLine() []int {
	ints := []int{}
	intsStr := NextLine()
	tmp := strings.Split(intsStr, " ")
	for _, s := range tmp {
		integer, _ := strconv.Atoi(s)
		ints = append(ints, integer)
	}
	return ints
}

// NextRunesLine reads a line text, that consists of **ONLY CHARACTERS ARRANGED CONTINUOUSLY**, from stdin.
// Ant then returns runes slice.
func NextRunesLine() []rune {
	return []rune(NextLine())
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// PowInt is integer version of math.Pow
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}
	fa := float64(a)
	fe := float64(e)
	fanswer := math.Pow(fa, fe)
	return int(fanswer)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	fa := float64(a)
	fanswer := math.Abs(fa)
	return int(fanswer)
}

// DeleteElement returns a *NEW* slice, that have the same and minimum length and capacity.
// DeleteElement makes a new slice by using easy slice literal.
func DeleteElement(s []int, i int) []int {
	if i < 0 || len(s) <= i {
		panic(errors.New("[index error]"))
	}
	// appendのみの実装
	n := make([]int, 0, len(s)-1)
	n = append(n, s[:i]...)
	n = append(n, s[i+1:]...)
	return n
}

// Concat returns a *NEW* slice, that have the same and minimum length and capacity.
func Concat(s, t []rune) []rune {
	n := make([]rune, 0, len(s)+len(t))
	n = append(n, s...)
	n = append(n, t...)
	return n
}

// sort package (snippets)
//sort.Sort(sort.IntSlice(s))
//sort.Sort(sort.Reverse(sort.IntSlice(s)))
//sort.Sort(sort.Float64Slice(s))
//sort.Sort(sort.StringSlice(s))

// copy function
//a = []int{0, 1, 2}
//b = make([]int, len(a))
//copy(b, a)

/*******************************************************************/

var n int
var s string

func main() {
	tmp := NextIntsLine()
	n = tmp[0]
	s := NextLine()
	runes := []rune(s)

	max, x := 0, 0
	for _, r := range runes {
		if r == 'I' {
			x++
		} else {
			x--
		}
		if max < x {
			max = x
		}
	}
	fmt.Println(max)
}


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

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

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int n;
  string a,b;
  cin>>n>>a>>b;
  rep(i,n){
    if(a.substr(i)==b.substr(0,n-i)){
      cout<<2*n-(n-i)<<endl;
      return 0;
    }
    
    
  }
  
  cout<<2*n<<endl;
  
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ALDS1_4_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var set = new HashSet<string>();
            while (n-- > 0)
            {
                var cmd = Console.ReadLine().Split(' ');
                if (cmd[0].Equals("insert")) set.Add(cmd[1]);
                else if (cmd[0].Equals("find")) Console.WriteLine(set.Contains(cmd[1]) ? "yes" : "no");
            }
        }
    }
}

Measured memory_bytes: 39740
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	int n;
	cin >> n;
	cout << n * n * n;
	return 0;
}

Measured memory_bytes: 256
class HeapQueue:
    """
    q = HeapQueue()
    q.append(p, v)
    v = q.pop()
    """
    from heapq import heappop, heappush, heappushpop, heapreplace

    def __init__(self, reverse=False):
        self.reverse = reverse
        self.heap = []

    def __len__(self):
        return len(self.heap)

    def append(self, p, v):
        self.heappush(self.heap, (-p if self.reverse else p, v))

    def appendpop(self, p, v):
        return self.heappushpop(self.heap, (-p if self.reverse else p, v))

    def popappend(self, p, v):
        return self.heapreplace(self.heap, (-p if self.reverse else p, v))

    def pop(self):
        return self.heappop(self.heap)[1]

    def front(self):
        return self.heap[0][1]


N = int(input())
v = [int(s) for s in input().split()]
q = HeapQueue()
for vi in v:
    q.append(vi, vi)
while len(q) > 1:
    a = q.pop()
    b = q.pop()
    v = (a + b) / 2
    q.append(v, v)
print(q.pop())


Measured memory_bytes: 3064
import numpy as np
N,M,C = map(int,input().split())
B = list(map(int,input().split()))

A1 = [input().split() for l in range(N)]
A = np.zeros((N,M),dtype="int64")
for i in range (0,N):
  for j in range (0,M):
    A[i,j] = int(A1[i][j])

ans = 0
for i in range (0,N):
  s = 0
  for j in range (0,M):
    s = s + A[i,j] * B[j]
  if s + C > 0:
    ans = ans + 1
print(ans)

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

int main(){
    int a,b;
    string s;
    cin >>a>>b>>s;
    bool check = 1;
    for(int i=0; i<a+b+1;++i){
        if(i==a) check = s[i]=='-';
        else check = ('0'<=s[i] && 9<=s[i]);
        if(check == 0) break;
    }
    cout << (check?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string a,b;
int n;
int ans = 100000;
int l[2005], r[2005];
int minl[2005];
void solve(){
    for (int i = 0; i < n; i++){
        for (l[i] = 0; b[(i+l[i]+n)%n] != '1'; l[i]--);
        for (r[i] = 0; b[(i+r[i])%n] != '1'; r[i]++);
        //printf("%d %d %d\n",i,l[i],r[i]);
    }
    for (int d = 0; d < n; d++){
        int numflip = 0;
        memset(minl,0,sizeof(minl));
        for (int i = 0; i < n; i++){
            if (a[i] != b[(i+d)%n]){
                numflip++;
                if (r[i] <= d) continue;
                //printf("%d will need %d left /%d right\n",i,l[i],r[(i+d)%n]);
                minl[r[(i+d)%n]-1] = min(minl[r[(i+d)%n]-1], l[i]);
            }
        }
        int MINL = 0;
        //printf("for %d shift, %d flips\n",d,numflip);
        for (int i = n-1; i >= 0; i--){
            MINL = min(MINL,minl[i]);
            //printf("<-(%d %d)-> works for %d shift\n",MINL,i,d);
            //printf("%d vs %d\n",ans,2*(i-MINL)+d+numflip);
            ans = min(ans,2*(i-MINL)+d+numflip);
        }
    }
}
int main(){
    cin >> a >> b;
    n = a.size();
    if (b == string(n,'0')){
        printf("%d",(a==string(n,'0'))?0:-1);
        return 0;
    }
    solve();
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    solve();
    printf("%d",ans);
}


Measured memory_bytes: 256
// 2011/09/23 Tazoe

#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;

int main()
{
	while(true){
		int d;
		cin >> d;
		if(d==0)
			break;

		int n;
		cin >> n;

		int m;
		cin >> m;

		deque<int> S;
		S.push_back(0);
		S.push_back(d);

		for(int i=0; i<n-1; i++){
			int D;
			cin >> D;
			S.push_back(D);
		}

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

		int sum = 0;
		for(int i=0; i<m; i++){
			int K;
			cin >> K;

			deque<int>::iterator it = S.begin();
			while(it!=S.end()){
				if(*it>K)
					break;
				it++;
			}

			int D1 = *it-K;
			it--;
			int D2 = K-*it;
			if(D1<D2)
				sum += D1;
			else
				sum += D2;
		}

		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
 
#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif
 
const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;
 
int main() {
 
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
 
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	string S;
	cin >> S;
 
 
 
	if (C < D) {
 
		bool flag = true;
		for (int i = A; i < C - 1; i++) {
			if (S[i] == '#' && S[i + 1] == '#') flag = false;
		}		
		for (int i = B; i < D - 1; i++) {
			if (S[i] == '#' && S[i + 1] == '#') flag = false;
		}
 
		if (flag) cout << "Yes" << "\n";
		else cout << "No" << "\n";
 
	}
	else {
 
		bool flag = false;
		for (int i = B - 2; i < D - 1; i++) {
 
			if (S[i] == '.' && S[i + 1] == '.' && S[i + 2] == '.') flag = true;
 
		}
		if (flag) cout << "Yes" << "\n";
		else cout << "No" << "\n";
 
	}
 
	return 0;
}

Measured memory_bytes: 592
n, l = map(int, input().split())

a = [0]*n
b = [0]*n

for i in range(n):
  a[i] = l+i

for i in range(n):
  b[i] = abs(sum(a) - (sum(a) - a[i]))

remove = a[b.index(min(b))]

print(int(sum(a)-remove))



Measured memory_bytes: 38512
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

fac = [-1] * (10**7+1)
finv = [-1] * (10**7+1)
inv = [-1] * (10**7+1)

fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1

def initNCMMod(limit):
    for i in range(2, limit):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod

initNCMMod(666670)

def NCMMod(n, k):
    if n < k:
        return 0
    if (n < 0 or k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

def main():
    X, Y = LI()
    if (2 * X - Y) % 3 > 0:
        ans = 0
    elif (2 * Y - X) % 3 > 0:
        ans = 0
    else:
        i = (2 * X - Y) // 3
        j = (2 * Y - X) // 3
        ans = NCMMod(i+j, i)
    print(ans)
    return

'''
def main():
    X, Y = LI()
    g = [[0 for _ in range(X+1)] for __ in range(Y+1)]
    def reachable(row, col):
        if row > Y or col > X:
            return 0
        if row == Y and col == X:
            return 1
        ans = reachable(row + 1, col + 2) % mod + reachable(row + 2, col + 1) % mod
        ans = ans % mod
        return ans
    print(reachable(0, 0))
'''
main()



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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string s;

    cin>>s;

    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes";

    }
    else
    {
        cout<<"No";
    }

    return 0;
}

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

int main(){
    int n=0,m=0,i=0,count=0;
    double A=0;
    cin >> n >> m;
    int a[n]={0};
    for(i=0;i<n;i++){
        cin >> a[i];
        A += a[i];
    }
    A = A / (4*m);
    for(i=0;i<n;i++){
        if(a[i]>=A){count++;}
    }
    if(count>=m){cout << "Yes" << endl;}
    else{cout << "No" << endl;}

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  cout<<N*N*N<<endl;
  return 0;
}


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

int main() {
    int A,B;
    cin >> A >> B;
    int n=0,flag=0;
    while(flag!=1 && n<1010){
        n++;
        if(floor(n*0.08)==A && floor(n*0.1)==B){
            flag=1;
        }
    }
    if(flag==1){
        cout << n << endl;
    }
    else{
        cout << -1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll r;
  cin >> r;
  cout << r * r << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int a[5];
	int b[5];
	while(b[0]=a[0]=in()){
		int i;
		for(i=1;i<5;i++){
			b[i]=a[i]=in();
		}
		sort(a,a+5);
		if(a[0]==a[4]||(1<<a[0]|1<<a[1]|1<<a[2]|1<<a[3]|1<<a[4])==14){
			cout<<3<<endl<<3<<endl<<3<<endl<<3<<endl<<3<<endl;
		}else{
			if(a[0]==1&&a[4]==2){
				for(i=0;i<5;i++){
					if(b[i]==1)cout<<1<<endl;
					else cout<<2<<endl;
				}
			}
			if(a[0]==1&&a[4]==3){
				for(i=0;i<5;i++){
					if(b[i]==1)cout<<2<<endl;
					else cout<<1<<endl;
				}
			}
			if(a[0]==2&&a[4]==3){
				for(i=0;i<5;i++){
					if(b[i]==2)cout<<1<<endl;
					else cout<<2<<endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cout<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1;

//{
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...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

int h,w;

main(){
    cin>>h>>w;
    rep(i,h){
        rep(j,w){
            string t;
            cin>>t;
            if(t=="snuke"){
                cout<<(char)('A'+j)<<i+1<<endl;
                return 0;
            }
        }
    }
}



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

long long gcd(long long a, long long b) {
	long long r;
	while (b != 0) {
		r = a % b;
		a = b;
		b = r;
	}

	return a;
}

int main() {
	int t;

	cin >> t;

	for (int ixxx = 0; ixxx < t; ++ixxx) {
		long long a, b, c, d;

		cin >> a >> b >> c >> d;

		if (a < b) {
			cout << "No" << endl;
		}
		else if (d < b) {
			cout << "No" << endl;
		}
		else if (c >= b) {
			cout << "Yes" << endl;
		}
		else {
			if (c < b + a%gcd(b, d) - gcd(b, d)) {
				cout << "No" << endl;
				continue;
			}
			else {
				cout << "Yes" << endl;
				continue;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#import <math.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vii vector<int, int>
#define po pop_back
#define hell 1000000007
#define PI 3.1415926535897
using namespace std;
 
void solve(){
	double n;
	cin>>n;
	cout<<2*n*PI;
}
 
int main(){
	int t = 1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3788
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	ll N;
	cin >> N;
	ll i = 0;
	ll p = 11;
	while (i < N) {
		bool prime = true;
		for (ll k = 2; k * k <= p; k++) {
			if (p % k == 0) {
				prime = false;
				break;
			}
		}
		if (prime) {
			cout << p << " ";
			i++;
		}
		p += 10;
	}
}


Measured memory_bytes: 3660
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    char ch1[55],ch2[55];
    while(cin>>ch1>>ch2)
        {
            int m=strlen(ch1);
            int n=strlen(ch2);
            if(m<=n)
            for(int i=0;i<m;i++)
            {
                cout<<ch1[i];
                cout<<ch2[i];
            }
            else
            for(int i=0;i<n;i++)
            {
                cout<<ch1[i];
                cout<<ch2[i];
            }
            if(m>n)
            for(int j=n;j<m;j++)
                cout<<ch1[j];
            else
            for(int k=m;k<n;k++)
                cout<<ch2[k];
            cout<<endl;
        }
    return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    left = 0
    right = 0
    stack = []
    for s in S:
        if s == "(":
            stack.append(s)
        else:
            if stack:
                stack.pop()
            else:
                left += 1
    right = len(stack)
    print("("*left + S + ")"*right)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39696
n,k = gets.chomp.split.map(&:to_i)
array = n.times.map{gets.chomp.split.map(&:to_i)}.sort_by(&:first)
ans = 0
array.each do |a,b|
  if k - b <= 0
    ans = a
    break
  else
    k -= b
  end
end

puts ans

Measured memory_bytes: 14712
a,b = map(int,input().split())
s = input()
s1 = s[0:a]
s2 = s[a]
s3 = s[a + 1:a + b + 1]
if "-" not in s1 and s2 == "-" and "-" not in s3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9112
//	created : 16/03/13
// 	author   : Rp7rf
#include <iostream>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF 1e9
#define MAX 100000

int main(void){
	int n,m;
	cin>>n>>m;
	vi c(m);
	int dp[50000];
	rep(i,m)cin>>c[i];
	rep(i,n+1)dp[i] = INF;
	dp[0] = 0;
	rep(i,m+1)
		for(int j = 0 ; j + c[i] <= n ; j ++)
			dp[j+c[i]] = min(dp[j + c[i]],dp[j] + 1);
	cout << dp[n] << endl;
}

Measured memory_bytes: 1388
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<vll> vvll;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef unsigned long long ull;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))
#define INF 10000000
#define MAXN 10000
#define PI atan(1)*4
#define pro 1000000007
#define MAXULL 18446744073709551615

ll gcd(ll a, ll b)
{
	return b ? gcd(b, a % b) : a;
}
ll sumofnumb(ll n)
{
	ll x = n;
	ll ans = 0;
	while (x > 0)
	{
		ans += x % 10;
		x /= 10;
	}
	return ans;
}
ll binpow(ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res *= a;

		a *= a;
		n >>= 1;
	}
	return res;
}
ll nsk(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll vhodg(ll n, ll p = 2)
{
	ll ans = 0;
	while (n%p == 0)
	{
		ans++;
		n /= p;
	}
	return ans;
}
ll maxstep(ll n, ll p = 2)
{
	ll ans = -1;
	while (n > 0)
	{
		ans++;
		n /= 2;
	}
	return binpow(2, ans);
}



int main() {
	int x, y;
	cin >> x >> y;
	if (x >0 && y > 0)
	{
		if (x < y)
		{
			cout << y - x;
			return 0;
		}
		else
		{
			cout << x - y + 2;
			return 0;
		}
	}
	if (x <0 && y < 0)
	{
		if (x < y)
		{
			cout << y - x;
			return 0;
		}
		else
		{
			cout << x - y + 2;
			return 0;
		}
	}
	if (x < 0 && y > 0)
	{
			cout << abs(y + x)+1;
			return 0;
	}
	if (x > 0 && y < 0)
	{
			cout << abs(y + x)+1;
			return 0;
	}
	if (x == 0)
	{
		if (y > 0)
		{
			cout << y;
			return 0;
		}
		else
		{
			cout << 1 - y;
			return 0;
		}
	}
	if (y == 0)
	{
		if (x < 0)
		{
			cout << -x;
			return 0;
		}
		else
		{
			cout << x + 1;
			return 0;
		}
	}
	
	//system("pause");
	return 0;
}

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

#define N 15

int imax, jmax, solution, digit[256], low[256];
char word[N][16];
bool ok[10];

void found(void){
	for(int i=0; i<imax; i++){
		if(strlen(word[i])>1&&digit[word[i][strlen(word[i])-1]]==0)return;
	}
	solution++;
}

void solve(int sum){
	static int i=0, j=0, carry;
	int c, d;

	c = word[i][j];
	if(i < imax-1) {
		i++;
		if((d = digit[c]) < 0) {
			for(d = low[c]; d <= 9; d++)
				if(ok[d]) {
					digit[c] = d;  ok[d] = false;
					solve(sum + d);  ok[d] = true;
				}
			digit[c] = -1;
		} else solve(sum + d);
		i--;
	} else {
		j++;  i=0;  d = sum % 10;  carry = sum / 10;
		if(digit[c] == d) {
			if(j <= jmax) solve(carry);
			else if(carry == 0) found();
		} else if(digit[c] < 0 && ok[d] && d >= low[c]) {
			digit[c] = d;  ok[d] = false;
			if(j <= jmax) solve(carry);
			else if(carry == 0) found();
			digit[c] = -1;  ok[d] = true;
		}
		j--;  i = imax-1;
	}
}

int main(){
	int k, c;
	char buffer[128];

	jmax = 0;
	while(1){
		cin >> imax;
		if(!imax) break;
		fill(word[0], word[16], 0);
		fill(digit, digit+256, 0);
		fill(ok, ok+10, false);
		for(int i=0; i<imax; i++) {
			cin >> buffer;
			k = strlen((char*)buffer) - 1;
			if(k > jmax) jmax = k;
			for(int j=0; j<=k; j++) {
				c = word[i][j] = buffer[k - j];
				if(isalpha(c)) digit[c] = -1;
				else if(isdigit(c)) digit[c] = c - '0';
			}
		}
		for(int i=0; i<=9; i++) ok[i] = true;
		solution = 0;
		solve(0);
		cout << solution << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#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 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF=(1LL<<60);
const int mod=1000000007;

int main(void){
    int H,W,K; cin >> H >> W >> K;
    vector<vector<int>> dp(H+1, vector<int>(W,0)); dp[0][0]=1;

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            for(int k=0; k<1<<(W-1); k++){
                //二つの横線が繋がっていないか調べる
                bool ok=true;
                for(int l=0; l<W-2; l++){
                    if(1&(k>>l) && 1&(k>>(l+1))) ok=false;
                }

                if(ok){
                    if(j>=1 && k>>(j-1) & 1){
                        dp[i+1][j-1]+=dp[i][j];
                        dp[i+1][j-1]%=mod;
                    }
                    else if(k>>j & 1){
                        dp[i+1][j+1]+=dp[i][j];
                        dp[i+1][j+1]%=mod;
                    }
                    else{
                        dp[i+1][j]+=dp[i][j];
                        dp[i+1][j]%=mod;
                    }
                }
            }
        }
    }

    cout << dp[H][K-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

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

  vector<int> v(N);
  for (int i = 0; i < N; ++i) cin >> v[i];
  
  sort(v.begin(), v.end());

  float result = (v[0] + v[1]) / (float)2;
  for (int i = 2; i < N; ++i)
  {
    result = (result + v[i]) / (float)2;
  }

  cout << result << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i,j,minj,times=0,temp,N;

  scanf("%d",&N);

  int A[N];

  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj])
	minj=j;
    }

    if(i!=minj){
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      times++;
    }
  }

  for(i=0;i<N-1;i++)
    printf("%d ",A[i]);
  printf("%d\n",A[N-1]);

  printf("%d\n",times);

  return 0;
}

Measured memory_bytes: 600
#include <iostream>

int main() {
    int N;

    std::cin >> N;

    switch (N % 10)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        std::cout << "hon" << std::endl;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        std::cout << "pon" << std::endl;
        break;
    case 3:
        std::cout << "bon" << std::endl;
    }

    return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

  int n;
  cin>>n;
  int x = (n+1)/2;
  cout<<x<<endl;
  

  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<cassert>
#include<map>
#include<set>

typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 5000000000000;
//typedef std::pair<int, int> P;
struct edge { int to;double cost; };
#define VMAX 1010

     ll N,M,K;
     ll A[300000],B[300000],C;
     std::vector<ll> G;
     bool D[1000];
     ll P[11];
     ll ans;

int main() {
    cin>>N>>M>>K;
    REP(i,N){cin>>A[i];}
    REP(i,M){cin>>B[i];}
    REP(i,N){A[i+1]+=A[i];}
    REP(i,M){B[i+1]+=B[i];}
    REP(i,M){G.push_back(B[i]);}
    auto itr = std::upper_bound(ALL(G),K);
    ans=max(0LL,ll(itr-G.begin()));
    REP(i,N){
        DEB(i)DEB(A[i])DEB(K-A[i])
        if(A[i]>K)break;
        auto it = std::upper_bound(ALL(G),K-A[i]);
        DEB(it-G.begin())END
        ans=max(ans,ll(it-G.begin())+i+1);

    }

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


Measured memory_bytes: 8468
#include <bits/stdc++.h>
#define REP(i, n) for(llong i = 0;i < n;i++)
#define REPR(i, n) for(llong i = n;i >= 1;i--)
#define FOR(i, m, n) for(llong i = m;i < n;i++)
#define FORR(i, m, n) for(llog i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
llong mod = 1000000007;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};


int main(){
  int a,b;
  cin >> a >> b;
  if(a <= 9 && b <= 9)
  cout << a* b<<endl;
  else{
    cout <<-1<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> X(n), Y(n);
  vector<char> U(n);
  map<char, vector<pair<ll, ll>>> mp;
  rep(i, n) {
    cin >> X[i] >> Y[i] >> U[i];
    mp[U[i]].push_back({X[i], Y[i]});
  }
  ll ans = longinf;
  map<ll, set<ll>> mpU, mpD, mpL, mpR;
  for(auto p: mp['U']) {
    mpU[p.first].insert(p.second);
  }
  for(auto p: mp['D']) {
    mpD[p.first].insert(p.second);
  }
  for(auto p: mp['L']) {
    mpL[p.second].insert(p.first);
  }
  for(auto p: mp['R']) {
    mpR[p.second].insert(p.first);
  }
  for(auto ele: mpU) {
    for(auto p: ele.second) {
      auto itr = mpD[ele.first].lower_bound(p);
      if(itr == mpD[ele.first].end()) continue;
      ans = min((*itr-p)*5, ans);
    }
  }
  for(auto ele: mpR) {
    for(auto p: ele.second) {
      auto itr = mpL[ele.first].lower_bound(p);
      if(itr == mpL[ele.first].end()) continue;
      ans = min((*itr-p)*5, ans);
    }
  }
  map<ll, set<ll>> mpU2, mpD2;
  map<ll, set<ll>> mpU3, mpD3;
  ll mx = 200000;
  for(auto p: mp['U']) {
    ll d = p.second-p.first;
    mpU2[d].insert(p.first);
    d = p.second-(mx-p.first);
    mpU3[d].insert(p.first);
  }
  for(auto p: mp['D']) {
    ll d = p.second+p.first;
    mpD2[d].insert(p.first);
    d = p.second+(mx-p.first);
    mpD3[d].insert(p.first);
  }
  for(auto p: mp['L']) {
    ll d = p.second+p.first;
    if(mpD2.count(d)) {
      auto itr = mpD2[d].upper_bound(p.first);
      if(itr == mpD2[d].begin()) continue;
      --itr;
      ans = min((p.first-*itr)*10, ans);
    }
    d = p.second-p.first;
    if(mpU2.count(d)) {
      auto itr = mpU2[d].upper_bound(p.first);
      if(itr == mpU2[d].begin()) continue;
      --itr;
      ans = min((p.first-*itr)*10, ans);
    }
  }
  for(auto p: mp['R']) {
    ll d = p.second+(mx-p.first);
    if(mpD3.count(d)) {
      auto itr = mpD3[d].lower_bound(p.first);
      if(itr == mpD3[d].end()) continue;
      ans = min((*itr-p.first)*10, ans);
    }
    d = p.second-(mx-p.first);
    if(mpU3.count(d)) {
      auto itr = mpU3[d].lower_bound(p.first);
      if(itr == mpU3[d].end()) continue;
      ans = min((*itr-p.first)*10, ans);
    }
  }
  if(ans == longinf) cout << "SAFE" << "\n";
  else cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 93176
X = int(input())

if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
elif 1800 <= X <= 1999:
    print(1)

Measured memory_bytes: 61648
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int TEN(int n) {return (n==0)?1:10*TEN(n-1);}


template<class T>
T pow(T x, ll n) {
    T r = 1;
    while (n) {
        if (n & 1) r *= x;
        x *= x;
        n >>= 1;
    }
    return r;
}

template<uint MD>
struct ModInt {
    uint v;
    ModInt() : v{0} {}
    ModInt(ll v) : v{normS(v%MD+MD)} {}
    static uint normS(const uint &x) {return (x<MD)?x:x-MD;};
    static ModInt make(const uint &x) {ModInt m; m.v = x; return m;}
    const ModInt operator+(const ModInt &r) const {return make(normS(v+r.v));}
    const ModInt operator-(const ModInt &r) const {return make(normS(v+normS(MD-r.v)));}
    const ModInt operator*(const ModInt &r) const {return make((ull)v*r.v%MD);}
    ModInt& operator+=(const ModInt &r) {return *this=*this+r;}
    ModInt& operator-=(const ModInt &r) {return *this=*this-r;}
    ModInt& operator*=(const ModInt &r) {return *this=*this*r;}
    static ModInt inv(const ModInt &x) {
        return pow(ModInt(x), MD-2);
    }
};

using Mint = ModInt<TEN(9)+7>;
const int MN = 5050;

Mint p2[MN];
Mint C[MN][MN];
void first() {
    p2[0] = 1;
    for (int i = 1; i < MN; i++) {
        p2[i] = p2[i-1]*2;
    }
    C[0][0] = 1;
    for (int i = 1; i < MN; i++) {
        C[i][0] = C[i-1][0];
        for (int j = 1; j < MN; j++) {
            C[i][j] = C[i-1][j-1]+C[i-1][j];
        }
    }
}

Mint K(int x, int y) {
    return C[x+y][y];
}

Mint f(int n, int m) {
    //kataran
    int x = (n+m)/2, y = (n-m)/2;
    //(0, 0) -> (x, y)
    return K(x, y) - K(y-1, x+1);
}

Mint gdp[MN];
bool gused[MN] = {};
Mint g(int n) {
    if (n == 0) return 1;
    if (gused[n]) return gdp[n];
    gused[n] = true;
    Mint ans = g(n-1);
    for (int i = 2; i <= n; i += 2) {
        ans += f(i-2, 0)*p2[i/2] * g(n-i);
    }
    return gdp[n] = ans;
}

int main() {
    first();
    int N;
    cin >> N;
    string s;
    cin >> s;
    int M = (int)s.size();
    Mint ans = 0;
    for (int i = 0; i < N; i++) {
        Mint res = g(i);
        int L = N-1-i, R = M-1;
        if (L < R) continue;
        if ((L-R)%2) continue;
        int UP = (L-R)/2;
        ans += res*f(L, R)*p2[UP];
    }
    cout << ans.v << endl;
    return 0;
}

Measured memory_bytes: 99968
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const int nrep = 50;
const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : VP{
    L(const P& a, const P& b){ resize(2); at(0)=a; at(1)=b; }
    L(){ resize(2); }
};
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

P projection(const L& l, const P& p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
double distanceLP(const L &l, const P &p) {
    return abs(p - projection(l, p));
}

int main(){
	while(1){
		vector<int> input(6);
		bool allzero = true;
		for(int i=0; i<6; i++){
			cin >> input[i];
			if(input[i]!=0) allzero = false;
		}
		if(allzero) break;
		
		VP v(3);
		for(int i=0; i<3; i++){
			v[i] = P(input[2*i], input[2*i+1]);
		}
		
		VP bisection(3);
		for(int i=0; i<3; i++){
			double a = abs(v[(i+1)%3] -v[i]), b = abs(v[(i+2)%3] -v[i]);
			bisection[i] = v[(i+1)%3] + (v[(i+2)%3]-v[(i+1)%3])* a/(a+b);
		}
		
		C c[3];
		P b = v[0], e = bisection[0];
		for(int i=0; i<nrep; i++){
			P mid = 0.5*(b+e);
			c[0] = C(mid, distanceLP(L(v[0], v[1]), mid));
			if(distanceLP(L(v[1], v[2]), mid) < c[0].r +EPS){
				e = mid;
				continue;
			}
			for(int j=1; j<=2; j++){
				P b = v[j], e = bisection[j];
				for(int k=0; k<nrep; k++){
					P mid = 0.5*(b+e);
					c[j] = C(mid, distanceLP(L(v[1], v[2]), mid));
					if(distanceLP(L(v[(j+1)%3], v[(j+2)%3]), mid) < c[j].r +EPS){
						e = mid;
						continue;
					}
					if(abs(c[0].p -c[j].p) < c[0].r+c[j].r){
						e = mid;
					}else{
						b = mid;
					}
				}
			}
			if(abs(c[1].p -c[2].p) < c[1].r+c[2].r){
				b = mid;
			}else{
				e = mid;
			}
		}
		
		cout << fixed;
		cout << setprecision(10);
		cout << c[0].r << " " << c[1].r << " " << c[2].r << endl;
	}
	return 0;
}

Measured memory_bytes: 3232
import Data.List

main = getContents >>= putOut.formatOut.calc.formatIn
  where putOut s | null s || last s == '\n' = putStr s
                 | otherwise                = putStrLn s
  
formatIn :: String -> [[Int]]
formatIn = map (map (read :: String -> Int).words).tail.lines

formatOut :: [[[Int]]] -> String
formatOut s = unlines.intercalate  ([replicate 20 '#']) $map (map ((' ' :).unwords.(map show))) s

calc :: [[Int]] -> [[[Int]]]
calc n = f ((reverse n)++[[]]) [s,s,s,s]
  where s = replicate 3 $replicate 10 (0 :: Int)

f :: [[Int]] -> [[[Int]]] -> [[[Int]]]
f [[]] s = s
f  (n:ns) s = g n $f ns s

g :: [Int] -> [[[Int]]] -> [[[Int]]]
g (a:b:c:d:_) s = replace (replace (replace (room + d) c storey) b build) a s
  where build  = s!!(a-1)
        storey = build!!(b-1)
        room   = storey!!(c-1)
  
replace t n s = (init (fst p)) ++ [t] ++ (snd p)
  where p = splitAt n s

Measured memory_bytes: 4224
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int K, N;
    cin >> K >> N;
    VEC(int) A(N);
    READVEC(A);
    
    int ret = A[N - 1] - A[0];
    FOR(i, 0, N) {
        int a = (i + 1) % N, b = (i + N - 1) % N;
        int dist1 = A[a] - A[i];
        if (dist1 < 0)
            dist1 += K;
        int dist2 = A[i] - A[b];
        if (dist2 < 0)
            dist2 += K;
        ret = min(ret, K - dist1);
        ret = min(ret, K - dist2);
    }

    cout << ret << endl;
    return 0;
};

Measured memory_bytes: 1024