akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)

using namespace std;

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

const int maxN = 200000;

int main() {
    ll N;
    ll A[maxN];
    cin >> N;
    ll firstMax = 0;
    ll secondMax = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] > firstMax) {
            secondMax = firstMax;
            firstMax = A[i];
        } else if (A[i] > secondMax) {
            secondMax = A[i];
        }
    }
    REP(i, N) {
        if (A[i] == firstMax) {
            cout << secondMax << endl;
        } else {
            cout << firstMax << endl;
        }
    }

}





Measured memory_bytes: 3200
#include <iostream>

using namespace std;

const int max_num = 1e2, max_capacity = 1e5;
int weight[max_num], value[max_num];
long long int dp[max_num][max_capacity + 1];

int get_num() {
    int input;
    cin >> input;

    return input;
}

int main() {
    int num = get_num(), capacity = get_num();
    for (int i = 0; i < num; i++) {
        weight[i] = get_num();
        value[i] = get_num();
    }

    for (int i = 0; i <= capacity; i++) {
        if (weight[0] <= i) {
            dp[0][i] = value[0];
        } else {
            dp[0][i] = 0;
        }
    }
    for (int i = 1; i < num; i++) {
        for (int j = 0; j <= capacity; j++) {
            dp[i][j] = dp[i - 1][j];
            if ((j >= weight[i]) and (dp[i][j] < (value[i] + dp[i - 1][j - weight[i]]))) {
                dp[i][j] = (value[i] + dp[i - 1][j - weight[i]]);
            }
        }
    }

    cout << dp[num - 1][capacity];
}

Measured memory_bytes: 81196
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる
//時間を意識しろ
//コードテストちゃんとして
//画面とにらめっこするな書け
//WA出すたびにABCは五億円払え
//わからない問題はとばせ
//躊躇なくぐぐれ

//ここから
int main(){
    string S,T;
    cin>>S>>T;
    sort(all(S));
    sort(all(T));
    reverse(all(T));
    vector<string> vec(2);
    vec.at(0)=S;
    vec.at(1)=T;
    sort(all(vec));
    if(vec.at(0)==S&&vec.at(0)!=T){
        cY;
    }else{
        cN;
    }
}



Measured memory_bytes: 256
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
 


def main():
    n = int(input())
    count = 0
    flag = False
    for i in range(n):
        x,y = map(int, input().split())
        if x == y:
            count += 1
        else:
            count = 0
        
        if count == 3:
            flag = True

    if flag:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 9636
#include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define Chkmin(a,b) a=a<b?a:b
using namespace std;
template<typename T>inline void read(T &x)
{
    T s=0,f=1;char k=getchar();
    while(!isdigit(k)&&(k^'-'))k=getchar();
    if(!isdigit(k)){f=-1;k=getchar();}
    while(isdigit(k)){s=s*10+(k^48);k=getchar();}
    x=s*f;
}
const int MAXN=3e5+7;

static int n,pre[MAXN],suf[MAXN];

static char s[MAXN];

inline void init()
{
	read(n);
	scanf("%s",s+1);
}

static int ans; 

inline void solve()
{
	Rep(i,1,n)pre[i]=pre[i-1]+(s[i]=='W');
	Repe(i,n,1)suf[i]=suf[i+1]+(s[i]=='E');
	ans=n;
	Rep(i,1,n)Chkmin(ans,pre[i-1]+suf[i+1]);
	printf("%d\n",ans);
}
int main()
{
    init();
    solve();
    return 0;
}


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

int main(){
    int n,y;
    cin >> n >> y;
    for(int i=0;10000*i<=y;i++){
        for(int j=0;j<=n-i;j++){
            int k=n-i-j;
            if(10000*i+5000*j+1000*k==y){
                cout << i << ' ' << j << ' ' << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<stdio.h>

using namespace std;

int main(){
  long long int N, K;
  cin >> N >> K;

  double sum = 0;
  
  for(int i = 1; i <= N; i++){
    if(i >= K){
      sum += 1;
      continue;
    }
    int nk = ceil(log2(double(K) / double(i)));
    sum += double(1)/(pow(2, nk));
  }
  printf("%.16lf", sum / double(N));
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}

void pr(string x){
	freopen((x+".in").c_str(),"w",stdout);
}


int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}
//Reynaldo's Template

int main(){
	int N;
	cin >> N;
	int x[N+5],cnt = 0;
	for(int i=1;i<=N;i++) {
		cin >> x[i];
	}
	for(int i=1;i<=N;i++){
		if(x[i] == i && x[i+1] == i + 1) {
			cnt++;
			i++;
		}
		else{
		//	cout << x[i] << "\n";
			if(x[i] == i) {
				cnt++;
			}
		}
	}
	cout << cnt << "\n";
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    int n;
    cin >> n;
    int Max = -1;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        Max = max(Max,a[i]);
    }
    vector<int> mps(Max+1);
    auto mpsinit = [&](){//O(NloglogN)
        for(int i = 0; i <= Max; i++) mps[i] = i;
        for(ll i = 2; i*i <= Max; i++){
            if(mps[i] == i){
                for(ll j = i*i; j <= Max; j += i){
                    if(mps[j] == j) mps[j] = i;
                }
            }
        }
    };
    auto prime_factorization = [&](int n){//O(logN)
        vector<int> ret;
        while(mps[n] != n){
            if(ret.size() != 0 && ret.back() == mps[n]){
                n /= mps[n];
            } else {
                ret.push_back(mps[n]);
                n /= mps[n];
            }
        }
        if(ret.size() == 0 || ret.back() != mps[n]) ret.push_back(mps[n]);
        return ret;
    };

    mpsinit();
    vector<int> seen(Max,0);
    bool pc = true;

    for(int i = 0; i < n; i++){
        if(a[i] == 1) continue;
        vector<int> fp;
        int n = a[i];
        while(mps[n] != n){
            if(fp.size() != 0 && fp.back() == mps[n]){
                n /= mps[n];
            } else {
                fp.push_back(mps[n]);
                n /= mps[n];
            }
        }
        if(fp.size() == 0 || fp.back() != mps[n]) fp.push_back(mps[n]);
        for(auto p:fp){
            if(seen[p]) pc = false;
            seen[p] = true;
        }
    }

    int g = __gcd(a[0],a[1]);
    for(int i = 0; i < n; i++) g = __gcd(g,a[i]);

    if(pc) cout << "pairwise coprime" << endl;
    else if(g == 1) cout << "setwise coprime" << endl;
    else cout << "not coprime" << endl;
}

Measured memory_bytes: 15080
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        System.out.println((a + b) == c || (a + c) == b || (b + c) == a ? "Yes" : "No");
    }
}


Measured memory_bytes: 21716
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

vector<int> makeTable(string &s){
    int n = s.size();
    vector<int> ret(n+1);
    ret[0] = -1;
    int j = -1;
    for (int i=0; i<n; i++) {
        while (j >= 0 && s[i] != s[j]) j = ret[j];
        ret[i+1] = ++j;
    }

    return ret;
}

vector<int> kmp(string &str, string &word){
    vector<int> table = makeTable(word), ret;
    int m = 0, i = 0, n = str.size();
    while(m + i < n){
        if(word[i] == str[m+i]){
            if(++i == (int)(word.size())){ 
                ret.emplace_back(m);
                m = m + i - table[i];
                i = table[i];
            }
        }
        else{
            m = m + i - table[i];
            if (i > 0) i = table[i];
        }
    }
    
    return ret;
}

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

    string s, t; cin>>s>>t;

    string s2 = s;
    while(s2.size() < t.size()) s2 += s;
    s = s2;

    int n = s.size(), m = t.size();
    s += s;
    
    auto v = kmp(s, t);

    vector<bool> sindex(n, false);
    for(auto i : v){
        sindex[i % n] = true; 
    }

    int ans = 0;
    vector<bool> visited(n, false);
    for(int i=0; i<n; i++){
        if(!sindex[i] || visited[i]) continue;

        visited[i] = true;
        int sum = 1;

        int nxt = i;
        while(1){
            nxt = (nxt + m) % n;
            if(nxt == i){
                cout << -1 << endl;
                return 0;
            }
            else if(sindex[nxt] && !visited[nxt]){
                sum++;
                visited[nxt] = true;
            }
            else{
                break;
            }
        }

        int pre = i;
        while(1){
            pre = (pre - m + (int)s.size()) % n;
            if(pre == i){
                cout << -1 << endl;
                return 0;
            }
            else if(sindex[pre] && !visited[pre]){
                sum++;
                visited[pre] = true;
            }
            else{
                break;
            }
        }

        chmax(ans, sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 15912
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
 int main (){
char a[50],b[50];
while(cin >> a >> b){
int la,lb,f;
la=strlen(a);
lb=strlen(b);
f=max(la,lb);
int i=0;
while(a[i]!='\0'&&b[i]!='\0'){
printf("%c%c",a[i],b[i]); i++; }
int j;
 for(j=i;j<f;j++){
if(la>lb)
printf("%c",a[j]);
else
printf("%c",b[j]);
}
}
 printf("\n");
return 0;
 }

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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) cout << s[i] << t[i];
}

Measured memory_bytes: 384
s = input()
t = input()
# print(s,t)

r = []
n = len(s) - len(t) + 1
# print(n)
for i in range(n):
    w_w = len(t)
    for j in range(len(t)):
        # print(s[i+j], t[j])
        if s[i+j] == t[j]:
            w_w -= 1
    # print(w_w)
    r.append(w_w)
print(min(r))


Measured memory_bytes: 67748
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int A, B, C; cin >> A >> B >> C;
  int a = A, b = B, c = C;
  int ans=0;
  while (a % 2 != 1 && b % 2 != 1 && c % 2 != 1 ) {
    if (A == B && B == C) {
      ans = -1;
      break;
    }
    A = b / 2 + c / 2;
    B = c / 2 + a / 2;
    C = a / 2 + b / 2;
    a = A, b = B, c = C;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
string s[1001];
bool visited[1001];
void dfs(vector<vector<int> > &g, string *s, int depth, int node){
  if(visited[node])return;
  visited[node] = true;
  for (int i = 0; i < depth; i++)
    std::cout << ".";

  std::cout << s[node] << std::endl;
  for (int i = 0; i < g[node].size(); i++) {
    dfs(g, s, depth + 1, g[node][i]);
  }
  return;
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  vector<vector<int> > g;
  g.resize(n + 1);
  int k;
  cin >> k >> s[0];
  for (int i = 1; i < n; i++) {
    cin >> k >> s[i];
    g[k - 1].push_back(i);
  }
  dfs(g, s, 0, 0);
  return 0;
}

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

void chmax(int &a, const int b) { if (a < b) a = b; return; }

int main(){
    int h, w, m; cin >> h >> w >> m;
    vector<int> H(h,0), W(w,0);
    map<pair<int,int>,int> mp;
    for(int i = 0; i < m; i++){
        int x, y; cin >> x >> y; x--; y--;
        H[x]++;
        W[y]++;
        mp[make_pair(x,y)]++;
    }

    int hmax = 0; for(int i = 0; i < h; i++) chmax(hmax,H[i]);
    int wmax = 0; for(int i = 0; i < w; i++) chmax(wmax,W[i]);
    vector<int> hh; for(int i = 0; i < h; i++) if(H[i] == hmax) hh.push_back(i);
    vector<int> ww; for(int i = 0; i < w; i++) if(W[i] == wmax) ww.push_back(i);

    for(int i = 0; i < (int)hh.size(); i++){
        for(int j = 0; j < (int)ww.size(); j++){
            if(!mp[make_pair(hh[i],ww[j])]){
                cout << hmax + wmax << endl;
                return 0;
            }
        }
    }

    cout << hmax + wmax - 1 << endl;
    return 0;
}

Measured memory_bytes: 28452
import java.util.Scanner;

public class Main {
	public static final String[] PREFIX = {"yotta","zetta","exa","peta","tera","giga","mega","kilo","hecto","deca","deci","centi","milli","micro","nano","pico","femto","ato","zepto","yocto"};
	public static final int[] SCALE = {24,21,18,15,12,9,6,3,2,1,-1,-2,-3,-6,-9,-12,-15,-18,-21,-24};
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		sc.nextLine();
		for(int t=0;t<T;t++) {
			String[] s = sc.nextLine().split(" ");
			int scale = 0;
			if (s.length == 2) {
				scale = 0;
			}else{
				for(int j=0;j<PREFIX.length;j++) {
					if (s[1].equals(PREFIX[j])) {
						scale = SCALE[j];
						break;
					}
				}
				s[1] = s[2];
			}
			if (s[0].indexOf('.') >= 0) {
				scale -= s[0].length() - 1 - s[0].indexOf('.');
			}
			s[0] = s[0].replace(".", "");
			for(int j=0;j<s[0].length();j++) {
				if (s[0].charAt(j) != '0') {
					s[0] = s[0].substring(j);
					break;
				}
			}
			scale += s[0].length() - 1;
			if (s[0].length() == 1) {
				System.out.print(s[0] + " * ");
			}else{
				System.out.print(s[0].charAt(0) + "." + s[0].substring(1) + " * ");
			}
			System.out.println("10^" + scale + " " + s[1]);
		}
	}

}

Measured memory_bytes: 18580
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val x = sc.nextLong()
    val k = sc.nextLong()
    val d = sc.nextLong()
    if (x == 0L) {
        println(if (k % 2 == 0L) 0 else d)
    } else if (x > 0) {
        val m = (x + d - 1) / d
        if (m >= k) {
            println(Math.abs(x - k * d))
        } else {
            if (k % 2 == m % 2) {
                println(Math.abs(x - m * d))
            } else {
                println(Math.abs(x - (m-1) * d))
            }
        }
    } else {
        val m = (-x + d - 1) / d
        if (m >= k) {
            println(Math.abs(x + k * d))
        } else {
            if (k % 2 == m % 2) {
                println(Math.abs(x + m * d))
            } else {
                println(Math.abs(x + (m-1) * d))
            }
        }
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 34424
import java.util.*;

public class Main{

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
		
        int N = sc.nextInt();
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		boolean flag = true;
		int temp, count = 0;
		
		while(flag){
			flag = false;
			for(int i = N - 1; i > 0; i--){
				if(A[i] < A[i - 1]){
					temp = A[i - 1];
					A[i - 1] = A[i];
					A[i] = temp;
					flag = true;
					count++;
				}
			}
		}
		System.out.print(A[0]);
		for(int i = 1; i < N; i++) System.out.print(" " + A[i]);
		System.out.println();
		System.out.println(count);
	}
}


Measured memory_bytes: 26408
#include <iostream>

using namespace std;

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

    if (a + b < c + d) {
        cout << "Right" << endl;
    } else if (a + b == c + d) {
        cout << "Balanced" << endl;
    } else {
        cout << "Left" << endl;
    }
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readlines()
N, M = map(int, input[0].strip().split(' '))
Xs = list(map(int, input[1].strip().split(' ')))
s = sorted(Xs)
gaps = [s[i+1]-s[i] for i in range(len(s)-1)]
sgaps = sorted(gaps)
if N>=M:
    print(0)
else:
    print(sum(sgaps[:(M-N)]))



Measured memory_bytes: 13828
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	string s;
	cin>>s;
	int ans=0;
	rep(i,s.size()){
		if(s[i]=='+'){
			ans++;
		}else{
			ans--;
		}
	}	
	cout<<ans<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.next();
		int price = 700;

		for (int i = 0; i < 3; i++) {
			//文字列Sを1文字ずつに分解し、listに追加
			String s = S.substring(i,i+1);

			//もし、"o"であれば、priceにプラス100
			if (s.equals("o")) {
				price += 100;
			}
		}
		System.out.println(price);
	}
}

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

string a,b="CF"; 
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ 
            bl++;
            if(bl==2)  
                break;
        }
    if(bl==2) cout<<"Yes"; 
    else cout<<"No";
    cout<<endl;
    return 0;
}

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

#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define trav(a,x) for (auto& a: x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main() {

    ll n;
    vector<int> dp(41, 0);
    dp[0] = 0;
    for (int i = 1; i <= 40; i += 1) {
        for (int j = 40; j - i >= 0; j--) {
            if (dp[j - i] || j - i == 0) {
                dp[j] = max(dp[j], dp[j - i] + 1);
            }
        }
    }
    while (cin >> n) {
        int total = 0;
        for (ll i = 2; i * i <= n; i += 1) {
            if (n % i) continue;
            int pf = 0;
            while (n % i == 0) {
                pf++;
                n /= i;
            }
            total += dp[pf];
        }
        if (n > 1) ++total;
        printf("%d\n", total);
    }

    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

const int oo = 2E9 + 10;

int n, k, q;
vi in;

int Val(int h){
  vi nal;
  for(int i = 0;i < n;++i){
    if(in[i] <= h) continue;

    vi have;
    int j = i;
    while(j + 1 < n && in[j + 1] > h) ++j;

    vi use;
    for(int k = i;k <= j;++k) use.pb(in[k]);

    if(sz(use) >= k){
      int take = sz(use) - k + 1;
      nth_element(use.begin(), use.begin() + take - 1, use.end());
      for(int k = 0;k < take;++k) nal.pb(use[k]);
    }

    i = j;
  }

  if(sz(nal) < q) return oo;

  sort(all(nal));
  return nal[q - 1] - nal[0];
}

int main(){
  scanf("%d%d%d", &n, &k, &q);
  in.resize(n);
  for(int& e : in) scanf("%d", &e);

  vi cand = in;
  cand.pb(-1);
  sort(all(cand));
  cand.erase(unique(all(cand)), cand.end());

  int best = oo;
  for(int e : cand) relaxMin(best, Val(e));

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

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> vec;
    for(int i=0; i<2*n ; i++){
        int a;
        cin >> a;
        vec.push_back(a);
    }
    sort(vec.begin(),vec.end());
    int cnt = 0;
    for(int i=0; i<2*n-1; i+=2){
        cnt += min(vec[i],vec[i+1]);
//        cout << vec[i] << " " << vec[i+1] << endl;
//        cout << cnt <<endl;
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}


class unionFind {
public:
  vector<ll> data;
  
  unionFind(ll size) {
    data.assign(size, -1);
  }
  
  bool same(ll x, ll y) {
    return find(x)==find(y);
  }
  
  void unite(ll x, ll y) {
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(data[x]>data[y]) swap(x, y);
    data[x]+=data[y];
    data[y]=x;
  }
  
  ll find(ll k) {
    if(data[k]<0) return k;
    return data[k]=find(data[k]);
  }
  
  ll size(ll k) {
    return -data[find(k)];
  }
  
};



int main(void) {
  ll N, M;
  cin >> N >> M;
  ll i;
  
  unionFind uf(N*2);
  
  ll ans=0;
  for(i=0; i<M; i++) {
    ll x, y, z;
    cin >> x >> y >> z;
    x--; y--;
    //pt(uf.size(x)<<" "<<uf.size(y));
    if(z%2==0) {
      
      if(uf.same(x, y)) continue;
      
      if(uf.size(x)==1 && uf.size(y)==1) {
        ans++;
        //pt(1);
      }else if(uf.size(x)>1 && uf.size(y)>1) {
        ans--;
        //pt(2);
      }
      
      uf.unite(x, y);
      uf.unite(x+N, y+N);
    }else {
      
      if(uf.same(x, y+N)) continue;
      
      if(uf.size(x)==1 && uf.size(y+N)==1) {
        ans++;
        //pt(3);
      }else if(uf.size(x)>1 && uf.size(y+N)>1) {
        ans--;
        
        //pt(4);
      }
      
      
      uf.unite(x, y+N);
      uf.unite(x+N, y);
    }
  }
  
  for(i=0; i<N; i++) {
    if(uf.size(i)==1) ans++;
  }
  pt(ans);
  
  
  
}











Measured memory_bytes: 1792
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N;cin>>N;
    vector<ll> A(N);
    REP(i,N)cin>>A[i];

    ll jdg=0;//-1,0,1
    ll cnt=1;
    REPS(i,N){
        if(i==N)break;
        if(jdg==0){//増加減少が決まっていない
            if(A[i-1]==A[i])continue;
            if(A[i-1]<A[i])jdg=1;
            else jdg=-1;
        }
        else{//決まっていたら
            if(
                (jdg==-1&&A[i-1]<A[i])||(jdg==1&&A[i-1]>A[i])
            ){//増加減少が変わったら
                jdg=0;
                cnt++;
            }
        }
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
 
S = deque(readline().rstrip().decode())
Q = int(readline())
query = readlines()
 
rev = False
for q in query:
    if q[0] == ord('1'):
        rev = not rev
    else:
        _, f, c = q.decode().split()
        f = int(f)
        if rev ^ (f == 1):
            S.appendleft(c)
        else:
            S.append(c)
 
T = ''.join(S)
if rev:
    T = T[::-1]
print(T)

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

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100;

int main(){
    #ifdef ONPC
    ifstream cin("a.in");
    ofstream cout("a.out");
    #endif
    ios::sync_with_stdio(0);
    ll n, m;
    ll x = 0;
    cin >> n >> m;
    x = min(n, m / 2);
    n -= x;
    m -= 2 * x;
    x += m / 4;
    cout << x;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

using namespace std;

int main(){
	int N;
	cin >> N;
	int h[N];
	rep(i,0,N) cin >> h[i];
	int cnt=0;
	rep(i,0,100){
		rep(j,0,N){
			if(h[j]){
				while(h[j]){
					h[j]--;
					j++;
				}
				cnt++;
			}
		}
	}
	cout << cnt << endl;


}


Measured memory_bytes: 256
def Multiple_Gift(x , y):

    ans = 1

    while x < y:
        if x * 2 <= y:
            ans += 1
        x = x * 2

    return ans

def main():
    x , y = map(int , input().split())
    print(Multiple_Gift(x , y))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<stdio.h>
#define N 100000
#define Q 50000

int main(){

  int n, q, i, S[N], T[Q], l, r, m, C = 0;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &S[i]);
  }
  
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &T[i]);
  }
  
  for(i = 0; i < q; i++){
    l = 0;
    r = n;
    while(l < r){
      m = (l + r) / 2;
      if(T[i] == S[m]){
	C++;
	break;
      }
      if(T[i] > S[m]) 
	l = m + 1;
      else if(T[i] < S[m]) 
	r = m;    
    }
  }
  
  printf("%d\n", C);
  return 0; 
}

Measured memory_bytes: 1184
#include<iostream>
using namespace std;
int main(){
  int S,W;
  cin>> S >> W;
  if(S<W){
    cout<< "unsafe" <<endl;
  }else if(S==W){
    cout<< "unsafe" <<endl;
  }else if(S>W){
    cout<< "safe" <<endl;
  }
  return 0;
}


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#define M 100000
using namespace std;
  
int main(){
    int n;
    int m;
    int l;
    int pos = 0;
    int ans = 0;
    int x[100000];
    scanf("%d %d",&n,&m);
    x[0] = 0;
    for (int i = 1; i < n; i++){
        scanf("%d", &x[i]);
        x[i] += x[i - 1];
    }
    while (m--){
        scanf("%d", &l);
        if(l > 0){
            ans += x[pos + l] - x[pos];
        }
        else{
            ans -= x[pos + l] - x[pos];
        }
        pos += l;
        ans %= M;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1580
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10

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

int main() {
	int N; cin >> N;
	vector<ll>A(N);
	vector<ll>L(N);
	vector<ll>R(N);
	REP(i, N) {
		cin >> A[i];
	}
	//calc L
	REP(i, N) {
		if (i == 0) {
			L[i] = A[i];
		}
		else L[i] = gcd(L[i - 1], A[i]);
	}
	//calc R
	RREP(i, N) {
		if (i == N - 1) {
			R[i] = A[i];
		}
		else R[i] = gcd(R[i + 1], A[i]);
	}
	vector<ll>M(N);
	ll mx = 0;
	REP(i, N) {
		if (i == 0)M[i] = R[i + 1];
		else if (i == N - 1) M[i] = L[i - 1];
		else {
			M[i] = gcd(L[i - 1], R[i + 1]);
		}
		if (M[i] > mx) mx = M[i];
	}
	print(mx);

	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;

int main(){
  char c;
  cin >> c;
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<cstdio>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
int main() {
	long long x,c=2;
	cin >> x;
	for (int i = 1; i <= x; i++)c = (c + 1) * 2;
	cout << c;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
table = list(map(int,input().split()))
count = 0
for i in range(N):
    minj = i
    for j in range(i,N):
        if table[j] <table[minj]:
            minj = j#最小の数がある位置
    table[i],table[minj] = table[minj],table[i]
    if i != minj:
        count += 1

print(" ".join(map(str,table)))
print(count)



Measured memory_bytes: 5600
n, k = gets.split("\s").map(&:to_i)

res = 0

mod = 1e9.to_i + 7

(k..n+1).each do |i|
  min_sum = i*(i+1)/2
  
  max_sum_init = n+1 - i + 1
  max_sum = i*(n+1 + max_sum_init) / 2
  
  ct = max_sum - min_sum + 1
  res += ct
  res %= mod
end

puts res

Measured memory_bytes: 14368
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.valueOf(sc.next());
		int[] arr= new int[n];
		for(int i=0;i<n;i++){
			arr[i]=Integer.valueOf(sc.next());
		}
		sc.close();
		
		int count=0;
		boolean f=true;
		while(f){
			f=false;
			for(int i=n-1;i>0;i--){
				int a=arr[i];
				int b=arr[i-1];
				if(a<b){
					arr[i]=b;
					arr[i-1]=a;
					count++;
					f=true;
				}
			}
			
		}
		System.out.print(arr[0]);
		for(int i=1;i<n;i++){
			System.out.print(" "+arr[i]);
		}
		System.out.println();
		System.out.println(count);
	}

}

Measured memory_bytes: 26256
<?php
list($A, $B, $Q) = array_map("intval", explode(" ", trim(fgets(STDIN))));

$aArray[] =-10**18;
for($i = 0; $i < $A; $i++)$aArray[] = intval(fgets(STDIN));
$aArray[] = 10**18;

$bArray[] =-10**18;
for($i = 0; $i < $B; $i++)$bArray[] = intval(fgets(STDIN));
$bArray[] = 10**18;
 
for($i = 0; $i < $Q; $i++){
    $q = intval(fgets(STDIN));
    $min = 10**18;
    $a = bsl($aArray, $q);
    $b = bsl($bArray, $q);
    $a0 = $aArray[$a];
    $a1 = $aArray[$a+1];
    $b0 = $bArray[$b];
    $b1 = $bArray[$b+1];
    $min = min($min, abs($q - $a0) + abs($a0 - $b0));
    $min = min($min, abs($q - $a0) + abs($a0 - $b1));
    $min = min($min, abs($q - $a1) + abs($a1 - $b0));
    $min = min($min, abs($q - $a1) + abs($a1 - $b1));
    $min = min($min, abs($q - $b0) + abs($b0 - $a0));
    $min = min($min, abs($q - $b0) + abs($b0 - $a1));
    $min = min($min, abs($q - $b1) + abs($b1 - $a0));
    $min = min($min, abs($q - $b1) + abs($b1 - $a1));
    printf("%d\n", $min);
}
 
//二分探索　target以下で最大の値の場所を返す
function bsl($nums, $target) {
    $size = count($nums);
    $min = 0; 
    $max = $size - 1;
    while(true){
        $center = intdiv($min + $max, 2);
        $centerValue = $nums[$center];
        if($target == $centerValue){
            return $center;
        }elseif($target > $centerValue){
            $min = $center + 1;
        }else{
            $max = $center;
        }
        if($min == $max){
            $center = intdiv($min + $max, 2);
            $centerValue = $nums[$center];
            if($centerValue == $target){
                return $center;
            }elseif($centerValue < $target){
                return $center;
            }else{
                return $center - 1;
            }
        }
    }
}

Measured memory_bytes: 14836
<?php
function search($m,$n){
    global $sum,$b;
    if($b[$m][$n+1]=="."){
        $b[$m][$n+1]="-";
        $sum++;
        search($m,$n+1);
    }
    if($b[$m][$n-1]=="."){
        $b[$m][$n-1]="-";
        $sum++;
        search($m,$n-1);
    }
    if($b[$m+1][$n]=="."){
        $b[$m+1][$n]="-";
        $sum++;
        search($m+1,$n);
    }
    if($b[$m-1][$n]=="."){
        $b[$m-1][$n]="-";
        $sum++;
        search($m-1,$n);
    }
}

while(1){
    fscanf(STDIN,"%d %d\n",$w,$h);
    if($w==0 && $h==0)
        break;
    $b[0]=str_repeat("-",$w+2);
    for($i=1;$i<=$h;$i++){
        fscanf(STDIN,"%s",$b[$i]);
        $b[$i]="-".$b[$i]."-";
    }
    $b[$h+1]=str_repeat("-",$w+2);

    $sum=1;
    for($i=0;$i<$h+2;$i++){
        for($j=0;$j<$w+2;$j++){
            if($b[$i][$j]=="@"){
                search($i,$j);
                break 2;
                }
        }
    }
    echo $sum."\n";
}
?>

Measured memory_bytes: 7024
#include <stdio.h>
#include <math.h>

#define SQ(x) ((x) * (x))
#define EPS 1e-2

double Menseki(double a, double b, double c)
{
	double s;
	
	s = (a + b + c) / 2.0;
	return (sqrt(s * (s - a) * (s - b) * (s - c)));
}
int main(void)
{
	double ab, bc, ca;
	double x1, x2, x3;
	double y1, y2, y3;
	double xp, yp;
	double ap, bp, cp;
	double S, Sp;
	
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF){
		
		ab = sqrt(SQ(x1 - x2) + SQ(y1 - y2));
		bc = sqrt(SQ(x2 - x3) + SQ(y2 - y3));
		ca = sqrt(SQ(x3 - x1) + SQ(y3 - y1));
	
	S = Menseki(ab, bc, ca);
	
	ap = sqrt(SQ(xp - x1) + SQ(yp - y1));
	bp = sqrt(SQ(xp - x2) + SQ(yp - y2));
	cp = sqrt(SQ(xp - x3) + SQ(yp - y3));
	
	Sp = Menseki(ap, cp, ca) + Menseki(ap, bp, ab) + Menseki(bp, bc, cp);
	if (Sp - S < EPS){
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	
	}
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int x;  cin>>x;
  if(x<600){
    cout<<8<<endl;
  }else if(x<800){
    cout<<7<<endl;
  }else if(x<1000){
    cout<<6<<endl;
  }else if(x<1200){
    cout<<5<<endl;
  }else if(x<1400){
    cout<<4<<endl;
  }else if(x<1600){
    cout<<3<<endl;
  }else if(x<1800){
    cout<<2<<endl;
  }else{
    cout<<1<<endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using ll = long long; 
using namespace std;
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; }

int main() {
	ll h;
	cin >> h;
	ll ans = 1;
	ll sum = 0;
	while(h > 0) {
		sum += ans;
		h /= 2;
		ans *= 2;
	}
	cout << sum << endl;
}

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

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

  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) cout << " " << i;
    else {
      for (int x = i; x != 0; x /= 10) {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
      }
    }
  }

  cout << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define PI 3.14159265359

int main(){
    int n; cin >> n;
    int total = 0;
    rep(i, n){
        int l, r; cin >> l >> r;
        total += r - l +1;
    }
    cout << total << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int dfs(vector<vector<long long >> &adj,vector<long long> &dp,int x)
{
    if(dp[x]!=-1)
    {
        return dp[x];
    }
    if(adj[x].size()==0)
    {
        dp[x]=0;
        return 0;
    }
    for(auto y:adj[x])
    {
        if(dp[x]<(dfs(adj,dp,y)))
        dp[x]=dfs(adj,dp,y);
    }
    dp[x]=dp[x]+1;
    return dp[x];
}
int main()
{
   long long  n,m;
   cin>>n>>m;
  if(m==1) 
  {
      cout<<m;
      return 0;
  }
   vector<vector<long long >> adj(n+1);
   long long  a,b;
   vector<long long> vec(n+1,0);
   for(int i=1;i<=m;i++)
   {
       cin>>a>>b;
       adj[a].push_back(b);
       vec[b]++;
   }
    vector<long long> dp(n+1,-1);
    long long ans=0;
    for(long long i=1;i<=n;i++)
    {
        if(vec[i]==0)
           {
               long long t=dfs(adj,dp,i);
               if(ans<t)
               ans=t;
           }
    }
    cout<<ans; 
    return 0;
}

Measured memory_bytes: 17976
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,m,k;
	int a[200],b[200];
	while(cin>>n>>m){
	for(int i=0;i<2*n;i++)
		a[i]=i+1;
	for(int l=0;l<m;l++){
		cin>>k;
		if(k==0){
			for(int i=0;i<n;i++)
				b[i*2]=a[i];
			for(int i=n;i<2*n;i++)
				b[1+i*2-n*2]=a[i];
		}
		else{
			for(int i=0;i<2*n;i++){
				if(i<k)
					b[i+2*n-k]=a[i];
				else
					b[i-k]=a[i];
			}
		}
		for(int i=0;i<2*n;i++)
			a[i]=b[i];
	}
	for(int i=0;i<2*n;i++)
		cout<<a[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import heapq

N,M = map(int, raw_input().split())
H = map(int, raw_input().split())
Height = {i+1:h for i,h in enumerate(H)}

G = {i+1:[] for i in range(N)}
for _ in range(M):
    a,b = map(int, raw_input().split())
    heapq.heappush(G[a], (-Height[b], b))
    heapq.heappush(G[b], (-Height[a], a))

# print G

ans = 0
for h,hs in G.items():
    if len(hs) == 0:
        ans += 1
        continue
    maxh = -heapq.heappop(hs)[0]
    if Height[h] > maxh:
        ans += 1

print ans
    

Measured memory_bytes: 117524
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define pii pair<int,int> 
long long M  = 1e9+7;
 
 
signed main(){
    fast;
    int n; cin >> n;
    string s; cin >> s;
    int ans=  0;
    for(int i=0 ; i<s.size()-2 ; i++){
    	if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
    		ans++;
    	}
    }
    cout << ans << endl;
}


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

using namespace std;

const int N = 101;
const int INF = 1000000000;

int node, limit, fr, edge, start, goal;
set<int> Fr;
int G[N][N];

class S{
public:
  int p, d, t;
  S(int p, int d, int t):p(p), d(d), t(t){}
  bool operator < (const S &s) const {
    return s.d < d;
  }
};

int sssp(){
  int dist[N][N];
  fill(dist[0], dist[N], INF);
  bool vis[N][N];
  fill(vis[0], vis[N], false);
  priority_queue<S> q;
  q.push(S(start, 0, limit));
  while(!q.empty()){
    S u = q.top();
    q.pop();
    if(vis[u.p][u.t]) continue;
    vis[u.p][u.t] = true;
    if(u.p == goal) return u.d;
    if(Fr.count(u.p)){
      for(int i=0;u.t+i<=limit;i++){
        if(!vis[u.p][u.t+i]){
          if(dist[u.p][u.t+i] > u.d+i){
            dist[u.p][u.t+i] = u.d + i;
            q.push(S(u.p, u.d+i, u.t+i));
          }
        }
      }
    }
    for(int i=0;i<node;i++){
      if(G[u.p][i] == INF) continue;
      if(u.t-G[u.p][i] < 0) continue;
      dist[i][u.t-G[u.p][i]] = min(dist[i][u.t-G[u.p][i]], u.d + G[u.p][i]);
      if(!vis[i][u.t-G[u.p][i]]) q.push(S(i, u.d + G[u.p][i], u.t-G[u.p][i]));
    }
  }
  return -1;
}

main(){
  while(cin >> node >> limit >> fr >> edge >> start >> goal){
    if((node | limit | fr | edge | start | goal) == 0) break;
    fill(G[0], G[N], INF);
    Fr.clear();
    for(int i=0;i<fr;i++){
      int in;
      cin >> in;
      Fr.insert(in);
    }
    for(int i=0;i<edge;i++){
      int a, b, c;
      cin >> a >> b >> c;
      G[a][b] = G[b][a] = c;
    }
    int res = sssp();
    if(res < 0) cout << "Help!" << endl;
    else cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1380
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

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

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int N, A, B, tmp1 = 0, tmp2 = 0;
  cin >> N >> A >> B;
  string S;
  cin >> S;
  REP(i, N) {
    if (S[i] == 'a') {
      if (tmp1 < A + B) {
        cout << "Yes" << endl;
        tmp1++;
      } else {
        cout << "No" << endl;
      }
    } else if (S[i] == 'b') {
      if (tmp1 < A + B && tmp2 < B) {
        cout << "Yes" << endl;
        tmp1++;
        tmp2++;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include<iostream>
using namespace std;
//#include<math>
#include<algorithm>
#include<map>
//#include<pair>
#include<vector>
#include<set>
#include<stack>
#include<queue>
//priority_queue inside queue
#include<deque>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl '\n'
typedef long long ll;
typedef unsigned long long ull;
#define f(i,start,end) for(i=start;i<=end;i++)


bool isPrime(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        if(n%i==0) return false;
    }
    return true;
}

string baseConvertFromDecimal(int base, ll n)
{
    string s = "";
    while(n!=0)
    {
        int rem = (n%base);
        if(rem!=0) s += 'a'-1 + rem;
        else s += 'z';
        n/=base;
        if(rem==0) n--;
    }
    reverse(s.begin(), s.end());
    return s;
}

int main()
{
fast;
//int t=0; cin >> t; while(t--) //testcases
{
    ll n; cin >> n;   
    
    string dog = baseConvertFromDecimal(26, n);
    
    cout << dog << nl;
}return 0;
}

Measured memory_bytes: 3624