akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
    char op = 0;
    int last = 0;
    string s;
    while( cin >> s ) {
        if ( s[0] == '+' || s[0] == '-' || s[0] == '*' || s[0] == '/' || s[0] == '=' ) {
            op = s[0];
            if ( op == '=' ) {
                cout << last << endl;
                
                op = 0;
                last = 0;
            }

        } else {
            int const v = stoi( s.c_str() );
            if ( op != 0 ) {
                switch( op )
                {
                case '+':
                    last += v;
                    break;
                case '-':
                    last -= v;
                    break;
                case '*':
                    last *= v;
                    break;
                case '/':
                    last /= v;
                    break;
                }
                op = 0;
            } else {
                last = v;
            }
        }
    }
}

Measured memory_bytes: 1204
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
-- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Monad.Primitive
import           Control.Applicative
import           Debug.Trace
import           Text.Printf

main = do
  n <- getInt
  putStrLn $ map digitToAlpha $ to26 n

to26 n = helpf n []
  where
    helpf m list
      | (m-1) < 26 = ((m-1) `mod` 26) : list
      | otherwise = helpf ((m-1) `div` 26) (((m-1) `mod` 26) : list)

digitToAlpha 0  = 'a'
digitToAlpha 1  = 'b'
digitToAlpha 2  = 'c'
digitToAlpha 3  = 'd'
digitToAlpha 4  = 'e'
digitToAlpha 5  = 'f'
digitToAlpha 6  = 'g'
digitToAlpha 7  = 'h'
digitToAlpha 8  = 'i'
digitToAlpha 9  = 'j'
digitToAlpha 10 = 'k'
digitToAlpha 11 = 'l'
digitToAlpha 12 = 'm'
digitToAlpha 13 = 'n'
digitToAlpha 14 = 'o'
digitToAlpha 15 = 'p'
digitToAlpha 16 = 'q'
digitToAlpha 17 = 'r'
digitToAlpha 18 = 's'
digitToAlpha 19 = 't'
digitToAlpha 20 = 'u'
digitToAlpha 21 = 'v'
digitToAlpha 22 = 'w'
digitToAlpha 23 = 'x'
digitToAlpha 24 = 'y'
digitToAlpha 25 = 'z'


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons
getInt = readLn :: IO Int
getInt2Tuple = (\vec -> (vec VU.! 0, vec VU.! 1)) <$> getIntVector
getInt3Tuple = (\vec -> (vec VU.! 0, vec VU.! 1, vec VU.! 2)) <$> getIntVector


Measured memory_bytes: 3896
N = int(input())

ans = 0
ten_lst = [(10 ** i - 1) // 9 for i in range(1, 7)]
for i in range(1, N + 1):
    str_i = str(i)
    l = len(str_i)
    if str_i[-1] == '0':
        continue
    elif str_i[0] == str_i[-1]:
        # 131など
        if l == 1:
            ans += 1
        elif l == 2:
            ans += 3
        else:
            ans += 3 + 2 * (ten_lst[l - 3] + int(str_i[1:-1]))
    elif int(str_i[0]) > int(str_i[-1]):
        # 312など
        ans += 2 * ten_lst[l - 2]
    elif l >= 3:
        # 213など
        ans += 2 * ten_lst[l - 3]
print(ans)


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

int main(){
  string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(i%2==0&&s.at(i)!='R'&&s.at(i)!='U'&&s.at(i)!='D'){
      cout << "No" << endl;
      return 0;
    }
     if(i%2==1&&s.at(i)!='L'&&s.at(i)!='U'&&s.at(i)!='D'){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
///cREATED bY BERNARB.01
#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
	cin.tie(0);
    double a, b;
    cin >> a >> b;
    for(double i=b*10; i<=1e5; i++){
        if(floor(i*0.08)==a&&floor(i*0.1)==b) return cout << i, 0;
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, a, b, c, d, e int64
	fmt.Scan(&n, &a, &b, &c, &d, &e)
	arr := []int64{a, b, c, d, e}
	times := make([]int64, 5)
	for i := 0; i < 5; i++ {
		if n % arr[i] == 0 {
			times[i] = n / arr[i]
		} else {
			times[i] = (n / arr[i]) + 1
		}
	}

	for i := 0; i < 4; i++ {
		if times[i] > times[i + 1] {
			times[i + 1] = times[i]
		}
	}

	for i := 0; i < 5; i++ {
		times[i] += int64(i)
	}
	fmt.Println(times[4])
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="Sunny") cout<<"Cloudy"<<endl;
  else if(s=="Cloudy") cout<<"Rainy"<<endl;
  else if(s=="Rainy") cout<<"Sunny"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int n;

vector<vi> g;
int visited[1001];

int dfs(int v){
	if(visited[v]) return 0;
	visited[v] = 1;
	int res = 1;
	FOR(u, g[v]) res += dfs(*u);
	return res;
}

int toOdd(int even, int odd);
int toEven(int even, int odd){
	if(even+odd == 2) return !!even;
	return (odd >= 2) ? !toOdd(even+1, odd-2) : !toOdd(even-1, odd);
}
int toOdd(int even, int odd){
	if(even+odd == 2) return !even;
	return (even >= 1) ? !toEven(even-1, odd) : !toEven(even+1, odd-2);
}

main(){
	ios::sync_with_stdio(false);
	cin >> n;
	g.resize(n);
	int e = 0;
	REP(i, n)REP(j, n){
		char c;
		cin >> c;
		if(i < j && c == 'Y'){
			g[i].push_back(j);
			g[j].push_back(i);
			e ++;
		}
	}
	vi par(2);
	REP(i, n) if(visited[i] == 0) par[dfs(i)&1] ++;
	int rest = n*(n-1)/2-e;
	int ans = (rest&1) ? toEven(par[0], par[1]) : toOdd(par[0], par[1]);
	cout << (ans ? "Taro" : "Hanako") << endl;
	return 0;
}

Measured memory_bytes: 1264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		while (true) {
			int tmpA = sc1.nextInt();
			int tmpB = sc1.nextInt();
			if (tmpA == 0 && tmpB == 0) {
				break;
			}
			else if (tmpA > tmpB){
				System.out.println(tmpB + " " + tmpA);
			}
			else {
				System.out.println(tmpA + " " + tmpB);
			}
		}

		sc1.close();

	}

}


Measured memory_bytes: 35316
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

int main(){
	long long K, X;
	cin >> K >> X;
	if(K*500>=X) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3600
a,b,k=map(int,input().split())
for i in range(k):
    if i%2 == 0:
        if a%2 != 0:
            a -= 1
        a //= 2
        b += a
    else:
        if b%2 != 0:
            b -= 1
        b //= 2
        a += b
print(a, b)

Measured memory_bytes: 3060
/******************************************
* AUTHOR : SHUBHAM KUMAR *
* NICK : { "CODECHEF" : "SCHELEON",
		   "CODEFORCES" : "SCH3130N" } *
* INSTITUTION : BIT MESRA *
******************************************/

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define large 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mk make_pair
#define sd(x) scanf("%lld",&x)
#define rep0(i,b) for(int i=0;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll, ll>
#define ld long double

const ll inf = 1e18L;
ll ModE(ll x, unsigned ll y, ll p = MOD)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {   if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

using namespace std;

ll v[100],w[100],n,W;
ll dp[100][large];
ll solve(int i, ll value){
    if(i<0){
        if(value==0)
            return 0;
        return inf;
    }
    if(dp[i][value]!=-1)
        return dp[i][value];
    if(value - v[i]>=0)
        dp[i][value] = min(solve(i-1, value), w[i] + solve(i-1, value - v[i]));
    else
         dp[i][value] = solve(i-1, value);
    //cout<<i<<" "<<value<<" => "<<dp[i][value]<<"\n";
    return dp[i][value];
}

int main() {
	//#ifndef _DEBUG
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
   // freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output.txt", "w", stdout);
	#endif
	fastio
    cin>>n>>W;
    ll sum_value=0;
    rep0(i,n){
        cin>>w[i]>>v[i];
        //sum_value += v[i];
    }
    rep0(ii, n){
        rep0(jj, large){
            dp[ii][jj] = -1;
        }
    }
    solve(n-1, sum_value);
    ll ans=0,minc;
//    for(int i=0;i<n;i++)
//    cout<<dp[i][90]<<" ";
//    cout<<endl;
    for(ll i= large-5; i>=0; i--){
        minc=solve(n-1, i);
        if(minc <= W){
            ans = i;
            break;
        }
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 78336
"use strict";

const main = arg => {
  arg = arg.trim().split(/\s+/).map(x=>x-0);
  const N = arg.shift();
  const A = [];
  const B = [];
  
  while(arg.length>0){
    B.push(arg.pop());
    A.push(arg.pop());
  }
  
  const M = Math.max.apply(null,A);
  const S = B[A.indexOf(M)];

  console.log(M + S);
}
main(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 56488
use std::io::Read;


fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let q = it.next().unwrap().parse::<usize>().unwrap();
    let a = (0..n).map(|_| it.next().unwrap().parse::<i32>().unwrap()).collect::<Vec<_>>();
    let mut dp = vec![vec![0; n]; n];
    for i in 0..n {
        for j in 0..n {
            if a[i] > a[j] { dp[i][j] = 1 }
        }
    }
    let m : i64 = 1_000_000_007;
    let d2 = m - m/2;
    for _ in 0..q {
        let x = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y = it.next().unwrap().parse::<usize>().unwrap() - 1;
        for i in 0..n {
            if i == x || i == y { continue }
            let avg1 = d2 * (dp[i][x] + dp[i][y]) % m;
            let avg2 = d2 * (dp[x][i] + dp[y][i]) % m;
            dp[i][x] = avg1;
            dp[i][y] = avg1;
            dp[x][i] = avg2;
            dp[y][i] = avg2;
        }
        let avg = d2 * (dp[x][y] + dp[y][x]) % m;
        dp[x][y] = avg;
        dp[y][x] = avg;
    }
    let mut res = 0;
    for i in 0..n {
        for j in i..n {
            res = (res + dp[i][j]) % m;
        }
    }
    for _ in 0..q { res = 2 * res % m }
    println!("{}", res);
}


Measured memory_bytes: 90492
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
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;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    INIT;
    cin >> A >> B >> X;
    cout << B / X - max((A - 1), 0LL) / X + (A == 0 ? 1 : 0) << endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s,t;
	cin>>s>>t;
	int n = s.size();
	int ans=0;
	for(int i=0;i<n;i++){
		ans+=(s[i]!=t[i]);
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3800
Sa = list(raw_input())
Sb = list(raw_input())
Sc = list(raw_input())

turn = Sa[0]
Sa.pop(0)
while True:
	if turn == "a":
		if len(Sa) == 0:
			print "A"
			break
		turn = Sa[0]
		Sa.pop(0)
	elif turn == "b":
		if len(Sb) == 0:
			print "B"
			break
		turn = Sb[0]
		Sb.pop(0)
	elif turn == "c":
		if len(Sc) == 0:
			print "C"
			break
		turn = Sc[0]
		Sc.pop(0)


Measured memory_bytes: 2568
# 2019/05/04
# AtCoder Beginner Contest 118 - C

import fractions

# Input
n = int(input())
a = list(map(int,input().split()))

# Search GCD
wkgcd = a[0]
for i in range(1, n):
    wkgcd = fractions.gcd(wkgcd, a[i])

# Output
print(wkgcd)


Measured memory_bytes: 16296
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{
	public static void main(String[] args) throws IOException {
	
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		while(true){
			String line = input.readLine();
			String[] num = line.split(" ");
			int tate = Integer.parseInt(num[0]);
			int yoko = Integer.parseInt(num[1]);
			int count = 0;
			if(tate==0 && yoko==0) break;
			
			for(int i = 1 ; i <= tate ; i++){
				for(int j = 1 ; j <= yoko ; j++){
				if(i % 2 != 0){
					if(j % 2 != 0) sb.append("#");
					else sb.append(".");
					if(j%yoko==0) sb.append("\n");
				    }
				else{
					if(j % 2 != 0) sb.append(".");
					else sb.append("#");
					if(j%yoko==0) sb.append("\n");
				    }
				}
			}
			sb.append("\n");
		}
		
		System.out.print(sb);
	}
}

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

int main() {
    int A, B, C, X;
    int count = 0;

    cin >> A >> B >> C >> X;
    for (int i=0; i<=A; ++i) {
      for (int j=0; j<=B; ++j) {
        for (int k=0; k<=C; ++k) {
          if (X == ((i*500) + (j*100) + (k*50))) count +=1;
        }
      }
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

upper = 10 ** 6  # 必要そうな階乗の限界を入れる
factorial = [1]
for i in range(1, upper):
    factorial.append(factorial[i-1] * i % mod)
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, int(y/2)) ** 2 % mod
    else:
        return power(x, int((y-1)/2)) ** 2 * x % mod
 
def C(n, r):
    return (((factorial[n] * x_inv[r]) % mod) * x_inv[n-r]) % mod
 
x_inv = [0] * upper
x_inv[-1] = power(factorial[-1], mod-2)
for i in range(upper-2, -1, -1):
    x_inv[i] = x_inv[i+1] * (i+1) % mod

N, K = MAP()
ans = 0
for i in range(1, K+1):
    if N-K >= i-1:
        ans = C(N-K+1, i) * C(K-1, i-1)
        print(ans % mod)
    else:
        print(0)



Measured memory_bytes: 84656
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
  int n,m;
  cin>>n>>m;
  std::vector<pair<int,int>> a(n);
  rep(i,n)std::cin >> a[i].fi>>a[i].se;
  sort(all(a));
  priority_queue<int> q;
  int p=0;
  int ans=0;
  rep(i,m){
    while(p<n&&a[p].fi<=i+1){
      q.push(a[p].se);
      p++;
    }
   // std::cout << p << std::endl;
    if(!q.empty()){
      ans+=q.top();
      q.pop();
    }
  
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 1660
import numpy as np
N, M  = map(int, input().split())
A = np.array([list(map(int, input().split())) for i in range(N)])
B = np.array([list(map(int, input().split())) for i in range(M)])
for i in A:
  L2 = [np.linalg.norm(i-b, ord=1) for b in B]
  print (L2.index(min(L2))+1)

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    long n;
    cin >> n;
    // char s[n];
    string s;
    // scanf("%s", &s);
    cin >> s;
    long right_e = 0;
    for (long i = 0; i < n; i++) if (s[i] == 'E') right_e++;
    // for (long i = 1; i < n; i++) if (s[i] == 'E') right_e++;
    long min_count = right_e;
    long left_w = 0;
    for (long i = 0; i < n; i++) {
    // for (long i = 1; i < n; i++) {
        if (!min_count) break;
        if (s[i] == 'E') {
            right_e--;
        } else {
            right_e++;
        }
        // if (s[i ] == 'W') right_e++;
        // if (s[i -1] == 'W') left_w++;
        min_count = min(min_count, right_e);
    }
    cout << min_count << endl;
    
    return 0;
}

Measured memory_bytes: 1016
#include <stdio.h>
#include <algorithm>

int main()
{
  int x, a, b;
  scanf("%d %d %d", &x, &a, &b);

  int distancea, distanceb;
  distancea = std::max(x, a) - std::min(x, a);
  distanceb = std::max(x, b) - std::min(x, b);

  if(distancea < distanceb)
    printf("A\n");

  else
    printf("B\n");

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <iostream>

using namespace std;

int min(int a, int b){
    return a < b ? a : b;
}

int max(int a, int b){
    return a > b ? a : b;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int S, W;
    cin >> S >> W;
    cout << (W>=S ? "unsafe\n": "safe\n");
    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

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

    ll k, a, b;
    cin >> k >> a >> b;

    ll res = k + 1;
    if (b > a + 2 && k >= a + 1) {
        ll tmp = 1;
        k -= (a + 1);
        tmp = b;
        ll ile = k / 2;
        tmp += (ile * (b - a));
        tmp += k % 2;
        res = max(res, tmp);
    }

    cout << res << "\n";
}


Measured memory_bytes: 24832
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,maxi=0,f=0,mini=INF;
    ll sum=0;
    string str,sub;
    ll h,w;
    ll m,k;
    cin>>n>>k;
    vector<ll> v(n);
    vector<ll> x(n,INF);

    rep(i,n) cin>>v[i];
    sort(v.begin(),v.end());
    a=0;
    rep(i,n)
    {
        m=1;
        for(ll j=i;v[j]==v[j+1];j++){
            m++;
        }
        x[a]=m;
        a++;
        i+=m-1;
    }
    x.resize(a);
    //cout<<a<<endl;
    sort(x.begin(),x.end());
    rep(i,x.size()-k){
        sum+=x[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3456
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			// 生成可能の数字と数のマップ
			Map<Integer, Integer> map = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				int number = scanner.nextInt();
				map.put(number - 1, map.getOrDefault(number - 1, 0) + 1);
				map.put(number, map.getOrDefault(number, 0) + 1);
				map.put(number + 1, map.getOrDefault(number + 1, 0) + 1);
			});
			System.out.println(
					map.entrySet().stream().max((x, y) -> x.getValue().compareTo(y.getValue())).get().getValue());
		}
	}
}


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

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> c(n);
    for(int i = 0; i < n; i++){
        cin >> c[i];
        for(int j = 0; j < m; j++)cin >> a[i][j];
    }
    int ans = 12345678;
    int all = 1<<n;
    for(int mask = 0; mask < all; mask++){
        vector<int> level(m);
        int cost = 0;
        for(int i = 0; i < n; i++){
            if((mask>>i)&1){
                cost += c[i];
                for(int j = 0; j < m; j++){
                    level[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        for(int j = 0; j < m; j++){
            if(level[j] < x) ok = false;
        }
        if(ok) ans = min(ans,cost);
    }
    if(ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] factors = new long[n+1];
        for (int i = 2; i <= n; i++) {
            int trg = i;
            int prime = 2;
            while (trg != 1) {
                if (trg % prime == 0) {
                    factors[prime]++;
                    trg /= prime;
                }
                else {
                    while (++prime<trg)
                        if (factors[prime] != 0)
                            break;
                }
            }
        }
        int mod = (int)1e9+7;
        long res = Arrays.stream(factors).reduce(1L, (a, b) -> (a*(b+1)) % mod);
        System.out.println(res);
    }
}

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

int main(){
  int n, m;
  int sum=0;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    int tmp;
    cin >> tmp;
    sum += tmp;
  } 
  
  if(n<sum)cout << "-1";
  else cout << n-sum;
  return 0;
}


Measured memory_bytes: 3620
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

temp = 9999
ans = 0
for i in a:
  ans += b[i-1]
  if i - temp == 1:
    ans += c[i-2]
  temp = i
  
print(ans)

Measured memory_bytes: 9032
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  double n, m, d; cin >> n >> m >> d;
  double ans = (n - d) * (m - 1) / (n * n);
  if (d > 0) ans *= 2;
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define LL long long
LL gcd(LL a,LL b){
    LL t;
    while(a%b){
        t = a;
        a = b;
        b = t%b;
    }
    return b;
}
int main() {
    LL a,b;
    while(cin>>a>>b){
        LL G = gcd(a,b);
        LL L = a/G * b;
        cout<<G<<" "<<L<<endl;
    }
    return 0;
}



Measured memory_bytes: 3088
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;
using static System.Math;
using System.Numerics;

class Program
{
    static int hoge()
    {
        int n = Parse(ReadLine());
        if ((n & 1) == 1)
        {
            var ary = new int[(n + 1) >> 1];
            foreach(var s in ReadLine().Split())
            {
                int a = Parse(s);
                if ((a & 1) == 1)
                {
                    return 0;
                }
                if (a == 0)
                {
                    if (++ary[0] == 2) return 0;
                }
                else
                {
                    if (++ary[a >> 1] == 3) return 0;
                }
            }
        }
        else
        {
            var ary = new int[n >> 1];
            foreach (var s in ReadLine().Split())
            {
                int a = Parse(s);
                if ((a & 1) == 0)
                {
                    return 0;
                }

                if (++ary[a >> 1] == 3) return 0;
            }
        }
        int kaisu = n >> 1;
        int waru = 1000000007;
        int result = 1;
        for(int i = 0; i < kaisu; ++i)
        {
            result = result << 1;
            if (waru < result)
            {
                result -= waru;
            }
        }
        return result;
    }

    static void Main(string[] args)
    {
        label:
        WriteLine(hoge());
        //goto label;
    }
}


Measured memory_bytes: 16096
# coding: utf-8
N = int(input())
S = list(input())
al = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", 
      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
tmp = ""
for i in range(len(S)):
    tmp += al[al.index(S[i])+N]
print(tmp)

Measured memory_bytes: 3188
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N,M,C = [int(x) for x in input().split()]
Bls =  [int(x) for x in input().split()]
Als = []
for _ in range(N):
    als = [int(x) for x in input().split()]
    Als.append(als)
    als = []

count = 0
for i in range (N):
    Sum = C
    for k in range (M):
        a = Als[i][k]*Bls[k]
        Sum += a
        a = 0
    if Sum > 0:
        count += 1

print(count)


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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














int main(){
    ll n;
    cin >> n;
    vector<vector<ll>> g(n);
    vector<ll> a(n - 1), b(n - 1);
    REP(i, n - 1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    vector<ll> c(n);
    REP(i, n){
        cin >> c[i];
    }
    sort(c.begin(), c.end(), greater<ll>());
    ll mx = 0, idx = 0;
    REP(i, n){
        if(mx < g[i].size()){
            mx = g[i].size();
            idx = i;
        }
    }
    using P = pair<ll, ll>;
    priority_queue<P> que;
    que.push({mx, idx});
    ll p = 0;
    vector<ll> d(n, -1);
    while(!que.empty()){
        auto tmp = que.top(); que.pop();
        ll v = tmp.first, now = tmp.second;
        if(d[now] != -1) continue;
        d[now] = c[p++];
        for(auto &c : g[now]){
            que.push({g[c].size(), c});
        }
    }
    ll ans = 0;
    REP(i, n - 1){
        ans += min(d[a[i]], d[b[i]]);
    }
    cout << ans << endl;
    REP(i, n){
        cout << d[i] << " \n"[i == n - 1];
    }
}

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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	for(int i = 0; i < 100; ++i) {
		for(int j = 0; j < 100; ++j) {
			if(4 * i + 7 * j == N) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
	return 0;
}



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

int main(){
  int all,a9;
  int a[9];
  while(1) {
    cin >> all;
    if(all == 0){
      break;
    }

    a9=0;
    for(int i=0;i<9;i++){
      cin >> a[i];
      a9+=a[i];
    }

    cout << all-a9 << endl;
  }
  return 0;
}



Measured memory_bytes: 2972
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
        int H[] = new int[N];
        int count = 0;
        int ans = 0;
        for(int i = 0; i < N; i++){
      	  H[i] = sc.nextInt();
          if(i >= 1 && H[i- 1] >= H[i]){
            count += 1;
          }else{
            count = 0;
          }
          if(ans < count){
            ans = count;
          }
        }
      	System.out.println(ans);
    }
}

Measured memory_bytes: 59460
import java.util.*

fun main(args: Array<String>) {
    abc151d()
}

fun abc151d() {
    data class Coordinate(val y: Int, val x: Int)

    val INF = 1000000

    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val isRoad = (1..h).map { readLine()!!.map { it == '.' }.toBooleanArray() }.toTypedArray()

    val direction = listOf(-1 to 0, 1 to 0, 0 to -1, 0 to 1)
    val minCosts = Array(500) { y -> IntArray(500) { x -> if (y == x) 0 else INF } }
    fun getId(y: Int, x: Int) = y * w + x

    for (y in 0 until h) {
        for (x in 0 until w) {
            if (!isRoad[y][x]) continue

            direction.map { Coordinate(y + it.first, x + it.second) }
                .filter { it.y in 0 until h && it.x in 0 until w && isRoad[it.y][it.x] }
                .forEach { minCosts[getId(y, x)][getId(it.y, it.x)] = 1 }
        }
    }

    val gridSize = h * w

    for (k in 0 until gridSize) {
        for (i in 0 until gridSize) {
            for (j in 0 until gridSize) {
                minCosts[i][j] = Math.min(minCosts[i][j], minCosts[i][k] + minCosts[k][j])
            }
        }
    }

    var answer = 0

    for (y in 0 until h) {
        for (x in 0 until w) {
            if (!isRoad[y][x]) continue
            for (y1 in 0 until h) {
                for (x1 in 0 until w) {
                    if (!isRoad[y1][x1]) continue
                    answer = Math.max(answer, minCosts[getId(y, x)][getId(y1, x1)])
                }
            }
        }
    }

    println(answer)
}


Measured memory_bytes: 40860
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define PB push_back
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=1510,mod=998244353;
inline void Add(int &x,int y) { x+=y; if(x>=mod) x-=mod; }
inline int Pow(int x,int y) {
	int res=1;
	while(y) {
		if(y&1) res=res*(ll)x%mod;
		x=x*(ll)x%mod,y>>=1;
	}
	return res;
}
int n;
char S[N][N];
vector<int> c[N][N];
int ty[N][N];
vector<int> G[N];
int v[N],vis[N],num;
void dfs(int u) {
	if(vis[u]) return;
	vis[u]=1,num+=v[u];
	for(int i=0;i<G[u].size();++i) dfs(G[u][i]);
}
int main() {
	rd(n);
	for(int i=1;i<n;++i) scanf("%s",S[i]+1);
	for(int i=0;i<=n;++i) {
		int x=0,y=i;
		int dx=1,dy=1;
		for(int ii=0;ii<((i>0&&i<n)?2*n:n);++ii) {
			c[x][y].PB(i);
			if(x+dx<0||x+dx>n) dx=-dx;
			if(y+dy<0||y+dy>n) dy=-dy;
			x+=dx,y+=dy;
		}
	}
	memset(ty,-1,sizeof(ty));
	for(int i=1;i<n;++i)
		for(int j=1;j<n;++j) if(S[i][j]!='?') {
			int x=c[i][j][0],y=c[i][j][1];
			if(ty[x][y]!=-1&&ty[x][y]!=(S[i][j]=='o')) {
				printf("0");
				return 0;
			}
			ty[x][y]=(S[i][j]=='o');
		}
	int ETOT[2]={0,0};
	for(int i=0;i<=n;++i)
		for(int j=i+2;j<=n;j+=2)
			if(ty[i][j]==-1) G[i].PB(j),G[j].PB(i),ETOT[i&1]++;
			else v[i]^=ty[i][j],v[j]^=ty[i][j];
	int ans=1;
	for(int d=0;d<2;++d) {
		int ntot=(n-d)/2+1;
		if(ntot&1) {
			int cnt=0;
			for(int i=d;i<=n;i+=2) if(!vis[i]) {
				cnt++,num=0;
				dfs(i);
				if(num&1) {
					printf("0");
					return 0;
				}
			}
			ans=ans*(ll)Pow(2,ETOT[d]-(ntot-cnt))%mod;
		}
		else ans=ans*(ll)Pow(2,ETOT[d])%mod;
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int a, b; cin >> a >> b;
	if (a + b < 10)cout << a + b << endl;
	else cout << "error" << endl;
}

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

int main() {
	int n,m,x; cin >> n >> m >> x;
	int cnt_l = 0;int cnt_r = 0;
	for (int i = 0; i < m; ++i)
	{
		int tmp;cin >> tmp;
		if (tmp < x ) {
			++cnt_l;
		} else if (tmp > x) {
			++cnt_r;
		}
	}
	cout << min(cnt_l, cnt_r) << endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


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

	if (a <= b)
	{
		println(a);
	}
	else
	{
		println(a - 1);
	}
}


Measured memory_bytes: 3528
#include <iostream> 
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int m,a[100],sum=0,x,i;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&a[i]);
		x=i+1;
		if(x%2==1 && a[i]%2==1)
			sum++;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 3728
'use strict'
const main = (input: string) => {
    // for-n1はTLE
    // sortして1番目と2番目出せればいい？
    const std: number[] = input.trim().split('\n').map(Number)
    const n: number = std.shift()
    const a: number[] = std
    const s: number[] = [...a].sort((a,b)=>b-a)
    let r: number[] = []
    for (let i = 0; i < n; i++) {
        if (a[i] !== s[0]) {
            r.push(s[0])
        } else {
            r.push(s[1])
        }
    }
    console.log(r.join('\n'))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    ll v[N];
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    sort(v, v + N);
    reverse(v, v + N);
    ll sum = 0;
    for (int i = 0; i < A; i++) {
        sum += v[i];
    }
    double avg = sum * 1.0 / A;
    cout << setprecision(10) << avg << endl;
    ll just = v[A - 1];
    int over = 0;
    int same = 0;
    for (int i = 0; i < N; i++) {
        if (v[i] > just) {
            over++;
        } else if (v[i] == just) {
            same++;
        }
    }
    ll ans = -1;
    if (over != 0) {
        int num = A - over;
        ll conb = 1;
        for (int i = 1; i <= num; i++) {
            conb = conb * (same - i + 1) / i;
        }
        ans = conb;
    } else {
        ans = 0;
        for (int i = A; i <= min(same, B); i++) {
            ll conb = 1;
            for (int j = 1; j <= i; j++) {
                conb = conb * (same - j + 1) / j;
            }
            ans += conb;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

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

    int n;
    cin >> n;

    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            if (i < 10 and n / i < 10)
                return cout << "Yes", 0;
        }
    }
    cout << "No" << endl;
}

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

int main(){
    int S;
    cin >> S;
    if(S%100 > 0 && S%100 < 13) {
        if(S/100 > 0 && S/100 < 13) {
            cout << "AMBIGUOUS" << endl;
        }
        else {
            cout << "YYMM" << endl;
        }
    }
    else if(S/100 > 0 && S/100 < 13) {
        cout << "MMYY" << endl;
    }
    else {
        cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
  vin h(n);
  rep(i,n) cin>>h[i];
  ////
  int ans=0;
  int mx=0;
  rep(i,n){
   if(h[i]>=mx){
     ans++;
     mx=h[i];
   }
  }
  cout<<ans<<endl;
}







Measured memory_bytes: 256
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
x=n//min(l)
if min(l)!=1:
    print(5+x)
else:
    print(4+x)


Measured memory_bytes: 3060
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(a,b):
  return a*b//gcd(a,b)

a,b,c,d=map(int,input().split())
e=b//c
f=b//d
g=(a-1)//c
h=(a-1)//d
k=lcm(c,d)
l=b//k
m=(a-1)//k
cdiv=e+f-g-h-l+m
print(b-a+1-cdiv)


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

string s;
int p = 0;

bool is_digit(char c){
    return '0' <= c && c <= '9';
}

int dfs(){
    vector<int> v;
    while( p < s.size() ){
        if( is_digit(s[p]) ){
            int res = 0;
            while( is_digit(s[p]) ){
                res *= 10;
                res += s[p] - '0';
                p++;
            }
            p++;
            return (res+1)/2;
        }else if( s[p] == '[' ){
            p++;
            v.push_back( dfs() );
        }else if( s[p] == ']' ){
            p++;
            int n = v.size();
            vector<int> a = v;
            sort(a.begin(), a.end());
            int res = 0;
            for(int i = 0; i <= n/2; i++){
                res += a[i];
            }
            return res;
        }
    }
    return 0;
}

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s;
        p = 1;
        cout << dfs() << endl;
    }
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int P[11], C[11];

int solve(int D, int G, vector<int> work){
    int ret = 0;
    for(int i = 1; i <= D; i++){
        if(work[i]){
            ret += P[i];
            G -= (C[i] + 100*i*P[i]);
        }
    }
    if(G <= 0) return ret;

    //最高の点数持ちなのは100*D
    for(int i = D; i >= 1; i--){
        if(work[i]) continue; //もう既に上で解いた
        for(int j = 0; j < P[i]; j++){
            G -= 100*i;
            ret++;
            if(j == P[i]-1) G -= C[i];
            if(G <= 0) return ret;
        }
    }
    cout << "err" << endl;
    return 0;
}

int main(void){
    int D, G; cin >> D >> G;
    int ans = mod;
    rep(i, D) cin >> P[i+1] >> C[i+1];

    int loop = (1 << D);
    rep(i, loop){
        int val = i;
        vector<int> work(1, 0);
        rep(j, D){
            work.push_back(val % 2);
            val /= 2;
        }
        ans = min(ans, solve(D, G, work));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import math
a, b, h, m = map(int, input().split())

angle_a = 30 * h + 30 * m / 60
angle_b = 360 * m / 60

angle = min(abs(angle_a - angle_b), 360 - abs(angle_a - angle_b))
print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(angle))))


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

int main(){
  int N;
  cin >> N;
  
  vector<int> value(N);
  for(int i = 0; i < N; i++){
    cin >> value.at(i);
    for(int j=i; j > 0; j--){
      if(value.at(j-1)>value.at(j)){
        swap(value.at(j-1), value.at(j));
      }
    }
  }
  
  double answer;
  for(int i = 0; i < N-1; i++){
    if(i == 0){
      answer = (value.at(0) + value.at(1))/2.0;
    }else{
      answer = (answer + value.at(i+1))/2.0;
    }
  }
  
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
typedef long long ll;
using namespace std;
int main() {
	ll L, R;
	cin >> L >> R;
	
	int a;
	if (R - L<2019) {
		a = R - L;
	}
	else {
		a = 2019;
	}
	ll ans = 2019;
	for (int i = 0;i < a + 1;++i) {
		for (int j = i + 1;j < a + 1;++j) {
			ll b = (L + i) * (L + j);
			ans = min(ans, b % 2019);
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll a,b;cin>>a>>b;
    cout<<6-(a+b)<<endl;
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) {
        FastReader sc = new FastReader();
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] ms = new int[n];
        int sum = 0;
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            ms[i] = sc.nextInt();
            sum += ms[i];
            min = Math.min(min, ms[i]);
        }
        int count = n;
        x -= sum;
        while (x >= min) {
            x -= min;
            count++;
        }
        System.out.println(count);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21332