akhauriyash/Code-Regression huggingface dataset:
k, x = map(int, input().split())
minN = max(-1000000, x-k+1)
maxN = min(1000000, x+k-1)
answer = str(minN)
index=minN+1
while index < maxN+1:
    answer+=" "
    answer+=str(index)
    index+=1
print(answer)

Measured memory_bytes: 3060
a,b,c=map(int,input().split())
l=[a,b,c]
l.sort()
m=l[-1]
from math import ceil
ans=0
if (l[0]+l[1])%2==1:
  ans+=ceil((m-l[0])/2)
  ans+=ceil((m-l[1])/2)
  ans+=1
else:
  ans+=(2*m-l[0]-l[1])//2
print(ans)



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

using namespace std;
using ll = long long;


int main()
{
    int n;
    cin >> n;
    vector<int> pr;
    vector<bool> a(55556);
    for(int i = 2; i < 55556; i++) {
        if(a[i])continue;
        pr.push_back(i);
        for(int j = i; j < 55556; j += i)a[j] = 1;
    }
    int cur = 1;
    reverse(pr.begin(), pr.end());
    while(cur <= n){
        if(pr.back() % 10 == 1){
            cout << pr.back() << endl;
            cur++;
        }
        pr.pop_back();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=444,mod=998244353;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
inline int qmo(int x){return x+(x>>31?mod:0);}
int n,a[maxn],b[maxn],as,bs,f[maxn][maxn],C[maxn][maxn],ans;
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
int main(){
	n=read();
	FOR(i,1,n) as+=a[i]=read(),bs+=b[i]=read();
	FOR(i,0,bs) C[i][0]=C[i][i]=1;
	FOR(i,1,bs) FOR(j,1,i-1) C[i][j]=qmo(C[i-1][j]+C[i-1][j-1]-mod);
	f[0][0]=1;
	int asinv=qpow(as,mod-2);
	FOR(i,1,n) ROF(j,as,a[i]) ROF(k,bs,0){
		int pr=1,fac=1ll*a[i]*asinv%mod;
		FOR(t,0,min(b[i]-1,k)){
			f[j][k]=qmo(f[j][k]-1ll*f[j-a[i]][k-t]*C[k][t]%mod*pr%mod);
			pr=1ll*pr*fac%mod;
		}
	}
	FOR(j,0,as) FOR(k,0,bs) ans=qmo(ans+1ll*f[j][k]*qpow(1ll*as*qpow(j,mod-2)%mod,k+1)%mod-mod);
	printf("%d\n",qmo(-ans));
}

Measured memory_bytes: 4968
#include <stdio.h>
#define REP(i, n) for(i = 0; i < n; ++i)
#define FOR(i, a, b) for(i = a; i < b; ++i)

void yes_or_no(char boolean){
    if(boolean){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
}

int main(){
    int x;
    int i;
    int five = 0, seven = 0;

    REP(i, 3){
        scanf("%d", &x);
        if(x == 7) seven++;
        else if(x == 5) five++;
    }
    yes_or_no(seven == 1 && five == 2);
    return 0;
}

Measured memory_bytes: 128
(defn split-space [s]
  (map #(Long/parseLong %) (.split s " ")))

(defn abs [a]
  (if (< 0 a) a (- a)))

(defn factorial [n]
  (reduce * (range 1 (inc n))))

(defn count-o [orders xi tail]
  (if (zero? (count tail))
    orders
    (recur
     (+ orders
         ;; (i - 1)!
        (* (factorial (count tail)) 
           ;; xi > xj (i < j) の個数
           (reduce (fn [acc xj]
                     (if (> xi xj)
                       (inc acc)        
                       acc))
                   0 tail)))
     (first tail)
     (rest tail))))

(defn count-order [n]
  (abs (- ((fn [xs] (count-o 1 (first xs) (rest xs))) (split-space (read-line)))
          ((fn [xs] (count-o 1 (first xs) (rest xs))) (split-space (read-line))))))

(println (count-order (Long/parseLong (read-line))))

Measured memory_bytes: 65328
#include<iostream>
#include<vector>
using namespace std;
int find_sum(int num);

int main() {
	int n, a, b;
	int ans = 0;
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) {
		if (a <= find_sum(i) && find_sum(i) <= b) {
			ans += i;
		}
	}
	cout << ans;
	return 0;
}

int find_sum(int num) {
	int sum = 0;
	while (num != 0) {
		sum += num % 10;
		num /= 10;
	}
	return sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s; cin >> s; 
  for(auto x: s)
    if(x=='1') cout << 9;
    else if(x=='9') cout << 1;
    else cout << x;
  cout << endl;
  return 0;
  int a,b,c;cin>>a>>b>>c;
  cout<<a+b+c+9*max({a,b,c})<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

//#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer","inline")
//#pragma GCC option("arch=native","tune=native","no-zero-upper")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")

using namespace std;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getrnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

template <typename T1, typename T2>
bool relax(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T1, typename T2>
bool strain(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

// :::::::::::::::::::::::::::::::

const int N = 103;

ll dp[N][2][N];

void solve() {
    string s;
    int k;
    cin >> s >> k;
    
    int n = s.size();
    dp[0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int sm = 0; sm <= 1; ++sm) {
            for (int c = 0; c < n; ++c) {
                for (int cur = 0; cur <= 9; ++cur) {
                    int off = cur != 0;
                    if (sm)
                        dp[i + 1][sm][c + off] += dp[i][sm][c];
                    else if (cur <= s[i] - '0')
                        dp[i + 1][(s[i] - '0' != cur)][c + off] += dp[i][sm][c];
                }
            }
        }
    }
    cout << dp[n][0][k] + dp[n][1][k] << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    srand(time(0));
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}


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

//long long
using ll = long long;

// pair<int, int>
using PII = pair<int, int>;

//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;

//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

int main(){
    ll N, P;
    cin >> N >> P;
    if(N == 1){
        print(P);
        return 0;
    }
    ll ans = 1;
    for(ll i = 2; pow(i, N) <= P; i++){
        ll x = pow(i, N);
        if(P % x == 0) ans = i;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 384
import bisect
A,B,Q=map(int,input().split())
INF=10**18
S=[-INF]+[int(input()) for i in range(A)]+[INF]
T=[-INF]+[int(input()) for i in range(B)]+[INF]
for q in range(Q):
    x=int(input())
    i=bisect.bisect_right(S,x)
    j=bisect.bisect_right(T,x)
    d=INF
    for s in [S[i-1],S[i]]:
        for t in [T[j-1],T[j]]:
            d1=abs(s-x)+abs(s-t)
            d2=abs(t-x)+abs(s-t)
            d=min(d,d1,d2)
    print(d)

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
  cout.precision(17);

  int n;cin>>n;
  double res=0;
  while(n--){
    double x;string u;
    cin>>x>>u;
    if(u=="JPY"){
      res+=x;
    }else{
      res += (x*380000.0);
    }
  }cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
import scala.annotation.tailrec

object Main extends App {
  import scala.io.StdIn._

  val n = readLine.trim.toInt
  val num = readLine.trim.split(' ').map(_.toInt)
  val sorted = num.sorted
  val diffCount = num.indices.count(i ⇒ num(i) != sorted(i))
  val q = readLine.trim.toInt
  solve(num, sorted, diffCount, q, 0)
  @tailrec def solve(num: Array[Int], sorted: Array[Int], diffCount: Int, q: Int, count: Int): Unit = {

    if (q == count && diffCount != 0) println(-1)
    else if (diffCount == 0) println(count)
    else {
      val a@Array(x, y) = readLine.trim.split(' ').map(_.toInt - 1)
      val diff = a.count(i ⇒ num(i) != sorted(i))
      val temp = num(x)
      num(x) = num(y)
      num(y) = temp
      solve(num, sorted, diffCount - diff + a.count(i ⇒ num(i) != sorted(i)), q, count + 1)
    }
  }
}


Measured memory_bytes: 425176
function main(input) {
    const args = input.split('\n');
    var a = parseInt(args[0])
    var b = parseInt(args[1])
    var c = parseInt(args[2])
    var d = parseInt(args[3])
    var e = parseInt(args[4])
    var k = parseInt(args[5])

    var distance = (e - a)

    if(distance <= k) {
        console.log('Yay!');
    } else {
        console.log(':(');
    }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }

const int maxn = 1e6 + 7;

int h,w;
int sx,sy;
int dx,dy;
vector<string> gridog;
vector<vector<int>> grid;
int cnt;
vector<pair<int,int>> moves = {{-1,0},{1,0},{0,-1},{0,1}};
map<int,set<int>> g;

void bfs(int xx, int yy) {
    queue<pair<int,int>> q;
    q.push({xx,yy});
    grid[xx][yy] = cnt;

    while (!q.empty()) {
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        for (auto p: moves) {
            int xx = x+p.first;
            int yy = y+p.second;
            if (xx < 0 || xx >= h) continue;
            if (yy < 0 || yy >= w) continue;
            if (grid[xx][yy] != 0) continue;
            grid[xx][yy] = cnt;
            q.push({xx,yy});
        }
    }
}

int main() {

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

    cin >> h >> w;

    cin >> sx >> sy;
    sx--; sy--;

    cin >> dx >> dy;
    dx--; dy--;

    gridog.resize(h);
    grid.assign(h, vector<int>(w,0));
    for (int i = 0; i < h; i++) {
        cin >> gridog[i];
        for (int j = 0; j < w; j++) {
            if (gridog[i][j] == '#') grid[i][j] = -1;
        }
    }

    cnt = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (grid[i][j] == 0) {
                cnt++;
                bfs(i,j);
            }
        }
    }

    /*
    cout << "printing grid.\n";
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << grid[i][j] << " ";
        }
        cout << "\n";
    }
    cout << "done printing grid.\n";
    */
    

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (grid[i][j] == -1) continue;
            assert(grid[i][j] != 0);
            int xx = i-2;
            int yy = j-2;
            for (int x = xx; x < xx+5; x++) {
                for (int y = yy; y < yy+5; y++) {
                    if (x < 0 || x >= h) continue;
                    if (y < 0 || y >= w) continue;
                    if (grid[x][y] == -1) continue;
                    if (grid[x][y] == grid[i][j]) continue;
                    g[grid[x][y]].insert(grid[i][j]);
                    g[grid[i][j]].insert(grid[x][y]);
                }
            }
        }
    }

    queue<pair<int,int>> q;
    q.push({grid[sx][sy],0});
    set<int> seen;

    int dnode = grid[dx][dy];

    while (!q.empty()) {
        int node = q.front().first;
        int dist = q.front().second;
        q.pop();
        seen.insert(node);
        if (node == dnode) out(dist);
        for (auto v: g[node]) {
            if (seen.count(v)) continue;
            seen.insert(v);
            q.push({v,dist+1});
        }
    }

    out(-1);
    
    return 0;
}


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

string s, t;

int main(void){
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	if(s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}
int main() {
  int n,d[100],i,x=1;
  scanf("%d",&n);
  for (i=0;i<n;i++) {
    scanf("%d",&d[i]);
  }
  qsort(d, n, sizeof(int), comp);
  for (i=1;i<n;i++) {
    if (d[i]>d[i-1]) {
      x++;
    }
  }
  printf("%d\n",x);
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int size = sc.nextInt();
			if (size == 0) break;
			int list[] = new int[size];
			for (int i = 0; i < size; ++i)
				list[i] = sc.nextInt();
			Arrays.sort(list);
			int sum = 0;
			for (int i = 0; i < size; ++i)
				if (i == 0 || i == size - 1) continue;
				else
					sum += list[i];
			System.out.println(sum / (size - 2));
		}
	}
}


Measured memory_bytes: 29132
n,m = map(int,input().split())
ks = [0] * m
for i in range(m):
    ks[i] = list(map(int,input().split()))
p = list(map(int,input().split()))
aans = 0

for i in range(2**n):
    ans = [0] * m

    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1): #ついてるのが1
            for k in range(m):
                if j+1 in ks[k][1:]:
                    ans[k] += 1
    flag = True
    for j in range(m):
        if ans[j] % 2 != p[j]:
            flag = False
            break
    if flag:
        aans += 1
print(aans)


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
bool flags[110000];
int main(){

	int N;
	cin >> N;
	vector<vector<int>> U(N+1);
	pairs(C);
	map<pair<int, int>, int> D;
	int start = 0, K = 0;
	fx(N-1) {
		int a, b;
		cin >> a >> b;
		auto c = make_pair(a, b);
		pb(U[a], b);
		pb(U[b], a);
		pb(C, c);
		if (K<U[a].size()) {
			K = U[a].size();
			start = a;
		}
		if (K < U[b].size()) {
			K = U[b].size();
			start = b;
		}
	}
	ce(K);
	queue<pair<int, int>> V;
	fx(K) {
		auto k = make_pair(U[start][x], x + 1);
		V.push(k);
		int s = min(start, U[start][x]);
		int t = max(start, U[start][x]);
		D[make_pair(s, t)] = x+1;
	}
	flags[start] = true;
	while (!V.empty()) {
		auto v = V.front(); V.pop();
		int k = 0;
		flags[v.first] = true;
		fx(U[v.first].size()) {
			if (flags[U[v.first][x]]) {
				continue;
			}
			k++;
			if (k==v.second) {
				k++;
			}

			int s = min(v.first, U[v.first][x]);
			int t = max(v.first, U[v.first][x]);
			D[make_pair(s, t)] = k;
			V.push(make_pair(U[v.first][x],k));
		}
	}

	fx(N-1) {
		ce(D[C[x]])
	}


    return 0;
}



Measured memory_bytes: 13172
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int k, n; cin >> k >> n;
	vector<int> a(n); for (int i = 0; i <= n - 1; i++) cin >> a[i];
	sort(a.begin(), a.end());
	int ans = a[n - 1] - a[0];
	for (int i = 1; i <= n - 1; i++) {
		ans = min(ans, k - (a[i] - a[i - 1]));
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

// ABC098 C - Attention
// 2020.06.18

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  string S; cin >> S;
  vector<int> LW(N), RE(N);
  REP(i, N){
    if(i != 0){
      LW[i] = LW[i-1];
      RE[N-i-1] = RE[N-i]; 
    }
    if(S[i] == 'W') LW[i]++;
    if(S[N-i-1] == 'E') RE[N-i-1]++;
  }

  int ans = N;
  REP(i, N){
    int res;
    if(i == 0){
      res = RE[+1];
    }else if(i == N-1){
      res = LW[i-1];
    }else{
      res = LW[i-1] + RE[i+1];
    }
    ans = min(ans, res);
  } 
  cout << ans << endl;
}

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

const long long MOD = 1000000007;

typedef long long ll;

ll mod_pow(ll x, ll n, ll mod)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * x % mod; //  最下位ビットが立っているときに x^(2^i) を掛ける
        x = x * x % mod;         // x を順次二乗していく
        n >>= 1;
    }
    return res;
}

void solve(long long N)
{
    ll ans = mod_pow(10, N, MOD) - 2 * mod_pow(9, N, MOD) + mod_pow(8, N, MOD);
    cout << (ans + MOD * 2) % MOD << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define LL long long int

int main() {
	
	LL a,p;
	cin>>a>>p;
	if(a&1){
	    if(p&1){
	        cout<<a+(p+a)/2<<endl;
	    }
	    else{
	        cout<<a+(a/2)+(p/2)<<endl;
	    }
	}
	else{
	    if(p&1){
	        cout<<a+(a/2)+(p/2)<<endl;
	    }
	    else{
	        cout<<a+(a/2)+(p/2)<<endl;
	    }
	}
	return 0;
}

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

constexpr int64_t mod = 1'000'000'007;
template <uint32_t mod>
class modint{
    uint64_t value;
public:
    constexpr modint(const int64_t x=0) noexcept: value(x % mod + (x < 0 ? mod : 0)){ }
    constexpr explicit operator uint64_t() const noexcept{ return value; }
    constexpr modint inverse() const noexcept{ return pow(*this, mod-2); }
    constexpr bool operator==(const modint &rhs) const noexcept{ return value == rhs.value; }
    constexpr bool operator!=(const modint &rhs) const noexcept{ return value != rhs.value; }
    constexpr modint operator+() const noexcept{ return modint(*this); }
    constexpr modint operator-() const noexcept{ return modint(mod - value); }
    constexpr modint operator+(const modint &rhs) const noexcept{ return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept{ return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept{ return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept{ return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) noexcept{
        if((value += rhs.value) >= mod) value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) noexcept{ return *this += mod - rhs.value; }
    constexpr modint &operator*=(const modint &rhs) noexcept{
        if((value *= rhs.value) >= mod) value %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) noexcept{ return *this *= rhs.inverse(); }
    constexpr modint operator++(int) noexcept{
        modint ret(*this);
        if((++value) >= mod) value -= mod;
        return ret;
    }
    constexpr modint operator--(int) noexcept{
        modint ret(*this);
        if((value += mod - 1) >= mod) value -= mod;
        return ret;
    }
    constexpr modint &operator++() noexcept{ return *this += 1; }
    constexpr modint &operator--() noexcept{ return *this -= 1; }
    friend std::ostream &operator<<(std::ostream &os, const modint<mod> &x){ return os << x.value; }
    friend std::istream &operator>>(std::istream &is, modint<mod> &x){
        int64_t i;
        is >> i;
        x = modint<mod>(i);
        return is;
    }
    friend constexpr modint<mod> pow(const modint<mod> &x, uint64_t y){
        modint<mod> ret{1}, m{x};
        while(y > 0){
            if(y & 1) ret *= m;
            m *= m;
            y >>= 1;
        }
        return ret;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, m;
    set<int> broken;
    cin >> n >> m;
    for(int i=0;i<m;++i){
        int a;
        cin >> a;
        broken.insert(a);
    }
    static modint<mod> dp[100001];
    dp[0] = 1;
    for(int i=1;i<=n;++i){
        if(broken.count(i)) dp[i] = 0;
        else dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 5760
ans = 0
a = [0]*6

for i in range(6):
  a[i] = int(input())

for i in range(5):
  for j in range(i+1, 5):
    if a[j] - a[i] > a[5]:
      ans = 1

if ans != 1:
  print('Yay!')
else:
  print(':(')


Measured memory_bytes: 9028
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int a,b,c;
  cin>>a>>b>>c;
  int l=a;
  if(l<b)l=b;
  if(l<c)l=c;
  int ans=l*9+a+b+c;
  cout(ans);
  return 0;
}

Measured memory_bytes: 125568
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int div_ceil(int x,int y){
  return (x+(y-1))/y;
}

int main(){
  long n,k;
  cin >> n >> k;
  REP(i,n){
    int a;
    cin >> a;
  }
  cout << div_ceil(n-1,k-1) << endl;
  return 0;
}


Measured memory_bytes: 256
#import sys
#input = sys.stdin.readline

n = int(input())
AB = []
for i in range(n):
    a, b = map(int, input().split())
    AB.append((b, a))

AB.sort()
t = 0
for i in range(n):
    t += AB[i][1]
    if t > AB[i][0]:
        print('No')
        exit()
else:
    print('Yes')

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

int main() {
  int n, Mx = 0, ans = 0; cin >> n;
  vector<int> h(n); rep(i, n) cin >> h[i];
  rep(i, n) {
    if (Mx <= h[i]) ans++;
    Mx = max(Mx, h[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

constexpr uint sentinel = 1000000001;

void Merge( std::vector<uint>& v, uint left, uint mid, uint right, int& cmpNum ){
    int n1 = mid - left;
    int n2 = right - mid;
    std::vector<uint> L( n1 + 1 );
    std::vector<uint> R( n2 + 1 );
    int i = 0;
    int j = 0;
    for( ; i < n1; ++i ){
        L[i] = v[left + i];
    }
    for( ; j < n2; ++j ){
        R[j] = v[mid + j];
    }
    L[n1] = sentinel;
    R[n2] = sentinel;

    i = 0;
    j = 0;

    for( int k = left; k < right; ++k ){
        cmpNum++;
        if( L[i] <= R[j] ){
            v[k] = L[i++];
        }else{
            v[k] = R[j++];
        }
    }
}

void MergeSort( std::vector<uint>& v, uint left, uint right, int& cmpNum ){
    if( left + 1 < right ){
        uint mid = ( left + right ) / 2;
        MergeSort( v, left, mid, cmpNum );
        MergeSort( v, mid, right, cmpNum );
        Merge( v, left, mid, right, cmpNum );
    }
}

int main(){
    std::cin.tie(0);
    int n;
    int cmpNum = 0;
    std::cin >> n;
    std::vector<uint> vec(n);
    for( auto& e : vec ){
        std::cin >> e;
    }

    MergeSort( vec, 0, n, cmpNum );

    for( int i = 0; i < n; ++i ){
        std::cout << vec[i] << ( ( i == n - 1 )? "\n" : " " );
    }
    std::cout << cmpNum << "\n";
}


Measured memory_bytes: 6756
N = int(input())
A = list(map(int,input().split()))
A.sort()
i = 0
ans = 0
cnt = 1
if N == 1 and A[0] != 1:
    print(1)
    exit()

while i+1 < N:
    if A[i] == A[i+1]:
        cnt += 1
        if i+1 == N-1:
            ans += cnt if A[i] > cnt else cnt - A[i]
    else:
        if i+1 == N-1:
            ans += 1
        ans += cnt if A[i] > cnt else cnt - A[i]
        cnt = 1
    i += 1
print(ans)

Measured memory_bytes: 14800
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i){cin >> a[i];}
    int s = 0;
    for(int i=0; i<n; ++i){s ^= a[i];}
    for(int i=0; i<n; ++i){a[i] ^= s;}
    for(int i=0; i<n; ++i){cout << a[i] << endl;}
    return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> lr(n);
    rep(i, n){
        cin >> lr[i].first >> lr[i].second;
        --lr[i].first;
        --lr[i].second;
    }
    sort(all(lr), [](pair<ll, ll> x, pair<ll, ll> y){
        if(x.first<y.first) return true;
        else if(x.first==y.first && x.second<y.second) return true;
        else return false;
    });

    ll a = 0;

    // one and the others
    vector<pair<ll, ll>> acc_lr0(n);
    vector<pair<ll, ll>> acc_lr1(n);
    ll l = 0, r = 1000000000-1;
    rep(i, n){
        l = max(l, lr[i].first);
        r = min(r, lr[i].second);
        acc_lr0[i] = {l, r};
    }
    l = 0, r = 1000000000-1;
    irep(i, n){
        l = max(l, lr[i].first);
        r = min(r, lr[i].second);
        acc_lr1[i] = {l, r};
    }
    rep(i, n){
        ll t = lr[i].second - lr[i].first + 1;
        ll l = 0, r = 1000000000-1;
        if(i>0){
            l = max(l, acc_lr0[i-1].first);
            r = min(r, acc_lr0[i-1].second);
        }
        if(i<n-1){
            l = max(l, acc_lr1[i+1].first);
            r = min(r, acc_lr1[i+1].second);
        }
        if(l<=r) t += r - l + 1;
        a = max(a, t);
    }

    // otherwise
    REP(i, 1, n-2){
        ll l0 = acc_lr0[i].first, r0 = acc_lr0[i].second;
        ll l1 = acc_lr1[i+1].first, r1 = acc_lr1[i+1].second;
        ll t = 0;
        if(l0<=r0) t += r0 - l0 + 1;
        if(l1<=r1) t += r1 - l1 + 1;
        a = max(a, t);
    }

    cout << a << endl;
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<string.h>
#include<math.h>

int main()
{
    char s;
    double sum=0, m;

    while(scanf("%c", &s))
    {
        if(s=='\n')
            break;
        sum = sum + s-48.0;
    }
    m = fmod(sum, 9);
    if(m==0)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 3080
#include<iostream>

using namespace std;

int n;
int ans = 0;

int dfs(long long k,int f1, int f2, int f3){
  if(k > n) return 0;
  if(f1 && f2 && f3) ans++;
  dfs(k*10+3, f1+1, f2, f3);
  dfs(k*10+5, f1, f2+1, f3);
  dfs(k*10+7, f1, f2, f3+1);
  return 0;
}

int main(){
  cin >> n;
  dfs(0, 0, 0, 0);
  cout << ans << endl;
}


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

int main(){
    int x, y; cin >> x >> y;
    
    
    int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
    if(a[x] == a[y]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

vector<int> d;

bool ok(string s){
  bool ok7 = false, ok5 = false, ok3 = false;
  for (int i = 0; i < s.size(); i++){
    if (s[i] == '7') ok7 = true;
    else if (s[i] == '5') ok5 = true;
    else if (s[i] == '3') ok3 = true;
  }
  if (ok7 && ok5 && ok3) return true;
  else return false;
}

void dfs(string s, int i){
  if (i == 10){
    if (ok(s)){
      d.push_back(atoi(s.c_str()));
    } 
  } else {
    dfs(s + '7', i + 1);
    dfs(s + '5', i + 1);
    dfs(s + '3', i + 1);
    dfs(s, i + 1);
  }
}

int main(){
  int n;
  cin >> n;
  string s = "";
  dfs(s, 1);
  sort(ALL(d));
  vector<int> vec;
  vec.push_back(d[0]);
  for (int i = 1; i < d.size(); i++){
    if (d[i] > vec.back()) vec.push_back(d[i]);
  }

  for (int i = 0; i < vec.size(); i++){
    if (vec[i] > n) {
      cout << i << "\n";
      return 0;
    }
  }
  cout << vec.size() << "\n";
}

Measured memory_bytes: 1400
#include <cstdio>
 

int n;
int l[100];
int max = 0;
int maxj = 0;
int sum = 0;
 
void solve() {
  for (int i = 0; i < n; i++) {
    if (max < l[i]) {
      max = l[i];
      maxj = i;
    }
  }
  l[maxj] = 0;
  for (int i = 0; i < n; i++) {
    sum += l[i];
  }
}
 
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &l[i]);
  }
  solve();
  if (sum > max) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
 
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string.h>
#include<string>
#include<string.h>
using namespace std;

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

int N;

void solve(){
	int x[200],y[200];
	memset(x,-1,sizeof(x));
	memset(y,-1,sizeof(y));

	bool box[500][500];
	memset(box,false,sizeof(box));
	box[250][250]=true;
	x[0]=250;y[0]=250;
	for(int i=1;i<=N-1;i++){
		int id,dir;
		cin>>id>>dir;
		int nx=x[id]+dx[dir],ny=y[id]+dy[dir];
		x[i]=nx;
		y[i]=ny;
		box[ny][nx]=true;
	}

	int left=10000,right=-1,top=100000,bottom=0;

	for(int y=0;y<500;y++)
		for(int x=0;x<500;x++)
			if(box[y][x]){
				left=min(left,x);
				right=max(right,x);
				top=min(top,y);
				bottom=max(bottom,y);
			}

	cout<<right-left+1<<" "<<bottom-top+1<<endl;
}

int main(){
	while(cin>>N){
		if(N==0) break;
		solve();
	}
	return 0;
}

Measured memory_bytes: 0
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> sw(M);
    for (int i = 0; i < M; i++) {
        int k; cin >> k;
        vector<int> tmp(k);
        for (int j = 0; j < k; j++) {
            int s; cin >> s;
            tmp[j] = s - 1;
        }
        sw[i] = tmp;
    }
    vector<int> p(M);
    for (int i = 0; i < M; i++) cin >> p[i];

    struct Recursive {
        int count = 0;
        int limit;
        void recursive(int index, string s, const vector<vector<int>> &sw, const vector<int> &p) {
            if (index == limit) {
                for (int i = 0; i < sw.size(); i++) {
                    int tmp = 0;
                    for (int j = 0; j < sw[i].size(); j++) {
                        tmp += s[sw[i][j]] - '0';
                    }
                    if (tmp % 2 != p[i]) {
                        return;
                    }
                }
                count += 1;
                return;
            }
            recursive(index + 1, s + "0", sw, p);
            recursive(index + 1, s + "1", sw, p);
        }
    };

    Recursive rec;
    rec.limit = N;

    rec.recursive(0, "", sw, p);
    cout << rec.count << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define SIZE 100333
#define MOD 1000
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef vector<vector<long long> > mat;

ll n,m,s[111][2],f[111][2];

int main () {
	scanf("%lld%lld",&n,&m);	
	for(int i=0;i<n;i++)	scanf("%lld%lld",&s[i][0],&s[i][1]);
	for(int i=0;i<m;i++)	scanf("%lld%lld",&f[i][0],&f[i][1]);
	for(int i=0;i<n;i++) {
		ll ret = INF, idx = -1;
		for(int j=0;j<m;j++) {
			ll cand = abs(s[i][0] - f[j][0]) + abs(s[i][1] - f[j][1]);
			if(cand < ret) {
				ret = cand, idx = j;
			}
		}
		printf("%lld\n",idx+1);
	}
}

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

template<typename TypeInt>
TypeInt G_C_D(TypeInt a, TypeInt b)
{
    if (a < 0) a = -a;
	if (b < 0) b = -b;
	while (b != 0) {
		a %= b;
		if (a == 0) return b;
		b %= a;
	}
	return a;
}

template<typename TypeInt>
TypeInt L_C_M(TypeInt a, TypeInt b) {
    if( a == 0 && b == 0)return 0;
	return a / G_C_D(a, b) * b;
}


int main(){
  ll A,B,C,D;
  cin>>A>>B>>C>>D;
  ll aqc =  (A-1)/C;
  ll aqd = (A-1)/D;
  ll bqc = B/C;
  ll bqd = B/D;

  ll lcm=L_C_M(C,D);
  ll bqab=B/lcm;
  ll aqab=(A-1)/lcm;
  ll ans = B-A+1-(bqc-aqc)-(bqd-aqd)+(bqab-aqab);
  
  cout<<ans<<endl;
}

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

int main (){
    int N;
    string S;
    cin>>N>>S;
    vector<int> X(N);
    vector<vector<int>> Vec(10, vector<int>(0));
    vector<bool> Bo(10, false);

    for(int i=0; i<N; i++){
        X.at(i)=(S.at(i)-'0');
        Vec.at(X.at(i)).push_back(i);
        Bo.at(X.at(i))=true;
    }
  	
    int Sum=0;
    for(int i=0; i<1000; i++){
        int j=i/100;
        int k=(i%100)/10;
        int l=i%10;
      	if(!(Bo.at(j)&&Bo.at(k)&&Bo.at(l))){
      		continue;
   		}
        int Left=Vec.at(j).at(0);
        int Right=Vec.at(l).at(Vec.at(l).size()-1);
        for(int m=Left+1; m<=Right-1; m++){
            if(X.at(m)==k){
                Sum ++;
                break;
            }
        }
    }
    cout<<Sum;
}



Measured memory_bytes: 640
#include<stdio.h>

int main(void){
    char S[3]={};
    scanf("%s",S);
    int count = 0;
    for(int i=0;i<3;i++){
        if(S[i]=='o'){
            count ++;
        }
    }
    printf("%d",700+100*count);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

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

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  int n;
  cin >> n;
  string s, t;
  cin >> s;
  cin >> t;

  string st;
  for (int i = 0; i < n; i++) {
    st.push_back(s[i]);
    st.push_back(t[i]);
  }

  cout << st << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
    long long int a,b,c,n,m,k,temp,total=0,menkan,flag=0,ans=1000000000000000005;
    string s,daan;
    cin>>n>>k;
    if(n<=k)
    {
        ans=min(n,k-n);
    }
    else
    {
        if((n-k)<=k)
        {
            n=n-k;
            ans=min(n,k-n);
        }
        else
        {
            ans=n%k;
            ans=min(ans,k-ans);
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,flag=0;
    scanf("%d %d %d",&a,&b,&c);
    while(1)
    {
        if(a<b && c<b || a==c && a!=b && b!=c && a<b && c<b)
        {
            a=a+1;
            c=c+1;
            flag++;
        }
        else if(a<c && b<c || a==b && a!=c && b!=c && a<c && b<c)
        {
            a=a+1;
            b=b+1;
            flag++;
        }
        else if(b<a && c<a || b==c && b!=a && c!=a && b<a && c<a)
        {
            b=b+1;
            c=c+1;
            flag++;
        }
        if(a<b && a<c)
        {
            a=a+2;
            flag++;
        }
        else if(b<a && b<c)
        {
           b=b+2;
           flag++;
        }
        else if(c<a && c<b)
        {
            c=c+2;
            flag++;
        }
        if(a==b && b==c && c==a)
        {
            break;
        }
    }
    printf("%d\n",flag);

    return 0;
}


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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok cerr << "ok\n";
#define whatis(x) cerr << #x << " = " << x << endl;

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;

main() {
  int n, k;
  scanf("%d %d", &n, &k);
  if (k == 0) {
    cout << n * 1LL * n;
    return 0;
  }
  ll ans = 0;
  int add = k + 1;
  ll ad = 1;
  for (int i = k + 1; i <= n; i++) {
    for (int j = k; j <= n; j += add) {
//      cerr << j << ' ';
      if (j + ad - 1 > n) {
        ans += (n - j + 1);
        break;
      }
      ans += ad;
      j += (ad - 1);
    }
    ad++;
  }
  cout << ans;
}


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

int main()
{
    int n,k;
    std::cin>>n>>k;
    std::vector<int> h(n);
    for(int i=0;i<n;i++)std::cin>>h[i];
    int min = 1000000000;
    std::sort(h.begin(),h.end());
    for(int i=0;i<n-k+1;i++){
        min = std::min(h[i+k-1]-h[i],min);
    }
    std::cout<<min<<std::endl;
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt();
		int n=sc.nextInt();
		int s=0;
		for(int i=0;i<n;i++)s+=sc.nextInt();
		if(s>=h)System.out.println("Yes");else System.out.println("No");
	}
}

Measured memory_bytes: 46948
#include <iostream>
/*???????????????????????§??????????????°?????????????????????
???????????????????????????????????°??§dp[0][sq]???????????£??\???????????????
sq??\????????°??¨?????????????????????????????°???????¨???????????????????
2????????\????????¢????????????????????????????????§?????????????¨????????????°??????
*/
using namespace std;

const int N = 32770;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int dp[4][N+1] = {};
	for(int i = 1;i*i <= N;i++){
		for(int j = 0;j < 3;j++){
			int sq = i*i;
			if(j == 0)dp[0][sq] = 1;
			for(int k = 1;k <= N;k++){
				if(k + sq >= N)continue;
				dp[j + 1][k + sq] += dp[j][k];
			}
		}
	}
	int n;
	while(cin >> n,n){
		cout << dp[0][n] + dp[1][n] + dp[2][n] + dp[3][n] << endl;
	}
  return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n, a, b, x[100000];

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> a >> b >> x[0];
	long long cnt = 0;
	for(int i = 1; i < n; i++){
		cin >> x[i];
		cnt += min((long long)b, a * (long long)(x[i] - x[i - 1]));
	}
	cout << cnt << "\n";
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
	char n,l,max=0,i;
	int sum=0;
	scanf("%hhd",&n);
	for (i=0;i<n;i++) {
		scanf("%hhd",&l);
		if (max < l) max = l;
		sum += l;
	}
	
	if (max < sum-max) printf("Yes\n");
	else printf("No\n");

	return 0;
}


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

using namespace std;

int H, W, sx, sy;
string S[100];
short dp[100][101][100][101];
int sum[102][102];

int rect(int a, int b, int c, int d, int e, int f, int g, int h) {
  a = max(a, e);
  b = min(b, f);
  c = max(c, g);
  d = min(d, h);
  return sum[b][d] - sum[b][c] - sum[a][d] + sum[a][c];
}

int rec(int top, int bottom, int left, int right) {
  if(top >= bottom || left >= right) return 0;
  if(~dp[top][bottom][left][right]) return dp[top][bottom][left][right];
  int ret = 0;
  int b2 = H - (sy - top), t2 = bottom - sy - 1;
  int r2 = W - (sx - left), l2 = right - sx - 1;
  if(top > 0) {
    int add = rect(top - 1, top, left, right, t2, b2, l2, r2);
    if(add >= 0) ret = max(ret, rec(top - 1, bottom, left, right) + add);
  }
  if(left > 0) {
    int add = rect(top, bottom, left - 1, left, t2, b2, l2, r2);
    if(add >= 0) ret = max(ret, rec(top, bottom, left - 1, right) + add);
  }
  if(bottom < H) {
    int add = rect(bottom, bottom + 1, left, right, t2, b2, l2, r2);
    if(add >= 0) ret = max(ret, rec(top, bottom + 1, left, right) + add);
  }
  if(right < W) {
    int add = rect(top, bottom, right, right + 1, t2, b2, l2, r2);
    if(add >= 0) ret = max(ret, rec(top, bottom, left, right + 1) + add);
  }
  return dp[top][bottom][left][right] = ret;
}

int main() {
  cin >> H >> W;
  for(int i = 0; i < H; i++) {
    cin >> S[i];
    for(int j = 0; j < W; j++) {
      if(S[i][j] == 'E') sy = i, sx = j;
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) sum[i + 1][j + 1] = S[i][j] == 'o';
  }
  for(int i = 0; i <= H; i++) {
    for(int j = 1; j <= W; j++) sum[i][j] += sum[i][j - 1];
  }
  for(int i = 1; i <= H; i++) {
    for(int j = 0; j <= W; j++) sum[i][j] += sum[i - 1][j];
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(sy, sy + 1, sx, sx + 1) << endl;
}

Measured memory_bytes: 199680
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N=5e3+5,mod=1e9+7;
int n;
double p[N],dp[N][N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lf",&p[i]);
    dp[0][0]=1;
    for(int i=0;i<n;i++)
        for(int j=0;j<=i;j++)
    {
        dp[i+1][j]+=dp[i][j]*(1-p[i+1]);
        dp[i+1][j+1]+=dp[i][j]*p[i+1];
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[n][i];
    printf("%.10f\n",ans);
}


Measured memory_bytes: 117248