akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<ll, ll>;
template<class T> inline bool chmax(T& a, T b) {if (a < b){a = b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b) {if (a > b){a = b;return 1;}return 0;}
const long long LLINF = 1LL << 60;
using namespace std;

ll dp[1010101];

int main()
{
    int N;
    cin >> N;
    fill(dp, dp+N+1, LLINF);
    dp[0] = 0;
    for (int i=1; i<=N; ++i)
    {
        dp[i] = min(dp[i], dp[i-1] + 1);
        ll b = 6;
        for (;i-b>=0;)
        {
            dp[i] = min(dp[i], dp[i-b] + 1);
            b *= 6;
        }
        b = 9;
        for (;i-b>=0;)
        {
            dp[i] = min(dp[i], dp[i-b] + 1);
            b *= 9;
        }
    }
    cout << dp[N] << endl;
}


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

using namespace std;
#define ll  long long
#define ld  long double

#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN=1e5 + 5;
int main()
{
    FAST
int arr[3];
cin>>arr[0]>>arr[1]>>arr[2];
sort(arr,arr+3);
cout<<(arr[1]-arr[0])+(arr[2]-arr[1])<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << '\n'
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    bool flag = false;
    for (int i = 1; i < 10; i++) {
        for (int k = 1; k < 10; k++) {
            if (i * k == n) {
                flag = true;
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
package main

import (
    "fmt"
    "sort"
)

func main() {
    var a, b, c, d, e, k int

    fmt.Scan(&a, &b, &c, &d, &e, &k)

    var towers = []int{a, b, c, d, e}

    sort.Ints(towers)

    if towers[4] - towers[0] > k {
        fmt.Println(":(")
    } else {
        fmt.Println("Yay!")
    }
}


Measured memory_bytes: 512
import math
 
x = int(input())
i = x
def prime(i):
    for j in range(2,math.ceil(math.sqrt(i))):
        if i%j == 0:
            return False
    return True

while True:
    if prime(i):
        print(i)
        break
    else:
        i += 1
  
  

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
vector<pair<ll,ll>> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}

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 MAX_N 110
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}

ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    
    return p;
}

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

int main(){
    ll n,count=0;
    cin >> n;
    string s=to_string(n);
    
    for (ll i=0;i<s.size();i++){
        count+=s[i]-'0';
    }
    if (n%count==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

ll n, m; 
vector<pair<ll, ll> > edg[1002];
ll d[1002];

int con[1002];

int check(int pos) {
	if (pos == n - 1) return 1;
	if (con[pos] == -1) return 2;
	if (con[pos] == 1) return 1;

	con[pos] = -1;
	int ret = 2;
	for (auto p : edg[pos]) {
		ll to = p.first;
		ret = check(to) == 1 ? 1 : ret;
	}
	con[pos] = ret;
	return ret;
}

int main() {
	cin >> n >> m;
	for (ll i = 0; i < m; i++) {
		ll a, b, c; cin >> a >> b >> c;
		a--; b--;
		edg[a].push_back({b, -c});
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (con[i] != 0) continue;
		check(i);
	}

	for (int i = 0; i < n; i++) d[i] = 1e18;
	d[0] = 0;
	for (int i = 0; i < 2*n; i++) {
		for (int j = 0; j < n; j++) {
			for (auto p : edg[j]) {
				ll to = p.first, c = p.second;
				if (d[to] > d[j] + c) {
					d[to] = d[j] + c;
					if (i >= n - 1 && con[to] == 1) {
						cout << "inf" << endl;
						return 0;
					}
				}
			}
		}
	}	
	cout << -d[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 384
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let n:i32 = procon_read()[0];
	let t:Vec<i32> = procon_read();
	let mut sum:i32 = 0;
	let m:i32 = procon_read()[0];
	let mut p:Vec<i32> = Vec::new();
	let mut x:Vec<i32> = Vec::new();
	for i in 0..m {
		let v:Vec<i32> = procon_read();
		p.push(v[0]);
		x.push(v[1]);
	}
	for i in &t {
		sum += *i;
	}
	for i in 0..p.len() {
		println!("{}", sum - t[(p[i] - 1) as usize] + x[i as usize]);
	}
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
// Useful constants
#define INF  (int)1e9
#define EPS   1e-9
#define MOD 1000000007ll
#define PI 3.14159
// for input-output
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
// iteration macros: have advantage of auto-casting and not recomputing arguments
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
// input macro
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
//output macro
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
// shortcut for data type
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
//--namespace
using namespace std;
//--useful function
ll gcd(ll a, ll b){ll temp;while (b > 0){temp = a%b;a = b;b = temp;} return a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
// --clock funtion
clock_t time_p=clock();
void TimeTaken()
{
    time_p=clock()-time_p;
    cerr<<"Completion time : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
// --solve function
void solve() {

}
//--main function
int main(){
	int a=-1,b=-1;
	string s;cin>>s;
	REP(i,0,s.length()-1){
		if(s[i]=='A')
		{
			a=i;
			break;
		}
	}
	REP(i,a,s.length()-1){
		if(s[i]=='Z'){
			b=i;
		}
	}
	cout<<b-a+1;
	return 0;

//   TimeTaken();
}


Measured memory_bytes: 3772
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

ll max(ll a, ll b) {
	if (a < b) {
		return b;
	}
	else
		return a;

}

ll min(ll a, ll b) {
	if (a < b)
		return a;

	return b;
}




pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

vector<pint> list;










void floyd(int N, ll** d) {

	rep(k, N+1){
		rep(i, N+1) {
			if (d[i+1][k+1] == inf) continue;
			rep(j, N+1) {
				if (d[j+1][k+1] == inf) continue;

				d[i+1][j+1] = min(d[i+1][j+1], d[i+1][k+1] + d[j+1][k+1]);

			}

		}
	}




}


ll vis[100005];
ll d[100005];
vector<ll> M[100005];
vector<ll> anslist;


stack<int> to_1;

ll col[100005];

void dfs(ll K, ll dist) {

	
	d[K] = dist;
	vis[K] = 1;

		
	for (int i = 0; i < M[K].size(); i++) {
		if (vis[M[K][i]] == 0) {
			
			dfs(M[K][i], dist + 1);
			
		}
	}

}



vector<unsigned long long> v;






vector<pint> e[105];
ll dist[105][105];
ll keiyu[105][105];

int main() {
	ll N, M;
	ll a, b, c;
	cin >> N >> M;



	rep(i, N+1)
		rep(j, N+1)
		dist[i][j] = ((i == j) ? 0 : inf);


	rep(i, M) {
		cin >> a >> b >> c;
		e[a].push_back({ b, c });
		e[b].push_back({ a, c });
		dist[a][b] = c;
		dist[b][a] = c;
	}

		
	


	rep(k, N) {
		rep(i, N) {
			if (dist[i + 1][k + 1] == inf) continue;
			rep(j, N) {
				if (dist[j + 1][k + 1] == inf) continue;

				dist[i + 1][j + 1] = min(dist[i + 1][j + 1], dist[i + 1][k + 1] + dist[j + 1][k + 1]);

			}

		}
	}

	

	for(int i = 1; i <= N; i++)
		for (int j = 0; j < e[i].size(); j++) {
			for (int k = 1; k <= N; k++) {
				if (dist[i][k] == e[i][j].second + dist[e[i][j].first][k])
					keiyu[i][e[i][j].first] = 1;

			}

		}

	
	ll sum_e = 0;

	rep(i, N + 1)
		rep(j, N + 1)
		sum_e += keiyu[i][j];


	cout << M - (sum_e / 2) << endl;
	
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int v[MAXN];
char s[MAXN];
int main(){
    string a;
    cin>>a;
    if(a=="ABC")cout<<"ARC";
    else cout<<"ABC";
}

Measured memory_bytes: 3016
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[110][1100];
char buf[1100];
char in[10];
int main(){
	int n=0;
	while(1){
		gets(str[n]);
		if(str[n][3]=='_')break;
		n++;
	}
	for(int i=0;i<1100;i++)str[n][i]=0;
	int row=0;
	int col=0;
	while(1){
		scanf("%s",in);
		if(in[0]=='-')break;
		if(in[0]=='a')col=0;
		if(in[0]=='e'){
			while(str[row][col]){
				col++;
			}
		}
		if(in[0]=='p'){
			if(row)row--;
			col=0;
		}
		if(in[0]=='n'){
			if(row<n-1)row++;
			col=0;
		}
		if(in[0]=='f'){
			if(str[row][col])col++;
			else if(row<n-1){row++;col=0;}
		}
		if(in[0]=='b'){
			if(col)col--;
			else if(row){row--;col=0;
				while(str[row][col])col++;
			}
		}
		if(in[0]=='d'){
			if(str[row][col]){
				for(int i=col;str[row][i];i++)str[row][i]=str[row][i+1];
			}else if(row<n-1){
				for(int i=0;str[row+1][i];i++){
					str[row][col+i]=str[row+1][i];
					str[row+1][i]=0;
				}
				for(int i=row+1;i<n;i++){
					for(int j=0;j<1100;j++)str[i][j]=str[i+1][j];
				}
				for(int i=0;i<1100;i++)str[n][i]=0;
				n--;
			}
		}
		if(in[0]=='k'){
			if(!str[row][col]){
				if(row<n-1){
					for(int i=0;str[row+1][i];i++){
					str[row][col+i]=str[row+1][i];
					str[row+1][i]=0;
				}
				for(int i=row+1;i<n;i++){
					for(int j=0;j<1100;j++)str[i][j]=str[i+1][j];
				}
				for(int i=0;i<1100;i++)str[n][i]=0;
				n--;
					buf[0]='@';
					buf[1]=0;
				}
			}else{
				int at=0;
				for(int i=col;str[row][i];i++){
					buf[at++]=str[row][i];
					str[row][i]=0;
				}
				buf[at]=0;
			}
		}
		if(in[0]=='y'){
			if(buf[0]){
				if(buf[0]=='@'){
					for(int i=n-1;i>row;i--){
						for(int j=0;j<1100;j++)str[i+1][j]=str[i][j];
					}
					int at=0;
					for(int i=col;str[row][i];i++){
						str[row+1][at++]=str[row][i];
						str[row][i]=0;
					}
					str[row+1][at]=0;
					row++;col=0;
					n++;
				}else{
					int sz=0;
					for(int i=0;buf[i];i++)sz++;
					for(int i=1109;i>=col;i--){
						if(i+sz>=1100)continue;
						str[row][i+sz]=str[row][i];
					}
					for(int i=0;i<sz;i++)str[row][col+i]=buf[i];
					col+=sz;
				}
			}
		}
	}
	for(int i=0;i<n;i++)printf("%s\n",str[i]);
}

Measured memory_bytes: 968
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            Console.WriteLine(Logic(X));
        }

        private static int Logic(int X)
        {
            var remain = X;
            var Happiness = 0;
            foreach(var coin in Coins)
            {
                while (remain >= coin.Key)
                {
                    remain -= coin.Key;
                    Happiness += coin.Value;
                }
            }
            return Happiness;
        }

        private static Dictionary<int, int> Coins = new Dictionary<int, int> {
            { 500, 1000 },
            { 5, 5 },
            { 1, 0 }
        };
    }
}


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

int main(){

  string s;
  cin >> s;
  if(s.back() == 's') cout << s << "es" << endl;
  else cout << s << 's' << endl;

}


Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <vector>
#include <iomanip>
using namespace std;


int main(){
    // input
    string S;
    cin >> S;

    // compute
    string ans = "Good";
    if (S.at(0) == S.at(1)) ans = "Bad";
    if (S.at(1) == S.at(2)) ans = "Bad";
    if (S.at(2) == S.at(3)) ans = "Bad";

    // output
    cout << ans << endl;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, T) = readLine()!!.split(" ").map { it.toInt() }
    var ans_c = Int.MAX_VALUE
    var ans_t = Int.MAX_VALUE

    for (i in 0 until N) {
        val (c, t) = readLine()!!.split(" ").map { it.toInt() }
        if (t <= T && c < ans_c) {
            ans_c = c
            ans_t = t
        }
    }

    if (ans_t > T) {
        println("TLE")
    } else {
        println(ans_c)
    }
}


Measured memory_bytes: 38004
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int x;
    cin >> x;
    int a = x / 1000;
    int b = x / 100 % 10;
    int c = x / 10 % 10;
    int d = x % 10;

    for (int i = 0; i < (1 << 3); ++i) {
        int t = a;
        string exp = to_string(a);

        if (i & 1) {
            t -= b;
            exp += "-";
            exp += to_string(b);
        } else {
            t += b;
            exp += "+";
            exp += to_string(b);
        }

        if (i >> 1 & 1) {
            t -= c;
            exp += "-";
            exp += to_string(c);
        } else {
            t += c;
            exp += "+";
            exp += to_string(c);
        }

        if (i >> 2 & 1) {
            t -= d;
            exp += "-";
            exp += to_string(d);
        } else {
            t += d;
            exp += "+";
            exp += to_string(d);
        }

        exp += "=7";
        if (t == 7) {
            cout << exp << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// Confessions of a Dangerous Mind

//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

/*
	"We know what we are, but know not what we may be."
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const long long N = 2e5 + 7;
const int M = 1e6 + 7;
const long long MOD = 1e6 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 1e-9;

/*
	"You never know how strong you are until being strong is the only choice you have."
*/

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

/*
	"With self-discipline most anything is possible."
*/	
	
	long long x; cin >> x;

	long long ans = 0;
	
	ans += (x / 500) * 1000;
	x %= 500;
	ans += x;
	
	x %= 5;
	
	ans -= x;
	
	cout << ans;

	return 0;
}

/*
	"Reach for it. Push yourself as far as you can."
*/

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

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >

#define all(a) (a).begin(),(a).end()
using namespace std;

int main(){
	string s; cin >> s;
	if (s[0] == '1') cout << 9;
	else if (s[0] == '9') cout << 1;
	if (s[1] == '1') cout << 9;
	else if (s[1] == '9') cout << 1;
	if (s[2] == '1') cout << 9;
	else if (s[2] == '9') cout << 1;
}

Measured memory_bytes: 256
n = int(input())

max_div_num = 1

for i in range(2, int(n**(1/2) + 1)):
    if n % i == 0:
        max_div_num = max(i, max_div_num)

x = max_div_num
y = n // max_div_num

print(x + y - 2)

Measured memory_bytes: 9372
#include<bits/stdc++.h>
#define N 500000
using namespace std;
int n, a[N];

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int nx = (i + 1 <= n) ? i + 1 : 1;
        if (a[i] == i) swap(a[i], a[nx]), ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
using namespace std;
int n, a[N];
int dp[N];
int solve(int i){
    if(i==n-1) re 0;
    int &res=dp[i];
    if(~res) re res;
    res=abs(a[i+1]-a[i])+solve(i+1);
    if(i<n-2){
        res =min(res,abs(a[i+2]-a[i])+solve(i+2));
    }
    re res;
}
int main() {
    IO;
    cin >> n;
    rep(i, 0, n) cin >> a[i];
    memset(dp,-1,sizeof dp);
    cout << solve(0);

}



Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


int main() {
  ll n, q; cin >> n >> q;
  Vll a;

  if (n % 2) {
    a.assign(n+1, 0);
    rep(i, n) cin >> a[i+1];
    ++n;
  }
  else {
    a.assign(n, 0);
    cin >> a;
  }

  Vll s(n+1);
  rep(i, n) s[i+1] = s[i] + a[i];
  Vll so(n/2+1);
  rep(i, n/2) so[i+1] = so[i] + a[2*i+1];

  rep(_, q) {
    ll x; cin >> x;

    auto fun = [&] (ll y) {
      if (y >= n) return true;
      if (y < 0) return false;
      return (2*x <= a[y] + a[y + (n-y)/2]);
    };

    ll ok = n;
    ll ng = -1;
    while (llabs(ok - ng) > 1) {
      ll mid = (ok + ng) / 2;
      if (fun(mid)) ok = mid;
      else ng = mid;
    }

    ll z = n - ok - (n-ok)/2;
    ll ans = s[n] - s[n-z];
    ans += so[ok/2];
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

typedef struct UnionFindTree{
    vector<int> par;

    UnionFindTree(int n){
        par.resize(n, -1);
    }

    bool is_root(int x){
        return par[x]<0;
    }

    int find(int x){
        if(is_root(x)) return x;
        return par[x] = find(par[x]);
    }

    int size(int x){
        return -par[find(x)];
    }

    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
}UF;

int n;
vector<int> G[MAX];
UF uf(MAX);
int lca[MAX];
vector<int> lca_query[MAX];
lint dist[MAX], ans;

void bfs(){
    queue<int> que;
    int pv = -1;
    que.push(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        if(pv >= 0){
            lca_query[pv].push_back(v);
            lca_query[v].push_back(pv);
        }
        pv = v;
        for(auto nv: G[v])if(dist[nv] == 0){
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
}

void lca_dfs(int v){
    lca[v] = v;
    for(auto nv: lca_query[v]){
        int pv = lca[uf.find(nv)];
        if(pv >= 0) ans += dist[v] + dist[nv] - 2 * dist[pv];
    }
    for(auto nv: G[v]){
        lca_dfs(nv);
        uf.unite(v, nv);
        lca[uf.find(v)] = v;
    }
}

int main(){
    scanf("%d", &n);
    For(i, 1, n){
        int p;
        scanf("%d", &p);
        --p;
        G[p].push_back(i);
    }
    bfs();
    fill(lca, lca+n, -1);
    lca_dfs(0);
    printf("%lld\n", ans);
}


Measured memory_bytes: 31124
'use strict';

const inputs = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');

const input = parseInt(inputs[0], 10);


const results = [];

for (let i = 1 ; i <= input ; ++i) {
  for (let j = 1 ; j <= input ; ++j) {
    for (let k = 1 ; k <= input ; ++k) {
      results.push(gcd(gcd(i, j), k));
    }
  }
}

console.log(results.reduce((acc, cur) => acc + cur, 0));

function gcd(a, b) {
  const max = Math.max(a, b);
  const min = Math.min(a, b);

  const result = a % b;

  if (result === 0) {
    return b;
  }

  return gcd(b, result);
}

Measured memory_bytes: 264076
def main():
    from itertools import permutations
    from math import hypot

    N = int(input())
    cities = [tuple(map(int, input().split())) for _ in range(N)]

    def dist(c1, c2):
        return hypot(c1[0] - c2[0], c1[1] - c2[1])

    ans = 0
    for perm in permutations(cities, r=2):
        ans += dist(*perm)
    ans /= N

    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

#define show(x) cerr << #x << " = " << x << endl;



int main()
{
  int a, b, c;
  cin>>a>>b>>c;

  if(c>=a && c<=b)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 1e18+10 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
vs in(8);
map<vs,int>ma;
void roll(){
	string t=in[3];
	in[3]=in[2];
	in[2]=in[1];
	in[1]=in[0];
	in[0]=t;
	t=in[7];
	in[7]=in[6];
	in[6]=in[5];
	in[5]=in[4];
	in[4]=t;
}
void rooll(){
	string t=in[5];
	in[5]=in[4];
	in[4]=in[0];
	in[0]=in[1];
	in[1]=t;
	t=in[6];
	in[6]=in[7];
	in[7]=in[3];
	in[3]=in[2];
	in[2]=t;
}
void roooll(){
	string t=in[6];
	in[6]=in[5];
	in[5]=in[1];
	in[1]=in[2];
	in[2]=t;
	t=in[7];
	in[7]=in[4];
	in[4]=in[0];
	in[0]=in[3];
	in[3]=t;
}
void F(){
	bool h=false;
	rep(k,4){
		rep(j,4){
			rep(i,4){
				roll();
				if(ma.count(in))h=true;
			}
			rooll();
		}
		roooll();
	}
	if(!h)ma[in]=1;
}
signed main(){
	while(cin>>in[0]){
		rep(i,7)cin>>in[i+1];
		sort(all(in));
		ma.clear();
		do{F();}while(next_permutation(all(in)));
		cout<<ma.size()<<endl;
	}
}


Measured memory_bytes: 3468
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int alice_start = Integer.parseInt(sc.next());
        int alice_end = Integer.parseInt(sc.next());
        int bob_start = Integer.parseInt(sc.next());
        int bob_end = Integer.parseInt(sc.next());
        int[] alice = new int[100];
        int[] bob = new int[100];
        for (int i = 0; i < 100; i++) {
            if (i >= alice_start && i < alice_end) {
                alice[i] = 1;
            }
            if (i >= bob_start && i < bob_end) {
                bob[i] = 1;
            }
        }
        int cnt = 0;
        for (int i = 0; i < 100; i++) {
            if (alice[i] == 1 && bob[i] == 1) cnt++;
        }
        System.out.println(cnt);
    }
}


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

#define MAX_N 10
#define RATE 380000.0

int main() {
  int n;
	double x[MAX_N];
	std::string u[MAX_N];

	std::cin >> n;
	for(int i = 0; i < n; ++i) {
		std::cin >> x[i] >> u[i];
	}

	double ans = 0;
	for(int i = 0; i < n; ++i) {
		if(u[i] == "BTC") {
			ans += RATE * x[i];
		} else {
			ans += x[i];
		}
	}

	std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
way = [1 for _ in range(n+1)]
for i in range(m):
  ai = int(input())
  way[ai] = 0
for i in range(2,n+1):
  if way[i] != 0:
    way[i] = (way[i-1]+way[i-2])%1000000007
print(way[n])
 
    
    
  
  
  

Measured memory_bytes: 7064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<P> op(n + m);
  rep(i, n) {
    int a;
    cin >> a;
    P p = make_pair(a, 1);
    op.push_back(p);
  }
  rep(j, m) {
    ll b, c;
    cin >> b >> c;
    P p = make_pair(c, b);
    op.push_back(p);
  }

  sort(all(op));
  reverse(all(op));
  ll updating = n;

  ll ans = 0;
  rep(j, n + m) {
    ll nb = min(updating, op[j].second);
    ans += nb * op[j].first;
    updating -= nb;
    if(updating < 0) break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define ll long long
#define N 3000003
#define endl "\n"
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll n , a[N] , sum , ans , mod = 1e9 + 7;

int main(){
fcin;
    cin >> n;
    for(ll i = 0 ; i < n ; i++) cin >> a[i] , sum += a[i];
    for(ll i = 0 ; i < n ; i++){
        sum -= a[i];
        a[i] %= mod;
        ans += (sum + mod )%mod * a[i];
        ans%=mod;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 5176
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}


// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
/*
int main() {
    // 前処理
    COMinit();

    // 計算例
    cout << COM(100000, 50000) << endl;
}*/

//printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
*/

int main(){
    ll N;
    vector<bool> pr(1000001,true);
    pr[1] = false;
    pr[0] = false;
    rep(i,1001){
        if(pr[i]){
            for(ll j = i * 2;j <= 1000000;j += i){
                pr[j] = false;
            }
        }
    }
    vector<ll> num(1000001);
    for(ll i = 1;i <= 1000001;i++){
        if(pr[i])num[i] += num[i - 1] + 1;
        else num[i] += num[i - 1];
    }
   /*rep(i,20){
        cout << i << ":" << num[i] << endl;
    }*/
    while(cin >> N){
        cout << num[N] << endl;
    }
}


Measured memory_bytes: 10504
#include<bits/stdc++.h>
using namespace std;
  char s[1000001];
  int i,a,b,tot;
  int main()
{
  scanf("%s",s);
  for(i=0;i<=strlen(s)-1;i++)
  if (a==b){a++; if (s[i]=='p') tot--;}
  else{ b++; if (s[i]=='g') tot++; }
  printf("%d\n",tot);
  return 0;
}

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

using namespace std;

static const int kModulo = 1000 * 1000 * 1000 + 7;

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

    int H, W, N; cin >> H >> W >> N;

    vector< pair<int, int> > points(N);
    for (int i = 0; i < N; ++i)
        cin >> points[i].first >> points[i].second;
    points.emplace_back(H, W);

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

    vector<int> fact(H + W + 1, 1);
    for (int i = 2; i <= H + W; ++i)
        fact[i] = 1LL * fact[i - 1] * i % kModulo;

    vector<int> ifact(H + W + 1, 1);
    for (int i = 2; i <= H + W; ++i) {
        ifact[i] = (kModulo - 1LL * (kModulo / i) * ifact[kModulo % i]) % kModulo;
        if (ifact[i] < 0)
            ifact[i] += kModulo;
    }

    for (int i = 2; i <= H + W; ++i)
        ifact[i] = 1LL * ifact[i - 1] * ifact[i] % kModulo;

    auto comb = [&](int N, int K) {
        int aux = 1LL * fact[N] * ifact[K] % kModulo;
        return 1LL * aux * ifact[N - K] % kModulo;
    };

    auto ways = [&](pair<int, int> a, pair<int, int> b) {
        int dx = b.first - a.first;
        int dy = b.second - a.second;
        return comb(dx + dy, dx);
    };

    ++N;
    vector<int> dp(N, 0);
    for (int i = 0; i < N; ++i) {
        dp[i] = ways({1, 1}, points[i]);

        for (int j = 0; j < i; ++j)
            if (points[j].second <= points[i].second)
                dp[i] = (dp[i] - 1LL * dp[j] * ways(points[j], points[i])) % kModulo;
        if (dp[i] < 0)
            dp[i] += kModulo;
    }

    cout << dp.back() << "\n";
}


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
void run_case()
{
    int n;
    cin >> n;
    int mx1 = -INF, mx2 = -INF;
    int mn1 = INF, mn2 = INF;
    for (int i = 1; i <= n; i++)
    {
        int x, y;
        cin >> x >> y;
        int z = x + y;
        mx1 = max(z, mx1);
        mn1 = min(z, mn1);
        int w = x - y;
        mx2 = max(w, mx2);
        mn2 = min(w, mn2);
    }
    int ans = max(mx1 - mn1, mx2 - mn2);
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a=scanner.nextInt();
		int b=scanner.nextInt();
		int k=scanner.nextInt();
		for(int i=0;i<k;i++) {
			if(i%2==0) {
				b+=a/2;
				a-=Math.ceil((double)a/2);
				
			}else {
				a+=b/2;
				b-=Math.ceil((double)b/2);
				
			}
			
		}
		System.out.println(a+" "+b);
	}
}

Measured memory_bytes: 21844
n = int(input())
h = []
for i in range(n):
    a,b,c = map(int,input().split())
    h.append((a,b,c))
dp = [[0 for i in range(3)] for i in range(n)]
for i in range(3):
    dp[0][i] = h[0][i]

for i in range(n-1):
    for j in range(3): #now
        for k in range(3): #pre
            if j != k:
                dp[i+1][j] = max(dp[i+1][j], dp[i][k] + h[i+1][j])
print(max(dp[n-1]))

Measured memory_bytes: 41820
#include<bits/stdc++.h>
#define GO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
const ll N = 2e5 + 2;
const ll Mod = 2520;



int main()
{
	GO;
	ll x, y;
	cin >> x >> y;
	cout << (y % 2 == 0 && y >= 2 * x && y <= 4 * x ? "Yes" : "No") << '\n';
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define mkp make_pair
#define fi first
#define se second
int n,k;
typedef long long ll;
typedef pair<ll,ll> pll; 
priority_queue <pll> q;
vector <pll> res;
map <ll,int> mp;
ll ans=0,num=0;
int main(){
	cin>>n>>k;
	for (int i=1;i<=n;i++){
		ll t,d;cin>>t>>d;
		q.push(mkp(d,t));
	}
	for (int i=1;i<=k;i++){
		pll aw=q.top();
		q.pop();
		mp[aw.se]++;
		num+=aw.fi;
		res.push_back(aw);
	}
	ll sz=mp.size();
	ans=num+sz*sz;
	reverse (res.begin(),res.end());
	for (int i=0;i<k;i++){
		if (mp[res[i].se]==1) continue;
		while (!q.empty()){
			pll aw=q.top();
			q.pop();
			if (mp[aw.se]==0){
            	num=num-res[i].fi+aw.fi;
            	sz++;
            	ans=max(ans,num+sz*sz);
 				mp[res[i].se]--;mp[aw.se]++;
 				res[i]=aw;
 				break;
            }
		}
	}
	cout<<ans;
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : x;
}

string str;

bool check(long long n) {
	return (n & (n - 1)) == 0;
}

void hawawa()
{
	string str;
	cin >> str;
	cout << 700 + count(begin(str), end(str), 'o') * 100 << "\n";
}

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


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

int main (){
  int n;
  std::cin >> n;

  auto min = 1000001;
  auto max = -1000001;
  long sum = 0;

  for (int i=0; i<n; i++)
    {
      int temp;
      std::cin >> temp;
      if (temp < min)
        min = temp;
      if (temp > max)
        max = temp;
      sum += temp;
    }
  std::cout << min << " " << max << " " <<  sum << std::endl;
}




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

int main()
{
	string str;
	while(getline(cin,str), str!=".")
	{
		bool ok=true;
		stack<char> s;
		for(int i=0; i<str.size(); i++)
		{
			if(str[i]=='(' || str[i]=='[')
			{
				s.push(str[i]);
			}
			else if(str[i]==')')
			{
				if(s.empty())    { ok=false; break; }
				if(s.top()!='(') { ok=false; break; }
				s.pop();
			}
			else if(str[i]==']')
			{
				if(s.empty())    { ok=false; break; }
				if(s.top()!='[') { ok=false; break; }
				s.pop();
			}
			else if(str[i]=='.')
			{
				break;
			}
		}

		if(!s.empty()) { ok=false; }

		cout << (ok?"yes":"no") << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n;
string s;

int main(){
	cin>>n>>s;
	ll t=0,res=1;
	for(int i=0;i<2*n;i++){
		if(s[i]=='W'^t%2==0){
			t++;
		}
		else{
			(res*=t)%=mod;
			t--;
		}
		if(t<0) res=0;
	}
	if(t!=0) res=0;
	for(int i=1;i<=n;i++) (res*=i)%=mod;
	cout<<res<<endl;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    string S;
    cin >> S;
    map<char, int> mp;
    REP(i, 4) mp[S[i]]++;
    int cnt = 0;
    for(auto p : mp){
        if(p.second == 2) cnt++;
    }
    if(cnt == 2) PRINT("Yes");
    else PRINT("No");
    return 0;
}

Measured memory_bytes: 256
def main():
    n,d,a = map(int,input().split())
    l = [list(map(int,input().split())) for i in range(n)]
    l.sort()
    count = 0
    from collections import deque

    i = 0
    area = deque([])
    damage = deque([])
    total_damage = 0
    count = 0
    ans = 0
    for pos,hp in l:
        while area:
            ar = area[0]
            if ar < pos:
                area.popleft()
                power = damage.popleft()
                total_damage -= power
            else:
                break
        if hp <= total_damage:
            continue
        else:
            count = (hp-total_damage+a-1)//a
            ans += count
            total_damage += count*a
            area.append(pos+2*d)
            damage.append(count*a)

    print(ans)
if __name__ == "__main__":
    main()



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

int main()
{
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  // Heightのチェック
  if ((y + r > H) || (y - r < 0)) {
    cout << "No" << endl;
  } else if ((x + r > W) || (x - r < 0)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
int grn,gbn,rbn,r,g,b,ans=1;

signed main(){
  int n;string s;cin>>n>>s;
  for(char p:s){
    if(p=='R'){
      if(gbn)ans*=gbn--;
      else if(g)ans*=g--,grn++;
      else if(b)ans*=b--,rbn++;
      else r++;
    }
    if(p=='G'){
      if(rbn)ans*=rbn--;
      else if(r)ans*=r--,grn++;
      else if(b)ans*=b--,gbn++;
      else g++;
    }
    if(p=='B'){
      if(grn)ans*=grn--;
      else if(g)ans*=g--,gbn++;
      else if(r)ans*=r--,rbn++;
      else b++;
    }
    ans%=MOD;
  }
  for(int i=0;i<n;i++)ans*=i+1,ans%=MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A = 0, N = 0;
	cin >> N;
	vector<int> V(N), C(N), P(N);
	for(int i = 0; i < N; i++){
		cin >> V.at(i);
    }
	for(int i = 0; i < N; i++){
		cin >> C.at(i);
    }
	for(int i = 0; i < N; i++){
		P.at(i) = V.at(i) - C.at(i);
    }
	for(int i = 0; i < N; i++){
		if(P.at(i) >= 0){
			A = A + P.at(i);
        }
    }
	cout << A;
}

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

int main(void) {
	int n;
	scanf("%d", &n);
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	int cnt = 0;
	for (int i = 1; i < n - 1; i++) {
		if (p[i - 1] < p[i] && p[i] < p[i + 1]) {
			cnt++;
		} else if (p[i - 1] > p[i] && p[i] > p[i + 1]) {
			cnt++;
		}
	}
	printf("%d", cnt);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int i,j,k,N,A[100],count=0;

  int minj;

  scanf("%d",&N);

  for(i=0;i<N;i++){
  scanf("%d",&A[i]);
  }
  
  for(i=0;i<=N-1;i++){
    count++;
    minj=i;

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

    if(A[minj]==A[i]){
      count--;
    }
	k=A[i];
	A[i]=A[minj];
	A[minj]=k;
	
      
	
  }

  for(k=0;k<N;k++){
    if(k!=0){
      printf(" ");
    }
    printf("%d",A[k]);
  }
  printf("\n");

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



Measured memory_bytes: 2124
C=[list(map(int,input().split())) for _ in range(3)]

for i in range(1,3):
  if C[i][0]-C[0][0]==C[i][1]-C[0][1] and C[i][0]-C[0][0]==C[i][2]-C[0][2]:
    pass
  else:
    print("No")
    exit()
    
print("Yes")


Measured memory_bytes: 38384
n, k = list(map(int, input().split()))
sunuke_list = [0] * n

for i in range(k):
    treat_count = input()
    give_treat = list(map(int, input().split()))
    for j in give_treat:
        sunuke_list[j - 1] += 1

print(len([ i for i in sunuke_list if i == 0 ]))


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}

signed main()
{   
    gearup;
    int n,m,X,Y; cin >> n >> m >> X >> Y;
    vector<int> x(n),y(m);
    rep(i,n)cin >> x[i];
    rep(i,m) cin >> y[i];
    sort(all(x));
    sort(all(y));

    FOR(i,-100,101){
        if(X<i && i<= Y && x[n-1] < i && y[0] >= i){
            cout <<"No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>


int main()
{
  int x, y;

  while (1)
    {
      scanf("%d %d", &x, &y);

      if (x==0 && y==0) break;

      if (x<y || x==y) printf("%d %d\n", x, y);
      if (x > y) printf("%d %d\n", y, x);
    }

  
  return 0;
}



Measured memory_bytes: 2572