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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b; cin >> a >> b;
    if (a + b >= 10) cout << "error\n";
    else cout << a + b << '\n';
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N =sc.nextInt();
        
      	int n[] = new int[N];
      	
      	for(int i=0; i<N; i++){//N番目に住んでいる住人
            n[i] =sc.nextInt();
      	} 
      
      	int th = 0;//住人たちの体力の総和
      	int pp[] = new int[101];
      	for(int p=1; p<=100; p++){//集会のP座標をまわす
           th = 0;
        for(int i=0; i<N; i++){//N番目に住んでいる住人
         	int h =(n[i]-p)*(n[i]-p);//住人が集会P座標に向かうのにいる体力
         	th +=h;//住人に必要な体力を足していく
          	pp[p] = th;//thにpp[p]を入れることで100個のthが用意される
      	}
        }
      	  int min = pp[1];
          for(int m=2; m<pp.length; m++){
          if(min>pp[m]){
          min = pp[m];
          }
          }
          System.out.println(min); 
    }
}

Measured memory_bytes: 21844
/* Author : Harshit Jain a.k.a. iharshit009 */
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
#define len(a)           int((a).size())
#define prec(n)          fixed<<setprecision(n)
#define cnt(n)           __builtin_popcountll(n)
#define pi               pair<int, int>
const int mod = 1000000007;
using namespace std;
using namespace std::chrono;
// const int N = 1e5 + 5; 
// int n;
// int a[N];



int32_t main(){
auto start = high_resolution_clock::now(); // starting clock
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){


int n;
cin >> n;
if(n>=400 && n <=599 ){
	cout << 8 << endl;
}

if(n>=600 && n <=799 ){
	cout << 7 << endl;
}

if(n>=800 && n <=999 ){
	cout << 6 << endl;
}

if(n>=1000 && n <=1199 ){
	cout << 5 << endl;
}

if(n>=1200 && n <=1399 ){
	cout << 4 << endl;
}

if(n>=1400 && n <=1599 ){
	cout << 3 << endl;
}

if(n>=1600 && n <=1799 ){
	cout << 2 << endl;
}

if(n>=1800 && n <=1999 ){
	cout << 1 << endl;
}







}
auto stop = high_resolution_clock::now(); // stop clock
auto duration = duration_cast<microseconds>(stop - start);  // printing duration
cerr << "Time taken by function: " << duration.count() << " milliseconds" << endl; 
return 0;
}

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

int main(){

	int n;
	scanf("%d", &n);

	double p[n];
	for (int i = 0; i < n; ++i) {
		scanf("%lf", &p[i]);
	}

	double dp[n+1][n+1];
	memset(dp, 0.0, sizeof dp);

	dp[0][0] = 0.0;
	dp[1][0] = p[0];
	dp[0][1] = 1.0 - p[0];

	for(int sum = 2; sum <= n; sum++) {
		for (int i = 0; i <= sum; ++i) {
			if(i == 0) {
				//cout << i << " " << sum-i << ": " << dp[i][sum-i-1] << "*" << (1 - p[sum-1]) << endl;
				dp[i][sum-i] = dp[i][sum-i-1]*(1 - p[sum-1]);
			}
			else if(i == sum) {
				//cout << i << " " << sum-i << ": " << dp[i-1][sum-i] << "*" << (p[sum-1]) << endl;
				dp[i][sum-i] = dp[i-1][sum-i]*(p[sum-1]);
			}
			else {
				//cout << i << " " << sum-i << ": " << dp[i][sum-i-1] << "*" << (1 - p[sum-1]) << " + " << dp[i-1][sum-i] << "*" << (p[sum-1]) << endl;
				dp[i][sum-i] = dp[i][sum-i-1]*(1 - p[sum-1]) + dp[i-1][sum-i]*(p[sum-1]);
			}
		}
	}
	
	double ans = 0.0;
	for (int i = n; i >= 0; --i) {
		if(i > n-i)ans += dp[i][n-i];
		else break;
	}

	cout << setprecision(10) << fixed << ans << endl;
	
	return 0;
}

Measured memory_bytes: 70528
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

vector<vector<ll>> Ais;
ll N, M;

bool can_leq(ll C) {
	vector<bool> forbidden(M);
	vector<ll> most_like_idx(N);
	ll forbid_cnt = 0;
	while (forbid_cnt < M) {
		vector<ll> liked_cnt(M);
		for (ll person = 0; person < N; person++) {
			while (forbidden[Ais[person][most_like_idx[person]]]) {
				most_like_idx[person]++;
			}
			liked_cnt[Ais[person][most_like_idx[person]]]++;
		}
		auto max_it = max_element(liked_cnt.begin(), liked_cnt.end());
		if (*max_it <= C) {
			return true;
		}
		forbidden[distance(liked_cnt.begin(), max_it)] = true;
		forbid_cnt++;
	}
	return false;
}

int main() {
	cin >> N >> M;
	Ais = make_vec_nd((ll)0, N, M);
	for (ll i = 0; i < N; i++) {
		for (ll j = 0; j < M; j++) {
			cin >> Ais[i][j];
			Ais[i][j]--;
		}
	}
	ll lower = 0;
	ll upper = N;
	while (upper - lower >= 2) {
		ll half = (lower + upper) / 2;
		if (can_leq(half)) {
			upper = half;
		} else {
			lower = half;
		}
	}
	cout << upper << endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define si set <ll>
#define vi vector <ll>
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define ll long long
#define sc second
#define pb push_back
#define mp make_pair
#define ff(i,a,n) for(int i=a;i<n;i++)
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ff(i,1,201)
    {
        if(i%2!=0)
            c-=b;
        else
            a-=d;
        if(a<=0||c<=0)
            break;
    }
    if(a>c)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

using namespace std;

int gcd(int a, int b){
  if(b > a){
    int c = a;
    a = b;
    b = c;
  }
  while(b != 0){
    int c = b;
    b = a%b;
    a = c;
  }
  return a;
}

int main(){
  int n;  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int fwd[100000];
  int back[100000];
  fwd[0] = a[0];
  back[n-1] = a[n-1];
  for(int i = 1; i < n-1; i++){
    fwd[i] = gcd(fwd[i-1],a[i]);
    back[n-1-i] = gcd(a[n-1-i], back[n-i]);
  }
  int maxi = 0;
  for(int i = 1; i < n-1; i++){
    int tmp = gcd(fwd[i-1],back[i+1]);
    if(maxi < tmp) maxi = tmp;
  }
  maxi = max(maxi, back[1]);
  maxi = max(maxi, fwd[n-2]);
  cout << maxi << endl;
}


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

string getRotaion(string s) {
	string tmp_s = "";
	tmp_s += s[s.size() - 1];
	for (int i = 0; i < s.size()-1; i++) {
		tmp_s += s[i];
	}
	return tmp_s;
}


int main() {

	string s, t; cin >> s >> t;
	string tmp_s = s;
	for (int i = 0; i < s.size(); i++) {
		tmp_s = getRotaion(tmp_s);
		if (tmp_s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline A abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >>s;
  int ans=0;
  int ma=0;
  for(int i=0;i<3;i++){
    if(s[i]=='R') ans++,ma=max(ma,ans);
    else ans=0;
  }
  cout <<ma<<'\n';

  return(0);
}

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

using namespace std;
const long long MOD = 2019;

int main(){
  long long l,r;cin>>l>>r;
  // l*(l+1) ~ (r-1)*r
  long long ans = 0;
  long long tmp;
  if(r-l  >= MOD || l==0){
    ans = 0;
  }else{
    for(long long i=l;i<r;++i){
      for(long long j=i+1;j<=r;++j){
        if(i==l && j==i+1) ans = ((i%MOD) * (j%MOD)) % MOD;
        else{
          tmp = ((i%MOD) * (j%MOD)) % MOD;
          if(ans > tmp) ans = tmp;
        }
      }
    }
  }


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


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

using namespace std;

int main(){
	int a[5];
	int ans = 0;
	for (int i = 0; i < 5; i++){
		scanf("%d", a + i);
		if (a[i] == 0){
			ans = i + 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3836
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = list(map(int, input().split()))
ans = sum(A)
cnt = collections.Counter(A)
#print(cnt)
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c-b)*cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    #print(cnt)
    print(ans)

Measured memory_bytes: 23388
n=int(input())
ans = 0
a = 0
b = 0
ba = 0
for i in range(n):
    s = input()
    ans += s.count('AB')
    s0 = s[0]
    s1 = s[-1]
    b += 1 if s0 == 'B' else 0
    a += 1 if s1 == 'A' else 0
    ba += 1 if s0 == 'B' and s1 == 'A' else 0

print(ans + min(a,b)-1 if (ba > 0 and ba == a and ba == b) else ans + min(a,b))


Measured memory_bytes: 44264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
#define Accepted 0
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fout(S,x)            cout<<fixed<<setprecision(x)<<(S)<<endl
#define pb push_back
#define mp make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define PI 3.141592653589793238462643383279502884197169399375105820974944
#define T() ll t;cin>>t;while(t--)
#define mem(input,b) memset(input,b,sizeof(input))
#define all(s) s.begin(),s.end()
#define lbi(input, val) (lower_bound(all(input), val) - input.begin())
#define ubi(input, val) (upper_bound(all(input), val) - input.begin())
#define ff first
#define ss second
#define pc(x) __builtin_popcount(x)
#define ln(x)                    (ll(log2(LD(x))))
#define dig(x)                   (ll(log10(LD(x)))+1)
#define ceil(input,b)                (ll(ceil(LD(input)/LD(b))))
#define etm cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n'
#define fread(input) freopen("input","r",stdin)
#define fwrite(b) freopen("b","w",stdout)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
ll MODpow(ll input,ll n,ll difference){ll res=1,y=input;while(n>0){if(n&1)res=(res*y)%difference;y=(y*y)%difference;n/=2;}return res%difference;}
template< class T > T _abs(T n) { return (n < 0 ? -n : n); }
template< class T > T _max(T input, T b) { return (!(input < b) ? input : b); }
template< class T > T _min(T input, T b) { return (input < b ? input : b); }
template< class T > T gcd(T input, T b) { return (b != 0 ? gcd<T>(b, input%b) : input); }
template< class T > T lcm(T input, T b) { return (input / gcd<T>(input, b) * b); }
inline int fi(){int n=0;int ch=getchar();while(ch<'0'||ch>'9')ch=getchar();while(ch>='0'&&ch<='9')n=(n<<3)+(n<<1)+ch-'0',ch=getchar();return n;}
inline void fo(int input){char snum[20];int iterator=0;do{snum[iterator++]=input%10+48;input=input/10;}while(input!=0);iterator=iterator-1;while(iterator>=0)putchar(snum[iterator--]);putchar('\n');}
int MOD=1e9+7, INF=1e9;
ll INFLL =1e18;
llu INFLLU=18446744073709551615ULL;
ld EPS = 1e-12;
inline int inv(int input, int p = MOD) {return MODpow(input, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline void addMOD(int& input, int val, int p = MOD) {if ((input = (input + val)) >= p) input -= p;}
inline void subMOD(int& input, int val, int p = MOD) {if ((input = (input - val)) < 0) input += p;}

int main(){
    fastio;
    ll s;
    cin >> s;
    int v = 1000000000;
    int x=(v-s%v)%v;
    int y=(s+x)/v;
    cout<<"0 0 1000000000 1 "<<x<<" "<<y<<endl;
    etm;
    return Accepted;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;


fn main() {
    let s = getline().into_bytes();

    let ev: Vec<u8> = s.clone().into_iter().enumerate().filter(|p| p.0 % 2 == 0).map(|p| p.1).collect();
    let odd: Vec<u8> = s.clone().into_iter().enumerate().filter(|p| p.0 % 2 == 1).map(|p| p.1).collect();

    let ng = ev.iter().find(|&&x| x == b'L').is_some()
        || odd.iter().find(|&&x| x == b'R').is_some();
    println!("{}", if ng {"No"} else {"Yes"});
}

#[allow(dead_code)]
fn getline() -> String {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().to_string()
}

#[allow(dead_code)]
fn read<T>() -> T where T : FromStr {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn reads<T>() -> Vec<T> where T : FromStr {
    let mut ln = String::new();
    io::stdin().read_line(&mut ln).ok();
    ln.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn printv<T>(xs: &[T]) where T : std::fmt::Display {
    xs.iter().fold("", |s, x| {
        print!("{}{}", s, x);
        " "
    });
    println!();
}


Measured memory_bytes: 4352
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  int n, p;cin>>n>>p;
  string s;cin>>s;
  reverse(s.begin(), s.end());
  ll ans=0LL;
  if(p==2){
    rep(i, n){
      if(int(s[i]-'0')%2==0){
        ans+=ll(n-i);
      }
    }
  }else if(p==5){
    rep(i, n){
      if(int(s[i]-'0')%5==0){
        ans+=ll(n-i);
      }
    }
  }else{
    int digit=1;
    vector<int> surplus(n);
    rep(i, n){
      surplus[i]=(int(s[i]-'0')*digit)%p;
      digit=(digit*10)%p;
    }
    rep(i, n-1){
      surplus[i+1]+=surplus[i];
      surplus[i+1]%=p;
    }
    map<int, ll> cnt;
    rep(i, n){
      cnt[surplus[i]]++;
    }
    for(auto itr=cnt.begin();itr!=cnt.end();itr++){
      if(itr->first==0){
        ans += itr->second*(itr->second+1)/2;
      }else{
        ans += itr->second*(itr->second-1)/2;
      }
    }
  }
  cout<<ans<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


Measured memory_bytes: 1796
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll a;
    cin >> a;
    putout(a + a * a + a * a * a);
    return 0;
}


Measured memory_bytes: 3608
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = list(map(int,input().split()))
    INF = -10**15
    
    dp = [[[INF,INF],[False,False]] for _ in range(N)]
    dp[0][0][0],dp[0][0][1],dp[0][1][1] = 0,a[0],True
    dp[1][0][0] = 0
    if a[0] < a[1]:
        dp[1][0][1],dp[1][1][1] = a[1],True
    else:
        dp[1][0][1] = a[0]
    
    for i in range(2,N):
        if i%2 != 0:
            dp[i][0][0] = dp[i-1][0][0]
            if dp[i][0][0] < dp[i-2][0][0]+a[i]:
                dp[i][0][0] = dp[i-2][0][0]+a[i]
                dp[i][1][0] = True
            dp[i][0][1] = dp[i-1][0][1]
            if dp[i-1][1][0] == False:
                if dp[i][0][1] < dp[i-1][0][0]+a[i]:
                    dp[i][0][1] = dp[i-1][0][0]+a[i]
                    dp[i][1][1] = True
            if dp[i][0][1] < dp[i-2][0][1]+a[i]:
                dp[i][0][1] = dp[i-2][0][1]+a[i]
                dp[i][1][1] = True
        else:
            dp[i][0][0] = dp[i-1][0][1]
            if dp[i-1][1][0] == False:
                if dp[i][0][0] < dp[i-1][0][0]+a[i]:
                    dp[i][0][0] = dp[i-1][0][0]+a[i]
                    dp[i][1][0] = True
            if dp[i][0][0] < dp[i-2][0][0]+a[i]:
                dp[i][0][0] = dp[i-2][0][0]+a[i]
                dp[i][1][0] = True
            dp[i][0][1] = dp[i-2][0][1]+a[i]
            if dp[i-1][1][1] == False:
                if dp[i][0][1] < dp[i-1][0][1]+a[i]:
                    dp[i][0][1] = dp[i-1][0][1]+a[i]
            dp[i][1][1] = True
    
    if N%2 == 0:
        print(dp[-1][0][1])
    else:
        print(dp[-1][0][0])
 
if __name__ == "__main__":
    main()


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

int main(){

  int i, n;
  int a[100];

  cin >> n;
  for(i = 0; i < n; i++)
    cin >> a[i];

  for(i = n-1; i >= 0; i--){
    if( i != n - 1 )
      cout <<" ";
    cout << a[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 3076
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string str;
	int i = 0;


	getline(cin, str);

	while (true) {

		if (str[i] == '\0') {
			printf("\n");
			break;
		}

		if ('a' <= str[i] && str[i] <= 'z')
			printf("%c", str[i] + 'A' - 'a');
		else if ('A' <= str[i] && str[i] <= 'Z')
			printf("%c", str[i] + 'a' - 'A');
		else 
			printf("%c", str[i]);

		i++;

	}

	return 0;
}


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

long long N;
long long ans[505];


int check(long long p1, long long p2){
	int i = 1;
	while(p1>0 || p2>0){
		if((p1&1) != (p2&1)){
			return i;
		}
		p1 = (p1>>1);
		p2 = (p2>>1);
		i++;
	}
	exit(1);
}


int main(){
	cin >> N;

	for(long long i = 0; i < N; i++){
		for(long long j = i + 1; j < N; j++){
			cout << check(i, j);
			if(j != N-1){
				cout << " ";
			}else{
				cout << endl;
			}
		}
	}
}

Measured memory_bytes: 512
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long

int main(){
  char s[6];
  scanf("%s",s);
  if(s[2]==s[3] && s[4]==s[5]){
    printf("Yes");
    return 0;
  }
  else{
    printf("No");
    return 0;
  }
}

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

int main(void){
	int n,m;
  	bool check=true;
  	cin >> n >> m;
  	int a=1,b=0,c=0;
  	bool ach=true,bch=true,cch=true;
  	if(n==2)a=0,b=1,c=0;
  	if(n==1)a=0,b=0,c=0;
  	for(int i=0;i<m;i++){
    	int cs,bs;
      	cin >> cs >> bs;
      	int x=0;
      	if(cs>n)check = false;
      	if(cs==1 && bs==0 &&n>1)check = false;
        
        if(n==3 && cs == 1 &&a==bs)continue;
        if(n==3 && cs == 2 &&b==bs)continue;
        if(n==3 && cs == 3 &&c==bs)continue;
      	if(n==2 && cs == 1 &&b==bs)continue;
        if(n==2 && cs == 2 &&c==bs)continue;
        if(n==1 && cs == 1 &&c==bs)continue;
      
      	if(n==3 && cs == 1 &&ach==true){a=bs;ach = false;x++;}
        if(n==3 && cs == 2 &&bch==true){b=bs;bch = false;x++;}
        if(n==3 && cs == 3 &&cch==true){c=bs;cch = false;x++;}
      	if(n==2 && cs == 1 &&bch==true){b=bs;bch = false;x++;}
        if(n==2 && cs == 2 &&cch==true){c=bs;cch = false;x++;}
        if(n==1 && cs == 1 &&cch==true){c=bs;cch = false;x++;}
      	if(x==0)check=false;
    }
  	if(check){
    	cout << 100*a+10*b+c <<endl;
    }else{
    	cout << -1 <<endl;
    }
	return 0;
}



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

int main(void)
{
    int K, X;
    cin >> K >> X;

    if (K * 500 >= X)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << 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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll h,w;cin>>h>>w;
  char s[h+1][w+1];rep(i,1,h+1)rep(j,1,w+1)cin>>s[i][j];

  ll ans[h+2][w+2];
  rep(i,0,h+1)rep(j,0,w+1)ans[i][j]=m;
  ans[1][1]=(s[1][1]=='#');

  rep(i,1,h+1){
    rep(j,1,w+1){
      chmin(ans[i+1][j],ans[i][j]+(s[i][j]=='.'&&s[i+1][j]=='#'));
      chmin(ans[i][j+1],ans[i][j]+(s[i][j]=='.'&&s[i][j+1]=='#'));
    }
  }

  out(ans[h][w]);


  // rep(i,1,h+1){
  //   rep(j,1,w+1)cout<<ans[i][j];
  //   cout<<endl;
  // }




  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
vector<int> et[200000];
int dist[200001];

void dfs(int p, int v, int dep) {
	dist[v] = dep;
	int i;
	rep(i, et[v].size()) {
		int nv = et[v][i];
		if (nv == p) continue;
		dfs(v, nv, dep + 1);
	}
}

signed main() {
	int i;
	
	cin >> n;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b; a--; b--;
		et[a].push_back(b);
		et[b].push_back(a);
	}
	
	dfs(-1, 0, 0);
	
	int rt = 0;
	rep(i, n) {
		if (dist[i] > dist[rt]) {
			dist[rt] = dist[i];
			rt = i;
		}
	}
	
	dfs(-1, rt, 0);
	int mDist = 0;
	rep(i, n) mDist = max(mDist, dist[i]);
	int tyoten = mDist + 1;
	
	if (tyoten == 0 || tyoten % 3 == 2) { cout << "Second" << endl; }
	else { cout << "First" << endl; }
	return 0;
}

Measured memory_bytes: 24448
#include <iostream> 
using namespace std;
void output(int i){
	cout << " " << i;
}
bool include3(int n){
	while(n){
		if (n % 10 == 3){
			return true;
		}
		n /= 10;
	}
	return false;
}
void call(int n){
	for(int i = 1; i <= n; i++){
		if(include3(i)){
			output(i);
		}else if(i % 3 == 0){
			output(i);
		}
	}
	cout << endl;
}

int main(int argc,char *argv[]){
	int n;
	cin >> n;
	call(n);
	return 0;
}

Measured memory_bytes: 3084
#include <stdio.h>
void triangle(int a,int b,int c);
int main(void){
    int n,a,b,c,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d",&a,&b,&c);
        if(a<=c&&b<=c) triangle(a,b,c);
        else if(a<=b&&c<=b) triangle(a,c,b);
        else if(b<=a&&c<=a) triangle(c,b,a);
    }
    return 0;
}
void triangle(int a,int b,int c){
    if(c*c==a*a+b*b) printf("YES\n");
    else printf("NO\n");
}


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

using namespace std;

#define ll long long

int main(){
	char S[6];
	string saida;
	cin >> S;
	saida = (S[2]==S[3] && S[4]==S[5]) ? "Yes" : "No";
	cout << saida << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

struct dice{
	int q1,q2,q3,q4,q5,q6;
};

void mN(dice &d){
	int tmp=d.q1;
	d.q1=d.q2;
	d.q2=d.q6;
	d.q6=d.q5;
	d.q5=tmp;
}

void mE(dice &d){
	int tmp=d.q1;
	d.q1=d.q4;
	d.q4=d.q6;
	d.q6=d.q3;
	d.q3=tmp;
}
void mW(dice &d){
	int tmp=d.q1;
	d.q1=d.q3;
	d.q3=d.q6;
	d.q6=d.q4;
	d.q4=tmp;
}
void mS(dice &d){
	int tmp=d.q1;
	d.q1=d.q5;
	d.q5=d.q6;
	d.q6=d.q2;
	d.q2=tmp;
}

void spin(dice &d){
	int tmp=d.q2;
	d.q2=d.q3;
	d.q3=d.q5;
	d.q5=d.q4;
	d.q4=tmp;
}

int main(){
	dice z;
	int q;
	
	scanf(" %d %d %d %d %d %d", &z.q1, &z.q2, &z.q3, &z.q4, &z.q5, &z.q6);
	scanf(" %d", &q);
	
	for(int i=0; i<q; ++i){
		int a, b;
		dice x=z;
		
		scanf(" %d %d", &a, &b);
		
		if(a==x.q3 || a==x.q4) mE(x);
		while(a != x.q1) 
			mN(x);
		while(b != x.q2)
			spin(x);
		
		printf("%d\n", x.q3);	
	}
	
	return 0;
}

Measured memory_bytes: 1188
N = int(input())
S = input()

lset = [0]
for c in S:
    lset.append(lset[-1] | (1<<int(c)))

rset = [0]
for c in S[::-1]:
    rset.append(rset[-1] | (1<<int(c)))
rset.reverse()

ptns = [set() for i in range(10)]
for i,c in enumerate(S):
    for j in range(10):
        if lset[i] & (1<<j) == 0: continue
        for k in range(10):
            if rset[i+1] & (1<<k) == 0: continue
            ptns[int(c)].add(j*10 + k)

print(sum(len(p) for p in ptns))

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

int main() {

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

  int ans=0;

  for(int i=A; i<=B; i++){
      string S;
      S=to_string(i);
      if(S[0]==S[4] && S[1]==S[3]){
          ans++;
      }
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define DOW(i,b,a) for (int i = (b); i >= (a); i--)
#define pb(a) push_back(a)
#define ALL(a) (a).begin(),(a).end()
#define fi first
#define se second

template<typename T>
void print_array(T* arr, int num) {
   FOR(i, 0, num) cout << arr[i] << ' ';
   cout << endl;
}

template<typename T> 
void print_vector(vector<T> vec) {
   FOR(i,0,vec.size()) cout << vec[i] << ' ';
   cout << endl;
}

int n,x;
deque<int> de;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    //freopen("test.txt", "r", stdin);
    cin >> n;
    FOR(i,0,n) {
    	cin >> x;
    	if (i % 2) de.push_front(x);
    	else de.push_back(x);
    }
    if (n % 2 == 0) {
    	while (!de.empty()) {
    		int a = de.front();
    		cout << a << " ";
    		de.pop_front();
    	} 
    } else {
		while (!de.empty()) {
			int a = de.back();
			cout << a << " ";
			de.pop_back();
    	}
    }
}

Measured memory_bytes: 3072
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <memory>

//#define int long long

using namespace std;

void Main()
{
	int a, b, c;
	cin >> a >> b >> c;

	if (a == b && a != c) {
		cout << "Yes" << endl;
		return;
	}
	if (a == c && a != b) {
		cout << "Yes" << endl;
		return;
	}
	if (b == c && a != b) {
		cout << "Yes" << endl;
		return;
	}

	cout << "No" << endl;
}

int32_t main()
{
	Main();
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
void p(string s){
  cout << s <<endl;
}
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while(1){
    int a, b, c ;
    cin >> a >> b >> c;
    if(a == -1 && b == -1 && c == -1) break;
    if(a == -1 || b == -1) p("F");
    else if(a + b >= 80) p("A");
    else if(a + b >= 65) p("B");
    else if(a + b >= 50) p("C");
    else if(a + b < 30) p("F");
    else{
      if(c >= 50) p("C");
      else p("D");
    }
  }




  return 0;
}



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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    //string c;
    char c;
    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
    return 0;
}

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

string str[3];
int main(){
	for(int i = 0;i < 3;i++)cin >> str[i];
	for(int i = 0;i < 3;i++){
		printf("%c", 'A'+(str[i][0]-'a'));
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define maxn 1000006
using namespace std;
int c[maxn], b[maxn];
int read(){
    int cnt = 0;
    char ch = getchar();
    while (ch < '0' || '9' < ch)
        ch = getchar();
    while ('0' <= ch && ch <= '9'){
        cnt = cnt * 10 + ch - '0';
        ch = getchar();
    }
    return cnt;
}
int main(){
    int n = read(), m = read();
    for (int i = 1; i <= n; ++ i)
        c[i] = 1;
    b[1] = 1;
    for (int i = 1; i <= m; ++ i){
        int x = read(), y = read();
        if (b[x]){
            if (c[x] == 1)
                b[x] = 0;
            b[y] = 1;
        }
        -- c[x], ++ c[y];
    }
    int ans = 0;
    for (int i = 1; i <= n; ++ i)
        ans += b[i];
    cout << ans << endl;
}


Measured memory_bytes: 4736
H = int(input())
heap = list(map(int, input().split()))
for i, h in enumerate(heap):
    index = i + 1
    print("node {}: key = {}, ".format(index, h), end='')
    if index // 2:
        print("parent key = {}, ".format(heap[index // 2 - 1]), end='')
    if index*2 <= H:
        print("left key = {}, ".format(heap[index*2 - 1]), end='')
    if index*2 < H:
        print("right key = {}, ".format(heap[index*2]), end='')
    print()

Measured memory_bytes: 7636
#include <iostream>
#include <cstring>
#include <algorithm>
#define INF (2 << 28)
using namespace std;

int main(){
    
    int d, n, dp[111][111];
    int a[111], e[111], r[111];
    
    while(cin >> d >> n, d||n){
        for(int i = 0; i < n; i++) cin >> a[i] >> e[i] >> r[i];
        fill_n(*dp, 111*111, INF);
        dp[d][0] = 0;
        for(int i = d; i >= 0; i--){
            for(int j = 0; j <= 100; j++){
                for(int k = 0; k < n; k++){
                    if(r[k] <= j)
                       dp[max(0, i - a[k])][min(100, j + e[k])]  = min(dp[max(0, i - a[k])][min(100, j + e[k])], dp[i][j]  + 1);
                }
            }
        }
        int res = *min_element(dp[0], dp[0] + 101);
        if(res == INF) cout << "NA" << endl;
        else cout << res << endl;
    }
}

Measured memory_bytes: 1212
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <deque>
#include <cmath>

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin>>s;
int n=s.size();
if(s[n-1]=='s'){
    s=s+"es";
}
else{
    s=s+"s";
}
cout<<s<<endl;
return 0;
}

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

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	
	vector<long long> a(n + 1, 0);
	vector<long long> b(m + 1, 0);
	for(int i = 1; i <  n + 1; i++){
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 1; i < m + 1; i++){
		cin >> b[i];
		b[i] += b[i - 1];
	}
	int ans = 0;
	int j = m;
	for(int i = 0; i < n + 1; i++){
		if(a[i] > k)
			break;
		while(b[j] > k - a[i]){
			j--;
		}
		ans = max(ans, i + j);
	}
	cout << ans; 
	return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
#define int long long 
signed main(void){
    int N;
    long long Ans=1;
    long long MOD = 1000000007;
    int A[114514];
    int ho[114514]={};
    cin >> N;
    REP(i,N){cin >> A[i];ho[A[i]]++;}
    if(N%2==1){
        REP(i,N){
            if((i%2==1&&ho[i]!=0) || (i==0&&ho[i]!=1) || (i!=0&&(i%2==0)&&(ho[i]!=2))){
                cout << 0 << endl;
                return 0;
            }
        }
    }else{
        REP(i,N){
            if((i%2==0&&ho[i]!=0) || ((i%2==1)&&(ho[i]!=2))){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    REP(i,N/2){
        Ans=(Ans*2)%MOD;
    }
    cout << Ans <<endl;
    return 0;
}

Measured memory_bytes: 1920
import math
n, m = map(int, input().split())
temp = []
a = []
for i in range(n):
    temp = []
    temp = input().split()
    a.append(temp)
ans = 0
for i in range(n):
    for j in range(i+1, n):
        res = 0
        for k in range(m):
            res += abs(int(a[j][k]) - int(a[i][k]))*abs(int(a[j][k]) - int(a[i][k]))
        res2 = math.sqrt(res)
        if int(res2) == res2:
            ans += 1
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, q, a[N], vec[N], cnt[N], pos[N];
set<int> st;
int main() {
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 1; i <= q; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= m; i++) st.insert(i);
	int tmp = 0;
	for (int i = q; i >= 1; i--) {
		if (st.count(a[i])) {
			vec[++tmp] = a[i];
			st.erase(a[i]);
		}
	}
	while (st.size()) {
		vec[++tmp] = *st.begin();
		st.erase(st.begin());
	}
	for (int i = 1; i <= m; i++) pos[vec[i]] = i;
	for (int i = q; i >= 1; i--) {
		int p = pos[a[i]];
		cnt[p] = min(cnt[p] + 1, n);
		if (p > 1 && cnt[p - 1] < cnt[p]) {
			if (!cnt[p - 1]) {
				puts("No");
				return 0;
			}
			cnt[p] = cnt[p - 1];
		}
	}
	int st;
	for (st = m; st > 1 && vec[st - 1] < vec[st]; st--);
	for (int i = 1; i < st; i++) {
		if (cnt[i] < n) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 9896
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

int main(void) {
    string s;
    cin >> s;
    int N = s.size();
    string goal_a(N, '0');
    string goal_b(N, '0');
    for(int i = 0; i < N; i++) {
	if(i % 2 == 1) {
	    goal_a[i] = '1';
	    goal_b[i] = '0';
	} else {
	    goal_a[i] = '0';
	    goal_b[i] = '1';
	}
    }
    int count_a = 0;
    int count_b = 0;
    for(int i = 0; i < N; i++) {
	if(s[i] == goal_a[i]) {
	    count_b++;
	} else {
	    count_a++;
	}
    }
    cout << min(count_a, count_b) << endl;
    return 0;
}


Measured memory_bytes: 512
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

  k -= 400;
  int ans = 8 - k/200;
  cout << ans << endl;
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }

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

  const int M = N.size();
  vector<vector<vector<ll>>> dp(M + 1,
                                vector<vector<ll>>(K + 2, vector<ll>(2, 0)));
  dp[0][0][0] = 1;

  for (int i = 0; i < (int)M; ++i) for (int j = 0; j < (int)K + 1; ++j) {
    dp[i + 1][j + (N[i] != '0')][0] += dp[i][j][0];
    if (N[i] != '0') dp[i + 1][j][1] += dp[i][j][0];
    dp[i + 1][j + 1][1] += (N[i] - '0' - (N[i] >= '1')) * dp[i][j][0];
    dp[i + 1][j][1] += dp[i][j][1];
    dp[i + 1][j + 1][1] += 9 * dp[i][j][1];
  }

  cout << dp[M][K][0] + dp[M][K][1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
void func(int,int);
int n[4],s[3],s2[3];
int main(void)
{
	int i;
	char a[5],ss[3]="-+";
	scanf("%s",a);
	for(i=3;i>=0;i--) n[i]=a[i]-'0';
	//for(i=0;i<4;i++) printf("%d\n",n[i]);
	func(0,n[0]);
	for(i=0;i<3;i++){
		printf("%d%c",n[i],ss[s2[i]]);
	}
	printf("%d=7\n",n[3]);
	return 0;
}
void func(int nn,int sum)
{
	int i;
	if(nn==3){
		if(sum==7){
			for(i=0;i<3;i++) s2[i]=s[i];
		}	
	}
	else{
		s[nn]=0;
		func(nn+1,sum-n[nn+1]);
		s[nn]=1;
		func(nn+1,sum+n[nn+1]);
	}
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<vector>
#define pa pair<int,int>
 
using namespace std;

const int MAXN=1000010;
int dis[MAXN];
vector <pa> g[MAXN];
vector <int> new_g[MAXN],all[MAXN];
int visit[MAXN],ptr[MAXN];
queue <int> q;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		int u,v,c;
		scanf("%d%d%d",&u,&v,&c);
		u--,v--;
		g[u].push_back(make_pair(c,v));
		g[v].push_back(make_pair(c,u));
		all[c].push_back(u);
		all[c].push_back(v);
	}
	for (int i=0;i<n;i++)
	{
		sort(g[i].begin(),g[i].end());
		visit[i]=-1;
	}
	int newn=n;
	for (int i=0;i<MAXN;i++)
	{
		if (all[i].empty())
		{
			continue;
		}
		for (int it=0;it<all[i].size();it++)
		{
			int v=all[i][it];
			if (visit[v]==i)
			{
				continue;
			}
			q.push(v);
			visit[v]=i;
			while (!q.empty())
			{
				int x=q.front();
				q.pop();
				while (ptr[x]<(int)g[x].size())
				{
					int c=g[x][ptr[x]].first;
					if (c!=i)
					{
						break;
					}
					int u=g[x][ptr[x]].second;
					if (visit[u]!=i)
					{
						visit[u]=i;
						q.push(u);
					}
					ptr[x]++;
				}
				new_g[x].push_back(newn);
				new_g[newn].push_back(x);	
			}
			newn++;
		}
	}
	for (int i=0;i<newn;i++)
	{
		dis[i]=-2;
	}
	q.push(0);
	dis[0]=0;
	while (!q.empty())
	{
		int x=q.front();
		q.pop();
		for (int i=0;i<new_g[x].size();i++)
		{
			int u=new_g[x][i];
			if (dis[u]==-2)
			{
				dis[u]=dis[x]+1;
				q.push(u);	
			}
		}
	}
	cout<<dis[n-1]/2;
    return 0;
}


Measured memory_bytes: 100096
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
///////////////////////////////////////
int N, Q, K;
vector<pair<int,ll>>G[100100];
ll d[100100];
vector<bool>visited(100100, false);
void dfs(int a,ll c) {
	d[a] = c;
	visited[a] = true;
	for (auto i : G[a]) {
		if (!visited[i.first]) {
			dfs(i.first, c + i.second);
		}
	}
}
int main() {
	cin >> N;
	for (int i = 0; i < N-1; ++i) {
		int a, b; ll c;
		cin >> a >> b >> c;
		a--, b--;
		G[a].push_back({ b,c });
		G[b].push_back({ a,c });
	}
	cin >> Q >> K;
	K--;
	dfs(K, 0);
	for (int i = 0; i < Q; ++i) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		cout << d[x]+d[y] << endl;
	}
	return 0;
}


Measured memory_bytes: 14336
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

int main() {
	int A[20], B[20], C[20];
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N - 1; i++) cin >> C[i];
	int ans = 0;
	for (int i = 0; i < N; i++) ans += B[i];
	for (int i = 0; i + 1 < N; i++) {
		if (A[i] + 1 == A[i + 1]) ans += C[A[i] - 1];
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
const int N=102,M=10010,mod=998244353;
int n,m,T,k,h,w,cnt,x,y,z,indx,t,ans,a[N][N],r[N],c[N],b[N][N];
string s;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=n;i++)
	{
		cin>>s;
		for (int j=0;j<m;j++)
			if (s[j]=='#') a[i][j+1]=1;
	}
	for (int i=0;i<(1<<n);i++)
		for (int j=0;j<(1<<m);j++)
		{
			int cnt1=0,cnt2=0;
			x=i; y=j;
			for (int ii=1;ii<=6;ii++) r[ii]=c[ii]=0;
			for (;x;x/=2) r[++cnt1]=x%2;
			for (;y;y/=2) c[++cnt2]=y%2;
			int sum=0;
			
			for (int ii=1;ii<=n;ii++)
				for (int jj=1;jj<=m;jj++) b[ii][jj]=a[ii][jj];
				
			for (int ii=1;ii<=n;ii++) 
				for (int jj=1;jj<=m;jj++) if (r[ii]||c[jj]) b[ii][jj]=0;
				
			for (int ii=1;ii<=n;ii++)
			{
				for (int jj=1;jj<=m;jj++)
				{
					if (b[ii][jj]) sum++;
				}
			}
			if (sum==k) ans++;
		}
	printf("%d\n",ans);
}

Measured memory_bytes: 3760
N = int(input())
S = str(input())
S = S.split()
S_list = list(S)
count = 0

for i in range(len(S_list)):
    S_list[i] = int(S_list[i])

while S_list.count(0) == 0:
    S_list = list(map(lambda x: x - 1, S_list))
    count = count + 1
    
# index_num = [n for n, v in enumerate(S_list) if v == 0]   
# =============================================================================
# print(count)
# print(S_list)
# =============================================================================

   
switch = []
for i in range(len(S_list)):
    if S_list[i] == 0:
        switch.append(0)
    else:
        switch.append(1)
        
while switch.count(1) != 0:  
    for i in range(len(S_list)):
        if i == 0:
            pass
        else:
            if switch[i-1] == 0 and switch[i] == 1:
                count = count +1
            else:
                pass
        if switch[i] == 1:
            S_list[i] = S_list[i] - 1
    if switch[0] == 1:
        count = count +1
        
    switch = []
    for i in range(len(S_list)):
        if S_list[i] == 0:
            switch.append(0)
        else:
            switch.append(1)
        
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long int
#define N 100000
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
        * @author :: Sawlani
        *
        */
int main()
{
     ll n;
     cin >>  n;

    ll a[n+1];

    map <ll,ll> mp;
    map <ll,ll> xp;
     f(i,1,n)
     {
         cin >> a[i];
         mp[a[i]]++;
         xp[a[i]]++;
     }

     ll ans=0;
    
     for(auto i:mp)
     {
         mp[i.first] = (mp[i.first]*(mp[i.first]-1))/2; 
         
         
         ans+=mp[i.first];
     }
        // debug(ans);
     ll res;
     f(i,1,n)
     {
         res=ans;
         res-=mp[a[i]];
         ll j=xp[a[i]]-1;
         res+=(j*(j-1))/2;

         cout << res << endl;

     }


      
}

Measured memory_bytes: 20864
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), std::greater<char>());
    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3592
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N, K; cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; i++) cin >> H[i];

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

    if (K >= N) {
        cout << 0 << endl;
        return;
    }

    long long ans = 0;
    for (int i = 0; i < N - K; i++) {
        ans += H[i];
    }

    cout << ans << endl;


}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 1024
def main():
  
  n,k=map(int,input().split())
  ans=[]
  for i in range(1,n+1):
    count=0
    while(i<k):
      i=i*2
      count+=1
    ans+=[1/2**count]
  
  s=sum(ans)/n
  print(s)
  
if __name__=="__main__":
  main()

Measured memory_bytes: 6296
#include<bits/stdc++.h>
using namespace std;
long long int res[100001],i,j,a,b,n,x;
int main(){
	cin>>n>>x;
	for(i=0;i<n;i++){
		scanf("%lld%lld",&a,&b);
		for(j=x-a;j>=0;j--)
		res[j+a]=max(res[j+a],res[j]+b);
	}
	cout<<res[x];
}

Measured memory_bytes: 1024