akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	static int w, h, count, before;
	static int[][] dir = {{-1,0}, {0,-1}, {1,0}, {0, 1}};
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			w = sc.nextInt();
			h = sc.nextInt();
			sc.nextLine();
			if(w == 0){
				break;
			}

			int[] pos = new int[2];
			int [][] c = new int[h][w];
			char abc;
			String str = new String();
			for(int i = 0; i < h; i++){/* ????????? */
				str = sc.nextLine();/* ?????§???????????? */
				for(int j = 0; j < w; j++){
					abc = str.charAt(j);
					if(abc == '#'){
						c[i][j] = 0;
					}else if(abc == '.'){
						c[i][j] = 1;
					}else if(abc == '@'){
						c[i][j] = 1;
						pos[0] = i;
						pos[1] = j;
					}
				}
			}
			
			count = 0;
			before = 1;
			int y;
			y = search(c , pos[0], pos[1]);
			
			System.out.println(count);
		}
	}
	
	public static int search(int[][] c, int i, int j){
		if(c[i][j] == 0){
			return 0;
		}
		c[i][j] = 0;
		count++;
		
		int d = before + 2/* ????????°????????????????????´???????§???? */;
		if(d > 3){
			d -= 4;
		}
		
		for(int k = 0; k < 4; k++){
			d++;
			if(d > 3){
				d -= 4;
			}
			
			before = d;
			int x = i + dir[d][0], y = j + dir[d][1];
			if((x >= 0) && (x < h) && (y >= 0) && (y < w)){
				int z = search(c, x, y);
			}
		}		
		return 1;
	}
}

Measured memory_bytes: 46980
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		Scanner sc = new Scanner(System.in);
		String str;

		while(true){
			str = sc.nextLine();
			if(str.equals("END OF INPUT")){
				break;
			}

			int count = 0;
			for(int i=0;i<str.length();i++){
				if(str.charAt(i) == ' '){
					System.out.print(count);
					count = 0;
				}else{
					count++;
				}
			}
			System.out.println(count);
		}
	}

}

Measured memory_bytes: 0
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// int MOD = 998244353;
int MOD = 1000000007;
int k;
vll runrun;
void dfs(int num,int n,int m){
	if(n == m){
		runrun.pb(num);
		return;
	}
	if(num%10 != 0)dfs(num*10+num%10-1,n+1,m);
	dfs(num*10+num%10,n+1,m);
	if(num%10 != 9)dfs(num*10+num%10+1,n+1,m);
	return;
}
/*----------------------------------------------------------------*/
signed main(){
	
	cin >> k;
	for(int i = 1;i <= 12;i++){
		for(int j = 1;j <= 9;j++){
			dfs(j,1,i);
			if(runrun.size() >= k+1)break;
		}
		if(runrun.size() >= k+1)break;
	}
	Sort(runrun);
	cout << runrun[k-1] << endl;

	

	
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc161.contest.atcoder.jp/tasks/abc161_a

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define int long long
#define double long double
#define all(a) a.begin(), a.end()
#define debug(x) cout << #x << " = " << x << endl;
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; }
using namespace std;

const int mod = 1000000007;
struct mint{ //modint
    int x;
    mint(int x = 0): x(x % mod) {}
    friend istream& operator >> (istream &s, mint& m){ return s >> m.x; }
    friend ostream& operator << (ostream &s, mint m){ return s << m.x; }
    inline mint& operator += (mint a){ if((x += a.x) >= mod)x -= mod; return *this; }
    inline mint& operator -= (mint a){ if((x += mod - a.x) >= mod)x -= mod; return *this; }
    inline mint& operator *= (mint a){ (x *= a.x) %= mod; return *this; }
    inline mint& operator /= (mint a){ return(*this) *= a.inv(); }
    inline mint operator + (mint a){ mint res(*this); return res += a; }
    inline mint operator - (mint a){ mint res(*this); return res -= a; }
    inline mint operator * (mint a){ mint res(*this); return res *= a; }
    inline mint operator / (mint a){ mint res(*this); return res /= a; }
    inline bool operator == (mint a){ return x == a.x; }
    inline bool operator != (mint a){ return x != a.x; }
    inline bool operator < (mint a){ return x < a.x; }
    inline bool operator > (mint a){ return x > a.x; }
    inline bool operator <= (mint a){ return x <= a.x; }
    inline bool operator >= (mint a){ return x >= a.x;}
    mint inv(){ return pow(mod - 2); }
    mint pow(int p){
        mint res(1), tmp(x);
        for(; p; p >>= 1){ if(p & 1)res *= tmp; tmp *= tmp; }
        return res;
    }
};

const int mx = 100005;
int n;
vector<int> g[mx];
mint dp[mx][2];

mint dfs(int v, int p, int c){
    if(dp[v][c] != mint(0))return dp[v][c];
    mint res(1);
    for(int i : g[v]){
        if(i == p)continue;
        if(c == 0)res *= dfs(i, v, 0) + dfs(i, v, 1);
        else res *= dfs(i, v, 0);
    }
    return dp[v][c] = res;
}

signed main(void){

    cin >> n;
    rep(i, n - 1){
        int x, y; cin >> x >> y; x--; y--;
        g[x].push_back(y); g[y].push_back(x);
    }

    cout << dfs(0, -1, 0) + dfs(0, -1, 1) << endl;
    return 0;

}

Measured memory_bytes: 14208
loop do
  lhs, op, rhs = gets.split
  lhs, rhs = [lhs, rhs].map(&:to_i)
  puts case op
  when ?+ then lhs + rhs
  when ?- then lhs - rhs
  when ?* then lhs * rhs
  when ?/ then lhs / rhs
  when ?? then break
  end
end



Measured memory_bytes: 6872
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string S;
	cin >> S;
	int res = 1;
	for (int i = 0; i < N - 1; i++) {
		if (S[i] != S[i + 1]) {
			res++;
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 512
/*author - Ashutosh Chitranshi*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define pow2(x) ((x)*(x))
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007
#define ordered_set tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update>
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define mp make_pair
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vi > vvi;
typedef vector< vl > vvl;
typedef pair< int,int > ii;
typedef pair< ll,ll> pll;
typedef map< ll,ll> mll;
typedef map< int,int> mii;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll k;
    cin >> k;
    string str = "ACL";
    for(int i=0;i<k;i++)
        cout << str;
    cout << nl;
    return 0;
}

Measured memory_bytes: 3572
import math

def prime_factor2(n):
    i = 2
    factors = {}
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors:
            factors[n] += 1
        else:
            factors[n] = 1
    return factors

def kai(n):
    return math.factorial(n)

def H(n, r):
    rtn = 1
    for i in range(n+r-1, n-1, -1):
        rtn *= i
    rtn //= kai(r)
    return rtn


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

prime = prime_factor2(M)

ans = 1
mili = (10**9 + 7)
for v in prime.values():
    h = H(N, v) % mili
    ans  =  ans * h

ans = ans % mili
ans = int(ans)
print(ans)

Measured memory_bytes: 3064
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    X = int(input())
    for B in range(1001):
        A5 = X + B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, B)
            return 

        A5 = X - B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, -B)
            return 

    print(-1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 10132
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    ll ans=0;
    vector<P> robot;
    rep(i,N){
        ll X,L; cin>>X>>L;
        robot.pb(P(X+L,X-L));
    }
    sort(all(robot));
    ll r=-INF;
    rep(i,N){
        //おける
        if(robot[i].b>=r){
            ans++;
            r=robot[i].a;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 5372
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#pragma warning(disable : 4996) //_CRT_SECURE_NO_WARNINGS

int main(void) {
	double l = 0;
	double a,b,c;
	scanf("%lf", &l);
	a = l / 3;
	b = (l - a) / 2;
	c = l - (a + b);
	printf("%.11lf\n", a*b*c);
	return 0;
}

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

int main()
{
  int n;
  int64_t ans = 0, tmp1, tmp2;
  cin >> n;
  vector<int64_t> A(n + 1), B(n);
  for (int i = 0; i <= n; i++)
    cin >> A[i];
  for (int i = 0; i < n; i++)
    cin >> B[i];

  for (int i = 0; i < n; i++)
  {
    tmp1 = min(B[i], A[i]);
    ans += tmp1;
    B[i] -= tmp1;
    if (B[i] == 0)
      continue;
    tmp2 = min(A[i+1], B[i]);
    ans += tmp2;
    A[i+1] -= tmp2;
  }
  cout << ans << endl;
}

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


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

    // レベルの同じ経路に着目すれば二分グラフが構成できる
    // 2^k 個の部屋は k 個の二分グラフに分けられることがわかるので、
    // bit 演算を用いてどの二分グラフに属するかを判別する
    for(int i = 0; i < N; ++i){
        for(int j = i+1; j < N; ++j){
            for(int k = 0; k < N; ++k){ 
                if((i^j) & (1 << k)){
                    cout << k+1 << " ";
                    break;
                }
            }
        }
        cout << endl;
    }

    return 0;
}

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

bool X[N][N];

void initialize()
{
  for(int i=0;i<N;i++){row[i]=FREE,col[i]=FREE;}
  for(int i=0;i<2*N-1;i++){dpos[i]=FREE;dneg[i]=FREE;}
}

void printBoard()
{
  for(int i=0;i<N;i++)
    {
      for(int j=0;j<N;j++)
	{
	  if(X[i][j])
	    {
	      if(row[i]!=j)return ;
	    }
	}
    }
  for(int i=0;i<N;i++)
    {
      for(int j=0;j<N;j++)
	{
	  cout<<((row[i]==j)?"Q":".");
	}
      cout<<endl;
    }
}

void recursive(int i)
{
  if(i==N)
    {
      printBoard(); return ;
    }

  for(int j=0;j<N;j++)
    {
      if(NOT_FREE==col[j]||NOT_FREE==dpos[i+j]||NOT_FREE==dneg[i-j+N-1])continue;
      row[i]=j; col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
      recursive(i+1);
      row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
    }
}

int main()
{
  initialize();

  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++) X[i][j]=false;

  int k; cin>>k;
  for(int i=0;i<k;i++)
    {
      int r,c; cin>>r>>c;
      X[r][c]=true;
    }

  recursive(0);

  return 0;
}



Measured memory_bytes: 3128
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

static const int NMAX = 3005;

int weight[NMAX];
int value[NMAX];
int dp[2*NMAX][2];


void Construct_Solution(int n, int g)
{
    for(int i =1 ; i <= n; i++)
    {
        for(int k = g; k>= 0 ; k--)
        {
            if(k + weight[i] < g)
            {
                dp[k+weight[i]][0] = max(dp[k+weight[i]][0], dp[k][0] + value[i]);
                dp[k+weight[i]][1] = max(dp[k+weight[i]][1], dp[k][1] + value[i]);
            }
            dp[k][1] = max(dp[k][1], dp[k][0] + value[i]);
        }
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,t;
    cin >> n >> t;

    for(int i = 1; i<= n; ++i)
    {
        cin >> weight[i] >> value[i];
    }
    Construct_Solution(n,t);
    cout << dp[t-1][1];



    return 0;
}

Measured memory_bytes: 256
object Main extends App {
    import scala.annotation.tailrec

    val sc = new java.util.Scanner(System.in)
    val pw = new java.io.PrintWriter(System.out)
    @tailrec
    def output(i: Int = 1, n: Int = sc.nextInt): Unit = {
        if( n != 0 ) {
            pw.println("Case "+i+": "+n)
            output(i=i+1)
        }
    }

    output()
    pw.flush
}


Measured memory_bytes: 62220
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdio.h>
#include <cmath>
#include <limits.h>
using namespace std;

typedef long long ll;

#define min(a, b) (((a) < (b))? (a):(b))
#define max(a, b) (((a) > (b))? (a):(b))
#define REP(i, a, n) for(int i=(a); i<(n); ++i)
#define rep(i, n) REP(i, 0, (n))
#define square(a) (a)*(a)
#define pb push_back

int s,a,b,c,d;

int main(){
	cin >> s;
	
	d = s%10;
	s = s/10;
	c = s%10;
	s = s/10;
	b = s%10;
	s = s/10;
	a = s%10;
	s = s/10;
	
	if(a+b+c+d==7)cout << a << '+' << b << '+' << c << '+' << d << '=' << 7;
	else if(a+b+c-d==7)cout << a << '+' << b << '+' << c << '-' << d << '=' << 7;
	else if(a+b-c+d==7)cout << a << '+' << b << '-' << c << '+' << d << '=' << 7;
	else if(a+b-c-d==7)cout << a << '+' << b << '-' << c << '-' << d << '=' << 7;
	else if(a-b+c+d==7)cout << a << '-' << b << '+' << c << '+' << d << '=' << 7;
	else if(a-b+c-d==7)cout << a << '-' << b << '+' << c << '-' << d << '=' << 7;
	else if(a-b-c+d==7)cout << a << '-' << b << '-' << c << '+' << d << '=' << 7;
	else if(a-b-c-d==7)cout << a << '-' << b << '-' << c << '-' << d << '=' << 7;
}

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

using namespace std;

int n,k;

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

	cin >> n >> k;
	int ans = 0;
	while(n)
	{
		ans++;
		n /= k;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int A, B;
  cin >> A >> B;

  cout << lcm(A,B) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next()); // 問題数
        int m = Integer.parseInt(sc.next()); // 提出回数
        // 正答HashSet(key:正答した問題番号)
        HashSet<Integer> ac = new HashSet<>(n);
        // 誤答HashMap(key:誤答した問題番号、value:誤答回数)
        HashMap<Integer, Integer> wa = new HashMap<>(n);
        // 正答数：'AC'を1回以上出した問題の数
        int ac_count = 0;
        // ペナルティ数：正答済みの各問題において、初めて'AC'を出すまでに出した'WA'の数の総和
        int wa_count = 0;
        for (int i = 0; i < m; i++) {
            int p = Integer.parseInt(sc.next()); // 提出した問題番号
            String s = sc.next(); // 結果
            // 正答済みの問題番号はスキップ
            if (ac.contains(p)) {
                continue;
            }
            // 結果がACの場合
            if (s.equals("AC")) {
                ac_count++; // 正答数を加算
                ac.add(p); // 問題番号を正答HashSetに格納
                continue;
            }
            // 上記以外はWAとして扱う
            // 誤答HashMapに格納済みの問題番号の場合、誤答数を加算
            if (wa.containsKey(p)) {
                int num = wa.get(p);
                num++;
                wa.replace(p, num);
            } else {
                wa.put(p, 1); // 初誤答した場合、誤答HashMapへ登録
            }
        }
        // 正答した問題番号の誤答数のみペナルティ数として扱う
        for (Integer i : wa.keySet()) {
            if (ac.contains(i)) {
                wa_count += wa.get(i);
            }
        }
        System.out.println(String.format("%s %s", ac_count, wa_count));
        sc.close();
    }
}


Measured memory_bytes: 63912
/* 
 * Project: AtCoder Beginners Contest 147 B - Palindrome-philia
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/06
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstring>
using namespace std;

char s[100];

void solve() {

    int cnt = 0;
    int s_length = strlen(s);
    int s_half = s_length/2;

    for (int i=0;i<s_half;i++) {
        if (s[i] != s[s_length-i-1]) {
            cnt++;
        }
    }
    printf("%d\n",cnt);

}

int main() {

    scanf("%s", s);

    solve();

}

Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


 

void solve(void)
{
  int H,W;
  cin>>H>>W;
  map<char,int> mp;
  int COUNT = H*W;
  for (int i = 0; i < H*W; i++)
  {
    char c ;cin>>c;
    mp[c]++;
  }

  int G1 = (H%2)*(W%2);
  int G2 = H/2 + W/2;
  int G3 = (H/2)*(W/2);
  G2 = (H*W - 4*G3 - G1);
  G2 /=2;
  // DEBUG(G1,G2,G3,"\n");

  for (auto i : mp)
  {
    int v = i.second;
    while(v>= 4&&G3 > 0)
    {
      v -= 4;
      --G3;
    }
    while(v>= 2&&G2 > 0)
    {
      v -= 2;
      --G2;
    }
     while(v == 1&&G1 > 0)
    {
      --v;
      --G1;
    }
  }
  if(G1||G2||G3)
  {
    cout<<"No"<<endl;
  }
  else
  {
    cout<<"Yes"<<endl;
  }
  


  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#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];

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;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

bool is_prime(long long n)
{
    if (n == 1) {
        return false;
    }

    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

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

    for (int i = 0; i < n; i++) {
        long long temp;
        std::cin >> temp;

        if (temp % 2) {
            continue;
        }

        if (temp % 3 != 0 && temp % 5 != 0) {
            std::cout << "DENIED" << std::endl;
            return 0;
        }
    }

    std::cout << "APPROVED" << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long x,y;
    cin >> x >> y;
    if(x < y)
    {
        long long t = y;
        y = x;
        x = t;
    }
    while(1)
    {
        long long z = x % y;
        if(z == 0)
        {
            break;
        }
        else
        {
            x = y;
            y = z;
        }
    }
    long long a;
    for(int i = 1;i < y + 1;i++)
    {
        if(x % i == 0 && y % i == 0)
        {
            a = i;
        }
    }
    cout << a << endl;
}

Measured memory_bytes: 1156
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <map>
#include <set>
#include <stack>
#include <deque>

#define INF 1000000000;
#define MOD 1000000007;
#define LIMIT 1000000000000000000;
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

vector<bool> g_visited;
vector<vector<bool>> g_graph;

int dfs(int now_node, int all_node_cnt, vector<bool> visited) {
    bool all_visited = true;
    for (int i = 0; i < all_node_cnt; i++) {
        if (!visited[i]) {
            all_visited = false;
            break;
        }
    }
    if (all_visited) return 1;

    int ret = 0;
    for (int i = 0; i < all_node_cnt; i++) {
        if (g_graph[i][now_node] == false) continue;
        if (visited[i]) continue;

        visited[i] = true;
        ret += dfs(i, all_node_cnt, visited);
        visited[i] = false;
    }
    return ret;
}

int main()
{
    int N, M; cin >> N >> M;
    g_graph.assign(N, vector<bool>(N, false));
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        g_graph[a][b] = g_graph[b][a] = true;
    }
    g_visited.assign(N, false);

    g_visited[0] = true;
    int ans = dfs(0, N, g_visited);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}


int main(){
	int n,m=1;
	cin>>n;
	vector<LL> c(1);
	LL tmp[202020]={};
	cin>>c[0];
	FOR(i,1,n){
		int t;
		cin>>t;
		if(c[m-1]!=t){
			m++;
			c.PB(t);
		}
	}
	tmp[c[0]]=1;
	c[0]=1;
	FOR(i,1,m){
		LL nw=add(c[i-1],tmp[c[i]]);
		tmp[c[i]]=nw;
		c[i]=nw;
	}
	cout<<c[m-1]<<endl;

    return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int mod = 1e9 + 7;
const int inf = 2e18;

signed main() {
    int N;
    cin >> N;
    vector<int> h(N);
    cin >> h;
    h.push_back(inf);
    vector<int> dp(N + 1, inf);
    dp[0] = 0;
    for (int i = 0; i < N - 1; i++) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
    cout << dp[N - 1] << endl;
}



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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define P				pair<string, int>
#define fi				first
#define se				second

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

const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_N = 100;

bool G[MAX_N][MAX_N];

signed main() {
	int n, a; cin >> n >> a;
	n %= 500;
	if( n <= a ) cout << "Yes" << endl;
	else		 cout << "No" << endl;
}

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

using namespace std;

int main()
{
    string a;
    cin >> a;
    int h=0;
    for(int i=0;i<26;i++)
    {
        int j;
        for( j=0;j<a.size();j++)
        {
            if(a[j]=='a'+i) break;
        }
        if(j<a.size()) continue;
        else {printf("%c\n",'a'+i);h=1; break;}
    }
    if(h==0) printf("None\n");
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define  sci(x)   scanf("%d", &x)
#define  scl(x)   scanf("%lld", &x)
#define  scd(x)   scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)

int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//CODE TONOY
	int a,c;
	char b;
	cin >> a >> b >> c;
	if (b == '+')
	cout << a+c;
	else
	cout << a-c;        
	return 0;
}

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

 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

   int count0 = 0, count1 = 0;
   rep(i, S.length()) {
     if (S.at(i) == '0') count0++;
     else count1++;
   }

   cout << 2 * min(count0, count1) << endl;
 }


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
#include<climits>
using namespace std;

int main()
{
  int a, b, result = 0;
  cin >> a >> b;

  for (int i = a; i <= b; i++)
  {
    if(i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10)
      result++;
  }

  cout << result << endl;

}


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

int N, M;
int cnt[100000];
bool passed[100000];


int main(){
    cin >> N >> M;
    fill_n(cnt, N, 1);
    passed[0] = true;
    for(int i = 0; i < M; i++){
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        cnt[x]--;
        cnt[y]++;
        if(passed[x] == true){
            passed[y] = true;
        }
        if(cnt[x] == 0){
            passed[x] = false;
        }
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        //cout << cnt[i] << endl;
        if(passed[i] == true){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
#include<stdio.h>

int main(void){
  int a,b,i;
  int x,y;
  scanf("%d%d",&a,&b);
  i=1;
  
  while(1){
    x=i*2/25;
    y=i/10;
    
    if(a==x&&b==y){
      printf("%d",i);
      return 0;
    }else if(a<x&&b<y){
      printf("-1");
      return 0;
    }
    
    i++;
  }
}

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

vector<int> yakusuu(int N) {
    vector<int> res;
    for (int i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    return res;
}

bool divs[1100000];

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    //  重複チェック
    rep(i,n-1){
        if(a[i]==a[i+1]) divs[a[i]]=true;
    }
    
    int ans=0;
    rep(i,n){
        bool fail=false;
        for(int f:yakusuu(a[i])){
            if(divs[f]){
                fail=true;
            }
        }
        if(!fail){
            divs[a[i]]=true;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4928
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

map<int, int>cx, cy;

signed main() {
	int n, k;
	cin >> n >> k;
	int x[55], y[55];
	vector<int>X, Y;
	rep(i, n) {
		cin >> x[i] >> y[i];
		X.push_back(x[i]), Y.push_back(y[i]);
	}
	sort(X.begin(), X.end()), sort(Y.begin(), Y.end());
	rep(i, n) {
		cx[i] = X[i], cy[i] = Y[i];
	}

	int ans = -1;
	rep(sx, n) {
		for (int fx = sx + 1; fx < n; fx++) {
			rep(sy, n) {
				for (int fy = sy + 1; fy < n; fy++) {
					int cnt = 0;
					rep(i, n) {
						if (cx[sx] <= x[i] && x[i] <= cx[fx] && cy[sy] <= y[i] && y[i] <= cy[fy]) {
							cnt++;
						}
					}
					if (cnt >= k) {
						if (ans == -1) ans = (cx[fx] - cx[sx]) * (cy[fy] - cy[sy]);
						else ans = min(ans, (cx[fx] - cx[sx]) * (cy[fy] - cy[sy]));
					}
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}


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

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

    int p[M];
    string S[M];

    bool chk[N + 1] = {false};
    for (int i = 0; i < M; i++) {
        cin >> p[i] >> S[i];
        if (S[i] == "AC") chk[p[i]] = true;
    }

    int AC = 0;
    int WA = 0;
    for (int i = 0; i < M; i++) {
        if (chk[p[i]]) {
            if (S[i] == "AC") {
                AC++;
                chk[p[i]] = false;
            }
            else {
                WA++;
            }
        }
    }

    cout << AC << " " << WA << endl;
    return 0;
}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll mod = 7 * 17 * (1 << 23) + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m, mat[1010][1010], dx[]={1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
	cin >> n >> m;
	queue<pair<int, int>> q;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++) {
			char t;
			cin >> t;
			mat[i][j]=t=='.'?-1:0;
			if(t=='#') {
				q.push({i, j});
			}
		}
	int ans = 0;
	while(!q.empty()) {
		int x, y;
		tie(x, y) = q.front();
		q.pop();
		ans = max(ans, mat[x][y]);
		for(int i = 0; i < 4; i++) {
			int tx = x+dx[i], ty = y+dy[i];
			if(tx>=0&&tx<=n&&ty>=0&&ty<=m&&mat[tx][ty]==-1) {
				mat[tx][ty] = mat[x][y]+1;
				q.push({tx,ty});
			}
		}
	}
	cout << ans << "\n";
	return 0;
}


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

int main(){

    int N, Y, i, j, k;
    cin >> N >> Y;

    for(i=0;i<=N;i++){
        for(j=0;j<=N;j++){
            if(Y/1000-4*j-9*i==N){
                k=N-j-i;
                if(k<0) continue;
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    
    cout << "-1 -1 -1" << endl;
    return 0;

}

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

int main() {

    string s;
    cin >> s;
    s += "R";
    int n = s.size();

    vector< int > ans(n);

    int mid = 0, st = 0;
    for(int i = 0; i < n; i++) {
        if(s[i] == 'L' && s[i - 1] == 'R') mid = i;
        if(s[i] == 'R' && s[i - 1] == 'L') {
            int w = (mid - st + 1);
            int l = (w / 2), r = w - l - 1;
            ans[mid - 1] = l + (i - mid) / 2, ans[mid] = r + ((i - mid) - ((i - mid) / 2));
            st = i;
        } else ans[i] = 0;
    }

    for(int i = 0; i < n - 2; i++) {
        cout << ans[i] << " ";
    }
    cout << ans[n - 2] << endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = double;
const ld eps = 1e-9;

using Point=complex<ld>;



int main() {
	int N;cin>>N;int M;cin>>M;
	vector<int>nums(N);
	for (int i = 0; i < N; ++i) {
		cin>>nums[i];
	}
	vector<int>sas;
	for (int i = 0; i < N - 1; ++i) {
		sas.emplace_back(nums[i+1]-nums[i]-1);
	}
	sort(sas.begin(),sas.end());
	int ans=N;
	ans+=accumulate(sas.begin(),sas.begin()+N-M,0);
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 3908
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define f(i, n) for (int i = 0; i < n; ++i)
#define INF 1e9 + 5
using namespace std;
bool okay(int h, int w, vector<vector<char>>& grid) {
    int H = grid.size();
    int W = grid[0].size();
    return (h >= 0 && h < H && w >= 0 && w < W && grid[h][w] == '.');
}
void solve() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> grid(h, vector<char>(w));
    int sw, sh, dw, dh;
    cin >> sh >> sw >> dh >> dw;
    sh--;
    sw--;
    dh--;
    dw--;
    f(i, h) f(j, w) cin >> grid[i][j];
    vector<vector<int>> dist(h, vector<int>(w, INF));
    dist[sh][sw] = 0;
    deque<pair<int, int>> q;
    q.push_back({sh, sw});
    while (!q.empty()) {
        auto e = q.front();
        int ch = e.first;
        int cw = e.second;
        // cout << "Current : " << ch << ' ' << cw << nl;
        q.pop_front();
        int ddh[] = {-1, 1, 0, 0};
        int ddw[] = {0, 0, -1, 1};
        for (int rep = 0; rep < 4; ++rep) {
            if (!okay(ch + ddh[rep], cw + ddw[rep], grid)) continue;
            if (dist[ch + ddh[rep]][cw + ddw[rep]] > dist[ch][cw]) {
                dist[ch + ddh[rep]][cw + ddw[rep]] = dist[ch][cw];
                q.push_front({ch + ddh[rep], cw + ddw[rep]});
            }
        }

        for (int i = -2; i <= 2; ++i) {
            for (int j = -2; j <= 2; ++j) {
                if (!okay(ch + i, cw + j, grid)) continue;
                if (dist[ch + i][cw + j] > dist[ch][cw] + 1) {
                    dist[ch + i][cw + j] = dist[ch][cw] + 1;
                    q.push_back({ch + i, cw + j});
                }
            }
        }
    }
    cout << (dist[dh][dw] >= INF ? -1 : dist[dh][dw]) << nl;
}

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

Measured memory_bytes: 8684
import java.util.*;

class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if((a*b)%2==0){
			System.out.println("Even");
		}else{
			System.out.println("Odd");
		}
		
	}
}
			

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> s(M), c(M);
    for(int i=0; i<M; i++){
        cin >> s[i] >> c[i];
    }

    for(int i=0; i<= 999; i++){
        string str = to_string(i);
        if(str.size() == N){
            bool flag = true;
            for(int j=0; j<M; j++){
                if(str[s[j]-1] != '0'+c[j]){
                    flag = false;
                    break;
                }
            }
            if(flag == true){
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int N,M,Q;	
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;
int dfs(vector<int> query,int index, int max)
{
	if(index==N)
	{
		sort(query.begin(),query.end());
		
		int sum = 0;
		for(int i=0; i<Q; i++)
		{
			if(query[b[i]] - query[a[i]] == c[i])
			{
				sum+=d[i];
			}
		}
		return sum;
	}
	vector<int> result;
	for(int i=max; i<M; i++)
	{
		vector<int> new_query = query;
		new_query[index]=i;
		result.push_back(dfs(new_query,index+1,i));
	}
	return *max_element(result.begin(),result.end());

}
int main()
{
	
	cin>>N>>M>>Q;
	a.resize(Q);
	b.resize(Q);
	c.resize(Q);
	d.resize(Q);
	for(int i=0; i<Q; i++)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;
		b[i]--;
	}
	//全てのやり方を試してみる
	vector<int> query(N);
	

	int result = dfs(query,0,0);
	cout<<result<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>

int main() {
    int N;
    std::string S,T;

    std::cin >> N;
    std::cin >> S >> T;

    std::string U;
    
    for(int i=0;i<N;i++){
        U += S[i];
        U += T[i];
        //std::cout << U << std::endl;
    }

    std::cout << U << std::endl;

    return 0;
}

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

int main()
{
  int n;
  for(;cin>>n,n;)
    {
      int y;
      cin>>y;
      int ans;
      int money=10000;
      for(int i=0;i<n;i++)
	{
	  int  b,t,r;
	  cin>>b>>r>>t;
	  if(t==1)
	    {
	      //	      cout<<10000*(1+y*(r/100.0))<<endl;
	      if(money<10000*(1+y*(r/100.0)))
		{
		  money=10000*(1+y*(r/100.0));
		  ans=b;
		}
	    }
	  else
	    {
	      // cout<<10000*pow(1+(r/100.0),y)<<endl;
	      if(money<10000*pow(1+(r/100.0),y))
		{
		  money=10000*pow(1+(r/100.0),y);
		  ans=b;
		}
	    }
	}

      cout<<ans<<endl;
    }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;

 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
    ci(n);
  ll Sum=0;
  ll Min=INF;
  FOR(i,0,n){
    ll a;
      ci(a);
    if(a%10!=0){
      chmin(Min,a);
    }
      Sum+=a;
  }

  if(Sum%10==0){
    Sum-=Min;
  }
  ll z=0;
  co(max(z,Sum))
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(void){
    // Your code here!
int l,r;
cin>>l>>r;

if((r-l)>=2019){
    cout<<0<<endl;
    return 0;
}

long long  answer=1e9;
for(long long i=l;i<r;i++){
    for(long long j=i+1;j<=r;j++){
        answer= min((i*j)%2019,answer);
    }
}
cout<<answer;
}


Measured memory_bytes: 3196