akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N; cin >> N;
  vector<ll> A(N, 0);
  rep(i, N) cin >> A[i];
  map<ll,ll> MP;
  ll ans = 0;
  rep(i, N){
    ans += MP[A[i]-i];
    MP[-A[i]-i]++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 27416
n = int(input())
a_list = list(map(int,input().split()))
ans_list = []
for i in range(len(a_list)):
    ans_list.append(a_list[i] - i - 1)
import numpy as np
if len(ans_list)% 2 == 0:
    ans_list1 = sorted(ans_list)
    number1 = ans_list1[n//2]
    number2 = ans_list1[n//2 + 1]
    
    ans1 = 0
    ans2 = 0
    for i in ans_list:
        ans1 += abs(i - number1)
        ans2 += abs(i - number2)
    print(min(ans1 , ans2))
else:
    cary = ans_list
    number = int(np.median(cary))
    ans = 0
    for i in ans_list:
        ans += abs(i - number)
    print(ans)


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int n;
  cin >> n;
  vector<int> cnt(26);
  for(int i = 0; i < 26; i++) cnt[i] = 2000;

  string s;
  for(int i = 0; i < n; i++){

    cin >> s;
    vector<int> tmp_cnt(26);
    for(int j = 0; j < 26; j++) tmp_cnt[j] = 0;

    for(int j = 0; j < s.length(); j++){
      tmp_cnt[int(s[j]-'a')]++;
    }

    for(int j = 0; j < 26; j++){
      chmin(cnt[j], tmp_cnt[j]);
    }

  }

  string ans = "";
  for(int i = 0; i < 26; i++){
    for(int j = 0; j < cnt[i]; j++){
      ans += char(i + 'a');
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#if 1
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif


int main(){
	string s;
	cin >> s;

	int a = 0;

	if("SUN" == s){
		a = 7;
	}
	else if("MON" == s){
		a = 6;
	}
	else if("TUE" == s){
		a = 5;
	}
	else if("WED" == s){
		a = 4;
	}
	else if("THU" == s){
		a = 3;
	}
	else if("FRI" == s){
		a = 2;
	}
	else if("SAT" == s){
		a = 1;
	}

	cout << a << endl;

	return 0;
}


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

int main(){
    
    int N;
    cin >> N;
    map<int,int> mp;
    if(N%2==0){
        int A;
        for(int i = 0; i < N ;i++){
            cin >> A;
            if(A<=0||N<=A||A%2==0){
                cout << 0 << endl;
                return 0;
            }
            mp[A]++;
            if(mp[A]>2){
                cout << 0 << endl;
                return 0;                
            }
        }
        
        long long ans = 1;
        for(int i = 0; i < N/2;i++) ans =(ans*2)%1000000007;
        cout << ans << endl;        
    }else{
        //cout << "odd"<<endl;
        int A;
        for(int i = 0; i < N ;i++){
            cin >> A;
            if(A<0||N<=A||A%2==1){
                cout << 0 << endl;
                return 0;
            }
            mp[A]++;
            if(mp[A]>2||mp[0]>1){
                cout << 0 << endl;
                return 0;                
            }
        }
        
        long long ans = 1;
        for(int i = 0; i < N/2;i++) ans =(ans*2)%1000000007;
        cout << ans << endl;        
    }
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
#define int long long

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

void solve() {
	int a, b; cin >> a >> b;
    int g = gcd(a, b);
    cout << a * b / g << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


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

using namespace std;

void rwFile() {
    freopen("INP.inp", "r", stdin);
    freopen("OUT.out", "w", stdout);
}

void solveA() {
    char x; cin >> x;
    cout << char(x + 1);
}

void solveB() {
    int n, k, m;
    cin >> n >> k >> m;
    int S = 0;
    for (int i = 0; i < n - 1; i++) {
        int x; cin >> x;
        S += x;
    }
    if (m * n - S > k) cout << -1;
    else {
        if (m * n - S < 0) cout << 0;
        else cout << m * n - S;
    }
}

void solveC() {
    int n, m;
    cin >> n >> m;
    int arr[n + 1], check[n + 1];
    memset(arr, 0, sizeof(arr));
    memset(check, 0, sizeof(check));
    for (int i = 0; i < m; i++) {
        int p; cin >> p;
        string s; cin >> s;
        if (s == "AC") check[p] = 1;
        else {
            if (check[p] != 1) arr[p]++;
        }
    }
    int cor = 0, pen = 0;
    for (int i = 1; i <= n; i++) {
        if (check[i] == 1) {
            cor++;
            pen += arr[i];
        }
    }
    cout << cor << ' ' << pen;
}

void solveD() {
    int h, w; cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++) cin >> s[i];
    int res = 0;
    for (int i = 0; i < h - 1; i++) {
        for (int j = 0; j < w - 1; j++) {
            for (int k = i + 1; k < h; k++) {
                for (int l = j + 1; l < w; l++) {
                    if (s[i][j] == '.' && s[k][l] == '.') {
                        res = max(res, k - i + l - j);
                    }
                }
            }
        }
    }
    cout << res;
}

const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;

long long Fact[MAXN];

long long Pow(int b, int e = MOD - 2) {
    if (e == 0) return 1LL;
    long long tmp = Pow(b, e / 2);
    if (e % 2 == 0) return tmp * tmp % MOD;
    return (tmp * tmp % MOD) * b % MOD;
}

long long Choose(int n, int k) {
    return (Fact[n] * Pow(Fact[k]) % MOD) * Pow(Fact[n - k]) % MOD;
}

void solveE() {
    int n, k; cin >> n >> k;
    long long arr[n];
    Fact[0] = 1;
    for (int i = 1; i <= n; i++) Fact[i] = Fact[i - 1] * i % MOD;
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    long long res = 0;
    for (int i = k - 1; i < n; i++) {
        res += arr[i] * (Choose(i, k - 1)) % MOD;
        res %= MOD;
    }
    for (int i = 0; i <= n - k; i++) {
        res = (res + MOD - arr[i] * Choose(n - i - 1, k - 1) % MOD) % MOD;
    }
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    //rwFile();
    solveE();
}


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

int main() {
  double a,b,ans;
  bool c=true;
  cin >> a >> b;
  for(int i=1;i<3000;i++) {
    if(floor(i*0.08)==a&&floor(i*0.1)==b) {
      c=false;
      cout << i << endl;
      break;
    };
  };
  if(c) cout << -1 << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

const int MAX_V = 200;
int dis[MAX_V][MAX_V]; //最短距離(INFで初期化,d[i][i]=0,d[i][j]=辺ijのコスト)
int V; //頂点数
//ワーシャルフロイド法
void warshall_floyd() {
    for (int k = 0; k < V; k++) {
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
            }
        }
    }
}

vector<int> mark;

bool nibu(const vector<vector<int>> &G, int v, int p, int m) {
    if (mark[v] != -1) {
        if (mark[v] == m) return true;
        return false;
    }
    mark[v] = m;
    for (int u : G[v]) {
        if (u == p) continue;
        if (!nibu(G, u, v, 1 - m)) return false;
    }
    return true;
}

int main() {
    int n; cin >> n;
    V = n;
    mark = vector<int>(n, -1);
    vector<vector<int>> G(n);
    vector<string> g(n);
    REP(i, n) cin >> g[i];
    REP(i, n) {
        REP(j, n) {
            if (g[i][j] == '1') {
                dis[i][j] = 1;
                G[i].push_back(j);
                G[j].push_back(i);
            }
            else if (i != j){
                dis[i][j] = INF;
            }
        }
    }
    if (!nibu(G,0,-1,0)) {
        puts("-1");
        return 0;
    }
    warshall_floyd();
    int ans = 0;
    REP(i, n) {
        REP(j, n) {
            ans = max(ans, dis[i][j]);
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 896
function main()
  N = parse(readline())
  v = sort(parse.(split(readline())))
  ans = 0
  for i = 1:N
    ans += v[i] * 2^((i == 1 || i == 2) ? 0 : i-2)
  end
  print(ans / 2^(N-1))
end
main()

Measured memory_bytes: 122108
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        long max = 0;
        {
            int p = 0;
            long[] stack = new long[N+1];
            int[] point = new int[N+1];
            for(int i=0;i<N;i++){
                long h = long.Parse(str[i]);
                while(p > 0 && stack[p-1] > h){
                    int l = p == 1 ? 0 : point[p-2] + 1;
                    max = Math.Max(max,stack[p-1]*(i-l));
                    p--;
                }
                stack[p] = h;
                point[p] = i;
                p++;
            }
            while(p > 0 && stack[p-1] > 0){
                int l = p == 1 ? 0 : point[p-2] + 1;
                max = Math.Max(max,stack[p-1]*(N-l));
                p--;
            }
        }
        sb.Append(max+"\n");
    }
}

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

//macro-----------------------------------------------------------------------------------------
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i=a;i>b;i--)
#define int long long

//constant--------------------------------------------------------------------------------------
const int inf = 100100100100000;
const int mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//general_method--------------------------------------------------------------------------------
vector<int> cs(vector<int> arr){vector<int> ret = arr;rep(i,1,arr.size()){ret[i] += ret[i-1];}return ret;}
int ceil(int a, int b){if(a%b == 0) return a/b;else return a/b + 1;}
int digitlen(int i){int t = i;int count = 0;while(t){count += 1;t /= 10;}return count;}
int gcd(int m, int n){if((0== m)||(0 == n))return 0;while(m != n){if(m > n)m = m - n;else n = n - m;}return m;}
int lcm(int n, int m){return n*m/gcd(n,m);}

//io_method-------------------------------------------------------------------------------------
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
void print(int n){cout << n << endl;}
void print(vector<int> arr){cout << arr[0];rep(i,1,arr.size()) cout << " " << arr[i];cout << endl;}
void print(string s){cout << s << endl;}
void print(pair<int, int> p){cout << p.first << " " << p.second;}
void print(vector<vector<int>> arr){rep(i,0,arr.size()){print(arr[i]);}}

//main------------------------------------------------------------------------------------------


vector<int> prime_factors(int n){
    int t = n;
    vector<int> ret;
    rep(i,2,sqrt(n)+1){
        while(t % i == 0){
            ret.push_back(i);
            t /= i;
        }
    }
    if(t > 1) ret.push_back(t);
    return ret;
}

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

    int ans = 1;
    int n = input();

    rep(i,0,n){
        ans = lcm(ans, input());
    }

    print(ans);
    
    


}


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

int main(){
	int n, m, typenum;
	std::cin >> n >> m;
	// std::vector<int> k(n);
	std::vector<int> b_all(m, 1);
	// std::vector< std::vector<int> > a(n);

	for(int i=0; i<n; i++){
		std::cin >> typenum;
		std::vector<int> b(m, 0);
		for(int j=0; j<typenum; j++){
			int c;
			std::cin >> c;
			b[c-1] = 1;
		}
		for(int j=0; j<m; j++){
			if(b[j]==0) b_all[j] = 0;
		}
	}
	int count = 0;
	for(int j=0; j<m; j++){
		if(b_all[j]==1) count++;
	}
	std::cout << count <<std::endl;
	return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007;
const ll INF=1LL<<60,MAX=100001;

int N,dp[MAX];
vector<int> S;

int judge(int a){
    if(dp[a]==0) return dp[a]=0;
    else if(dp[a]==1) return dp[a]=1;
    else{
        bool flag=false;
        for(int i=0;i<N;i++){
            if(a-S[i]>=0&&dp[a-S[i]]==-1){
                if(judge(a-S[i])==0) flag=true;
            }else if(a-S[i]>=0&&dp[a-S[i]]!=-1){
                if(dp[a-S[i]]==0) flag=true;
            }
        }
        if(flag) return dp[a]=1;
        else return dp[a]=0;
    }
}

int main(){
    
    int K;cin>>N>>K;
    for(int i=0;i<MAX;i++){
        dp[i]=-1;
    }
    for(int i=0;i<N;i++){
        int a;cin>>a;
        S.push_back(a);
        dp[a]=1;
    }
    for(int i=0;i<S[0];i++){
        dp[i]=0;
    }
    if(judge(K)) cout<<"First"<<endl;
    else cout<<"Second"<<endl;
}


Measured memory_bytes: 5376
using System;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            var d = 0;
            var max1 = 0;
            foreach(char c in a)
            {
                if(c.Equals('R'))
                {
                    d = d + 1;
                    if (d > max1)
                    {
                        max1 = d;
                    }
                }
                else
                {
                    if(d>max1)
                    {
                        max1 = d;
                    }
                    d = 0;
                }
            }
            Console.WriteLine(max1);
        }
    }
}


Measured memory_bytes: 25860
n = int(input())
h_list = list(map(int,input().split()))
max = 0
ans = 0
for t in range(0,n-1):
  if h_list[t] >= h_list[t+1]:
    ans += 1
    if ans >= max:
      max = ans
  else:
    ans = 0
print(max)

Measured memory_bytes: 14252
#include <stdio.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
	double weight;

	while(scanf("%lf",&weight)!=EOF){
		if(weight > 91.00){
			printf("heavy\n");
		}else if(weight > 81.00){
			printf("light heavy\n");
		}else if(weight > 75.00){
			printf("middle\n");
		}else if(weight > 69.00){
			printf("light middle\n");
		}else if(weight > 64.00){
			printf("welter\n");
		}else if(weight > 60.00){
			printf("light welter\n");
		}else if(weight > 57.00){
			printf("light\n");
		}else if(weight > 54.00){
			printf("feather\n");
		}else if(weight > 51.00){
			printf("bantam\n");
		}else if(weight > 48.00){
			printf("fly\n");
		}else{
			printf("light fly\n");
		}
	}

	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int arr[n][3];
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<3; j++)
            cin >> arr[i][j];
    }

    for(int i=1; i<n; i++){
        arr[i][0] += max(arr[i-1][1], arr[i-1][2]);
        arr[i][1] += max(arr[i-1][0], arr[i-1][2]);
        arr[i][2] += max(arr[i-1][0], arr[i-1][1]);
    }
    cout << max(arr[n-1][0], max(arr[n-1][1], arr[n-1][2])) << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;


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


    vector<int> taste(n);

    for(int i=0;i<n;i++) taste[i]=l+i;
    
    int total_n=0;
    for(int i=0;i<n;i++) total_n+=taste[i];

    bool flag=true;
    int pick=1000;
    int index;
    

    for(int i=0;i<n;i++){
        if(flag){
           if(taste[i]==0){
           pick=0;
           index=i; 
           flag=false;
         }
           else{
               pick=min(abs(taste[i]),pick);
               if(abs(taste[i])==pick){
                   index=i;
               } 
           }
        }
    }

    int sum=0;
    for(int i=0;i<n;i++){
        if(i!=index){ 
        sum+=taste[i];
        }
    }
    cout<<sum<<endl;
   // cout<<index<<endl;
   // for(int i=0;i<n;i++) cout<<taste[i];
    
    return 0;
}

Measured memory_bytes: 256
A1, A2, A3 = map(int,input().split())
if A1>A2>A3 or A3>A2>A1:
    x = abs(A1-A3)
    print(x)
elif A2>A1>A3 or A3>A1>A2:
    x = abs(A2-A3)
    print(x)
else:
    x = abs(A1-A2)
    print(x)

Measured memory_bytes: 3060
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a=sorted(a)
b=sorted(b)
c=sorted(c)
c.insert(0,-1)
c.append(10**10)
B=[0]*n
ans=0
for i in range(n):
    x=b[i]
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if c[m]>x:
            r=m
        elif c[m]<=x:
            l=m
    B[i]=n-l
g=[0]*n


g[n-1]=B[n-1]
for i in range(n-1):
    g[-2-i]=g[-1-i]+B[-2-i]
g.append(0)

b.insert(0,-1)
b.append(10**10)
for i in range(n):
    x=a[i]
    l=0
    r=n+1
    while r-l>1:
        m=(l+r)//2
        if b[m]>x:
            r=m
        elif b[m]<=x:
            l=m
    ans+=g[l]
print(ans)


Measured memory_bytes: 121288
def main():
    data = []
    n = input().split()
    a = int(n[0])
    b = int(n[1])

    divans = a / b
    intdiv = int(divans)
    divr = a % b

    print("{0} {1} {2:.5f}".format(intdiv, divr, divans))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 5616
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> void pp(T a, T b){ for(T i = a; i != b; ++i) cout << *i << ' '; cout << endl; }

#define INF (1<<29)

int N;
int d[200];
int dp[1000010][2];

void init(){
  int n;
  rep(n,200) d[n] = n * (n+1) * (n+2) / 6;
}


int main(){
  int i,j;

  init();

  // pp(d,d+200);

  rep(i,1000010) rep(j,2) dp[i][j] = INF;

  dp[0][0] = dp[0][1] = 0;
  rep(i,1000010) for(j = 1; d[j] <= i+1; j++){
    if(i - d[j] >= 0){
      dp[i][0] = min(dp[i][0], dp[i-d[j]][0] + 1);
      if(d[j] % 2 == 1){
        dp[i][1] = min(dp[i][1], dp[i-d[j]][1] + 1);
      }
    }
  }


  while(1){
    scanf("%d",&N);
    if(N == 0) break;

    printf("%d %d\n",dp[N][0],dp[N][1]);
  }

  return 0;
}

Measured memory_bytes: 8560
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  int T;
  int A;
  cin >>N>>T>>A;
  vector<double>vec(N);
  rep(i,N) {
    cin>>vec.at(i);
  }
  rep(i,N) {
    vec.at(i)=T-vec.at(i)*0.006;
  }
  vector<pair<double,int>> P(N);
  rep(i,N) {
    P.at(i).first=abs(A-vec.at(i));
    P.at(i).second=i+1;
                      }
      sort(all(P));
           cout<<P.at(0).second<< endl;
                      }

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

bool solve(int a0, int nuniq, int nother)
{
	int mincolor = nuniq + (nother ? 1 : 0);
	int maxcolor = nuniq + (nother)/2;
	//print(mincolor, maxcolor);
	if(mincolor <= a0+1 && a0+1 <= maxcolor)
		return true;
	else
		return false;
}

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

	int n;
	cin >> n;
	vector<int> a(n);
	map<int,int> m;
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		++m[a[i]];
	}
	
	sort(a.begin(), a.end());
	if(2 < m.size() || (m.size() == 2 && a.front()+1 != a.back()))
	{
		puts("No");
		return 0;
	}
	
	int nuniq = lower_bound(a.begin(), a.end(), a.back()) - a.begin();
	int nother = n - nuniq;
	//print(nuniq, nother);
	
	if(a.front() == a.back())
	{
		if(solve(a.front()-1, 0, n) || solve(a.front(), n, 0))
			puts("Yes");
		else
			puts("No");		
	}
	else
	{
		if(solve(a.front(), nuniq, nother))
			puts("Yes");
		else
			puts("No");
	}

	return 0;
}


Measured memory_bytes: 5376
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
tmp = {}
sum = 0
for j in c:
  tmp[j] = c[j] * (c[j] - 1) // 2
  sum += c[j] * (c[j] - 1) // 2
for i in range(n):
  print((c[a[i]] - 1) * (c[a[i]] - 2) // 2 + sum - tmp[a[i]])

Measured memory_bytes: 30776
#include <math.h>

int main()
{
  int n, i, count = 0, j;
  int a[10000];

  scanf("%d", &n);

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

  for(i=0; i<n; i++){
    for(j=30; j>=1; j--){
      if(a[i]%(int)(pow(2,j)) == 0) {
	count = count + j;
	break;
      }
    }
  }

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef pair<char,int> P;
const int maxn = 100005;
int tree[maxn];
int ar[maxn];
P query[maxn];
int get(int i)
{
	if(ar[i])return i;
	return tree[i] = get(tree[i]);
}
int main()
{
	int n,q;
	while(scanf("%d%d",&n,&q),n|q){
		memset(ar,0,sizeof(ar));
		ar[1] = true;
		for(int i = 2;i<=n;i++)
			scanf("%d",&tree[i]);
		for(int i = 0;i<q;i++)
			scanf(" %c%d",&query[i].first,&query[i].second);
		for(int i = 0;i<q;i++)
			if(query[i].first=='M')
				ar[query[i].second] += 1;
		long long sum = 0;
		for(int i = q-1;i>=0;i--)
			if(query[i].first=='M')ar[query[i].second] -= 1;
			else sum += get(query[i].second);
		printf("%lld\n",sum);	
	}
	return 0;
}

Measured memory_bytes: 2908
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <bitset>
#include <queue>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x)*(x)
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    int i = 1;
    while(n >= pow(k, i)) {
        i++;
    }
    cout << i;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char s[1000];
  int len;
  int x,y;
  int a,b,c,d;
  int i;
  scanf("%s",s);
  len=strlen(s);
  a=b=c=d=0;
  for(i=0;i<len;i++){
    if(s[i]=='N')a=1;
    else if(s[i]=='S')b=1;
    else if(s[i]=='E')c=1;
    else if(s[i]=='W')d=1;
  }

  if(a==b && c==d)printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	int x;
	cin>>x;
	if(x>=30){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef pair<int,pii> pip;
const int maxn=200005;
int n,bit[maxn],a[maxn];
pii odd[20][maxn],even[20][maxn];
inline void init() {
    memset(odd,0x3f,sizeof odd);
    memset(even,0x3f,sizeof even);
    for (int i=1;i<=n;++i)
        if (i&1)
            odd[0][i]=pii(a[i],i);
        else
            even[0][i]=pii(a[i],i);
    for (int i=1;i<20;++i)
        for (int j=1;j+(1<<i)-1<=n;++j) {
            odd[i][j]=min(odd[i-1][j],odd[i-1][j+(1<<(i-1))]);
            even[i][j]=min(even[i-1][j],even[i-1][j+(1<<(i-1))]);
        }
}
inline pii oddmin(int l,int r) {
    int x=0;
    while ((1<<(x+1))<=r-l+1)
        ++x;
    return min(odd[x][l],odd[x][r-(1<<x)+1]);
}
inline pii evenmin(int l,int r) {
    int x=0;
    while ((1<<(x+1))<=r-l+1)
        ++x;
    return min(even[x][l],even[x][r-(1<<x)+1]);
}
priority_queue<pip,vector<pip>,greater<pip> > que;
vector<int> res;
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
        scanf("%d",&a[i]);
    init();
    que.push(pip(oddmin(1,n).first,pii(1,n)));
    while (!que.empty()) {
        int l=que.top().second.first,r=que.top().second.second;
        que.pop();
        pii p1,p2;
        if (l%2==0) {
            p1=evenmin(l,r);
            p2=oddmin(p1.second+1,r);
        } else {
            p1=oddmin(l,r);
            p2=evenmin(p1.second+1,r);
        }
        res.push_back(p1.first);
        res.push_back(p2.first);
        if (p1.second-1>=l)
            que.push(pip(l%2==1?oddmin(l,p1.second-1).first:evenmin(l,p1.second-1).first,pii(l,p1.second-1)));
        if (p1.second+1<=p2.second-1)
            que.push(pip((p1.second+1)%2==1?oddmin(p1.second+1,p2.second-1).first:evenmin(p1.second+1,p2.second-1).first,pii(p1.second+1,p2.second-1)));
        if (p2.second+1<=r)
            que.push(pip((p2.second+1)%2==1?oddmin(p2.second+1,r).first:evenmin(p2.second+1,r).first,pii(p2.second+1,r)));
    }
    for (int i=0;i<(int)res.size();++i)
        printf("%d%c",res[i],i+1==(int)res.size()?'\n':' ');
    return 0;
}


Measured memory_bytes: 66444
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
bitset<N>V;
int main()
{
    int n,s=0;
    scanf("%d",&n);
    V[0]=1;
    for(int i=0,x; i<n; i++)scanf("%d",&x),s+=x,V|=V<<x;
    for(int i=(s+1)/2;;i++)
    if(V[i])
    {
        printf("%d",i);
        return 0;
    }
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
    abc141b()
}

fun abc141b() {
    val s = readLine()!!

    val odds = s.filterIndexed { index, c -> index % 2 == 0 }
        .all { it == 'R' || it == 'U' || it == 'D' }
    val evens = s.filterIndexed { index, c -> index % 2 != 0 }
        .all { it == 'L' || it == 'U' || it == 'D' }

    val answer = if (odds && evens) "Yes" else "No"

    println(answer)
}


Measured memory_bytes: 33976
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int arr[MAX],ans[MAX],rain[MAX],n,mx;
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n;
    int idx;
    ll sum=0,res=0;
    for(int i=1; i<=n; i++)
    {
        cin>>arr[i];
        sum+=arr[i];
        if(i%2==0)
            res+=arr[i];
    }
    rain[1]=sum-(2ll*res);
    for(int i=2;i<=n;i++){
        rain[i]=2*(arr[i-1]-(rain[i-1]/2));
    }


    for(int i=1; i<=n; i++)
        cout<<rain[i]<<" ";



    return 0;
}


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

int main() {
	int n;
	string s,ans;
	cin >> n >> s;
	ans=s;
	while (s.find("()")<n){
		s=s.substr(0,s.find("()"))+s.substr(s.find("()")+2,s.length()-1);
	}
	for (int i=0;i<s.length();i++){
		if (s[i]==')')
			ans='('+ans;
		else if (s[i]=='(')
			ans=ans+')';
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

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

  int64 n, a, b; cin >> n >> a >> b;

  int64 diff = b - a;
  if (diff % 2 == 0) {
    cout << diff / 2 << endl;
  } else {
    cout << min(a - 1LL, n - b) + 1LL + diff / 2 << endl; 
  }

  return 0;
}

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

int main()
{
    string s;
    
    cin >> s;

    string ss ="";
    ss+=s[0];

    ss+= to_string(s.size()-2);
    ss+=s[s.size()-1];


    cout <<ss;
    
    return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ara[200000]={0},sh[200000];
    int i,j=1,k,a,b,s=0;
    cin>>a;
    for(i=0;i<a-1;i++)
    {
        cin>>sh[i];
        ara[sh[i]]++;
        if(sh[i]>s)
            s=sh[i];
    }
    for(i=1;i<=s;i++)
    {
       cout<<ara[i]<<endl;
    }
    b=a-s;
    for(i=0;i<b;i++)
    {
        cout<<"0"<<endl;
    }
    return 0;
}


Measured memory_bytes: 5200
import java.util.Scanner;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        Scanner scanner = new Scanner(System.in);
 
        String P = scanner.next().toLowerCase();
        char p[] = P.toCharArray();
 
        String tmp;
        int ans = 0;
        boolean FLG;
 
        while(!(tmp = scanner.next()).equals("END_OF_TEXT")){
 
            char line[] = tmp.toLowerCase().toCharArray();
 
            if(line.length != p.length)continue;
 
            FLG = true;
            for(int i = 0; i < P.length(); i++){
                if(p[i] != line[i]){
                    FLG = false;
                    break;
                }
            }
            if(FLG)ans++;
        }
 
        System.out.println(ans);
    }
}


Measured memory_bytes: 26216
using System;

class AOJ2018
{
    static void Main()
    {
        while (true)
        {
            string[] cfgstr = Console.ReadLine().Split(' ');
            if (cfgstr[0] == "0") break;
            int n = int.Parse(cfgstr[0]);
            int m = int.Parse(cfgstr[1]);
            int p = int.Parse(cfgstr[2]);
            int sum = 0;
            int[] v = new int[n];
            for (int i = 0; i < n; i++)
            {
                v[i] = int.Parse(Console.ReadLine());
                sum += v[i];
            }
            if (v[m - 1] == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine((sum * (100 - p)) / v[m - 1]);
            }
        }
    }
}

Measured memory_bytes: 5780
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

		//??\??????????????????????????????Scanner???????????§???????????????
		Scanner scan = new Scanner(System.in);

		//???????????????????????????
		String text = scan.nextLine();

		//?????£??????????????\??????????????????
		char[] c = text.toCharArray();

		//??§?????????????°??????????????°???????????????§????????????????????????
		for(int i=0;i< c.length ; i++ ){
			//System.out.println(c[i]);
			if( Character.isLowerCase(c[i])){
				c[i] = Character.toUpperCase(c[i]);
				//System.out.println(c[i]);
			} else {
				c[i] = Character.toLowerCase(c[i]);
				//System.out.println(c[i]);
			}
		}

		//String????????¨?????????
		String s ="";
		//char?????????String?????????1???????????????
		for(int i = 0; i < c.length ; i++ ){
			s += String.valueOf(c[i]);
		}
		//??¨?????¨?????°
		System.out.println(s);


	}

}

Measured memory_bytes: 31552
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;

class CLowElements {
public:
	void solve(std::istream& cin, std::ostream& cout) {
		ll n;cin >> n;
		vector<ll> a(n);for(int i = 0;i < n;i++)cin >> a[i];
		ll m = n+1;
		int ans = 0;
		for (int i = 0; i < n; ++i)
		{
			if(a[i] < m){
				ans++;m = a[i];
			}
		}
		cout << ans << endl;
	}
};


int main() {
	CLowElements solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int x,y;
const int mx[8]={-1,-1,-1,0,0,1,1,1};
const int my[8]={-1,0,1,-1,1,-1,0,1};

void dfs(vector<vector<int>> &c,int H,int W,int& h,int& w)
{
c[H][W] = 0;
for(int i=0;i<8;i++){y=H+my[i],x=W+mx[i];if(y<0||y>h-1||x<0||x>w-1)continue;if(!c[y][x])continue;dfs(c,y,x,h,w);}
}

int main()
{
int w,h,ans;
vector<vector<int>> c(50,vector<int>(50));
scanf("%d%d", &w, &h);
while(w!=0&&h!=0)
{
ans=0;
for(int i=0;i<h;i++)for(int j=0;j<w;j++)scanf("%d", &c[i][j]);
for(int i=0;i<h;i++)for(int j=0;j<w;j++){if(!c[i][j])continue;dfs(c,i,j,h,w);ans++;}
printf("%d\n",ans);
scanf("%d%d", &w, &h);
}
return 0;
}


Measured memory_bytes: 3392
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    n, W = readi(2)
    ws, vs = zip(*readi(n, 2))
    dp = arr(n + 1, W + 1)
    for i in range(n):
        for w in range(W + 1):
            if w - ws[i] >= 0:
                dp[i + 1][w] = dp[i][w - ws[i]] + vs[i]
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w])
    print(dp[n][W])


if __name__ == "__main__":
    main()


Measured memory_bytes: 118512
local n=io.read("n")
local a={}
for i=1,n do
    local input=io.read("n")
    a[input]=(a[input] or 0)+1
end
local sum=0
for k,v in pairs(a) do
    sum=sum+k*v
end

local q=io.read("n")
for i=1,q do
    local b,c=io.read("n","n")
    if a[b] then
        sum=sum+a[b]*c-a[b]*b
        a[c]=(a[c] or 0)+a[b]
        a[b]=0
        print(sum)
    else
        print(sum)
    end
end

Measured memory_bytes: 7424
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f

let () =
  let [a; b] = read_ints 2 in
  printf "%d\n" @@ (a + b + 1) / 2


Measured memory_bytes: 384
N,K=map(int,input().split())
p=list(map(int,input().split()))
expected=[0]*N
for i in range(N):
    expected[i]=(p[i]+1)/2
accumurate=[0]*(N+1)
for i in range(1,N+1):
    accumurate[i]=accumurate[i-1]+expected[i-1]
M=0
for i in range(N-K+1):
    M=max(M,accumurate[i+K]-accumurate[i])
print(M)

Measured memory_bytes: 32660
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wijebandara
 */
public class Main {
     public static void main(String[] args) throws IOException {
        java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
        {
            int n =Integer.parseInt(in.readLine());
            StringTokenizer st;
            int data[] =new int[3];
            for (int i = 0; i < n; i++) {
                st = new StringTokenizer(in.readLine());
                for (int j = 0; j < 3; j++) {
                    data[j]=Integer.parseInt(st.nextToken());;
                }
               
                Arrays.sort(data);
                
                if((long)data[0]*data[0] + data[1]*data[1]==(long)data[2]*data[2])
                {
                    System.out.println("YES");
                }
                else
                {
                    System.out.println("NO");
                }
            }
            
            
        }
     }
}

Measured memory_bytes: 18436
#include "bits/stdc++.h"
using namespace std;



int main() {
    int a, b, c, x;
    int res = 0;
    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) {
                int v = i * 500 + j * 100 + k * 50;
                if (v == x) res++;
            }

    printf("%d\n", res);
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    X = INT()

    for i in range(8):
        if 400 + 200 * i <= X < 400 + 200 * (i + 1):
            print(8 - i)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10040
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int dp[200010][2];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n) if(s[i] == '?') s[i] = 'D';
    cout << s << endl;
//    memset(dp,-inf, sizeof(dp));
//    dp[0][0] = 0;
//    rep(i,n) {
//        if(s[i] == 'D') {
//            dp[i+1][0] = max(dp[i][0]+1,dp[i][1]+1);
//        } else if(s[i] == 'P') {
//            dp[i+1][1] = max(dp[i][0],dp[i][1]);
//        } else {
//            dp[i+1][0] = max(dp[i][0]+1,dp[i][1]+1);
//            dp[i+1][1] = max(dp[i][0],dp[i][1]);
//        }
//    }
//    cout << max(dp[n][0],dp[n][1]) << endl;
}


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


int main() {

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

  int A,B,K; cin >> A >> B >> K;

  if (abs(A-B)+1 <= K*2) {
    int cur = A;
    while (cur <= B) {
      cout << cur << endl;
      cur++;
    }
    return 0;
  }

  int curA = A;
  int countA = K;
  while (countA--) {
    cout << curA << endl;
    curA++;
  }

  int curB = B-K+1;
  int countB = K;
  while (countB--) {
    cout << curB << endl;
    curB++;
  }

  return 0;
}


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

const ll MOD = 1000000007;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<int> a(M+1);
    for (int i = 0; i < M; i++) {
        cin >> a[i];
    }
    a[M] = 0;

    ll dp[N+1]; // dp[i]=(i段目にたどり着くまでの方法)
    for (int i = 0; i <= N; i++) {
        dp[i] = 0;
    }
    dp[0] = 1; //0段目は万人に等しく一通りあるので

    int flag = 0;

    if (a[flag] == 1) {
        dp[1] = 0;
        flag ++;
    }
    else dp[1] = 1;

    //dpる！
    for (int i = 2; i <= N; i++) {
        if (i == a[flag]) {
            flag ++;
            continue;
        }
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= MOD;
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1408
A, B = map(int, input().split())
cakes = 'E'*A + 'S'*B + '0' *(16-A-B)

while 'ES' in cakes:
    cakes = cakes.replace('ES', '')
while 'E0' in cakes:
    cakes = cakes.replace('E0', '')
while 'S0' in cakes:
    cakes = cakes.replace('S0', '')

if 'EE' in cakes or 'SS' in cakes:
    print(':(')
else: print('Yay!')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin>>n;
  vector<int> a(n), b(n);
  int max1 = 0, max2 = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
    b[i] = a[i];
  }
  //max1 = max2 = a[0];
  sort(b.rbegin(), b.rend());
  max1 = b[0];
  max2 = b[1];

  for(int i=0; i<n; i++){
    if(a[i] == max1){
      cout << max2 << "\n";
    }else{
      cout << max1 << "\n";
    }
  }
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long unsigned int ll;
typedef pair<ll, ll> P;

int main(){
  const long long mod=1e9+7;
  ll n,m;
  cin >> n >> m;
  vector<ll> a(m);
  vector<ll> step(n+1);
  ll at;
  REP(i,m){
    cin >> at;
    a[i]=at;
  }
  REP(i,n+1){
    step[i]=0;
  }
  REP(i,n+1){
    if(i==0){
      step[0]=1;
    }else if(i==1){
      if(distance(a.begin(),find(all(a),i))==a.size()){
        step[1]=1;
      }else{
        step[1]=0;
      }
    }else{
      if(distance(a.begin(),find(all(a),i))==a.size()){
        if(step[i-1]+step[i-2]==0){
          cout << 0 << endl;
          return 0;
        }
        step[i]=(step[i-1]+step[i-2])%mod;
      }else{
        step[i]=0;
      }
    }
  }
  // REP(i,step.size()){
  //   cout << i << " " << step[i] << endl;
  // }
  cout << step[n] << endl;
}


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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> ans(n);
  for(int i=0;i<m*2;i++) {
    int a;
    cin >> a;
    ans[a-1]++;
  };
  for(int i=0;i<n;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,m,k,i,j,t,rx=10,ry=10,tx,ty,ta[21][21],z;
  char d,x;

  while(1){
    rx=10;
    ry=10;
    scanf("%d",&n);

    if(n==0){
      break;
    }
    for(i=0;i<21;i++){
      for(j=0;j<21;j++){
	ta[i][j]=0;
      }
    }
    for(i=0;i<n;i++){
      scanf("%d%d",&tx,&ty);
      ta[tx][ty]=1;
    }
     ta[10][10]=0;
    scanf("%d",&m);
    scanf("%c",&x);

    for(i=0;i<m;i++){
      scanf("%c %d",&d,&z);
      scanf("%c",&x);

      switch(d){
      case 'N':
	for(j=0;j<z;ry++,j++){
	  ta[rx][ry]=0;
	}
	break;
      case 'S':
	for(j=0;j<z;ry--,j++){
	  ta[rx][ry]=0;
	}
	break;
      case 'E':
	for(j=0;j<z;rx++,j++){
	  ta[rx][ry]=0;
	}
	break;
      case 'W':
	for(j=0;j<z;rx--,j++){
	  ta[rx][ry]=0;
	}
	break;
      }
      ta[rx][ry]=0;
    }

    k=0;
    for(i=0;i<21;i++){
      for(j=0;j<21;j++){
	if(ta[i][j]==1){
	  k=1;
	}
      }
    }

    if(k==0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return 0;
}

Measured memory_bytes: 584