akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int N;cin>>N;
    int ans;
    if(1<=N && N<=9) ans = N;
    if(10<=N && N<=99) ans = 9;
    if(100<=N && N<= 999) ans = 9 + N - 99;
    if(1000<=N && N<= 9999) ans = 909;
    if(10000<=N && N<= 99999) ans = 909 + N - 9999;
    if(N==100000) ans = 90909;

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


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

using namespace std;
using ll = long long;


int main() {
    string str;
    cin >> str;
    ll cnts=0,cntt=0,num=0;
    for(int i=0;i<str.size();i++){
        if(str[i]=='S') cnts++;
        else if(str[i]=='T'&&cnts>0){
            cnts--;
            num++;
        }
    }
    cout << str.size()-num*2;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int x, y, W, H, r;
	cin >> W >> H >> x >> y >> r;
	if (x - r >= 0 && x + r <= W&&y - r >= 0 && y + r <= H) {
		cout << "Yes\n";
	}
	else cout << "No\n";

	return 0;
}


Measured memory_bytes: 3200
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
typedef double db;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
int main()
{
	char a[15] , b[15] , c[15] ;
	cin >> a >> b >> c;
	int len1 = strlen(a) ,len2 = strlen(b) , len3 = strlen(c);
	if(a[len1 - 1] == b[0] && b[len2 - 1] == c[0])cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
	}

Measured memory_bytes: 256
#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 <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> k;
  vector<ll> a(k);
  rep(i, k) cin >> a[i];
  ll mn = 2, mx = 2;
  for (int i = k-1; i >= 0; i--) {
    mn = (mn+a[i]-1)/a[i]*a[i];
    mx = mx/a[i]*a[i]+a[i]-1;
    if (mx < mn) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << mn << ' ' << mx << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
    string S, T, U;
    cin >> S;
    cin >> T;
    int A = inputValue();
    int B = inputValue();
    cin >> U;
    if(S == U){
        A--;
    }else{
        B--;
    }
    cout << A << " " << B << endl;
}


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  string S; cin >> S;
  string ans = "";
  for(int i = 0; i < S.size(); i++){
    if(S[i] == 'B'){
      if(ans.size() == 0){
        continue;
      } else { 
        ans.erase(ans.size()-1);
      } 
    } else { 
      ans += S[i];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3556
def actual(N, K):
    # 2つの操作のうち、小さくなる方を選び続ければよい
    op_A = lambda i: i * 2
    op_B = lambda i: i + K

    num = 1

    for _ in range(N):
        num = min(op_A(num), op_B(num))

    return num

N = int(input())
K = int(input())
print(actual(N, K))

Measured memory_bytes: 9076
import java.util.*;
import java.math.BigDecimal;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
      	double B = sc.nextDouble();
      	BigDecimal A2 = new BigDecimal(Long.toString(A));
      	BigDecimal B2 = new BigDecimal(Double.toString(B));
      	BigDecimal value = A2.multiply(B2);
      	BigDecimal ans = value.setScale(0, BigDecimal.ROUND_DOWN);
      	//String str = Double.toString(ans2);
      	System.out.println(ans);
    }
}

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

int main(){
    ll N, K = 0;
    cin >> N;
    vector<pair<ll, ll> > edge(N-1);
    vector< vector< ll > > g(N, vector<ll>());
    map<pair<ll, ll>, ll> col;

    for(int i = 0; i < N - 1; i++){
        ll a, b; cin >> a >> b;
        a--; b--;
        edge[i] = make_pair(a, b);
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<ll> cs(N, 0);
    vector<bool> usd(N, false);
    queue<ll> que;
    
    que.push(0);
    usd[0] = true;
    
    while(!que.empty()){
        ll now = que.front(); que.pop();
        K = max(K, (ll)g[now].size());
        ll nc = 1;
        for(auto e: g[now]){
            if(usd[e]) continue;
            if(nc == cs[now]) nc++;
            cs[e] = nc;
            col[make_pair(now, e)] = nc;
            col[make_pair(e, now)] = nc;
            nc++;
            usd[e] = true;
            que.push(e);
        }
    }
    
    cout << K << endl;
    for(ll i = 0; i < N-1; i++){
        cout << col[edge[i]] << endl;
    }
}

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

int main(){
	int sum;
	string inp;
	ostringstream oss;
	while (true){
		cin >> inp;
		if (inp == "0"){
			break;
		}
		sum = 0;
		for (unsigned int i = 0; i < inp.length(); i++){
			sum += inp[i] - '0';
		}
		oss << sum << endl;
	}
	cout << oss.str();
}

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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

int main(){
	int n,k;
	int ans = 0;
	cin >> n >> k;

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

	for( int i=0; i<n; i++ )	if( h[i] >= k )	ans++;
	
	cout << ans << endl;

	return 0;
}


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

typedef long long ll;

int n;
int a[100005];
ll mx[100005];

int main(){

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

    cin>>n;
    for(int i=0;i<=n;i++){
        cin>>a[i];
    }
    for(int i=n;i>=0;i--){
        mx[i]=mx[i+1]+a[i];
    }
    ll tot=0,cur=1;
    for(int i=0;i<=n;i++){
        tot+=cur;
        cur-=a[i];
        if(cur<0||cur>mx[i+1]){
            cout<<-1<<endl;
            return 0;
        }
        cur=min(cur<<1,mx[i+1]);
    }
    cout<<tot<<endl;

    return 0;
}

Measured memory_bytes: 4828
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let M: usize = read();
    let work_day = (0..M).map(|_| read::<usize>()).sum::<usize>();
    let ans = if work_day > N {
        -1
    } else {
        (N - work_day) as i32
    };
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  int x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  int ans = inf;
  for (int i = 0; i < (1 << n); ++i) {
    vector<int> b(m);
    int cur = 0;
    for (int j = 0; j < n; ++j) {
      if ((i >> j) & 1) {
        cur += c[j];
        for (int q = 0; q < m; ++q) {
          b[q] += a[j][q];
        }
      }
    }
    if (*min_element(begin(b), end(b)) >= x) {
      ans = min(ans, cur);
    }
  }
  if (ans == inf) {
    ans = -1;
  }
  cout << ans << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}




Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>

using namespace std;

int main(){
    int n;
    cin >> n;
    int bits[n][10];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 10; j++){
            cin >> bits[i][j];
        }
    }
    int scores[n][11];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 11; j++){
            cin >> scores[i][j];
        }
    }
    
    
    int ans = 0;
    for(int i = 1; i < (1 << 10); i++){
        int sum = 0;
        for(int j = 0; j < n; j++){
            int cnt = 0;
            for(int k = 0; k < 10; k++){
                if(i & (1 << k)){
                    if(bits[j][9 - k] == 1){
                        cnt++;
                    }
                }
            }
            sum += scores[j][cnt];
        }
        if(i == 1){
            ans = sum;
        }else{
            ans = max(ans, sum);
        }
    }
    cout << ans;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000
#define PI 3.141592653589793

int main() {
	int n, m, x, money, low_money = 1200001, value;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m));
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	for (int bit = 0; bit < (1 << n); bit++) {
		for (int i = 0; i < m; i++) {
			value = 0;
			for (int j = 0; j < n; j++) {
				if (bit & (1 << j)) {
					value += a[j][i];
				}
			}
			if (value < x) break;
			if (i + 1 >= m) {
				money = 0;
				for (int j = 0; j < n; j++) {
					if (bit & (1 << j)) {
						money += c[j];
					}
				}
				if (money < low_money)low_money = money;
			}
		}
	}
	if (low_money == 1200001) low_money = -1;

	cout << low_money;
	return 0;
}

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

struct Mod
{
    static const auto P = int(1e9+7);
    long long k;

    Mod() = default;
    static Mod unit() { return 1; }
    Mod(const long long k) : k(k%P) {}
};

Mod operator+(const Mod a, const Mod b) { return a.k + b.k; }
Mod operator*(const Mod a, const Mod b) { return a.k * b.k; }
Mod& operator+=(Mod& a, const Mod b) { return a = a+b; }

using Matrix = array<array<Mod, 4>, 4>;

Matrix identity()
{
    auto I = Matrix{};
    for (auto i = 0; i < 4; i++) I[i][i] = 1;
    return I;
}

Matrix operator*(const Matrix& A, const Matrix& B)
{
    auto C = Matrix{};
    for (auto i = 0; i < 4; i++) for (auto j = 0; j < 4; j++)
        for (auto k = 0; k < 4; k++)
            C[i][k] += A[i][j] * B[j][k];
    return C;
}

Matrix& operator*=(Matrix& A, const Matrix& B) { return A = A * B; }

Matrix power(const Matrix& A, const int k)
{
    if (k == 0) return identity();
    else if (k % 2 == 0) return power(A*A, k/2);
    else return A * power(A*A, k/2);
}

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

    auto A = Matrix{}, B = Matrix{};
    for (auto i = 0; i < 4; i++) for (auto j = 0; j < 4; j++)
        if ((j & i) == i) A[i][j] = B[i][j] = 1;
    for (auto i = 0; i < 4; i++) A[3][i] += 1;

    auto C = identity();
    auto last_forbidden = -1;
    for (auto i = 0; i < M; i++)
    {
        int x; cin >> x;
        C *= power(A, x - last_forbidden - 1) * B;
        last_forbidden = x;
    }
    C *= power(A, N-1 - last_forbidden);

    cout << C[0][3].k << endl;
}


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

#define limit (int)(2e5 + 5)
#define mod (int)(1e9 + 7)

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
using ld = long double;



int main() {

	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int x,y;
	cin >> x >> y;

	if (y%2 != 0)
	{
		cout << "No";
		return 0;
	}

	if (y > 4*x || y < 2*x)
	{
		cout << "No";
		return 0;
	}

	cout << "Yes";
	return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<math.h>
#define pow5(a,b) pow(a,5)-pow(b,5)

int checkNumRange(int upLim){
  int n = 0;
  while(pow5(n,n-1)<=upLim) n++;
  return n;
}

int main() {
  int x,upLim,a,b;
  scanf("%d", &x);
  upLim =checkNumRange(1000000000);
  for(int i = upLim; i > -upLim; i--){
    for(int j = upLim; j > -upLim; j--){
      if(pow5(i,j) == x) { a = i; b = j;}
    }
  }
  printf("%d %d\n",a,b);
}

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

int main() {
    int x,n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int hantei=0,ans_min=-101,ans_max=201;
    while(hantei<=x){
        bool list = true;
        rep(i,n){
            if(p[i]==hantei) list=false;
        }
        if(list) ans_min = hantei;
        hantei++;
    }
    hantei=200;
    while(hantei>=x){
        bool list = true;
        rep(i,n){
            if(p[i]==hantei) list=false;
        }
        if(list) ans_max = hantei;
        hantei--;
    }

    int ans=0;
    if(x-ans_min<=ans_max-x) ans = ans_min;
    else ans = ans_max;

    cout << ans << endl;

}

Measured memory_bytes: 3636
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        int[] a = new int[n];

        string[] input = Console.ReadLine().Split(' ');
        for(int i = 0; i < n; i ++){
            a[i] = int.Parse(input[i]);
        }

        long total = 0;
        int pos = a[0];

        for(int i = 1; i < n; i++){
            int diff =  pos - a[i];

            if(diff > 0){
                a[i] += diff;
                total += diff;
            }

            pos = a[i];
        }

        Console.WriteLine(total);
    }
}

Measured memory_bytes: 46264
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

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

const double INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

const ll MAX_N = 1e5;
ll dp[MAX_N + 5];

void init() {
	for (ll i = 0; i <= MAX_N; i++) {
		dp[i] = INF;
	}
}

int main() {
	ll N;
	ll i, j;
	cin >> N;
	vll H(N);
	for (auto& e : H)cin >> e;

	dp[1] = abs(H[0] - H[1]);
	for (i = 2; i < N; i++) {
		dp[i] = min(dp[i - 2] + abs(H[i - 2] - H[i]), dp[i - 1] + abs(H[i - 1] - H[i]));
	}
	cout << dp[N - 1] << endl;	

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;

int main() {
  int N;
  cin>>N;
  cout<<"ABC"<<N<<endl;
  return 0;  
}

Measured memory_bytes: 3680
#include<iostream>
#include<bitset>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

int ord(bitset<64> a){
  li i=1;
  bitset<64> b;
  while((b=(a>>i))!=bitset<64>(0)){
    a|=b;
    i*=2;
  }
  return a.count();
}

int in(bitset<64> a,vector<bitset<64>>& space){
  for(bitset<64> x:space){
    if(ord(x)==ord(a)) a^=x;
  }
  
  return a==bitset<64>(0);
}

void normarize(vector<bitset<64>>& space){
  int n=space.size();
  rep(k,n){
    int i=n-1-k;
    rep(j,i){
      if(ord(space[i]&space[j])==ord(space[i])) space[j]^=space[i];
    }
  }
}

void add(bitset<64> a,vector<bitset<64>>& space){
  if(df)print("add",a);
  for(bitset<64>& x:space){
    if(ord(x)==ord(a)) a^=x;
    if(ord(x)<ord(a)) swap(a,x);
  }
  if(ord(a)){
    space.push_back(a);
    normarize(space);
  }
  if(df)print(space);
}

int main(){
  int q;cin >>q;
  if(df)print(q);
  //  if(df)rep(i,20)print(i,ord(i));
  rep(_,q){
    int n; cin >>n;
    vector<bitset<64>> a(n);
    rep(i,n){
      li t;
      cin >>t;a[i]=t;
    }
    if(df)print("a",a);
    string s; cin >>s;
    vector<bitset<64>> space;
    int flag=0;
    rep(j,n){
      int i=n-j-1;
      int c=s[i]-'0'; bitset<64> h=a[i];
      if(df)print("c,h",c,h);
      if(c){
        if(!in(h,space)){
          flag=1;
          break;
        }
      } else {
        add(h,space);
      }
    }
    print(flag);
    if(df)print("---------------");
  }
}


Measured memory_bytes: 3500
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      w: usize,
      mut wv: [(usize, usize); n]
   }

   let w0 = wv[0].0;
   for i in 0..n {
      wv[i].0 -= w0;
   }

   let mut dp = vec![vec![0; 301]; 101];
   for i in 0..n {
      let (w, v) = wv[i];
      for j in (0..n).rev() {
         for k in w..=300 {
            dp[j + 1][k] = max(dp[j + 1][k], v + dp[j][k - w]);
         }
      }
   }

   let mut ans = 0;
   for i in 1..=n {
      if i * w0 > w {
         break;
      }
      for j in 0..=300 {
         if i * w0 + j > w {
            break;
         }
         ans = std::cmp::max(ans, dp[i][j]);
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 2252
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
using namespace std;
using ll = long long;

int main() {
  int x;
  cin >> x;
  if(x >= 30){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  

}


Measured memory_bytes: 3632
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n  = f()[0]
    a = f()

    s = [0] * n
    for i in range(n):
        s[i] = a[i] + (s[i-1] if i>0 else 0)

    mina = abs(s[n-1]-2*s[0])

    for i in range(n-1):
        mina = min(mina, abs(s[n-1] - 2*s[i]))
    
    print(mina)

solve()


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

int main(){
  int id[3];
  int pl = 0;
  string s[3];
  
  id[0] = id[1] = id[2] = 0;
  cin >> s[0] >> s[1] >> s[2];
  while (true){
    if (s[pl][id[pl]]=='\0'){
      cout << (char)('A'+pl) << endl;
      break;
    }
    pl = s[pl][id[pl]++]-'a';
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
using namespace std;
using P=pair<int,int>;
using ll=long long;

int main(){
    int k[10]={2,2,1,3,1,1,2,1,2,1};
    int n;
    cin>>n;
    if(k[n%10]==1)cout<<"hon"<<endl;
    else if(k[n%10]==2)cout<<"pon"<<endl;
    else cout<<"bon"<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
long double pi =  3.141592653589793238;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int r;cin>>r;
	double ans = double(2*pi*r);
	cout<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x1,y1,x2,y2;
    int x3,y3,x4,y4;
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    x3=x1+y1-y2;
    y3=y1+x2-x1;
    x4=x2+y1-y2;
    y4=y2+x2-x1;
    printf("%d %d %d %d\n",x4,y4,x3,y3);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n;

int getKeta(int n)
{
	int ret = 0;
	for(;n;n/=10) ret++;
	return ret;
}

int main(void)
{
	cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(getKeta(i) % 2) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#define LOCAL0
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define xx first 
#define yy second
#define INF 0x3f3f3f3f
void read(int &p)
{
    p=0;int flag=1;char c=getchar();
    while(!isdigit(c)) {if(c=='-') flag=-1;c=getchar();}
    while(isdigit(c)) {p=p*10+c-'0';c=getchar();}p*=flag;
}
//n以内素数个数
const int maxn=1000000;
int prime[maxn];
bool is_prime[maxn+1];
int sieve(int n){
    int p=0;
    for(int i=0;i<=n;i++) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}
int cnt,a[35],m;
int main()
{
    #ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    while(cin>>a[++cnt]){
        cout<<sieve(a[cnt])<<endl;
    }
    return 0;
}


Measured memory_bytes: 4356
N,M = map(int,input().split())
solved = [0]*(N+1)
penalty = [0]*(N+1)

ac = 0
wa = 0
for _ in range(M):
    a,b = input().split()
    a = int(a)

    if not solved[a]:
        if b == "AC":
            wa += penalty[a]
            solved[a] = 1
        else:
            penalty[a] += 1

print(sum(solved),wa)

Measured memory_bytes: 10448
#include <stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    char s[n+1];
    scanf("%s",s);
    if(n%2!=0){
        printf("No");
        return 0;
    }
    for(i=0;i<n/2;i++){
        if(s[i]!=s[n/2+i]){
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <functional>
#include <stack>
#include <cmath>
#include <map>
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define llong long long

int main() {
  map<int,map<int,int> > cell;
  FOR(i,-2,12) {
    FOR(j,-2,12) {
      cell[i][j] = 0;
    }
  }
  int x,y,s;
  while(scanf("%d,%d,%d", &x, &y, &s) != EOF) {
    if(s == 1) {
      cell[x][y-1]++;
      cell[x-1][y]++;
      cell[x][y]++;
      cell[x+1][y]++;
      cell[x][y+1]++;
    }
    else if(s == 2) {
      FOR(i,-1,2) {
	FOR(j,-1,2) {
	  cell[x+i][y+j]++;
	}
      }
    }
    else if(s == 3) {
      cell[x][y-2]++;
      cell[x-2][y]++;
      cell[x+2][y]++;
      cell[x][y+2]++;
      FOR(i,-1,2) {
	FOR(j,-1,2) {
	  cell[x+i][y+j]++;
	}
      }
    }
  }

  int numzero = 0;
  int maxvalue = 0;
  REP(i,10) {
    REP(j,10) {
      if(cell[i][j] == 0) numzero++;
      if(cell[i][j] > maxvalue) maxvalue = cell[i][j];
    }
  }
  printf("%d\n%d\n",numzero,maxvalue);
  return 0;
}

Measured memory_bytes: 2636
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

string S,T;

int main(){
    cin>>S>>T;

    int ans=0;
    rep(i,S.size()) if(S[i]!=T[i]) ans++;

    cout<<ans<<endl;
}

Measured memory_bytes: 3864
#include <iostream>
#include <climits>

int cnt = 0;

void merge(int A[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1],R[n2];
    for(int i=0; i<n1; i++){
        L[i] = A[left + i];
    }
    for(int i=0; i<n2; i++){
        R[i] = A[mid + i];
    }
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;
    int i = 0;
    int j = 0;
    for(int k=left; k<right; k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i];
            i = i + 1;
        }else{
            A[k] = R[j];
            j = j + 1;
        }
    }
}

void merge_sort(int A[], int left, int right){
    if(left+1 < right){
        int mid = (left + right) / 2;
        merge_sort(A, left, mid);
        merge_sort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main(){
    int n;
    std::cin >> n;
    int A[n];
    for(int i=0;i<n;i++){
        std::cin >> A[i];
    }
    merge_sort(A,0,n);
    for(int i=0;i<n;i++){
        std::cout << A[i];
        if(i!=n-1){
            std::cout << " ";
        }else{
            std::cout << "\n";
        }
    }
    std::cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 6992
//ProblemB

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

#ifndef REDIRECT_STDIO
#define REDIRECT_STDIO {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
#endif // REDIRECT_STDIO

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

//vector
template<typename T> using vt = std::vector<T>;
template<typename T> using vvt = vt<vt<T>>;
template<typename T> using vvvt = vt<vvt<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vvvi = vvvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;
using vvvl = vvvt<ll>;
using vb = vt<bool>;
using vpii = vt<pii>;

static inline void Solve();

int main(int argc, char* argv[]) {
	REDIRECT_STDIO;

	Solve();
	return 0;
}

constexpr int MAXN = 200000;
constexpr ll MAXX = 1000000000;
constexpr ll MAXA = 1000000000;

//ProblemB
void Solve() {
	int n;
	ll x;
	cin >> n >> x;

	vl a(n, 0);
	for(int i = 0; i < n; i++) cin >> a[i];
	vl psum(n, 0);
	psum[0] = a[0];
	for(int i = 1; i < n; i++) psum[i] = psum[i-1] + a[i]; 

	ll ans = 0;
	for(auto aa : a) ans += x * 2 + aa * 5;
	for(int m = 1; m < n; m++) {
		ll tans = 0;
		tans += x * (m + n);
		tans += (psum[n-1] - psum[n-1-m]) * 2;
		for(int i = n - 1, k = 1; i >= 0; i-= m, k++) {
			auto t = i >= m ? psum[i-m] : 0;
			tans += (psum[i] - t) * (2 * k + 1);
			if(tans > ans) break;
		}
		ans = min(ans, tans);
	}

	cout << ans << endl;
}


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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = 3e5 + 100;
const int maxM = 3e5 + 10;
const long long oo = 1e15;
const int module = 1e9 + 7;
const long double du = 1e-9;

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

vector <int> a[maxN];
int F[maxN][2];
void DFS(int u, int pa) {
    F[u][0] = F[u][1] = 1;
    for (int v : a[u]) {
        if (v != pa) {
            DFS(v, u);
            F[u][0] = 1LL * F[u][0] * F[v][1] % module;
            int S = (F[v][0] + F[v][1]) % module;
            F[u][1] = 1LL * F[u][1] * S % module;
        }
    }
}
void solve() {
    int n;
    cin >> n;
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        a[u].push_back(v);
        a[v].push_back(u);
    }
    DFS(1, 0);
    cout << (F[1][0] + F[1][1]) % module;
}
int main(int argc,char *argv[]) {
    //srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ///doc();
    solve();
}


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

typedef long long ll;
#define gc getchar()
inline int read(){
	int x=0,f=1;char c=gc;
	for(;c<48||c>57;c=gc)
		if(c=='-')f=-1;
	for(;c>47&&c<58;c=gc)
		x=x*10+c-48;
	return x*f;
}
#define io read()

#define maxn 300005
char s[maxn];int n;

inline void init(){
	scanf("%d%s",&n,s+1);
	int e=0,w=0;
	for(int i=2;i<=n;++i){
		if(s[i]=='E')++e;
	}
	int ans=e;
	for(int i=2;i<=n;++i){
		if(s[i]=='E')--e;
		if(s[i-1]=='W')++w;
		ans=min(ans,w+e);
	}
	printf("%d\n",ans);
}

inline void solve(){
	
}

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

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

vector<int> res;

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

  int a[n+1];
  int b[n+1];
  a[0] = 0;
  b[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i+1];
    b[i+1] = 0;
  }

  int sum;
  for (int i = n; i > 0; i--) {
    sum = 0;
    for (int j = i + i; j <= n; j += i) {
      sum = sum ^ b[j];
    }

    b[i] = sum ^ a[i]; 
  }

  for (int i = 1; i <= n; i++) {
    if (b[i]) {
      res.push_back(i);
    }
  }

  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) {
    cout << res[i] << " ";
  }
  return 0;
}


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int flg = 0;
		int count = 0;

		int data[] = new int[n];

		for(int i = 0;i<n ; i++) {
			data[i] = scanner.nextInt();
		}

		while(flg == 0) {
			for(int i=0;i<n;i++) {
				if(data[i]%2 == 0)
					data[i]/=2;
				else flg = 1;
			}
			count ++;
		}

		System.out.println(count-1);

		scanner.close();

	}
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

const int NUM = 2019;

int main()
{
    string S;
    cin >> S;
    int N = S.size();
    vector<ll> mod(NUM), prevMod(NUM);
    mod[S[0] - '0'] = 1;
    ll ans = mod[0];
    repSE(i,1,N) {
        int Si = S[i] - '0';
        rep(j,NUM) prevMod[j] = mod[j];
        rep(j,NUM) {
            int Sj = (10 * j + Si) % NUM;
            mod[Sj] = prevMod[j];
        }
        mod[Si] += 1;
        ans += mod[0];
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3728
/**
*　　　　　　　　┏┓　　 　┏┓
* 　　　　　　　┏┛┗━━━━━━━┛┗━━━┓
* 　　　　　　　┃　　　　　　　┃ 　
* 　　　　　　　┃　　　━　　 　┃
* 　　　　　　　┃　＞　　　＜　┃
* 　　　　　　　┃　　　　　　　┃
* 　　　　　　　┃...　⌒　... 　┃
* 　　　　　　　┃　　　　　　　┃
* 　　　　　　　┗━┓　　　┏━┛
* 　　　　　　　　　┃　　　┃　　　　　　　　　　
* 　　　　　　　　　┃　　　┃
* 　　　　　　　　　┃　　　┃　　　　　　　　　　　
* 　　　　　　　　　┃　　　┃  　　　　　　
* 　　　　　　　　　┃　　　┃
* 　　　　　　　　　┃　　　┃　　　　　　　　　　　
* 　　　　　　　　　┃　　　┗━━━┓
* 　　　　　　　　　┃　　　　　　　┣┓
* 　　　　　　　　　┃　　　　　　　┏┛
* 　　　　　　　　　┗┓┓┏━┳┓┏┛
* 　　　　　　　　　　┃┫┫　┃┫┫
* 　　　　　　　　　　┗┻┛　┗┻┛
*/
#include<iostream>  
#include<cstdio>  
#include<fstream>  
#include<iomanip>
#include<algorithm>  
#include<cmath>  
#include<deque>  
#include<vector>
#include<bitset>
#include<queue>  
#include<string>  
#include<cstring>  
#include<map>  
#include<stack>  
#include<set>
#include<cassert>
#include<functional>

#define pii pair<int, int>
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define eps 0.000000001
#define mst(a,i) memset(a,i,sizeof(a))
#define all(n) n.begin(),n.end()
#define lson(x) ((x<<1))  
#define rson(x) ((x<<1)|1) 
#define inf 0x3f3f3f3f
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifdef DEBUG
	freopen("old_data.json", "r", stdin);
	freopen("1.out", "w", stdout);
#endif // DEBUG clang++ checker.cpp --target=i686-pc-mingw32 -o checker.exe
	string t;
	int a, b;
	cin >> a >> b;
	cin >> t;
	int cnt = 0;
	for (auto it : t) {
		if (!isdigit(it))cnt++;
	}
	int ok = 1;
	if (t[a] != '-' || cnt != 1)ok = 0;
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納　par[x] == x の時そのノードは根
        self.par = [i for i in range(n+1)]
        # 木の高さを格納する（初期状態では0)
        self.rank = [0] * (n+1)
        # 各々の集合の要素数（根が代表して値を持っておく）
        self.count = [1] * (n+1)

    # 検索
    def find(self, x):
        # 根ならその番号を返す
        if self.par[x] == x:
            return x
        # 根でないなら親の要素で再検索
        else:
            # 検索する過程で親を更新
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.count[y] += self.count[x]
            self.count[x] = 0
        else:
            self.par[y] = x
            self.count[x] += self.count[y]
            self.count[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属しているか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    # 属している集合の要素数
    def size(self,x):
        q = UnionFind.find(self,x)
        return self.count[q]

n, k ,l = map(int,input().split())
road = UnionFind(n)
train = UnionFind(n)

for i in range(k):
    p, q = map(int,input().split())
    road.union(p-1,q-1)

for i in range(l):
    r, s = map(int,input().split())
    train.union(r-1,s-1)

d = defaultdict(int)
a = []
for i in range(n):
    t = (road.find(i),train.find(i))
    d[t] += 1
    a.append(t)

print(*[d[i] for i in a])

Measured memory_bytes: 124588
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n;
      cin>>n;
      string s;
      cin>>s;
      vector<vector<int>>dp(n+1,vector<int>(n+1,0));
      vector<vector<int>>pre(n+1,vector<int>(n+1,0));
      dp[1][1]=1;
      pre[1]=vector<int>(n+1,1);pre[1][0]=0;
      for(int i=2;i<=n;i++){
            if(s[i-2]=='<'){
                  for(int j=1;j<=i;j++){
                        dp[i][j]=(pre[i-1][i-1]-pre[i-1][j-1]+modulo)%modulo;
                  }
            }
            else{
                  for(int j=1;j<=i;j++){
                        dp[i][j]=pre[i-1][j-1];
                  }
            }
            for(int j=1;j<=i;j++){
                  pre[i][j]=(pre[i][j-1]+dp[i][j])%modulo;
            }
      }
      cout<<pre[n][n];
}


Measured memory_bytes: 141184
#include<iostream>
using namespace std;
 
int main() {
	int n;
	cin >> n;
 
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}
 
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+7;
typedef long long ll;

struct node{
        ll a,b;
}z[MAXN];

bool cmp(node x,node y) {
        return x.a<y.a;
}

int main() {
        int n,m;
        while(cin>>n>>m) {
                for(int i=0;i<n;++i)
                        cin>>z[i].a>>z[i].b;
                sort(z,z+n,cmp);
                ll ans = 0;
                int id = 0;
                priority_queue<ll> que;
                for(int i=1;i<=m;++i) {
                        while(z[id].a<=i && id<n) {
                                que.push(z[id].b);
                                id++;
                        }
                        if(que.empty()) continue;
                        ans += que.top();
                        que.pop();
                }
                cout<<ans<<endl;
        }
        return 0;
}

Measured memory_bytes: 2936
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import qualified Data.Sequence as Seq

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)



main :: IO ()
main = do
    s <- getLine
    print $ cnt 0 0 s



cnt _ ac [] = ac
cnt 0 ac ('g':xs) = cnt 1 ac xs
cnt c ac ('g':xs) = cnt (c-1) (ac+1) xs
cnt 0 ac ('p':xs) = cnt 1 (ac-1) xs
cnt c ac ('p':xs) = cnt (c-1) ac xs





Measured memory_bytes: 4988
N=int(input())
 
flag=[0]*8
 
a=list(map(int,input().split()))
 
count=0
 
for i in range(N):
 if 1<=a[i]<=399:
  flag[0]=1
 if 400<=a[i]<=799:
  flag[1]=1
 if 800<=a[i]<=1199:
  flag[2]=1
 if 1200<=a[i]<=1599:
  flag[3]=1
 if 1600<=a[i]<=1999:
  flag[4]=1
 if 2000<=a[i]<=2399:
  flag[5]=1
 if 2400<=a[i]<=2799:
  flag[6]=1
 if 2800<=a[i]<=3199:
  flag[7]=1
 if 3200<=a[i]:
  count+=1
 
print(max(1,sum(flag)),sum(flag)+count)

Measured memory_bytes: 3064
/*
 * main.c
 *
 *  Created on: 2019/04/20
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    char S[4];
    int len = 0;
    scanf("%s", S);
    len = strlen(S);
    if(len==2) {
        printf("%s\n", S);
    } else {
        printf("%c%c%c\n", S[2],S[1],S[0]);
    }
    return 0;
}


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

int main(){

    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    ll ans = 0;
    if(x + x == W && y + y == H)ans = 1;
    printf("%.9f %d\n", 0.5 * W * H, ans);

    return 0;
}

Measured memory_bytes: 256
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();
    let t: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut ans = t.len();
    for i in 0..=(s.len() - t.len()) {
        let mut a = 0;
        for j in 0..t.len() {
            if s[i + j] != t[j] {
                a += 1;
            }
        }
        ans = min(ans, a);
    }
    ans.to_string()
}


Measured memory_bytes: 2152
a, b = map(int, input().split())
alpha = str(b)
beta = str(a)
if a >= b:
  for k in range(a - 1):
    alpha = alpha + str(b)
  print(int(alpha))
else:
  for k in range(b - 1):
    beta = beta + str(a)
  print(beta)

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

int main(){
  long k,a,b;
  bool flg=false;
  cin >> k >> a >> b;
  for(int i=0;i<1000;i++){
    if(k*i>=a && k*i<=b){
      flg=true;
      break;
    }
  }
  
    if(flg){
      cout << "OK" << endl;
    }else{
      cout << "NG" << endl;
    }
}

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

using ll = long long;
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int t[] = {500, 100, 50, 10, 5, 1};
   int n, ans;
   while (cin >> n, n) {
      n = 1000 - n, ans = 0;
      for (int i = 0; i < 6; i++) {
         ans += n / t[i];
         n %= t[i];
      }
      cout << ans << endl;
   }
   return 0;
}


Measured memory_bytes: 3084
#include <cstdio>

using namespace std;
int C[500], S[500], F[500];
int N;

int solve(int time, int sta) {
  //printf("time:%d, sta:%d", time, sta);
  if (sta == N) {
    return time;
  }
  if (time < S[sta]) {
    time = S[sta];
    return solve(time+C[sta], sta+1);
  } else {
    int amari = time % F[sta];
    if (amari == 0) {
      return solve(time+C[sta], sta+1);
    } else {
      time = time - amari + F[sta];
      return solve(time+C[sta], sta+1);
    }
  }
}

int main() {
  int i;
  scanf("%d", &N);
  for (i = 1; i < N; i++) {
    scanf("%d %d %d", &C[i], &S[i], &F[i]);
  }
  for (i = 1; i < N; i++) {
    printf("%d\n", solve(0, i));
  }
  printf("0\n");
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>


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

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    ll ans = 0;
    string s;
    vector<vector<int>> m(h, vector<int>(w, 0));

    for (int i = 0; i < h; i++) {
        cin >> s;
        for (int j = 0; j < w; j++) {
            if (s[j] == '#')
                m[i][j] = 1;
        }
    }

    int hb = (1 << h) - 1;
    int wb = (1 << w) - 1;

    for (int hh = 0; hh <= hb; hh++) {
        for (int ww = 0; ww <= wb; ww++) {
            int tmp = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (((hh >> i) & 1) == 1 && ((ww >> j) & 1) == 1) {
                        tmp += m[i][j];
                    }
                }
            }
            if (tmp == k)
                ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define ms(x, y) memset(x, y, sizeof(x))
#define pb push_back
#define pr make_pair
#define fi first
#define se second
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAX_N = 1e5 + 5;
int main() {
    ll n, k;
    scanf("%lld%lld", &n, &k);
    //n++;
    if (n < k / 2) {
        printf("0\n");
    }
    else if (k % 2 != 0) {
        printf("%lld\n", ((n / k) * (n / k) * (n / k)));
    }
    else printf("%lld\n", (n / k) * (n / k) * (n / k) + ((n - k / 2) / k + 1) * ((n - k / 2) / k + 1) * ((n - k / 2) / k + 1));
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a > k) cout << ":(" << endl;
  else cout << "Yay!" << endl;
}

Measured memory_bytes: 256