akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int h = in.nextInt();
    		int w = in.nextInt();
    		String[] a = new String[h];
    		for (int i = 0; i < h; i++) {
    			a[i] = in.next();
    		}
     
    		boolean[] row = new boolean[h];
    		Arrays.fill(row, false);
    		boolean[] col = new boolean[w];
    		Arrays.fill(col, false);
    		for (int i = 0; i < h; i++) {
    			for (int j = 0; j < w; j++) {
    				if (a[i].charAt(j) == '#') {
    					row[i] = true;
    					col[j] = true;
    				}
    			}
    		}
     
    		for (int i = 0; i < h; i++) {
    			if (row[i]) {
    				for (int j = 0; j < w; j++) {
    					if (col[j]) {
    						System.out.print(a[i].charAt(j));
    					}
    				}
    				System.out.println();
    			}
    		}
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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

int main() {
  int five = 0, seven = 0;
  for (int i = 0; i < 3; i++) {
  	int s;
    cin >> s;
    if (s == 5) {
    	five ++;
    }
    else if (s == 7) {
    	seven ++;
    }
  }
 
  if((five == 2) && (seven == 1)) {
  	cout << "YES"  << endl;
  }
  else {
  	cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  x -= z;
  int t = y + z;
  cout << x / t << endl;
}


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

int main(){
	int N, K, answer = 0;
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		int height = 0;
		cin >> height;
		if(height >= K) answer++;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
a = int(input())
s = input()

if a >= 3200:
    ans = s
else:
    ans = "red"

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
def main():
    S = input()
    s_len = len(S)
    num_list = [0 for _ in range(s_len)]
    flag = True
    num = 0
    for i in range(s_len):
        if S[i] == "R":
            if flag:
                num += 1
            else:
                num_list[point-1] += num//2
                num_list[point] += (num+1)//2
                num = 1
                flag = True
        elif S[i] == "L":
            if flag:
                num_list[i-1] += (num+1)//2
                num_list[i] += num//2
                point = i
                num = 1
                flag = False
            else:
                num += 1
    num_list[point-1] += num//2
    num_list[point] += (num+1)//2
    for i in num_list:
        print(i, end=" ")

main()


Measured memory_bytes: 4864
//https://atcoder.jp/contests/dp/tasks/dp_q
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int N;
int h[212345];
LL a[212345];
namespace BIT_{
    using RET = LL;
    constexpr int BUF = 1123456;
    int ptr = 0;
    RET t[BUF];
    inline RET* get(const int size){
        ptr+=size;
        return t+ptr-size;
    }
}
//[1,n],0は扱えない!
struct BIT{
    using T=BIT_::RET;
    T* bit;
    int sz;
    BIT(int n):bit(BIT_::get(n+10)),sz(n){
        fill(bit,bit+n+10,0);
    }
    T sum(int i){
        T s=0;
        while(i>0){
            chmax(s,bit[i]);
            i-=i&-i;
        }
        return s;
    }
    void add(int i,T x){
        while(i<=sz){
            chmax(bit[i],x);
            i+=i&-i;
        }
    }
};

int main(){
    cin>>N;
    for(int i:range(N))cin>>h[i];
    for(int i:range(N))cin>>a[i];
    BIT bit(N+10);
    for(int i:range(N)){
        LL ans = bit.sum(h[i])+a[i];
        bit.add(h[i],ans);
    }
    cout<<bit.sum(N)<<endl;
    return 0;
}

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


int main() {
  int w, a, b;
  cin >> w >> a >> b;
  if (a <= b && b <= a + w){
    cout << 0 << endl;
    return 0;
  }
  if(a + w < b){
    cout << b - a - w << endl;
  }else{
    cout << a - b - w << endl;
  }
}

Measured memory_bytes: 3632
#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
using namespace std;
int a[2];
int main()
{
 scanf("%d%d%d",&a[0],&a[1],&a[2]);
 sort(a,a+3); 
 printf("%d",a[0]+a[1]);
 return 0;
}


Measured memory_bytes: 256
S = input()
L = len(S)
ACGT = ["A","C","T","G"]
ctr = 0
ctrs = [0]
for l in range(L):
  if S[l] in ACGT:
    ctr += 1
    if l==L-1:
      ctrs.append(ctr)
  else:
    ctrs.append(ctr)
    ctr = 0
 
print(max(ctrs))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N, W;
int v[101], w[101];
int dp[101][10001];

int main() {
	scanf("%d %d", &N, &W);
	rep(i, N) scanf("%d %d", &v[i], &w[i]);
	repr(i, N - 1) rep(j, W + 1) {
		if(j < w[i]) dp[i][j] = dp[i + 1][j];
		else {
			dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
		}
	}
	printf("%d\n", dp[0][W]);
	return 0;
}

Measured memory_bytes: 7024
from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import dijkstra
import numpy as np

N,M,S=map(int,input().split())

Us=[0]*M
Vs=[0]*M
As=[0]*M
Bs=[0]*M
for i in range(M):
    Us[i],Vs[i],As[i],Bs[i] = map(int,input().split())
    Us[i] -= 1
    Vs[i] -= 1

# ---
V={}
Ns = max(As)*N
Nv=N*(Ns+1)
cnt=0
for i in range(N):
    for ns in range(Ns+1):
        V[(i,ns)]=cnt
        cnt+=1

row=[]
col=[]
data=[]

if S > Ns:
    S = Ns

# U <-> V
for _ in range(M):
    u = Us.pop()
    v = Vs.pop()
    a = As.pop()
    b = Bs.pop()
    #
    for i in range(Ns+1): # i = 0,..,Ns
        ns_s = Ns - i
        ns_g = ns_s - a
        if ns_g >= 0:
            # U -> V
            row.append( V[(u,ns_s) ])
            col.append( V[(v,ns_g)] )
            data.append( b )
            # V -> U
            row.append( V[(v,ns_s) ])
            col.append( V[(u,ns_g)] )
            data.append( b )

# -----

for i in range(N):
    c,d = map(int,input().split())
    for j in range(Ns): # j = 0,...,Ns-1
        ns_s = j
        ns_g = j + c
        if ns_g > Ns:
            ns_g = Ns
        row.append( V[(i,ns_s) ])
        col.append( V[(i,ns_g)] )
        data.append( d )

graph=coo_matrix((data, (row, col)), shape=(Nv,Nv))

s=V[(0,S)]
dist_matrix = dijkstra(csgraph=graph, directed=True, indices = s)

for i in range(1,N):
    ans = min([dist_matrix[i*(Ns+1)+v] for v in range(Ns+1)])
    print(int(ans))

Measured memory_bytes: 98464
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPowerOfTwo (int x) {
  return x && (!(x&(x-1))); 
}
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    int ans = 1000;
    while(ans < n){
        ans += 1000;
    }
    cout << ans - n;
}

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


void solve(long long N, std::vector<long long> x, std::vector<long long> y){
    vector<int> I(N);
    for(int i=0;i<N;++i) I[i] = i;
    double avg = 0;
    long long S = 0;
    do {
        S++;
        double ret = 0.0;
        for(int i=1;i<N;++i) {
            ret += sqrt((x[I[i]]-x[I[i-1]])*(x[I[i]]-x[I[i-1]]) + (y[I[i]]-y[I[i-1]])*(y[I[i]]-y[I[i-1]]));
        }
        avg += ret;
    } while (std::next_permutation(I.begin(), I.end()));
    cout << setprecision(8) << avg/S << 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);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 3816
x, y = 0, 0
a = 90

while line = gets
  break if line.chomp == '0,0'
  c, d = line.chomp.split(',').map(&:to_i)
  x += c * Math.cos(a * Math::PI / 180)
  y += c * Math.sin(a * Math::PI / 180)
  a -= d
end

puts "#{x.to_i}\n#{y.to_i}"

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

bool judge(string&s){
	string s2=s;
	reverse(s2.begin(),s2.end());
	return s!=s2;
}

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s;
	cin>>s;
	bool yes=true;
	int n=s.size(),n2;
	if(judge(s))yes=false;
	string s2=s.substr(0,(n-1)/2);
	n2=s2.size();
	if(yes==true&&judge(s2))yes=false;
	s2=s.substr((n+3)/2-1,n2);
	if(yes==true&&judge(s2))yes=false;
	if(yes)cout<<"Yes\n"s;
	else cout<<"No\n"s;
}

Measured memory_bytes: 256
#include<cstdio>
#include<bitset>
using namespace std;
const int N=4e6+7;
bitset<N>s;int n,i,x,sum;
int main(){
	s[0]=1;
	for(scanf("%d",&n),i=1;i<=n;++i)scanf("%d",&x),s|=(s<<x),sum+=x;
	for(x=(sum+1)/2;;++x)if(s[x])break;
	printf("%d\n",x);
}

Measured memory_bytes: 1664
#[allow(unused)]
use std::cmp::{max, min};

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        n: usize,
        d: [i64; n],
    }

    let mut d = d;
    d.sort();
    println!("{}", (d[n / 2] - d[n / 2 - 1]));
}

Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

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

    vector<vector<long long>> dp(N + 2, vector<long long>(2, 0));
    dp[0][0] = 0;
    dp[0][1] = INT_MIN; // 型が long long なので INT_MIN よりも小さな値をとれる

    for(int i = 0; i <= N; i++) {
        long long A;
        cin >> A;
        for(int j = 0; j < 2; j++) {
            dp[i + 1][0] = max(dp[i][0] + A, dp[i][1] - A);
            dp[i + 1][1] = max(dp[i][0] - A, dp[i][1] + A);
        }
    }

    cout << dp[N][0] << endl;

    return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <stdlib.h>
//#include <string.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (abs(a-c) <= d) printf("Yes\n");
  else if (abs(a-b)<=d && abs(b-c)<=d) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
/*
─────────▄▄▄▄▄▄▄▄▄▄▄▄─────────
─────▄▄▀▀░░░░░░░░░░░░▀▀▄▄─────
───▄▀░░░░░░░░░░░░░░░░░░░░▀▄───
──█░░░░░▄▄▄▄▄░░░░▄▄▄▄▄░░░░░█──
─█░░░░░██░█░██▄▄██░█░██░░░░░█─
█░░░░░░░▀▀▀▀▀░░░░▀▀▀▀▀░░░░░░░█
█░░░░▄▄▄░░░░░░░░░░░░░░▄▄▄░░░░█
█░░░░██▀█▄▄▄▄▄▄▄▄▄▄▄▄██▀█░░░░█
─█░░░▀██▄████████▄▄▄▄██▄▀░░░█─
──█░░░░▀██▀▀▀▀████████▀░░░░█──
───▀▄░░░░▀▄▄▄▄██████▀░░░░▄▀───
─────▀▀▄▄░░░░░░░░░░░░▄▄▀▀─────
─────────▀▀▀▀▀▀▀▀▀▀▀▀─────────
*/
#include <bits/stdc++.h>

using namespace std;

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

	int n, q;
	cin >> n >> q;
	vector<vector<int>> g(n);
	vector<long long> cnt(n);
	for (int i = 0; i < n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		g[u - 1].push_back(v - 1);
		g[v - 1].push_back(u - 1);
	}
	while (q--) {
		int p, x;
		cin >> p >> x;
		cnt[p - 1] += x;
	}
	function<void(int, int)> dfs = [&](int v, int p) {
		for (int to : g[v]) {
			if (to == p) {
				continue;
			}
			cnt[to] += cnt[v];
			dfs(to, v);
		}
	};
	dfs(0, -1);
	for (int i = 0; i < n; ++i) {
		if (i) {
			cout << ' ';
		}
		cout << cnt[i];
	}

	return 0;
}

Measured memory_bytes: 30592
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define ll long long
const int MAX=1e5+8;
using namespace std;

int main() 
{ 
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r",stdin);
//	freopen("out.txt", "w", stdout);
//	#endif
	double a;
	cin>>a;
	cout<<ceil(a/2);
} 


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

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin>>n;
    unsigned long long arr[n][2];
    unsigned long long x,y;
    cin>>arr[0][0]>>arr[0][1];
    for (int i=1;i<n;i++){
        cin>>arr[i][0]>>arr[i][1];
        if (arr[i-1][0]%arr[i][0]==0){
            x=arr[i-1][0]/arr[i][0];
        }else x=arr[i-1][0]/arr[i][0]+1;
        if (arr[i-1][1]%arr[i][1]==0){
            y=arr[i-1][1]/arr[i][1];
        }else y=arr[i-1][1]/arr[i][1]+1;
        x=max(x,y);
        arr[i][0]*=x;arr[i][1]*=x;
    }cout<<arr[n-1][0]+arr[n-1][1]<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    REP(i, N - K) {
        if (A[i] < A[i + K]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }

    return 0;
}

Measured memory_bytes: 3984
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
void read(int &x){
	char ch = getchar();x = 0;
	for (; ch < '0' || ch > '9'; ch = getchar());
	for (; ch >='0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}

int main(){
	double k;
	string jud;
	int n;
	cin>>n;
	double ans=0;
	for(int i=1;i<=n;i++){
		cin>>k>>jud;
		if(jud=="JPY") ans+=k;
		else ans+=k*380000.0;
	}	
	printf("%.8lf\n",ans);
	return 0;
}




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

void input ();
void solve ();

int n;
std::string str;

void input () {
  scanf ("%d", &n);
  std::cin >> str;

  solve ();
}

void solve () {
  if (n % 2)
    puts ("No");
  else {
    if (str.substr (0, n / 2) == str.substr (n / 2, n / 2))
      puts ("Yes");
    else
      puts ("No");
  }
}

int main () {
  input ();
  return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    vi cnt(100005,0);
    int n,ans=0; cin>>n; 
    while (n--){
        int  a; cin >> a; 
        cnt[a]++;
    }
    for (int i=1;i<100000;i++) ans = max(ans,cnt[i]+cnt[i-1]+cnt[i+1]);
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000


int main(){

	int a;
	cin>>a;
	string s;
	cin>>s;
	
	if(a>=3200)cout<<s<<endl;
	else cout<<"red"<<endl;
	
	
	return 0;
}


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

typedef long long ll;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
#define SP << " " <<
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 

#define MOD 1000000007

template <class T> T comb(T n, T r)
{
    if (n < 0 || n < r || r < 0)
        return 0;

    r = min(r, n - r);
    if (r == 0)
        return 1;

    vector<T> numer(r);
    vector<T> denom(r);

    iota(all(numer), n - r + 1);
    iota(all(denom), 1);

    for (T i = 1; i < r; i++) {
        T divisor = denom[i];
        if (divisor > 1) {
            T offset = (n - r) % (i + 1);
            for (T j = i; j < r; j += i + 1) {
                numer[j - offset] /= divisor;
                denom[j] /= divisor;
            }
        }
    }
    
    T p = 1;
    for(T i = 0; i < r; i++)
        p = p * numer[i] % MOD;

    return p % MOD;
}

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

    ll X, Y; cin >>X>>Y;


    ll ans = 0;

    if ((X+Y)%3==0 && (2*Y-X)%3==0) {
        ll n, r;
        n = (X + Y) / 3;
        r = (2 * Y - X) / 3;

        ans = comb(n, r);

    }
    cout << ans << endl;
}


Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
bool vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}
 
int main() {
  vector<int> p;
  int X, N;
  cin >> X >> N;
  for (int i = 0; i < N; i++) {
    int pi;
    cin >> pi;
    p.push_back(pi);
  }
  for (int a = 0; a < 101; a++) {
    if (!vector_finder(p, X-a)) {
      cout << X-a << endl;
      return 0;
    } else if (!vector_finder(p, X+a)) {
      cout << X+a << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3572
#define _crt_secure_no_warnings
#include<bits/stdc++.h>
#include<functional>
#define ll long long
#define Test int t;cin>>t;while(t--)
#define PI 3.14159265
#define endl "\n"
int dx[]= {-1,-1,-1,0,0,0,1,1,1};
int dy[]= {-1,0,1,-1,0,1,-1,0,1};
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll a[100001];
ll b[100001];
int main()
{
    fast();
    ll x,y,n;
    cin>>x>>y>>n;
    ll z=min(n,y-1);
    cout<<(x*z)/y;
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int cnt_digits( int a)
{
    int ans = 0;
    while(a > 0)
    {
        ans++;
        a /= 10;
    }
    return ans;
}
int main()
{
    she_told_me_dont_worry
    int n;
    cin>>n;
    int i;
    int ans = 0;
    FOR(i, 1, n+1)
    {
        if( cnt_digits(i)%2!=0) ans++;
    }
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};

void solve()
{
    ll a, b, c, d, n, m, l, r, k, y, z, ans = 0ll;
    string s, t;
    cin>>n>>a>>b;
    VLL x(n);
    REP(i,n) cin>>x[i];
    REP(i,n-1) {
        ans += min(a * (x[i+1] - x[i]), b);
    }

    cout<<ans<<endl;
}

int main()
{
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3940
n=int(input())
l=[]
for i in range(n):
  a,b=map(int,input().split())
  l.append([b,a])
l.sort()
tmp=0
for i in range(n):
  tmp+=l[i][1]
  if tmp>l[i][0]:
    print('No')
    break
  if i==n-1:
    print('Yes')

Measured memory_bytes: 35616
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>


int main() {
	constexpr long long int MOD = 998244353;
	std::cin.tie(nullptr); std::cin.sync_with_stdio(false);
	int n, s; std::cin >> n >> s;
	std::vector<int> number(n); for (auto& a : number)std::cin >> a;
	std::vector<long long int> pattern(3001); pattern[0] = 1;
	long long int result = 0;
	for (auto i = 0; i < n; ++i) {
		const auto a = number[i];
		for (auto j = 3000 - a; j > 0; --j) {
			pattern[j + a] += pattern[j];
			pattern[j + a] %= MOD;
		}
		pattern[a] += i + 1;
		pattern[a] += MOD;
		result += pattern[s];
		result %= MOD;
	}
	std::cout << result << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll x,f=0,s=0;
    cin>>x;
    for(ll i=0;i<10000;i++)
    {
        int br=0;
        for(ll j=-10000;j<i;j++)
        {
            ll a=i*i*i*i*i,b=j*j*j*j*j;
            if(a-b==x){
                f=i;
                s=j;
                br=1;
                break;
            }
        }
        if(br) break;
    }
    cout<<f<<" "<<s;
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace::std;
typedef long long lint;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(n) (n).begin(),(n).end()
template<typename T,typename ...Args>auto make_vector(T x,int arg,Args ...args){if constexpr(sizeof...(args)==0)return vector<T>(arg,x);else return vector(arg,make_vector<T>(x,args...));}

int main(){
    lint n,k;
    cin>>n>>k;
    k--;
    string s;
    cin>>s;
    s[k]=s[k]-'A'+'a';
    cout<<s<<endl;
}

Measured memory_bytes: 3516
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
const int INF = 1e9;
typedef long long ll;
using namespace std;
int main() {
    ll X, Y;
    cin >> X >> Y;
    ll a = 1;
    while(X <= Y) {
        X += X;
        if(X <= Y) a++;
    }
    cout << a << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()
# template


def main():
    n = ii()
    if n % 2 == 1:
        print(0)
    else:
        ans = 0
        for i in range(1, 60):
            ans += (n // (2 * pow(5, i)))
        print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>

using namespace std;

typedef long long ll;

ll N,X;
ll s[51];
ll p[51];

ll dfs(ll L,ll x){
    if(L == 0) return 1;
    if(s[L] == x) return p[L];
    if(x == 1) return 0;
    if(x <= 1 + s[L-1]) return dfs(L-1,x-1);
    if(x == 2 + s[L-1]) return p[L-1] + 1;
    return p[L-1] + 1 + dfs(L-1,x-2-s[L-1]);
}

int main(){
    cin >> N >> X;
    s[0] = p[0] = 1;
    for(int i=1;i<=50;i++){
        s[i] = s[i-1] * 2 + 3;
        p[i] = p[i-1] * 2 + 1;
    }
    cout << dfs(N,X) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {

	void solve() {

		int ab = inint(), bc = inint(), ca = inint();
		out.println(ab*bc/2);
		
	}
	
	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);
	
	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}
	
	public int inint() {
		return in.nextInt();
	}
	
	public String instr() {
		return in.next();
	}

}

Measured memory_bytes: 21972
#include<stdio.h>
int main(){
  char s[110];
  int i,j,m,d[110][5][2]={};
  scanf("%s %d",s,&m);
  d[0][0][1]=1;
  for(i=0;s[i];i++){
    for(j=0;j<4;j++){//printf("%d %d:",d[i][j][0],d[i][j][1]);
      d[i+1][j  ][0]+=d[i][j][0];//mini+0
      d[i+1][j+1][0]+=d[i][j][0]*9;//mini+other
      if(s[i]=='0')d[i+1][j][1]+=d[i][j][1];
      else{
	d[i+1][j  ][0]+=d[i][j][1];
	d[i+1][j+1][1]+=d[i][j][1];
	d[i+1][j+1][0]+=d[i][j][1]*(s[i]-'0'-1);
      }
      //d[i+1][j+1][0]+=d[i][j][1]*(s[i]-'0');
    }//printf("\n");
  }
  //for(j=0;j<4;j++)printf("%d %d:",d[i][j][0],d[i][j][1]);printf("\n");
  printf("%d\n",d[i][m][0]+d[i][m][1]);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>

int main() {
  size_t D;
  int G;
  scanf("%zu %d", &D, &G);

  std::vector<int> p(D), c(D);
  for (size_t i = 0; i < D; ++i)
    scanf("%d %d", &p[i], &c[i]);

  int res = 1e9;
  for (int i = 0; i < (1 << D); ++i) {
    int sum = 0;
    int cur = 0;
    for (size_t j = 0; j < D; ++j) {
      if (i >> j & 1) {
        sum += 100*(j+1) * p[j] + c[j];
        cur += p[j];
      }
    }
    for (size_t j = D; j--;) {
      if (i >> j & 1) continue;
      for (int k = 0; (k < p[j] && sum < G); ++k) {
        sum += 100*(j+1);
        ++cur;
      }
    }
    res = std::min(res, cur);
  }

  printf("%d\n", res);
}

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

using namespace std;

int main(){
    int N,K,ans=0;
    cin >> N >> K;
    vector<int> sn(N,0);
    for(int i=0;i<K;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int A;
            cin >> A;
            sn[A-1]++;
        }
    }

    for(int i=0;i<N;i++){
        if(sn[i]==0){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
def main():
    a = []
    for i in range(5):
      n = int(input())
      a.append(n)
    k = int(input())
    a.sort()
    for i in a:
      for j in a:
        if i == j:
          continue
        if abs(i-j) > k:
          return False
    return True

if __name__ == '__main__':
    if main():
      print("Yay!")
    else:
      print(":(")

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

int main (){
	int n,k;
	
	cin>>n>>k;
	string s;
	
	vector<string>str;
	
	
	for(int i=0; i<n; i++) {
		cin>>s;
		str.push_back(s);
	}
	
	sort(str.begin(), str.end());
	
	for(int i=0; i<n; i++) {
		cout<<str[i];
	}cout<<"\n";
}

Measured memory_bytes: 3644
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	n <- readInt
	s <- getLine
	putStrLn $ map ( chr . ( + ord 'A' ) . ( `mod` 26 ) . ( + n ) . ( subtract $ ord 'A' ) . ord ) s

Measured memory_bytes: 1404
# -*- coding: utf-8 -*-
N,K=map(int,input().split())
import math
for i in range(1,K+1):
    ans1=(math.factorial(K-1)//math.factorial(i-1)//math.factorial(K-i))%1000000007
    if N-K-i+1<0:
        print(0)
        continue
    ans2=(math.factorial(N-K+1)//math.factorial(N-K-i+1)//math.factorial(i))%1000000007
    ans=(ans1*ans2)%1000000007
    print(ans)

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

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> II;
typedef vector<II> VII;

#define REP(x, n) for (int x = 0; x < (n); ++x)
#define IT(s) s.begin(), s.end()
#define INF (1e9 + 1)
#define EPS 1e-9
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD 1000000007

string s, t;

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

    cin >> s >> t;
    int cnt {0};

    REP (i, s.length()) {
        if (s[i] != t[i]) {
            ++cnt;
        }
    }

    cout << cnt << "\n";

    return 0;
}


Measured memory_bytes: 3776
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;


public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.uniqueNumberGame();
		return;
	}
	
	//数当てゲーム
	private void uniqueNumberGame() {
		
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); //標準入力
		
		try {
			
			String inputStr = bufferedReader.readLine();
			int playerNum = Integer.parseInt(inputStr);
			LinkedList<int[]> gameResultList = new LinkedList<int[]>();
			
			//ゲーム結果の入力
			for (int i = 0; i < playerNum; i++) {
				
				String inputStr2 = bufferedReader.readLine();
				String[] inputStrs = inputStr2.split(" ");
				int[] gameResultArray = new int[3];
				
				for (int j = 0; j < 3; j++) {
					gameResultArray[j] = Integer.parseInt(inputStrs[j]);
				}
				
				gameResultList.add(gameResultArray);
				
			}
			
			//得点が得られるプレイヤーを特定し、ゲームの結果に加算する
			int[] resultArray = new int[playerNum]; //ゲームの結果を保存する
			for (int i = 0; i < 3; i++) {
				
				int[] gameIntermediateResultsArray = new int[playerNum];
				boolean[] getFlagArray = new boolean[playerNum]; //trueなら該当する添字のプレイヤーは得点を得られる
				
				//i回目のゲームのそれぞれのプレイヤーが書いた数字を取得
				for (int j = 0; j < playerNum; j++) {
					int[] tmpArray = gameResultList.get(j);
					gameIntermediateResultsArray[j] = tmpArray[i];
				}
				
				//同じ値を書いたプレイヤーがいないかをチェック
				for (int k = 0; k < playerNum; k++) {
					
					int checkNum = gameIntermediateResultsArray[k];
					boolean checkFlag = false; //1回でもcheckNumと同じ数字が配列にあった場合、trueになる
					
					for (int l = 0; l < playerNum; l++) {
						
						if (k != l && checkNum == gameIntermediateResultsArray[l]) {
							checkFlag = true; //同じ数字が見つかった
						}
						
					}
					
					//同じ数字を出したプレイヤーがいなかったのは、どのプレイヤーか記録する
					if (!checkFlag) {
						getFlagArray[k] = true; 
					}
					
				}
				
				//記録に基づいて、他のプレイヤーと同じ数字を出さなかったプレイヤーに加点する
				for (int m = 0; m < playerNum; m++) {
					
					if (getFlagArray[m] == true) {
						resultArray[m] += gameIntermediateResultsArray[m];
					}
					
				}
				
			}
			
			//結果の表示
			for (int resultNum : resultArray) {
				System.out.println(resultNum);
			}
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
	}
}

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

int main() {
    string s;
    cin >> s;
    int s_num = 0, del_num = 0;
    for (char ch : s) {
        if (ch == 'T') {
            if (s_num > 0) {
                s_num--;
                del_num++;
            } else {
                s_num = 0;
            }
        } else {
            s_num++;
        }
    }
    cout << s.size() - 2 * del_num << endl;

    return 0;
}


Measured memory_bytes: 640
#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;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
	int n;
	std::cin >> n;
	std::vector<int> p(n);
	rep(i,n)std::cin >> p[i];
	int counter=0;
	rep(i,n-2){
		std::vector<int> dum(3);
		dum[0]=p[i];dum[1]=p[1+i];dum[2]=p[i+2];
		sort(all(dum));
		if(dum[1]==p[i+1])counter++;
	}
	std::cout << counter << std::endl;
}

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

using namespace std;
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
using pii=pair<int, int>;
using ll=long long;

const int mn = 2e5 + 5;
const int mod = 1e9 + 7;
int n;
char s[mn];

void bye() {
    puts("0");
    exit(0);
}

int main() {
    //cin.sync_with_stdio(0);
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d%s", &n, s + 1);
    n *= 2;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'W') s[i] = 0;
        else s[i] = 1, cnt++;
    }
    if (cnt % 2) bye();
    bool p = 0;
    cnt = 0;
    ll ans = 1;
    for (int i = 1; i <= n; i++) {
        if (s[i] ^ p) {
            cnt++;
        } else {
            ans *= cnt;
            ans %= mod;
            cnt--;
            if (cnt < 0) bye();
        }
        p ^= 1;
        //printf("%d %d %lld\n", i, cnt, ans);
    }
    if (cnt) bye();
    for (int i = 1; i <= n / 2; i++) ans = ans * i % mod;
    printf("%lld\n", ans);

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n , k;
    while (~scanf("%d%d" , &n,&k)){
        int ans = 1;
        for (int i=0; i<n; i++)
            ans = min(ans*2,ans+k);
        printf("%d\n",ans);
    }
    return 0;
}


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

int main() 
{
  int n;
  cin >> n;
  vector<int> p(30);
  int count = 0;


  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 1; i < n - 1; i++) {
    if (p[i-1] < p[i] && p[i] < p[i+1]) {
      count++;
    }
    else if(p[i-1] > p[i] && p[i] > p[i+1]) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { if (i) os << " "; os << v[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
inline int add(int a, int b) { a += b; if (a >= mod) return a - mod; return a; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n, m;
  cin >> n >> m;
  map<char, int> mp;
  rep(i, n) rep(j, m) {
    char c;
    cin >> c;
    mp[c]++;
  }
  int cnt = 0;
  for (auto e : mp) {
    if (e.S >= 4) {
      rep(i, e.S / 4) {
        if (cnt == (n / 2) * (m / 2)) break;
        cnt++;
        mp[e.F] -= 4;
      }
    }
  }
  if (cnt < (n / 2) * (m / 2)) {
    cout << "No" << endl;
    return;
  }

  if (n % 2 == 0 && m % 2 == 0) {
    cout << "Yes" << endl;
    return;
  }

  cnt = 0;
  for (auto e : mp) if (e.S % 2 == 0) cnt += e.S / 2;
  if (n % 2 && m % 2 == 0) {
    if (cnt == m / 2) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if (n % 2 == 0 && m % 2) {
    if (cnt == n / 2) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    if (cnt == (n / 2) + (m / 2)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

int main(void)
{
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;

	if (X > Y)
		cout << min(A + B, C * 2)*Y + min(A, C * 2)*(X - Y) << endl;
	else
		cout << min(A + B, C * 2)*X + min(B, C * 2)*(Y - X) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=998244353;
int dp[3000][3000];
signed main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    for(int i=0;i<3000;i++){
        for(int j=0;j<3000;j++){
            if(i==0){
                if(j==0)
                    dp[i][j]=1;
                else
                    dp[i][j]=dp[i][j-1]*a%mod;
            }else{
                if(j==0)
                    dp[i][j]=dp[i-1][j]*b%mod;
                else
                    dp[i][j]=(dp[i][j-1]*(a+i)+dp[i-1][j]*(b+j)-dp[i-1][j-1]*(a+i-1)*(b+j-1)%mod+mod)%mod;
            }
        }
    }
    cout<<dp[c-a][d-b]<<endl;
}

Measured memory_bytes: 73908
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

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

    std::string s;
    std::cin >> s;

    int count = 1;
    for (int i = 0; i < n - 1; i++) {
        if (s[i] != s[i + 1]) {
            count++;
        }
    }

    std::cout << count << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

class sh{
public:
	ll a,b;
	sh(){}
	sh(ll aa,ll bb){
		a=aa;
		b=bb;
	}

	bool operator<(const sh &d)const{
		return d.a*(b+1LL)<a*(d.b+1LL);
	}
};

int n;
ll T;
ll a[200005],b[200005];
ll dp[200005][501];
ll sum[200005];

int main(void){
	scanf("%d%lld",&n,&T);
	vector<P> va0;
	vector<sh> va1;
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		if(a[i]==0){
			va0.push_back(P(a[i],b[i]));
		}else{
			va1.push_back(sh(a[i],b[i]));
		}
	}
	sort(va0.begin(),va0.end());
	sort(va1.begin(),va1.end());
	for(int i=0;i<=va1.size();i++){
		for(int j=1;j<=500;j++){
			dp[i][j]=T+5LL;
		}
		dp[i][0]=0;
	}
	for(int i=0;i<va0.size();i++){
		sum[i+1]=sum[i]+va0[i].second+1;
	}
	for(int i=va0.size();i<n;i++){
		sum[i+1]=sum[va0.size()]+T+5;
	}
	for(int i=0;i<va1.size();i++){
		for(int j=0;j<500;j++){
			if(dp[i][j]>T)continue;
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			ll co=dp[i][j];
			dp[i+1][j+1]=min(dp[i+1][j+1],co+1LL+va1[i].a*(co+1LL)+va1[i].b);
		}
	}
	int ans=0;
	for(int i=0;i<=500;i++){
		if(dp[va1.size()][i]<=T){
			//printf("a %d %lld\n",i,dp[va1.size()][i]);
			ans=max(ans,i);
			int po=upper_bound(sum,sum+va0.size()+1,(ll)T-dp[va1.size()][i])-sum;
			po--;
			ans=max(ans,i+po);
		}
	}
	printf("%d\n",ans);
	return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, V, W, T;

    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    if(V < W){
        cout << "NO" << endl;
        return 0;
    }

    ll L = abs(A-B);

    // cout << abs(A-B) << endl;
    // cout << T*(W-V) << endl;

    if(T*(V-W) < L){
        cout << "NO" << endl;
        return 0;
    }

    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 3636