akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    string s;
    while(cin >> s, s != "#"){
        string t = "";
        for(char x : s){
            char y = ('0' + (x-'1')%3);
            t += y;
        }
        int ans = s.length();
        for(int i = 0; i < 2; i++){
            int turn = i, score = 0;
            for(int j = 1; j < t.length(); j++){
                if((t[j]-t[j-1])*(2*turn-1) >= 0){
                    turn = 1-turn;
                }else{
                    score++;
                }
            }
            ans = min(ans, score);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3248
<?php
$input = array();
while ( ! feof(STDIN) ) {
  $line = trim(fgets(STDIN));
  $input[] = $line;
}

$s = $input[0];
$k = $input[1];

$cnt = 0;
$num = 1;
for($i = 0; $i < strlen($s); $i++){
  if(substr($s, $i, 1) == 1){
    $cnt++;
  }else{
    $num = substr($s, $i, 1);
    break;
  }
}

if($k <= $cnt){
  echo 1;
}else{
  echo $num;
}
?>

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

int main() {
	int c1, c2, c3;
	while (cin >> c1) {
		cin >> c2 >> c3;

		int c[10] = { 0 }, sum = c1 + c2, count = 0;
		c[c1 - 1] = c[c2 - 1] = c[c3 - 1] = 1;
		for (int i = 0; i < 10; i++) {
			if (c[i]) continue;

			if (sum + i + 1 <= 20) count++;
		}

		if (count / 7.0 >= 0.5) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    string s;cin>>s;
    int cnt[4];
    fill(cnt,cnt+4,0);
    rep(i,0,s.size()){
        if(s[i]=='N')cnt[0]++;
        if(s[i]=='S')cnt[1]++;
        if(s[i]=='E')cnt[2]++;
        if(s[i]=='W')cnt[3]++;
    }
    if(cnt[0]>0){
        if(cnt[1]==0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(cnt[1]>0){
        if(cnt[0]==0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(cnt[2]>0){
        if(cnt[3]==0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(cnt[3]>0){
        if(cnt[2]==0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a[5];
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a, a + 3);
    if(a[0] == a[2]) return cout << "No", 0;
    for(int i = 1; i < 3; i++) if(a[i] == a[i - 1]) return cout << "Yes", 0;
    cout << "No";

    return 0;
}


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

const long long int MOD = 1000000007;

long long int powmod(long long int n,long long int r){
	if(r == 0) return 1;
	if(r == 1) return n % MOD;

	long long int tmp = powmod(n,r/2);
	if(r%2==0){
		return (tmp*tmp) % MOD;
	}else{
		return (tmp*((tmp*n)%MOD))%MOD;
	}
	
}

long long int comb(long long int n,long long int r){
	long long int res = 1;
	
	for(int i=0;i<r;++i){
		res *= (n-i);
		res %= MOD;
	}
	for(int i=1;i<=r;++i){
		res *= powmod(i,MOD-2);
		res %= MOD;
	}
	return res;
}

int main() {
	
	long long int n;
	long long int a,b;
	cin >> n >> a >> b;
	
	long long int res = powmod(2,n);
	res = res - comb(n,a) - comb(n,b) -1;
	
	res += MOD + MOD;
	res %= MOD;
	
	cout << res << endl;
	
	
	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

int main() {
	ll N;
	cin >> N;
	ll ans = 0;
	if (N % 2 == 0) {
		ll N2 = N;
		ll ans2 = 0;
		while (1) {
			N2 /= 2;
			ans2 += N2;
			if (N2 == 0)
				break;
		}
		ll N5 = N / 2;
		ll ans5 = 0;
		while (1) {
			N5 /= 5;
			ans5 += N5;
			if (N5 == 0)
				break;
		}
		ans = min(ans2, ans5);
	}
	cout << ans << endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;

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

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

int n, m; // 変数
string s, t;
int dp[3001][3001];
string ans;

void res(int i, int j) { // LCSの復元
    if (i == 0 || j == 0) return;
    if (s[i] == t[j]) {
        ans.push_back(s[i]);
        res(i-1, j-1);
    } else if (dp[i][j] == dp[i-1][j]) {
        res(i-1, j);
    } else if (dp[i][j] == dp[i][j-1]) {
        res(i, j-1);
    }
}

int rec(int i, int j) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i == 0 || j == 0) return dp[i][j] = 0;
    if (s[i] == t[j]) return dp[i][j] = rec(i-1, j-1) + 1;
    int x = rec(i-1, j);
    int y = rec(i, j-1);
    return dp[i][j] = max(x, y);
}

// void dp_solve() {
//     if (s.size() < t.size()) swap(s, t);
//     s = ' ' + s;
//     t = ' ' + t;
//     n = s.size();
//     m = t.size();
//     rep(i, n) {
//         rep(j, m) {
//             if (i == 0 || j == 0) {
//                 dp[i][j] = 0;
//                 continue;
//             } else {
//                 if (s[i] == t[j]) {
//                     dp[i][j] = dp[i-1][j-1] + 1;
//                 } else {
//                     int x = dp[i-1][j];
//                     int y = dp[i][j-1];
//                     dp[i][j] = max(x, y);
//                 }
//             }
//         }
//     }
//     res(n-1, m-1);
//     reverse(ALL(ans));
// }


int main() {
// input
    cin >> s;
    cin >> t;
// solve
    if (s.size() < t.size()) swap(s, t);
    s = ' ' + s;
    t = ' ' + t;
    n = s.size();
    m = t.size();
    rep(i, n) {
        rep(j, m) {
            dp[i][j] = -1;
        }
    }
    rec(n-1, m-1);
    res(n-1, m-1);
    reverse(ALL(ans));
// output
    cout << ans << "\n";
}

Measured memory_bytes: 38988
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define inf INT_MAX
#define MOD 1000000007
#define MEM(a,b) memset(a,(b),sizeof(a))
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;

const int N = 10;
int H, W, temp, s = 1;
vector<pii> a[N+2];
vector<int> dis(N+2,inf);

void Djikstra(){

    priority_queue<pii, vector<pii>, greater<pii> > pq;

    dis[s] = 0;
    pq.push(mp(dis[s],s));
    while(!pq.empty()){
        int u = pq.top().ss;
        pq.pop();
        for(int j=0;j<a[u].size();j++){
            int v = a[u][j].ff;
            int w = a[u][j].ss;
            if(dis[v] > dis[u]+w){
                dis[v] = dis[u]+w;
                pq.push(mp(dis[v],v));
            }
        }
    }
}

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

    cin >> H >> W;

    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin >> temp;
            a[j].pb(mp(i,temp));
        }
    }
    Djikstra();
    int MP = 0;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            cin >> temp;
            //cout << temp << " ";
            if(temp == -1 || temp == 1){continue;}else{
                MP += dis[temp];
            }
        }//cout << "\n";
    }
    cout << MP << "\n";
    return 0;
}


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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define all(A) A.begin(),A.end()

using namespace std;

/////////////////////////////////////////////////////

ll N;
ll L[1010101];
char S[40];

ll i, j, k;

int main(){
    scanf("%lld", &N);
    rep(i,0,N){
        scanf("%lld", &L[i]);
    }
    ll ans = 0;
    rep(i,0,N){
        rep(j,i+1,N){
            rep(k,j+1,N){
                set<ll> st;
                st.insert(L[i]);
                st.insert(L[j]);
                st.insert(L[k]);
                if(st.size()<3)
                    continue;
                ll mx = max(L[i], max(L[j], L[k]));
                ll ttl = L[i] + L[j] + L[k];
                if(mx<ttl-mx){
                    ++ans;
                }
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3792
#include<stdio.h>

int N;
double dp[301][301][301];

double dfs(int i, int j, int k){
  if(dp[i][j][k] != -1) return dp[i][j][k];
  if(i == 0 && j == 0 && k == 0) return dp[0][0][0] = 0;
  
  dp[i][j][k] = N;
  if(i > 0) dp[i][j][k] += dfs(i - 1, j, k) * i;
  if(j > 0) dp[i][j][k] += dfs(i + 1, j - 1, k) * j;
  if(k > 0) dp[i][j][k] += dfs(i, j + 1, k - 1) * k;
  
  dp[i][j][k] /= (double)(i + j + k);
  
  return dp[i][j][k];
}

int main(){
  scanf("%d", &N);
  
  int a[4] = {0, 0, 0, 0};
  for(int i = 0; i < N; i++){
    int in;
    scanf("%d", &in);
    a[in]++;
  }
  
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= N; j++){
      for(int k = 0; k <= N; k++){
        dp[i][j][k] = -1;
      }
    }
  }
  
  printf("%.10lf\n", dfs(a[1], a[2], a[3]));
  
  return 0;
}

Measured memory_bytes: 213248
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func sstring() string {
	scanner.Scan()
	return scanner.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	n := sint64()
	m := sint64()
	k := sint64()
	a := make([]int64, n+1)
	for i := 1; i < len(a); i++ {
		a[i] = a[i-1] + sint64()
	}
	b := make([]int64, m+1)
	for i := 1; i < len(b); i++ {
		b[i] = b[i-1] + sint64()
	}
	printf("%d\n", sol(a,b,k))
}

func sol(a, b []int64, k int64) int64 {
	maxSoFar := int64(0)
	pb := 0
	for pb < len(b) && b[pb] <= k {
		pb++
	}
	pb--
	for i := range a {
		for pb >= 0 && b[pb] + a[i] > k {
			pb--
		}
		if pb < 0 {
			break
		}
		maxSoFar = max(maxSoFar, int64(i)+int64(pb))
	}
	return maxSoFar
}


Measured memory_bytes: 7172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
int N, M;
vector <pair<int, int>> queries;
int A[100005];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin >> N >> M;
 
    for(int i = 1; i <= N; i++)
        cin >> A[i];
 
    for(int i = 1; i <= M; i++) {
        int a, c;
        cin >> a >> c;
        queries.emplace_back(c, a);
    }
    sort(A + 1, A + N + 1);
 
    sort(queries.begin(), queries.end());
 
    int idx = 1;
    for(int i = queries.size() - 1; i >= 0; i--) {
        for(int j = 0; j < queries[i].second && idx <= N; j++) {
            A[idx] = max(A[idx], queries[i].first);
            idx++;
        }
    }
 
    long long ans = 0;
    for(int i = 1; i <= N; i++)
        ans += A[i];
    cout << ans;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,m,k,ans,n,a,b,g,h;
    	cin>>h>>a;
    	ans=h/a;
    	h=h-(h/a)*a;
    	if(h>0)
    	ans++;
    	cout<<ans;
    } 
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner( System.in );
		int n = sc.nextInt();
		
		int[] S = new int[13];
		int[] H = new int[13];
		int[] C = new int[13];
		int[] D = new int[13];
		
		int NG = 0;
		int OK = 1;
		
		for(int i = 0; i < 13; i++) {
			S[i] = NG;
			H[i] = NG;
			C[i] = NG;
			D[i] = NG;
			
		}
		
		for(int i = 0; i < n; i++){
			String suit = sc.next();
			int num		= sc.nextInt();
			num -= 1;
			
			if ( suit.equals("S") ) {
				S[num] = OK;
				
			} else if ( suit.equals("H") ) {
				H[num] = OK;
				
			} else if ( suit.equals("C") ) {
				C[num] = OK;
				
			} else if ( suit.equals("D") ) {
				D[num] = OK;
				
			}
			
		}
		
		for(int i = 0; i < 13; i++){
			if ( S[i] == NG ) {
				System.out.println("S "+(i+1));
			}
			
		}
		for(int i = 0; i < 13; i++){
			if ( H[i] == NG ) {
				System.out.println("H "+(i+1));
			}
			
		}
		
		for(int i = 0; i < 13; i++){
			if ( C[i] == NG ) {
				System.out.println("C "+(i+1));
			}
			
		}
		
		for(int i = 0; i < 13; i++){
			if ( D[i] == NG ) {
				System.out.println("D "+(i+1));
			}
			
		}
		
		
		
		
		
	}
	
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int h[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>h[i];
	}
	int ans=0,now=0;
	for (int i = 0; i < n-1; ++i)
	{
		if (h[i]>=h[i+1])
		{
			++now;
			ans=max(ans,now);
		}
		else
		{
			now=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    ll n; std::cin >> n;
    if (n < 27) {
        std::cout << char('a' + n - 1) << "\n";
        return 0;
    }
    string ans;
    --n;
    while (n >= 0) {
        ans += 'a' + (n % 26);
        n /= 26;
        n--;
    }
    reverse(rng(ans));
    std::cout << ans << "\n";
}


Measured memory_bytes: 3624
N = int(input())
numA = 0
numB = 0
cnt = 0
sm = 0

for i in range(N):
    mm = input()
    if mm[0]=="B":
        numB += 1
    if mm[-1]=="A":
        numA += 1
    if mm[0]=="B" and mm[-1]=="A":
        sm += 1

    for i in range(len(mm)):
        if mm[i:i+2]=="AB":
            cnt += 1

if sm == numA and sm==numB and sm>0:
    numA -= 1
    numB -= 1
mm2 = min(numA,numB,N-1)
print(cnt+mm2)

Measured memory_bytes: 3064
N=int(input())
if N%4==0 or N%7==0:
	print("Yes")
else:
	i=0
	while (N-7*i)>0:
		if ((N-7*i)%7==0 or (N-7*i)%4==0):
			print("Yes")
			break
		if(N-7*i<=6):
			print ("No")
		i+=1

Measured memory_bytes: 3060
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,m=parseMap(split(readline()))
    ans=min(n,div(m,2))
    ans+=div(m-ans*2,4)
    println(ans)
end
main()

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

int main() {
  int A, B, N, M, sum;
  cin >> N;
  A = 1;
  int min = 100;
  
  while (A <= N / 2) {
    sum = 0;
    M = A;
    while (M > 0) {
      sum += M % 10;
      M /= 10;
    }
    B = N - A;
    M = B;
    while (M > 0) {
      sum += M % 10;
      M /= 10;
    }
    if (sum < min) min = sum;
    A++;
  }
  cout << min << endl;
}

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

int main() {
  int n; cin >> n;
  int ans;
  if (n%111 == 0) {
    ans = n;
  } else {
    int a = n/111;
    ans = (a+1)*111;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#define MOD 1000000007
using namespace std;
int n,len;
char s[5005];
inline void add(int &x,int a)
{
	x+=a;
	if(x>=MOD)x-=MOD;
}
namespace Task1{
	const int MAXN = 305;
	int f[2][MAXN][MAXN];
	inline int solve()
	{
		f[0][0][0]=1;
		for(int i=1;i<=n;++i){
			memset(f[i&1],0,sizeof(f[i&1]));
			for(int j=0;j<=len;++j)
				for(int k=0;k<=i-j;++k){
					int t=f[(i&1)^1][j][k];
					if(!t)continue;
					if(k>0){
						add(f[i&1][j][k+1],t*2%MOD);
						add(f[i&1][j][k-1],t);
					}else{
						if(j<len){
							add(f[i&1][j+1][0],t);
							add(f[i&1][j][1],t);
							add(f[i&1][max(j-1,0)][0],t);
						}else{
							add(f[i&1][j][1],t*2%MOD);
							add(f[i&1][max(j-1,0)][0],t);
						}
					}					
				}
		}
		return f[n&1][len][0];
	}
}
namespace FullMark{
	const int MAXN = 5005;
	int f[2][MAXN];
	inline int solve()
	{
		f[0][0]=1;
		for(int i=1;i<=n;++i){
			memset(f[i&1],0,sizeof(f[i&1]));
			for(int j=0;j<=i;++j){
				int t=f[(i&1)^1][j];
				add(f[i&1][j+1],t*2%MOD);
				add(f[i&1][max(j-1,0)],t);
			}
		}
		int ret=f[n&1][len];
		for(int i=1;i<=len;++i)
			ret=(long long)ret*500000004%MOD;
		return ret;
	}
}
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	len=strlen(s+1);
	if(n<=300)cout<<Task1::solve()<<endl;
	else cout<<FullMark::solve()<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  string PL,CL,NL;
  int H,W,count=0;
  char CC;
  cin >> H >> W >> CL >> NL;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(CL.at(j)!='#'){
        if(i!=0){
          if(PL.at(j)=='#') count++;
          if(j!=0) if(PL.at(j-1)=='#') count++;
          if(j!=W-1) if(PL.at(j+1)=='#') count++;
        }
        if(i!=H-1){
          if(NL.at(j)=='#') count++;
          if(j!=0) if(NL.at(j-1)=='#') count++;
          if(j!=W-1) if(NL.at(j+1)=='#') count++;
        }
        if(j!=0) if(CL.at(j-1)=='#') count++;
        if(j!=W-1) if(CL.at(j+1)=='#') count++;
        if(count == 0) CL.at(j) = '0';
        if(count == 1) CL.at(j) = '1';
        if(count == 2) CL.at(j) = '2';
        if(count == 3) CL.at(j) = '3';
        if(count == 4) CL.at(j) = '4';
        if(count == 5) CL.at(j) = '5';
        if(count == 6) CL.at(j) = '6';
        if(count == 7) CL.at(j) = '7';
        if(count == 8) CL.at(j) = '8';
        count = 0;
      }     
    }
    cout << CL << endl;
      PL = CL;
      CL = NL;
      cin >> NL;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <map>
using namespace std;

typedef pair<int,int> pii;

int n, m, x;
const int MAX_N = 1000;
const int MAX_M = 100;

int table[MAX_M];

int main() {
	while(cin>>n>>m, n|m) {
		for(int j=0; j<m; j++) table[j] = 0;
		for(int i=0; i<n; i++) {
			for(int j=0; j<m; j++) {
				cin >> x;
				if(x == 1) table[j]++;
			}
		}

		multimap<int, int, greater<int> > rank;
		for(int j=0; j<m; j++) {
			rank.insert(pii(table[j], j+1));
		}

		multimap<int,int>::const_iterator iter = rank.begin();
		while(iter != rank.end()) {
			int r = (*iter).second;
			if(iter == rank.begin()) printf("%d", r);
			else printf(" %d", r);
			++iter;
		}
		printf("\n");
	}
}

Measured memory_bytes: 916
let () =
  let rec aux u =
    let i = read_line () in
    let a,op,b = Scanf.sscanf i "%d %s %d" (fun a op b ->  a,op,b) in
    if op="?" then ()
    else aux (print_endline (string_of_int
                               (if op = "+"      then a+b
                                else if op = "-" then a-b
                                else if op = "*" then a*b
                                else a/b)))
  in aux ()

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

int main() {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 1; i <= n; i *= 6) {
    s.insert(i);
  }
  for (int i = 1; i <= n; i *= 9) {
    s.insert(i);
  }
  vector<int> dp(n + 1, n);
  dp[0] = 0;
  for (int i = 1; i <= n; i++) {
    for (auto e : s) {
      if (i - e >= 0) {
        dp[i] = min(dp[i], dp[i - e] + 1);
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}


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

int main(){
	int height;
	vector<int> heights;
	while(cin >> height)
		heights.push_back(height);
	sort(heights.begin(), heights.end());
	cout << heights[9] << endl;
	cout << heights[8] << endl;
	cout << heights[7] << endl;
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<climits>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<queue>
#include<math.h>

int main(){
	int a, b;
	int ans;

	std::cin>>a>>b;

	ans= (b-1)/(a-1);

	if((b-1)%(a-1)!=0)
		ans++;

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

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int N=1005;
typedef long long ll;

int n,a[N],L,R;
int num,x[N];

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	
	ll ans=-1e18,sum;
	for (int l=1;l<=n;l++)
	{
		sum=a[l];
		if (sum>ans) ans=sum,L=R=l;
		for (int r=l+2;r<=n;r+=2) 
		{
			if (sum+a[r]>ans) ans=sum+a[r],L=l,R=r;
			sum+=max(a[r],0);
		}
	}


	printf("%lld\n",ans);
	
	
	int l=L,r=R;
	
	while (n>r) x[++num]=n,n--;
	for (int i=1;i<l;i++) x[++num]=1;
	n=n-l+1;
	for (int i=1;i<=n;i++) a[i]=a[i+l-1];
	
	
	for (int i=3;i<n;i+=2) 
	if (a[i]<0)
	{
		x[++num]=i;
		for (int j=i;j<=n;j++) a[j]=a[j+2];
		n-=2;i-=2;
	}
	
	for (int i=1;i<=(n-1)/2;i++) x[++num]=2;
	
	printf("%d\n",num);
	for (int i=1;i<=num;i++) printf("%d\n",x[i]);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
vector<P<ll>> prime_fact(ll x) {
	vector<P<ll>> factor;
	for (ll i = 2; i * i <= x; i++) {
		if (x % i != 0) continue;
		ll res = 0;
		while (x % i == 0) {
			res++;
			x /= i;
		}
		factor.push_back(P<ll>(i, res));
	}
	if (x != 1) factor.push_back(P<ll>(x, 1));
	return factor;
}
VL divisor(ll x) {
	VL div;
	div.push_back(x);
	for (ll i = 2; i * i <= x; i++) {
		if (x % i != 0) continue;
		if (i * i != x) div.push_back(x / i);
		div.push_back(i);
	}
	sort(all(div));
	return div;
}
int main(){
	int n, m;
	cin >> n >> m;
	VL div = divisor(m);
	int ans = 1;
	for (auto c : div) {
		bool amari = false;
		int tmp = m / c;
		int tmp2 = tmp / n;
		if (n > tmp) continue;
		if (tmp % n) amari++;
		int tmp3 = (amari) ? gcd(c * tmp2, c * tmp2 + c) : c;
		chmax(ans, tmp3);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<int,pi> pii;
map<int,int> mp;
ll f[100050];
ll power(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b/2);
    c = (c*c)%mod;
    if (b&1) return (c*a)%mod;
    return c;
}
ll comb(ll a,ll b) {
    ll c = (f[b]*f[a-b])%mod;
    return (f[a] * power(c,mod-2))%mod;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    f[0] = 1;
    for (int i=1;i<100050;i++) {
        f[i] = ((ll)i*f[i-1])%mod;
    }
    int n,m;
    cin>>n>>m;
    for (int i=2;i<=sqrt(m);i++) {
        while (m%i==0) {
            mp[i]++;
            m /= i;
        }
    }
    if (m>1) mp[m]++;
    ll ans = 1;
    for (auto it:mp) {
        ans = (ans * comb(it.second + n-1,n-1))%mod;
    }
    cout<<ans;
}


Measured memory_bytes: 1024
# coding: utf-8
N=int(input())
S=list(input())

W=[0 for i in range(N)]
E=[0 for i in range(N)]


for i in range(N):
    if S[i]=="W":
        if i==0:
            W[i]=1
        else:
            W[i]=W[i-1]+1
    else:
        if i!=0:
            W[i]=W[i-1]
    
    if S[-(i+1)]=="E":
        if i==0:
            E[-(i+1)]=1
        else:
            E[-(i+1)]=E[-i]+1
    else:
        if i!=0:
            E[-(i+1)]=E[-i]

cost=min(W[N-2],E[1])

for i in range(1,N-1):
    cost = min(cost,W[i-1] + E[i+1])

print(cost)

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

int main() {
    vector<int> A(3);
    cin >> A[0] >> A[1] >> A[2];
    sort(A.begin(), A.end(),greater<>());
    cout << A[0] * 10 + A[1] + A[2] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main(void){
	int A, B, C;	cin >> A >> B >> C;
	if (B <= A)	{
		int tmp = A;
		A = B;
		B = tmp;
	}

	if ((A <= C) && (C <= B))	{
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns #-}

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

solve :: String -> Int
solve s = ans where
  (_, _, _, ans) = foldl f (1, 0, 0, 0) s
  f (!n, !a, !ab, !abc) 'A' = (n, n `add` a, ab, abc)
  f (!n, !a, !ab, !abc) 'B' = (n, a, ab `add` a, abc)
  f (!n, !a, !ab, !abc) 'C' = (n, a, ab, abc `add` ab)
  f (!n, !a, !ab, !abc) '?' = (mul3 n, mul3 a `add` n, mul3 ab `add` a, mul3 abc `add` ab)
  f _ _ = undefined

add :: Int -> Int -> Int
add x y = (x + y) `mod` modN

mul3 :: Int -> Int
mul3 x = (x * 3) `mod` modN

modN :: Int
modN = 10 ^ 9 + 7


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

int main()
{
  int n,m,*x,*d,ans=0;
  cin >> n >> m;
  x = new int[m];
  d = new int[m-1];
  
  for(int i=0;i<m;i++)cin >> x[i];
  sort(x,x+m);
  for(int i=0;i<m-1;i++)d[i] = x[i+1] - x[i];
  sort(d,d+m-1);
  
  for(int i=0;i<m-n;i++)ans+=d[i];
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let S = cin.getStr();
    let N = S.length;
    const ABC = "ABC";
    const MOD = 1e9 + 7;
    let dp = new Array(N + 1).fill(0).map(() => new Array(3 + 1).fill(0));
    for (let i = N; i >= 0; --i) {
        for (let j = 3; j >= 0; --j) {
            if (i == N) {
                dp[i][j] = (j == 3 ? 1 : 0);
            } else {
                dp[i][j] = dp[i + 1][j] * (S[i] == '?' ? 3 : 1);
                if (j < 3 && (S[i] == '?' || S[i] == ABC[j])) {
                    dp[i][j] += dp[i + 1][j + 1];
                }
                dp[i][j] %= MOD;
            }
        }
    }
    console.log(dp[0][0]);
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
ll vl[2010][2010] = {}, vr[2010][2010] = {}, vu[2010][2010] = {}, vd[2010][2010] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W;
    cin >> H >> W;
    string S[2010];
    rep(i,0,H) cin >> S[i];
    rep(i,0,H){
        ll v = 0;
        rep(j,0,W){
            if(S[i][j] == '#'){
                v = 0;
            }else{
                v++;
            }
            if(j != W-1) vl[i][j+1] = v; 
        }
        v = 0;
        rrep(j,W-1,0){
            if(S[i][j] == '#'){
                v = 0;
            }else{
                v++;
            }
            if(j != 0) vr[i][j-1] = v; 
        }

    }
    rep(j,0,W){
        ll v = 0;
        rep(i,0,H){
            if(S[i][j] == '#'){
                v = 0;
            }else{
                v++;
            }
            if(i != H-1) vu[i+1][j] = v;

        }
        v = 0;
        rrep(i,H-1,0){
            if(S[i][j] == '#'){
                v = 0;
            }else{
                v++;
            }
            if(i != 0) vd[i-1][j] = v;
        }
    }
    ll ans = 0;
    rep(i,0,H){
        rep(j,0,W){
            if(S[i][j] == '.'){
               ll tt = vl[i][j] + vr[i][j] + vu[i][j] + vd[i][j] + 1;
               ans = max(ans, tt); 
            }
        }
    }
    print(ans);
    
}

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

int main(){
  
  int A, B, C;
  
  cin >> A >> B >> C;
  
  if (A + B + C < 22) {
    
    cout << "win" << endl;
  }else{
    
    cout << "bust" << endl;
  }
  
  return 0;
}

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

ll fac[510000], finv[510000], inv[510000];

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

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    ll res = N;
    for(ll i = 2;i * i <= N;i++){
        if(N % i == 0){
            res -= res / i;
            while(N % i == 0){
                N /= i;
            }
        }
    }
    if(N != 1)res -= res / N;
    cout << res << endl;
}


Measured memory_bytes: 3220
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

pii a[150000];

int main() {
    int N;
    cin >> N;
    multiset<pii> sta;
    multiset<pii> stb;
    multiset<pii> staa;
    multiset<pii> stbb;
    for (int i = 0; i < N; i++) {
        int L, R;
        cin >> L >> R;
        a[i] = pii(L, R);
        sta.insert(pii(L, i));
        stb.insert(pii(R, i));
        staa.insert(pii(L, i));
        stbb.insert(pii(R, i));
    }
    ll ans = 0;
    ll now = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            auto itr = sta.end();
            itr--;
            pii p = *itr;
            int inum = p.second;
            //cout << inum << endl;
            if (now < p.first) {
                ans += abs(p.first - now);
                now = p.first;
            }
            //cout << now << endl;
            sta.erase(p);
            stb.erase(pii(a[inum].second, inum));
        } else {
            auto itr = stb.begin();
            pii p = *itr;
            int inum = p.second;
            //cout << inum << endl;
            if (now > p.first) {
                ans += abs(p.first - now);
                now = p.first;
            }
            //cout << now << endl;
            stb.erase(p);
            sta.erase(pii(a[inum].first, inum));
        }
    }
    ans += abs(0 - now);
    ll ansb = 0;
    now = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 != 0) {
            auto itr = staa.end();
            itr--;
            pii p = *itr;
            int inum = p.second;
            //cout << inum << endl;
            if (now < p.first) {
                ansb += abs(p.first - now);
                now = p.first;
            }
            //cout << now << endl;
            staa.erase(p);
            stbb.erase(pii(a[inum].second, inum));
        } else {
            auto itr = stbb.begin();
            pii p = *itr;
            int inum = p.second;
            //cout << inum << endl;
            if (now > p.first) {
                ansb += abs(p.first - now);
                now = p.first;
            }
            //cout << now << endl;
            stbb.erase(p);
            staa.erase(pii(a[inum].first, inum));
        }
    }
    ansb += abs(0 - now);
    cout << max(ans, ansb) << endl;
}


Measured memory_bytes: 21760
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>


int main(){

  int A, B;
  scanf("%d", &A);
  scanf("%d", &B);
  std::cout << A*B << std::endl;
  return 0;
}
 

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using ll = long long;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using ld = long double;
using ui = unsigned int;
using ull = unsigned long long;
using ui128 = __uint128_t;
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define lc ind<<1
#define rc ind<<1|1
const int MN = 2e6 + 2, LOG = 17, INF = 1e8;
int main () { 
	ll n,m;
	scanf ("%lld %lld",&n,&m); m /= 2;
	if (m <= n) printf ("%lld\n",m);
	else printf ("%lld\n",(n+m)/2);
    return 0;
}
//n += x, m -= x


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
int n,u,v;
vector<int> G[N];
vector<int> dist(int x)
{
	vector<int> res(n,1<<20);
	res[x]=0;
	queue<int> q;
	q.push(x);
	while(!q.empty())
	{
		int r=q.front();q.pop();
		for(int rr:G[r])
		{
			if(res[rr]>res[r]+1)
			{
				res[rr]=res[r]+1;
				q.push(rr);
			}
		}
	}
	return res;
}
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>u>>v;
rep(i,0,n-1)
{
	int x,y;
	cin>>x>>y;
	x--;y--;
	G[x].push_back(y);
	G[y].push_back(x);
}
vector<int> s=dist(u-1),t=dist(v-1);
int ans=0;
for(int i=0;i<n;i++)
{
	if(s[i]<t[i])
	ans=max(ans,s[i]+(t[i]-s[i])-1);
}
cout<<ans;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define printii(x)  for(auto it=x.begin();it!=x.end();it++) cout<<*it.F<<' '<<*it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double x;
    cout.precision(8);
    cin>>x;
    long double y = x/3;
    cout<<fixed<<y*y*y;
    

    return 0;
}







Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::VecDeque;
#[derive(Copy, Clone)]
struct Node {
	wall: bool,
	c: usize,
	x: usize,
	y: usize,
}

fn main() {
	input! {
		h: usize,
		w: usize,
		c: (usize, usize),
		d: (usize, usize),
		s: [Chars; h],
	}

	let inf = 99999999999999usize;

	let mut m = vec![vec![Node {wall: false, c: inf, x: 0, y: 0}; w]; h];
	for i in 0..h {
		for j in 0..w {
			m[i][j].x = j;
			m[i][j].y = i;
			if s[i][j] == '#' {
				m[i][j].wall = true;
			}
		}
	}

//	m[c.0-1][c.1-1].t = true;
	m[c.0-1][c.1-1].c = 0;
	let mut q = VecDeque::new();
	let n = m[c.0-1][c.1-1];
	q.push_back(n);
	while q.len() > 0 {
		let tmp = q.pop_front().unwrap();
		// 上
		if 0 < tmp.y && !m[tmp.y-1][tmp.x].wall {
			if m[tmp.y-1][tmp.x].c > tmp.c {
				m[tmp.y-1][tmp.x].c = tmp.c;
				let n = m[tmp.y-1][tmp.x];
				q.push_front(n);
			}
		}
		if tmp.y < h-1 && !m[tmp.y+1][tmp.x].wall {
			if m[tmp.y+1][tmp.x].c > tmp.c {
				m[tmp.y+1][tmp.x].c = tmp.c;
				let n = m[tmp.y+1][tmp.x];
				q.push_front(n);
			}
		}
		if 0 < tmp.x && !m[tmp.y][tmp.x-1].wall {
			if m[tmp.y][tmp.x-1].c > tmp.c {
				m[tmp.y][tmp.x-1].c = tmp.c;
				let n = m[tmp.y][tmp.x-1];
				q.push_front(n);
			}
		}
		if tmp.x < w-1 && !m[tmp.y][tmp.x+1].wall {
			if m[tmp.y][tmp.x+1].c > tmp.c {
				m[tmp.y][tmp.x+1].c = tmp.c;
				let n = m[tmp.y][tmp.x+1];
				q.push_front(n);
			}
		}

		for i in 0..5 {
			if 2 > tmp.y + i || tmp.y + i > h-1+2 {
				continue;
			}
			for j in 0..5 {
				if 2 > tmp.x + j || tmp.x + j > w-1+2 {
					continue;
				}
				if i == 2 && j == 2 {
					continue;
				}
				if !m[tmp.y+i-2][tmp.x+j-2].wall {
					if m[tmp.y+i-2][tmp.x+j-2].c > tmp.c + 1 {
						m[tmp.y+i-2][tmp.x+j-2].c = tmp.c + 1;
						let n = m[tmp.y+i-2][tmp.x+j-2];
						q.push_back(n);
					}
				}
			}
		}
	}
	if m[d.0-1][d.1-1].c == inf {
		println!("-1");
	}
	else {
		println!("{}", m[d.0-1][d.1-1].c);
	}
}



Measured memory_bytes: 38612
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;

void main() {
  string str = readln.chomp;
  string[2] ss = ["eraser", "dreamer"];

  // array.lengthの返り値の型はulongなので
  // intに代入しようとすると(dmd64 v2.070.1では)CEになる
  int p = str.length.to!int;

  while (p > 0) {
    bool flag = false;

    if (str[p - 1] == 'r') {
      for (int i = 0; i < 2; ++i) {
        if (p < ss[i].length.to!int) {
          break;
        }

        if (ss[i] == str[(p - ss[i].length.to!int)..p]) {
          p -= ss[i].length.to!int;
          flag = true;
          break;
        }
      }
    }
    else if (str[p - 1] == 'e' && p >= 5) {
      if (str[(p - 5)..p] == "erase") {
        flag = true;
        p -= 5;
      }
    }
    else if (str[p - 1] == 'm' && p >= 5) {
      if (str[(p - 5)..p] == "dream") {
        flag = true;
        p -= 5;
      }
    }

    if (!flag) {
      writeln("NO");
      return;
    }
  }

  writeln("YES");

  return;
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<ll> vll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define forn(s, e) for(int i=s; i<e; ++i)
#define pb push_back
#define INF 1000000000

int main(){
	IO
	int n, m;
	cin >> n >> m;

	int val;
	int sum = 0;
	for(int i=0; i<m; ++i){
		cin >> val;
		sum+=val;
	}

	sum = n - sum;
	sum < 0 ? cout << -1 << endl : cout << sum <<endl;
	return 0;
}

Measured memory_bytes: 3656