akhauriyash/Code-Regression huggingface dataset:
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll long long
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl

bool num[3000010]={1,1};
ll prime[3000100];

ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}

ll getprime()
{
    for(int i=2;i*i<=3000000;i++)
        if(!num[i])
            for(int j=i;j*i<=3000000;j++)
                num[i*j]=true;
    
    int k=0;
    for(int i=2;i<=3000000;i++)
    {
        if(!num[i])prime[k++]=i;
    }

    return k;
}

int main(void)
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    ll a,b,g=0,k=getprime(),sum=1;
    scanf("%lld%lld",&a,&b);
    g=gcd(a,b);

    for(int i=0;i<k;i++)
    {
        if(g%prime[i]==0)
        {
            sum++;
            while(g%prime[i]==0)g/=prime[i];
        }
    }
    if(g!=1)sum++;
    printf("%lld\n",sum);


    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


Measured memory_bytes: 6528
#include <stdio.h>

int main(void)
{
	int a,b,c,x,i;
	
	scanf("%d %d %d",&a,&b,&c);
	
	for(i = 0;i <=3;i++){
		if(a > b){
			x = a;
			a = b;
			b = x;
		}
		if(b > c){
			x = b;
			b = c;
			c = x;
		}
		if(a < b && b < c)
			break;
	}
	
	printf("%d %d %d\n",a,b,c);
	
	return 0;
}

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

using namespace std;

int main(void) {
  int n;
  cin >> n;

  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }

  vector<long long> v;
  for (auto i : mp) {
    while (i.second >= 2) {
      v.push_back(i.first);
      i.second -= 2;
    }
  }

  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());

  if (v.size() <= 1) {
    cout << 0 << endl;
  } else {
    cout << v[0] * v[1] << endl;
  }

  return 0;
}

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

int main(void){
	string n;
	while(cin>>n){
		
		if(n[0]==n[1] && n[1]==n[2] && (n[0]=='x' || n[0]=='o')){
			cout<<n[0]<<endl;continue;
		}else if(n[3]==n[4] && n[4]==n[5] && (n[3]=='x' || n[3]=='o')){
			cout<<n[3]<<endl;continue;
		}else if(n[6]==n[7] && n[7]==n[8] && (n[6]=='x' || n[6]=='o')){
			cout<<n[6]<<endl;continue;
		}else if(n[0]==n[4] && n[4]==n[8] && (n[0]=='x' || n[0]=='o')){
			cout<<n[0]<<endl;continue;
		}else if(n[2]==n[4] && n[4]==n[6] && (n[2]=='x' || n[2]=='o')){
			cout<<n[2]<<endl;continue;
		}else if(n[0]==n[3] && n[3]==n[6] && (n[0]=='x' || n[0]=='o')){
			cout<<n[0]<<endl;continue;
		}else if(n[1]==n[4] && n[4]==n[7] && (n[1]=='x' || n[1]=='o')){
			cout<<n[1]<<endl;continue;
		}else if(n[2]==n[5] && n[5]==n[8] && (n[2]=='x' || n[2]=='o')){
			cout<<n[2]<<endl;continue;
		}else cout<<"d"<<endl; 
		 
	}
}

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

int calc(const vector<int>& a, int n, bool right) {
    if (right) {
        for (int i = 0; i < a.size(); i++) {
            if (a[i] >= n) return a[i];
        }
    } else {
        for (int i = a.size() - 1; i >= 0; i--) {
            if (a[i] <= n) return a[i];
        }
    }
    return -1;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int left = a.back() / 2;
    int cand1, cand2;
    int ans;
    if (a.back() % 2 == 0) {
        cand1 = calc(a, left, true);
        cand2 = calc(a, left, false);
        if (abs(cand1 - left) < abs(cand2 - left)) {
            ans = cand1;
        } else {
            ans = cand2;
        }
    } else {
        cand1 = calc(a, left+1, true);
        cand2 = calc(a, left, false);
        if (abs(cand1 - (left + 1)) < abs(cand2 - left)) {
            ans = cand1;
        } else {
            ans = cand2;
        }
    }
    cout << a.back() << " " << ans << endl;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ll LCM(int a, int b){
    return a*b/gcd(a,b);
}

int main(void){
    ll n,m;
    cin>>n>>m;
    cout<<abs((n-2)*(m-2))<<endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){

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

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

}

Measured memory_bytes: 256
use std::io;

fn main() {
    let n = parse_line::<usize>();
    let line = parse_line::<String>();
    let split: Vec<&str> = line.split_whitespace().collect();
    let nums: Vec<usize> = split.iter().map(|s| s.parse::<usize>().unwrap()).collect();
    let found = find_numbers(nums);
    if found == 0 {
        println!("{}", -1);
    } else {
        println!("{}", n - found);
    };
}

fn parse_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn find_numbers(nv: Vec<usize>) -> usize {
    let mut counter = 1;
    for i in nv {
        if i == counter {
            counter += 1;
        }
    }
    counter - 1
}

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

using namespace std;

int main()
{
    int N, K;
    cin>>N>>K;
    vector<vector<long long>> T(N);
    for (int i=0; i<N; i++)
    {
        int t;
        cin>>t;
        long long d;
        cin>>d;
        T[t-1].push_back(d);
    }
    
    for (int i=0; i<N; i++)
        sort(T[i].begin(), T[i].end(), greater<long long>());
    
    vector<long long> X;
    vector<long long> Y;
    for (int i=0; i<N; i++)
    {
        int n = (int)T[i].size();
        if (n > 0)
        {
        
            X.push_back(T[i][0]);
            for (int j=1; j<n; j++)
                Y.push_back(T[i][j]);
        }
    }
    sort(X.begin(), X.end(), greater<long long>());
    sort(Y.begin(), Y.end(), greater<long long>());

    vector<long long> SX(X.size());
    if (X.size()>0)
        SX[0] = X[0];
    for (int i=1; i<(int)X.size(); i++)
        SX[i] = SX[i-1] + X[i];
    vector<long long> SY(Y.size());
    if (Y.size()>0)
        SY[0] = Y[0];
    for (int i=1; i<(int)Y.size(); i++)
        SY[i] = SY[i-1] + Y[i];

    long long ans = 0;
    for (long long i=1; i<=X.size(); i++)
        if (K-i <= SY.size())
            ans = max(ans, SX[i-1] + i*i + (K-i>0 ? SY[K-i-1] : 0));
    cout<<ans<<endl;
}


Measured memory_bytes: 7412
//made by Sert
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (ll)1e18 + 34;
const int N = (int)3e5 + 34;
const int M = (int)1e4 + 34;

vector<int> ans;

void relax(pair<int, int> &bst, int ind, vector<int> &a) {
    if (ind == bst.first || ind == bst.second || ind == -1) return;
    if (a[ind] > a[bst.first]) {
        bst.second = bst.first;
        bst.first = ind;
    } else if (bst.second == -1 || a[ind] > a[bst.second]) {
        bst.second = ind;
    }
}

pair<int, int> go(int msk, vector<vector<int>> &es, vector<int> &a, vector<pair<int, int>> &res) {
    if (res[msk].first != -1) return res[msk];
    pair<int, int> bst = {msk, -1};
    for (int submsk: es[msk]) {
        auto q = go(submsk, es, a, res);
        relax(bst, q.first, a);
        relax(bst, q.second, a);
    }
    if (bst.second != -1) ans[msk] = a[bst.first] + a[bst.second];
    return res[msk] = bst;
}

void solve() {
    int n;
    scanf("%d", &n);
    int m = (1 << n);
    vector<int> a(m);
    for (int i = 0; i < m; i++) {
        scanf("%d", &a[i]);
    }
    vector<vector<int>> es(m);
    for (int msk = 0; msk < m; msk++) {
        for (int i = 0; i < n; i++) {
            if (msk & (1 << i)) {
                int new_msk = (msk ^ (1 << i));
                es[msk].push_back(new_msk);
            }
        }
    }

    ans.resize(m);
    vector<pair<int, int>> res(m);
    for (int i = 0; i < m; i++) res[i] = {-1, -1};
    auto q = go(m - 1, es, a, res);

    for (int i = 2; i < m; i++) {
        ans[i] = max(ans[i], ans[i - 1]);
    }
    for (int i = 1; i < m; i++) {
        printf("%d\n", ans[i]);
    }
    //printf("\n");
}

int main() {
#ifdef MADE_BY_SERT
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    solve();
    solve();
    //solve();
#endif
    solve();
    return 0;
}


Measured memory_bytes: 30336
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define EPS 1e-10
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

string a, b, c;
ll dp[2][100];

ll calc(int dif, int rank){
	ll ret = 0;
	if(rank == -1){
		if(dif == 0) return 1;
		else return 0;
	}
	if(dp[dif][rank] != -1) return dp[dif][rank];
	if(a[rank] != '?' && b[rank] != '?'){
		int A = a[rank]-'0', B = b[rank]-'0';
		if(c[rank] == '?' || (A+B+dif)%10 == c[rank]-'0'){
			if(A+B+dif >= 10) ret = calc(1,rank-1);
			else ret = calc(0,rank-1);
		}
		dp[dif][rank] = ret;
		return ret;
	}
	if(a[rank] == '?' && b[rank] != '?') swap(a[rank],b[rank]);
	if(a[rank] != '?' && b[rank] == '?'){
		int A = a[rank]-'0';
		for(int B = 0; B <= 9; B++){
			if(rank == 0 && B == 0) continue;
			if(c[rank] == '?' || (A+B+dif)%10 == c[rank]-'0'){
				if(A+B+dif >= 10) ret += calc(1,rank-1);
				else ret += calc(0,rank-1);
			}
		}
		dp[dif][rank] = ret%MOD;
		return ret%MOD;
	}
	for(int A = 0; A <= 9; A++){
		if(rank == 0 && A == 0) continue;
		for(int B = 0; B <= 9; B++){
			if(rank == 0 && B == 0) continue;
			if(c[rank] == '?' || (A+B+dif)%10 == c[rank]-'0'){
				if(A+B+dif >= 10) ret += calc(1,rank-1);
				else ret += calc(0,rank-1);
			}
		}
	}
	dp[dif][rank] = ret%MOD;
	return ret%MOD;
}

void solve(){
	rep(i,2) rep(j,100) dp[i][j] = -1;
	cout << calc(0,a.size()-1) << endl;
}

int main(){
	while(cin >> a >> b >> c){
		solve();
	}
}

Measured memory_bytes: 1184
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int64

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let (N, K) = readInts() |> pair

// mod K = n
let count =
  let x=N/K
  (pown x 3)
  + if (K%2L)=0L then pown (if (N%K)>=(K/2L) then x+1L else x) 3 else 0L

printfn "%d" count

Measured memory_bytes: 14044
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;

int not_simu_num(char A, char B, char C){
  if(A == B && B == C){
    return 0;
  }
  else if(A == B || B == C || C == A){
    return 1;
  }
  else{
    return 2;
  }
}

int main(void){
  int N;
  string A, B, C;
  int ans = 0;
  //入力
  cin >> N;
  cin >> A;
  cin >> B;
  cin >> C;
  //同じ文字の個数をそれぞれ数えて、同じsumをとる。
  for(int i = 0; i < N; i++){
    ans += not_simu_num(A[i], B[i], C[i]);
    //cout << i << " " << ans << endl;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
k=int(input())
import math
x=0
c=0
d=0
for i in range(1,k+1):
  for j in range(i,k+1):
    for k in range(j,k+1):
      d=math.gcd(i,j)
      c=math.gcd(d,k)
      if i!=j and j!=k:
        x+=6*c
      elif (i!=j and j==k) or (k!=i and i==j):
        x+=3*c
      else:
        x+=c
print(x)

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

int main()
{
	int A[100], N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];

	bool flag = true;
	int count = 0;
	int end = 0;
	while (flag) {
		flag = false;
		for (int i = N - 1; i > end; i--) {
			if (A[i-1] > A[i]) {
				int tmp = A[i - 1];
				A[i - 1] = A[i];
				A[i] = tmp;
				count++;
			}
			flag = true;
		}
		end++;
	}

	cout << A[0];
	for (int i = 1; i < N; i++) {
		cout << ' ';
		cout << A[i];
	}
	cout << endl;
	cout << count << endl;
}

Measured memory_bytes: 3092
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>

using namespace std;

#define MOD 1000000007

long long int intpow(long long int base, long long int p)
{
	if (1 == p){
		return base;
	}

	if (0 == p % 2){
		long long int val = intpow(base, p / 2);
		return (val*val) % MOD;
	}
	else{
		return (intpow(base, p - 1) * base) % MOD;
	}
}

long long int comb(long long int n, long long int k)
{
	if (1 == n){
		return 1;
	}
	if (0 == k){
		return 1;
	}
	return (((comb(n - 1, k - 1)*n) % MOD) * intpow(k, MOD - 2)) % MOD;
}

void solv()
{
	long long int N, M, K; scanf("%lld%lld%lld", &N, &M, &K);

	long long int c = comb(N*M - 2, K - 2);
	long long int ret = 0;
	for (int d = 1; d < N; d++){
		long long int val = ((N - d)*M*M) % MOD;
		val = (val*(long long int)d) % MOD;
		val = (val*c) % MOD;
		ret = (ret + val) % MOD;
	}

	for (int d = 1; d < M; d++){
		long long int val = ((M - d)*N*N) % MOD;
		val = (val*(long long int)d) % MOD;
		val = (val*c) % MOD;
		ret = (ret + val) % MOD;
	}

	printf("%lld", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 6400
# -*- coding: utf-8 -*-
S = str(input())
Q = int(input())

rev_flag = 1
head_str = ""
tail_str = ""
for _ in range(Q):
    query = list(map(str, input().split()))
    if query[0] == "1":
        rev_flag *= -1
    else:
        h_or_t_flag = 1 if query[1] == "1" else -1
        h_or_t_flag *= rev_flag
        
        if h_or_t_flag == 1:
            head_str += query[2]
        else:
            tail_str += query[2]

ans = head_str[::-1] + S + tail_str
print(ans if rev_flag == 1 else ans[::-1])

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

int main()
{
  int64_t N, a, ans = 0;
  cin >> N;
  priority_queue<int64_t> pq;
  for (int i = 0; i < N; i++)
  {
    cin >> a;
    pq.push(a);
  }
  queue<int64_t> Q;
  Q.push(0);
  Q.push(pq.top());
  pq.pop();
  while (pq.size())
  {
    Q.push(pq.top());
    Q.push(pq.top());
    pq.pop();
  }
  for (int i = 0; i < N; i++)
  {
    ans += Q.front();
    Q.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 8140
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
   ll n,k;
  cin>>n>>k;
  ll a[k];
  for(ll i=0;i<k;i++){
    cin>>a[i];
  }
  sort(a,a+k);
  for(ll i=k-1;i>=0;i--){
    n = n - a[i];
    
    if(n<=0)
       break;
  }
  
  if(n<=0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

typedef long long lint;
typedef long double ldouble;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = 1e18;
const lint MOD = 1e9 + 7;
const lint inv = 1e9 + 5;

int main(){
    string s, t;
    cin >> s >> t;
    string ans;
    bool flag = false;
    repr(i, s.size() - t.size() + 1){
        ans = s;
        REP(j, i, i+t.size()){
            ans[j] = t[j-i];
        }
        rep(j, s.size()){
            if(s[j] != '?' && s[j] != ans[j]){
                flag = false;
                break;
            }
            flag = true;
        }
        if(flag){
            break;
        }
    }
    rep(i, ans.size()){
        if(ans[i] == '?'){
            ans[i] = 'a';
        }
    }
    if(flag){
        cout << ans << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}

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

int main() {
    int n; cin >> n;
    set<int> a;

    for(int i = 0; i < n; i++) {
        int inp; cin >> inp;

        if(a.find(inp) == a.end()) {
            a.insert(inp);
        } else {
            a.erase(inp);
        }
    }
    cout << a.size() << endl;
}


Measured memory_bytes: 4992
def tillx(x): #x is binary number
    if x == '0':
        return '0'
    elif x == '1':
        return '1' 
    rest = len(x)
    last = x[-1]
    result = ''
    for i in range(len(x)-1):
        if rest > 2:
            if x[i] == '1':
                if last == '1':
                    result += '0'
                elif last =='0':
                    result += '1'
            elif x[i] == '0':
                result += '0'
            rest -= 1
        elif rest == 2:
            m = x[i]+x[i+1]
            if m == '00' or m == '11':
                result += '00'
            elif m == '01':
                result  += '01'
            elif m == '10':
                result += '11'
    return result


def resultmake(A,B):
    a = tillx(bin(A-1)[2:])
    b = tillx(bin(B)[2:])
    a = '0'*(len(b)-len(a)) + a
    result = ''
    for i in range(len(b)):
        if int(b[i])-int(a[i]) == 0:
            result += '0'
        else:
            result += '1'
    return int(result,2)

A,B = map(int,input().split())
print(resultmake(A,B))

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

int main() {
  int N;
  cin >> N;
  
  int n1, n2, n3, n4, n5, n6, n7, n8, n9;
  
  n1 = N/100000000;
  n2 = (N - n1*100000000)/10000000;
  n3 = (N - n1*100000000 - n2*10000000)/1000000;
  n4 = (N - n1*100000000 - n2*10000000 - n3*1000000)/100000;
  n5 = (N - n1*100000000 - n2*10000000 - n3*1000000 - 
       n4*100000)/10000;
  n6 = (N - n1*100000000 - n2*10000000 - n3*1000000 - 
       n4*100000 - n5*10000)/1000;
  n7 = (N - n1*100000000 - n2*10000000 - n3*1000000 - 
       n4*100000 - n5*10000 - n6*1000)/100;
  n8 = (N - n1*100000000 - n2*10000000 - n3*1000000 - 
       n4*100000 - n5*10000 - n6*1000 - n7*100)/10;
  n9 = N - n1*100000000 - n2*10000000 - n3*1000000 - 
       n4*100000 - n5*10000 - n6*1000 - n7*100 - n8*10;
    
  int R;
  R = n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9;
  
  if (N % R == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
using namespace std;
int main(){
	int N,Q,i,x,y;
	string s;
	for(;cin>>N>>Q,N;){
		vector<pair<pair<int,int>,string> >v;
		for(i=0;i<N;i++)cin>>s>>x>>y,v.push_back(make_pair(make_pair(y-x,y),s));
		for(i=0;i<Q;i++){
			cin>>x;
			for(y=0;y<N;y++)if(v[y].first.first<x&&x<=v[y].first.second)break;
			if(y==N)cout<<"Unknown"<<endl;
			else cout<<v[y].second<<' '<<x-v[y].first.first<<endl;
		}
	}
}

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

struct Point { double x, y; };

void koch(int n, Point a, Point b) {
  if (n == 0) return;
  Point s, t, u;
  double th = M_PI * 60.0 / 180.0;
  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n - 1, a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, b);
};

int main() {
  Point a, b;
  int n;
  scanf("%d", &n);
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n, a, b);
  printf("%.8f %.8f\n", b.x, b.y);
  return 0;
};



Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scaneer = new Scanner(System.in);
		
		int n = scaneer.nextInt();
		
		String s = "";
		
		scaneer.close();
		
		for (int i = 0; i < n; i++) {
			
			s = s + "ACL";
		}
		
		System.out.println(s);
	}

}


Measured memory_bytes: 27024
#include <iostream>
#include <vector>
#include <string>
 
using namespace std;
 
int main(){
  long long N , T;
  cin >> N >> T;
  vector<long long> t(N);
  for(auto &&it:t){
    cin >> it;
  }
 
  long long before = 0;
  long long count =T;
  for(int i=1;i<t.size();i++){
    if(t[i]-before>=T){
      count+=T;
    }else{
      count+=t[i]-before;
    }
    before = t[i];
  }
  cout << count <<endl;
}

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

using namespace std;
#define endl '\n'
#define K 100010
int N,M;

int boxes[K];
int reds[K];

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

    cin >> N >> M;
    
    for(int i=0;i<K;i++)
    {
        boxes[i] = 1;
        reds[i] = 0;
    }
    reds[1]=1;
    int x,y;
    for(int i=0;i<M;i++)
    {
        cin >> x >> y;
        if(reds[x]>0) reds[y]++;
        if(boxes[x]==reds[x]) reds[x]--;
        boxes[x]--;
        boxes[y]++;
    }
    int r = 0;
    for(int i=1;i<N+1;i++)
    {
        if(reds[i]) r++;
    }
    cout << r << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a>b)
        printf("a > b\n");
    else if(a<b)
        printf("a < b\n");
    else
        printf("a == b\n");
        return 0;
    
        
}


Measured memory_bytes: 2048
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pf = min(a[0], b[0])
f = pf
pf = min(a[1], b[0] - pf)
f += pf
for i in range(1, n):
    pf = min(a[i] - pf, b[i])
    f += pf
    pf = min(a[i + 1], b[i] - pf)
    f += pf
print(f)


Measured memory_bytes: 18468
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long a[] = new long[n];
            long b[] = new long[n];
            long ia = 0, ib = 0, s = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                b[i] = in.nextInt();
            }
            long op = 0;
            for (int i = 0; i < n; i++) {
                op += b[i] - a[i];
                if (a[i] < b[i]) {
                    ia += (b[i] - a[i] + 1) / 2;
                }
            }
            if (op >= 0 && op >= ia) {
                out.println("Yes");
                return;
            }
            out.println("No");

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
class JNum{
	static constexpr uint64_t mod = 1000000007;
	uint64_t num;
public:
	JNum(uint64_t x):num(x%mod){}
	JNum operator+(const JNum& j)const{
		return (num + j.num)%mod;
	}
	JNum operator*(const JNum& j)const{
		return (num * j.num)%mod;
	}
	void operator+=(const JNum& j){
		num += j.num;
		num %= mod;
	}
	void operator*=(const JNum& j){
		num *= j.num;
		num %=mod;
	}
	uint64_t out()const{return num;}
};
using namespace std;
#define REP(i, n) for(int i=0;i<n;i++)
template<typename T>
void get(T& t){cin >> t;}
int main(void){
	int A, B;
	get(A), get(B);
	cout << 100 << " "<<100 << endl;
	char ans[100][101];
	for(int i=0;i<100;i++)ans[i][100] = '\0';
	REP(i, 100){
		REP(j, 100){
			if(i < 50){
				ans[i][j] = '.';
				if(B > 1 && i % 2 == 0 && j % 2 == 0){
					B--;
					ans[i][j] = '#';
				}
			}
			else {
				ans[i][j] = '#';
				if(A > 1 && i % 2 == 1 && j % 2 == 0){
					A--;
					ans[i][j] = '.';
				}
			}
		}
	}
	for(int i=0;i<100;i++){
		cout << string(ans[i]) << endl;
	}
	return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int a = 1;
  for (int i=0; i<N; i++) {
    if (a < K) a *= 2;
    else a += K;
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli n;
    cin >> n;
    vector<pair<lli, lli>> a(n);
    rep(i, n){
        cin >> a[i].first;
        a[i].first *= (-1);
        a[i].second = i;
    }
    sort(all(a));

    rep(i, n){
        if(i == a[0].second) cout << (-1)*a[1].first << endl;
        else cout << (-1)*a[0].first << endl;
    }
}

Measured memory_bytes: 4736
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
	x, y = map(int, input().split())
	w.append(x)
	v.append(y)

VMAX = 1000
INF = 1 << 30
dp = [[INF] * (N * VMAX + 1) for _ in range(N + 1)]
dp[0][0] = 0

for i in range(N):
	for j in range(N * VMAX + 1):
		if j < v[i]:
			dp[i + 1][j] = dp[i][j]
		else:
			dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])

res = 0
for i in range(N * VMAX + 1):
	if dp[N][i] <= W:
		res = i
print(res)

Measured memory_bytes: 120172
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 3006
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define mem( a ) memset( a , 0 , sizeof a )
#define P 998244353
typedef long long ll;
int n , s , k;
int A[MAXN] , dp[MAXN][MAXN];
void solve( ) {
    cin >> n >> s;
    for( int i = 1 ; i <= n ; ++ i ) scanf("%d",A + i);
    long long ans = 0;
    for( int i = 1 ; i <= n ; ++ i ) {
        for( int j = 1 ; j <= s ; ++ j ) dp[i][j] = dp[i - 1][j];
        for( int j = A[i] ; j <= s ; ++ j ) ( dp[i][j] += dp[i - 1][j - A[i]] ) %= P;
        ( dp[i][A[i]] += i ) %= P;
        ( ans += 1ll * ( dp[i][s] - dp[i - 1][s] + P ) % P * ( n - i + 1 ) % P ) %= P;
    }
    cout << ans << endl;
}
signed main() {
//    int T;cin >> T;while( T-- ) solve();
    solve();
}


Measured memory_bytes: 35456
#include<stdio.h>
int main(){
  int w,h,x,y,r;
  scanf("%d %d %d %d %d", &w,&h,&x,&y,&r);
  if(x-r<0 || x+r>w){
    printf("No\n");
  }else if(y-r<0 || y+r>h){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 584
import           Control.Monad
import           Data.Maybe
import           Data.List
import qualified Data.ByteString.Char8         as BS

tuplify2 (x : y : _) = (x, y)
tuplify2 _           = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInteger
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

main = do
    n       <- read <$> getLine
    strings <- map BS.unpack <$> replicateM n BS.getLine
    print $ solve n strings

solve n strings = sum $ map c $ map length $ group $ sort $ map sort strings
  where
    c :: Int -> Int
    c x = (x * (x - 3)) `div` 2 + x


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

int main()
{
	int A,B,C,X,Y;
	cin >> A >> B >> C >> X >> Y;

	int min_money = -1;

	for(int i=0; i<=max(X,Y); i++){
		if(min_money == -1)
			min_money = X*A + Y*B;
		else
			min_money = min(min_money, max((X-i),0)*A + max((Y-i),0)*B + 2*i*C);
	}
	cout << min_money << endl;
	return 0;
}


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

int main(int argc, char const *argv[]) {
    int a[3];
    for(int i=0;i<3;i++)cin>>a[i];
    int max = 0;
    int max_i;
    int sum=0;
    for(int i=0;i<3;i++){
        if(max < a[i]){
            max = a[i];
            max_i=i;
        }
    }
    for(int i=0;i<3;i++){
        if(i!=max_i)
            sum += a[i];
        else
            sum += 10*a[i];
    }
    cout << sum << endl;
    return 0;
}


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

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

  vector<int> c(N + 1, 0);
  rep(i, M) {
    int L, R;
    cin >> L >> R;
    --L, --R;
    c[L] += 1;
    c[R + 1] -= 1;
  }

  rep(i, N) c[i + 1] += c[i];

  int ans = 0;
  rep(i, N) ans += (c[i] == M);

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


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

//-----------------------------------------------------------------------

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

    int a,b,c;
    cin>>a>>b>>c;
    int ret=-1;
    REP(i,1e5){
        if(c%(a+b)<=a){
            ret=c;
            break;
        }else{
            c+=60;
        }
    }
    cout<<ret<<endl;
}


Measured memory_bytes: 3216
fun main(args: Array<String>) {

    var (a, b, c) = readLine()!!.split(" ").map { it.toInt() }

    if (a > b) { var tmp = a; a = b; b = tmp; }
    if (b > c) { var tmp = b; b = c; c = tmp; }
    if (a > b) { var tmp = a; a = b; b = tmp; }
    
    println("%d %d %d".format(a, b, c))
}



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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    string s , t;
    cin >> s >> t;
    int ans = 0;
    loop(i,SZ(s)) ans += (s[i] != t[i]);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
int n,m;
long long ans=0;
vector<int> adjl[9];
bool visited[9];
void dfs(int x){
	visited[x]=true;
	for(int i : adjl[x]){
		if(!visited[i]){
			dfs(i);
		}

			
		
	}
	bool flag=true;
			for(int j=1;j<=n;j++){
				if(!visited[j]){
					flag=false;
				}
			}
			if(flag){
				//cout<<x<<endl;
				ans++;
			}
	visited[x]=false;
}

int main(){
	cin>>n>>m;
	visited[0]=true;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		adjl[a].push_back(b);
		adjl[b].push_back(a);
	}
	dfs(1);
	cout<<ans<<endl;

}

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

 int main()
 {
 	ll t,n,i,j,k,s=0,q,a,b;
 	cin>>n>>a>>b;
 	if((ll)(b-a)%(ll)2==0) cout<<(ll)(b-a)/(ll)2;
 	else 
 	{
 		ll xx,yy,zz,pp;
 		xx=(b-1);yy=n-a;
 		zz=a+(b-a-1)/2;
 		pp=n-b+1+(n-(a+n-b+1))/2;
 		cout<<min(min(xx,yy),min(zz,pp));
	 }
 	
 	
 }

Measured memory_bytes: 256
n = int(input())
S = input()
left = []
right = []
cl = 0
cr = 0
for i in range(n):
  left += [cl]
  if S[i] == "#":
    cl += 1
  right += [cr]
  if S[n - 1 -i] == ".":
    cr += 1
min = cl
for i in range(n):
  if S[i] == "#":
    p = left[i] + right[n - 1 -i]
    if p < min:
      min = p
print(min)

Measured memory_bytes: 12812
#include<bits/stdc++.h>
using namespace std;
long long ans=0;
int main()
{
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)
    {
        for(int j=0;j<=b;j++)
        {
            for(int k=0;k<=c;k++) if(i*500+j*100+k*50==x) ans++;
        }
    }
    cout<<ans<<endl;
	return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

array<array<ll, 2>, 2010> dp;
array<ll, 2010> a;

int main()
{
 
	cin.tie(0); ios_base::sync_with_stdio(false);
	int  n; ll zz,ww;
	cin >>n >>zz >>ww;
	rep(i, n) cin >>a[i];
	rep(i, 2010) dp[i].fill(-1);
	
	auto rec =[&](auto f, ll z, ll w, int s, int t){
		ll& rtn = dp[s][t];
		if(rtn !=-1) return rtn;
		if(s == n) return abs(z -w);
		
		if(t==0){
			rtn = 0;
			rep2(i, s, n) rtn = max(rtn, f(f,a[i], w, i+1, 1));
		}else{
			rtn = 1LL<<60;
			rep2(i, s, n) rtn = min(rtn, f(f,z, a[i], i+1, 0));
		}
		return rtn;
	};

	cout << rec(rec, zz, ww, 0, 0) <<endl;
	
	return 0;
}


Measured memory_bytes: 384
import Data.Char

data Tree = Empty | Node Tree Int Tree deriving Show

toTree [] = Empty
toTree (n:ns) = Node (toTree ns) n (toTree ns)

plusMinus sum list Empty = [(sum,list)]
plusMinus sum list (Node l n r) = plusMinus  (sum+n) (list++"+"++(show n)) l ++ plusMinus (sum-n) (list++"-"++(show n)) r

solve (n:ns) = (++"=7") . snd . head . filter (\n -> (fst n) == 7) . plusMinus n (show n) $ toTree ns

toDigit x = ord x - ord '0'

main = do
  kippu <- map toDigit <$> getLine
  putStrLn $ solve kippu


Measured memory_bytes: 380
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int n;

    cin >> n;

    int min = INF;

    for(int i = 1; i < n; i++){
        int tmpa,tmpb;
        tmpa = i;
        tmpb = n - i;
        int total = 0;
        while(tmpa > 0){
            total += tmpa%10;
            tmpa /= 10;
        }
        while(tmpb > 0){
            total += tmpb%10;
            tmpb /= 10;
        }
        if(total < min){
            min = total;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 3e5+7 ;
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;

void solve(){
    int x ;
    cin >> x ;
    int cnt ;
    if(x>=400&&x<600){
    	cnt = 8 ;
    }
    if(x>=600&&x<800){
    	cnt = 7 ;
    }
    if(x>=800&&x<1000){
    	cnt = 6 ;
    }
    if(x>=1000&&x<1200){
    	cnt = 5 ;
    }
    if(x>=1200&&x<1400){
    	cnt = 4 ;
    }
    if(x>=1400&&x<1600){
    	cnt = 3 ;
    }
    if(x>=1600&&x<1800){
    	cnt =2 ;
    }
    if(x>=1800&&x<2000){
    	cnt = 1 ;
    }
    cout << cnt << endl ;
}

int32_t main(){
    FAST_IO ;
    int t = 1 ;
//  cin >> t ;
    while(t--){
        solve() ;
    }
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int n;
void dfs(string s, char mx){
    if(s.size() == n){
        dunk(s);
        return;
    }
    for(char x = 'a'; x <= mx + 1; x++){
        string t = s;
        t += x;
        dfs(t, max(x, mx));
    }
}

int main(){
    cin >> n;
    dfs("", 'a'-1);
}

    

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

int main(){
  int n = 10, m = 3;
  int ans[m];
  memset(ans, 0, sizeof(ans));

  for(int i = 0; i < n; i++){
    int x;
    cin >> x;

    for(int j = 0; j < m; j++){
      if(x > ans[j]){
        for(int k = m - 1; k > j; k--){
          ans[k] = ans[k - 1];
        }
        ans[j] = x;
        break;
      }
    }
  }

  for(int i = 0; i < m; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 1160
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int coun[105][105][105];
vector<int>x,y,z;
int rx[52][2], ry[52][2], rz[52][2];
int a[52],b[52],c[52],d[52],e[52],f[52];
int n,m;

int compress1(){
	for(int i = 0;i < n;i++){
		x.push_back(a[i]);
		x.push_back(d[i]);
	}
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for(int i = 0;i < n;i++){
		rx[i][0] = find(x.begin(),x.end(),a[i])-x.begin();
		rx[i][1] = find(x.begin(),x.end(),d[i])-x.begin();
	}
	return 0;
}

int compress2(){
	for(int i = 0;i < n;i++){
		y.push_back(b[i]);
       y.push_back(e[i]);
	}
	sort(y.begin(), y.end());
	y.erase(unique(y.begin(), y.end()), y.end());
	for(int i = 0;i < n;i++){
		ry[i][0] = find(y.begin(),y.end(),b[i])-y.begin();
		ry[i][1] = find(y.begin(),y.end(),e[i])-y.begin();
	}
	return 0;
}

int compress3(){
	for(int i = 0;i < n;i++){
		z.push_back(c[i]);
       z.push_back(f[i]);
	}
	sort(z.begin(), z.end());
	z.erase(unique(z.begin(), z.end()), z.end());
	for(int i = 0;i < n;i++){
		rz[i][0] = find(z.begin(),z.end(),c[i])-z.begin();
		rz[i][1] = find(z.begin(),z.end(),f[i])-z.begin();
	}
	return 0;
}

int main()
{
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
	}
	compress1();
	compress2();
	compress3();
	for(int i = 0;i < n;i++){
	for(int tx=rx[i][0];tx<rx[i][1];tx++)
    {
      for(int ty=ry[i][0];ty<ry[i][1];ty++)
        {
          for(int tz=rz[i][0];tz<rz[i][1];tz++)
        {
          coun[tx][ty][tz]++;
        }
        }
    }
	}
  long long ans=0;
  for(int i=0;i<=100;i++)
    {
      for(int j=0;j<=100;j++)
    {
      for(int k=0;k<=100;k++)
        {
          if(coun[i][j][k]>=m)
        {
          long long s1=(x[i+1]-x[i]),s2=(y[j+1]-y[j]),s3=(z[k+1]-z[k]);
          ans+=s1*s2*s3;
        }
        }
    }
    }
	//long long ans = 0;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6668
#include <bits/stdc++.h>
#define T tuple<int,int,string,long long int,string>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<T> v1;
    for(int i=0;i<n;i++){
        int v,w;
        long long int d;
        string t,s;
        cin>>v>>w>>t>>d>>s;
        v1.emplace_back(v,w,t,d,s);
    }
    sort(v1.begin(),v1.end());
    for(int i=0;i<n;i++){
        int v,w;
        long long int d;
        string s,t;
        tie(v,w,t,d,s)=v1[i];
        cout<<v<<" "<<w<<" "<<t<<" "<<d<<" "<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 16948
#!/usr/local/bin/python3

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

def f(x, m):
    return x**2 % m

check = [False for _ in range(M)]
d = [X]
max_x = 0
for _ in range(1, N+1):
    X = f(X, M)
    if check[X]:
        break
    else:
        check[X] = True
    d.append(X)

idx = d.index(X)
ans = sum(d[:idx])
N -= idx
d = d[idx:]

sumd = sum(d)
ans += N//len(d) * sumd

ans += sum(d[:N%len(d)])

print(ans)


Measured memory_bytes: 12060
n = int(input())
a = list(map(int,input().split()))
count = [0 for i in range(n)]
for i in a:
  count[i-1] += 1
ans = 0
for i in count:
  ans += i*(i-1)//2
for i in a:
  z = count[i-1]
  print(ans-z*(z-1)//2+(z-1)*(z-2)//2)



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

using namespace std;

//#define _FILES
#define PB push_back
#define MP make_pair

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

const int maxn = 200005;
vector<int> g[maxn];

int main()
{
    ios_base::sync_with_stdio(false);

    #ifdef _FILES
        freopen("","r",stdin);
        freopen("","w",stdout);
    #endif // _FILES
    int n, m;
    cin >> n >> m;
    for (int i=0;i<m;++i)
    {
        int a, b;
        cin >> a >> b;
        g[a].PB(b);
        g[b].PB(a);
    }

    string ans = "IMPOSSIBLE";

    for (int i=0;i<g[1].size();++i)
    {
        int to = g[1][i];
        for (int j=0;j<g[to].size();++j)
        {
            if (g[to][j] == n)
            {
                ans = "POSSIBLE";
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  
  int len = Z, ans = 0;
  while (len < X) {
    len += Y + Z;
    ans++;
  }
  if (len > X) ans--;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256