akhauriyash/Code-Regression huggingface dataset:
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=MOD;
const int INF = 1e16;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);
const int N=100005;

void solve()
{
    string s;
    cin>>s;
    int n=s.length();
    if(n%2)
    {
        cout<<"No"<<endl;
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            if(i%2)
            {
                if(s[i]!='i')
                {
                    cout<<"No"<<endl;
                    return;
                }
            }
            else
            {
                if(s[i]!='h')
                {
                    cout<<"No"<<endl;
                    return;
                }
            }
        }
        cout<<"Yes"<<endl;
    }
}

int32_t main()
{
    
    IOS;
    //FILE *fin = freopen("in","r",stdin);
    //FILE *fout = freopen("out","w",stdout);
    
    int t;
    t=1;
     //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}



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

struct Point {
    long long int x, y;
};

string signed_area(int xp2, int yp2, Point p0, Point p1){
    double area2;
    area2 = (p0.x - xp2) * (p1.y - yp2) - (p0.y - yp2) * (p1.x - xp2);
    Point vec1, vec2;
    vec1.x = (p1.x-p0.x);
    vec1.y = (p1.y-p0.y);
    vec2.x = (xp2-p0.x);
    vec2.y = (yp2-p0.y);
    double naiseki;
    naiseki = vec1.x * vec2.x + vec1.y * vec2.y;
    //cout << "areea2:" << area2 << endl;
    //cout << naiseki << endl;
    if(area2 > 0){
        return "COUNTER_CLOCKWISE";
    }
    else if(area2 < 0){
        return "CLOCKWISE";
    }
    else {
        if(naiseki < 0){
            return "ONLINE_BACK";
        }
        else if(naiseki > 0){
            double leng1, leng2;
            leng1 = (p1.x-p0.x)*(p1.x-p0.x)+(p1.y-p0.y)*(p1.y-p0.y);
            leng2 = (xp2-p0.x)*(xp2-p0.x)+(yp2-p0.y)*(yp2-p0.y);
            if(leng1 < leng2){
                return "ONLINE_FRONT";
            }
            else {
                return "ON_SEGMENT";
            }
        }
        else {
            return "ON_SEGMENT";
        }
    }
}


int main() {
    Point p0, p1;
    cin >> p0.x >> p0.y >> p1.x >> p1.y;
    int q;
    cin >> q;
    vector<string> str;
    for(int i = 0; i < q; i++){
        int xp2, yp2;
        cin >> xp2 >> yp2;
        //cout << signed_area(xp2, yp2, p0, p1) << endl;
        str.push_back(signed_area(xp2, yp2, p0, p1));
    }

    for(int i = 0; i < q; i++){
        cout << str[i] << endl;
    }
}


Measured memory_bytes: 3260
n = gets.to_i
hs = gets.split.map(&:to_i)
flag = n.times.map { false }

res = true
(n - 1).times do |i|
  if hs[i] > hs[i + 1]
    if flag[i] == true
      res = false
      break
    else
      hs[i] -= 1
      flag[i] = true
    end
  elsif hs[i] < hs[i + 1]
    hs[i + 1] -= 1
    flag[i + 1] = true
  end

  if i != 0 && hs[i - 1] > hs[i]
    res = false
    break
  end 
end

if res == true
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 9484
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
cnt = 0
for _ in range(n):
    a = list(map(int, input().split()))
    if sum(i*j for i, j in zip(a, b)) + c > 0:
        cnt += 1 
print(cnt)

Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = pow(10,9) + 7;

ll dfs(int K, const vector<vector<int>>&G, int now, int from){
	int available_colors_num;
	if(from == -1){
		available_colors_num = K-1;
	}else{
		available_colors_num = K-2;
	}
	if(K<G[now].size()){
		return 0;
	}else{
		ll case_num = 1;
		for( auto e : G[now]){
			if(e == from) continue;
			case_num *= available_colors_num;
			available_colors_num--;
			case_num %= MOD;
		}
		for(auto e : G[now]){
			if(e==from)continue;
			case_num *= dfs(K,G,e,now);
			case_num %= MOD;
		}
		return case_num;
	}

}

int main(){
	int N,K;
	cin >> N >> K;
	vector<vector<int>> G(N);
	for(int i(0);i<N-1;++i){
		int a,b;
		cin >> a >> b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	ll ans = K*dfs(K,G,0,-1);
	ans %= MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11520
#include<stdio.h>

int main(void){
        int h,w,i,j;

        for(;;){
                scanf("%d %d",&h,&w);
                if(h == 0 && w == 0)
                        break;
                else{
                        for(i=0; i<h; i++){
                                for(j=0; j<w; j++)
                                        printf("#");
                                printf("\n");
                        }
                        printf("\n");
                }
        }
        return 0;
}

Measured memory_bytes: 572
# 整数リスト
bingo = []
for i in range(3):
    bingo.append(list(map(int, input().split())))

N = int(input())
for _ in range(N):
    K = int(input())
    for i in range(3):
        for j in range(3):        
            if K == bingo[i][j]:
                bingo[i][j] = 1000

ans = False
for i in range(3):
    if set(bingo[i]) == {1000}:
        ans = True

for i in range(3):
    cnt = []
    for k in range(3):
        cnt.append(bingo[k][i])
    if set(cnt) == {1000}:
        ans = True
cnt1 = []
cnt2 = []
cnt3 = []
cnt4 = []
for i in range(3):    
    k = 2-i
    cnt1.append(bingo[i][k])
    cnt2.append(bingo[k][i])
    cnt3.append(bingo[i][i])
    cnt4.append(bingo[k][k])
if set(cnt1) == {1000}:
    ans = True
if set(cnt2) == {1000}:
    ans = True
if set(cnt3) == {1000}:
    ans = True
if set(cnt4) == {1000}:
    ans = True
if ans:
    print("Yes")
if ans == False:
    print("No")

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

/*-------------------Define Start-------------------*/
typedef bool BL;                        // 布尔类型
typedef char SB;                        // 有符号1字节,8位
typedef unsigned char UB;                // 无符号1字节,8位
typedef short SW;                        // 有符号短整型,16位
typedef unsigned short UW;                // 无符号短整型,16位
typedef long SDW;                        // 有符号整型,32位
typedef unsigned long UDW;               // 无符号整型,32位
typedef long long SLL;                    // 有符号长整型,64位
typedef unsigned long long ULL;            // 无符号长整型,64位
typedef char CH;                        // 单个字符
typedef float R32;                        // 单精度浮点数
typedef double R64;                        // 双精度浮点数

#define Rep(i, n) for (register SDW i = 0; i < (n); ++i)
#define For(i, s, t) for (register SDW i = (s); i <= (t); ++i)
#define rFor(i, t, s) for (register SDW i = (t); i >= (s); --i)
#define foreach(i, c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,0x7f,sizeof(a))
#define LOWBIT(x) ((x)&(-x))

#define MP make_pair
#define PB push_back
#define ft first
#define sd second
#define ALL(x) x.begin(),x.end()

#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl

const ULL mod = 1e9 + 7;                //常用模数(可根据题目需要修改)
const ULL inf = 0x7fffffff;                //用来表示无限大
const ULL infLL = 0x7fffffffffffffffLL;    //用来表示无限大
/*-------------------Define End-------------------*/

const UDW maxN = 1e5 + 7;
SLL n, a, b;
SLL ans;

SLL fac[maxN * 2];
void init_fact() {
    fac[0] = 1;
    For(i, 1, 2 * maxN - 1) {
        fac[i] = (i * fac[i - 1]) % mod;
    }
}

void input(){
    cin >> n >> a >> b;
    init_fact();
}

// Calculate x^y % p
inline SLL pow_mod(SLL x, SLL y, ULL p = mod){
	SLL ret = 1;
	while(y){
		if(y & 1) {
			ret = (ret * x) % p;
		}
        x = (x * x) % p;
        y >>= 1;
	}
	return ret;
} 

//ax + by = gcd(a, b) = d
// 扩展欧几里德算法
/**
 *    a*x + b*y = 1
 *    如果ab互质，有解
 *    x就是a关于b的逆元
 *    y就是b关于a的逆元
 *     
 *    证明： 
 *        a*x % b + b*y % b = 1 % b
 *        a*x % b = 1 % b
 *        a*x = 1 (mod b)
 */
inline void ex_gcd(SLL a, SLL b, SLL &x, SLL &y, SLL &d){
    if(!b) {
        d = a, x = 1, y = 0;
    }
    else{
        ex_gcd(b, a % b, y, x, d);
        y -= x * (a / b);
    }
}

// 求a关于p的逆元，如果不存在，返回-1 
// a与p互质，逆元才存在 
inline SLL inv_mod(SLL a, SLL p = mod){
    SLL d, x, y;
    ex_gcd(a, p, x, y, d);
    return d == 1 ? (x % p + p) % p : -1;
}

// 使用条件：n非常大m非常小 
inline SLL comb_mod(SLL m, SLL n) {
    SLL ret;

    if(m > n) {
        swap(m, n);
    } 
    
    SLL X = 1;
	SLL Y = fac[m];
	
	For(i, n - m + 1, n) {
		X = (X * i) % mod;
	}
	
	ret = (X * inv_mod(Y)) % mod;
    return ret;
}

void solve(){
    ans = (pow_mod(2, n) - 1 - comb_mod(a, n) - comb_mod(b, n) + (mod << 1)) % mod;
}

void output(){
    cout << ans << endl;
}

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

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

int a[3];
int main() {
    int K;
	cin >> a[0] >> a[1] >> a[2] >> K;
    sort(a, a + 3);
    for (int i = 0; i < K; i++) {
        a[2] *= 2;
    }
	cout << a[0] + a[1] + a[2] << endl;
	return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  if(N==1){
    cout << "Hello World";
  }else{
    ll a, b;
    cin >> a >> b;
    cout << a+b;
  }
  return 0;
}


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

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))


# ランレングス圧縮
def rle(lst):
    ans = []
    cnt = 1
    ini = lst[0]
    for i in range(1, len(lst)):
        if ini == lst[i]:
            cnt += 1
        else:
            ans.append((ini, cnt))
            cnt = 1
            ini = lst[i]
    ans.append((ini, cnt))
    return ans

n = int(input())
a = lmp()
t = ["d"]
for i in range(1,n):
    if a[i] >= a[i-1]:
        t.append("u")
    else:
        t.append("d")
rt = rle(t)
if rt[-1][0] == "d":
    rt = rt[:-1]
cum = -1
money = 1000
kabu = 0
for i in range(len(rt)):
    if i % 2 == 0:
        cum += rt[i][1]
        kabu = money//a[cum]
        money -= kabu * a[cum]
    else:
        cum += rt[i][1]
        money += kabu * a[cum]
        kabu = 0
print(money)







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


vector<ll> v;

int main() {
	ll k, n;
	cin >> k >> n;

	ll x;
	ll mx = 0;
	for(int i = 0; i < n; ++i) {
		cin >> x;
		v.push_back(x);

		if(i != 0) {
			ll ab = abs(v[i]-v[i-1]);
			mx = max(mx, ab);
		}
		else
			mx = x;	
	}

	//cout << k << " " << mx << endl;
	
	if(v[0] == 0) {
		mx = max(mx, k-v.back());
	}
	else {
		mx = max(mx, k-v.back()+v[0]);
	}

	cout << k - mx << endl;
	return 0;
}

Measured memory_bytes: 2420
#include<stdio.h>

int main(){
	double n,x;
	int a[12],i;
	while(scanf("%lf",&n)!=EOF){
		if(n<0.0)break;
		x=128.0;
		for(i=11;i>=0;i--){
			if(n>=x)a[i]=1,n-=x;
			else a[i]=0;
			x/=2;
		}
		if(n>0)printf("NA");
		else if(n==0)for(i=11;i>=0;i--)printf("%d%s",a[i],(i==4)?".":"");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    if n == 0:
        print(1)
    else:
        print(0)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 61696
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N ,K;
    cin >> N >> K;
    string s;
    cin >> s;
    //int i;
    s[K-1] = s[K-1] + 32;
    cout << s << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
using namespace std;
 
int main() {
 
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  long N;
  cin >> N;
 
  long ans = ((N - 1) * N) / 2;
 
  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 256
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll moda =29;
const ll modb =34483;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
/*ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}*/
const ll N =2e5+5;
/*
int dp[1000+5][1000+5];
int dpsol(int x, int y, string &s, string &t){
	if ( x<0||y<0)
		return 0;
	if ( dp[x][y]!=-1)
		return dp[x][y];
	if ( s[x]==t[y])
		return dp[x][y]=1+dpsol( x-1,y-1,s,t);
	return dp[x][y]=min( dpsol( x-1,y, s, t),dpsol(x,y-1,s,t));
}*/
void solve(){
	string s,t;
	cin>>s>>t;/*
	memset( dp,-1,sizeof ( dp));

	cout<<t.len()-dpsol( s.len()-1,t.len()-1,s,t)<<'\n';*/
	int n=s.len(),m=t.len();
	int ans=1e9;
	for ( int i=0;i<n-m+1;i++){
		int cnt=0;
		for ( int j=0;j<m;j++){
			if ( s[i+j]==t[j])
				cnt++;
		}
		ans=min( ans, m-cnt);
	}
	cout<<ans<<'\n';
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);

	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
}

Measured memory_bytes: 3640
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a;
    string s;
    cin >> a >> s;
    if(a < 3200){
        cout << "red";
    }
    else
    {
        cout << s;
    }
    
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main(){
	int R;
	cin >> R;
	printf("%.2lf",3.141*2*1.0*R);
	return 0;
}



Measured memory_bytes: 3760
import           Control.Applicative
import qualified Data.ByteString.Char8 as BS
import qualified Data.List             as L
import qualified Data.Map              as M
import           Data.Maybe

type UnionFind = M.Map Int Int

initUnionFindSet :: Int -> UnionFind
initUnionFindSet n =
    M.fromList [(i, i) | i <- [0..(n - 1)]]

find :: UnionFind -> Int -> (Int, UnionFind)
find ufset node = (root, ufset')
    where
      root = until (\ x -> M.findWithDefault (-1) x ufset == x)
             (\ x -> M.findWithDefault (-1) x ufset) node
      path = getPath ufset node
      ufset' = compressPath ufset root path

addToMap :: Ord k => M.Map k a -> [(k, a)] -> M.Map k a
addToMap m xs = L.foldl' (\ acc (x, d) -> M.insert x d acc) m xs

getPath :: UnionFind -> Int -> [Int]
getPath ufset node = until (\ (x:_) -> M.findWithDefault (-1) x ufset == x)
                     (\ xs -> (M.findWithDefault (-1) (head xs) ufset) : xs)
                     [node]

compressPath :: UnionFind
             -> Int             -- ^ root
             -> [Int]           -- ^ nodes on the path
             -> UnionFind
compressPath ufset root xs =
    addToMap ufset (map (\ x -> (x, root)) xs)

union :: UnionFind -> Int -> Int -> UnionFind
union ufset x y = if fx == fy then ufset'' else M.insert fx fy ufset''
    where
      (fx, ufset') = find ufset x
      (fy, ufset'') = find ufset' y


readInt' :: BS.ByteString -> Int
readInt' = fst . fromJust . BS.readInt

solve :: [(Int, Int, Int)] -> UnionFind -> [Int] -> [Int]
solve [] _ acc = reverse acc
solve ((op, x, y):xs) ufset acc
    | op == 0 = solve xs (union ufset x y) acc
    | otherwise = if fx == fy
                  then solve xs ufset'' (1:acc)
                  else solve xs ufset'' (0:acc)
    where (fx, ufset')  = find ufset x
          (fy, ufset'') = find ufset' y


main :: IO ()
main = do
  [n, _] <- map readInt'. BS.words <$> BS.getLine
  contents <- (map (\ x -> map readInt' (BS.words x)) .
                   BS.lines <$> BS.getContents)
  let res = solve (map (\ [x, y, z] -> (x, y, z)) contents)
            (initUnionFindSet n) []
  putStrLn (L.intercalate "\n" (map show res))

Measured memory_bytes: 66148
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    X, Y = map(int, input().split())
    ret = 1
    tmp = X
    while Y>=tmp:
        if tmp*2>Y:
            break
        else:
            tmp = tmp * 2
            ret += 1

    print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     loopR(n,i,a)    for(int i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
#define     test(i)        cout<<i<<endl
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e2+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = 3.14159265358979323846;

void solve(){
    int n,cnt=0;
    cin>>n;
    string s;
    cin>>s;
    loop(n,i,0)
        cnt+=(s[i]=='R');
    int res=0;
    loop(cnt,i,0){
        if(s[i]=='W')
            res++;
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

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

int main( int argc, char *argv[] )
{
int i;
int a[ 3 ];
int K;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> a[ 0 ];
	cin >> a[ 1 ];
	cin >> a[ 2 ];
	cin >> K;

	sort( a, a + 3 );
	for( i = 0; i < K; i++ )
	{
		a[ 2 ] *= 2;
	}

	cout << accumulate( a, a + 3, 0 ) << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int x[200100];
int y[200100];
int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> x[i];
        y[i] = x[i];
    }
    sort(x, x+n);
    
    for(int i = 0; i < n; i++)
    {
        if(x[n/2-1] < y[i])
        {
            cout << x[n/2-1] << endl;
        }
        else
        {
            cout << x[n/2] << endl;
        }
    }
}


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

int main(){
    int a,b,c,x;
    int ans=0;
    cin >> a >> b >> c >> x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                int sum=500*i+100*j+50*k;
                if(sum==x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){

    string[6] ans;
    for(int i=1;i<=6;i++) ans[i-1] = to!char(i + '0') ~ ":";
    int n = readln().chomp().to!int;
    for(int i=0;i<n;i++){
	double h = readln().chomp().to!double;
	if(h < 165.0) ans[0] ~= '*';
	else if(h < 170.0) ans[1] ~= '*';
	else if(h < 175.0) ans[2] ~= '*';
	else if(h < 180.0) ans[3] ~= '*';
	else if(h < 185.0) ans[4] ~= '*';
	else ans[5] ~= '*';
    }
    foreach(i ; ans) writeln(i);

}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;
typedef pair<int,int> ii;

#define MAX 200010
int n;
ll a[MAX];

void solve() {
  ll sum = 0;
  rep(i,n) sum = sum ^ a[i];
  rep(i,n) {
    if( i ) printf(" ");
    cout << ( sum ^ a[i] );
  } puts("");
}

int main() {
  cin >> n;
  rep(i,n) cin >> a[i];
  solve();
  return 0;
}


Measured memory_bytes: 5168
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> S(N);
  int ans=100;
  for(int i=0;i<N;i++){
    cin>>S.at(i);
    int j=0;
    while(S.at(i)%2==0){
      S.at(i)/=2;
      j++;
    }
    ans=min(ans,j);
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main()
{
    int h,w,k,ans=0;
    cin>>h>>w>>k;

    vector<vector<char>> v(h,vector<char>(w,' '));
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            cin>>v[i][j];

    for(int maskR=0;maskR<=pow(2,h)-1;++maskR)
    {
        for(int maskC=0;maskC<=pow(2,w)-1;++maskC)
        {   
            int black=0;
            for(int i=0;i<h;++i)
            {
                if((maskR & (1<<i))==0)
                for(int j=0;j<w;++j)
                {
                    if((maskC & (1<<j))==0)
                    {
                        if(v[i][j]=='#') black++;
                    }
                }
            }
            if(black==k) ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{ ll t,n,m,i,a[23],b[23],c[23],sum=0;
  cin>>n;
  for(i=1;i<=n;i++)cin>>a[i];
  for(i=1;i<=n;i++)cin>>b[i];
  for(i=1;i<=n-1;i++)cin>>c[i];
  sum+=b[a[1]];
for(i=2;i<=n;i++)
{ if(a[i]!=a[i-1]+1)
  sum+=b[a[i]];
  else
    sum+=b[a[i]]+c[a[i]-1];

 } cout<<sum;}






















Measured memory_bytes: 3628
# -*- coding: utf-8 -*-
"""
B - Polygon

"""
import sys
from sys import stdin
input = stdin.readline


def solve(L):
    return 'Yes' if L[-1] < sum(L[:-1]) else 'No'


def main(args):
    N = int(input())
    L = sorted([int(l) for l in input().split()])
    print(solve(L))


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3060
import math

N = int(input())
a = list(input().split())
A = [int(a[i])for i in range(N)]

L = [0 for i in range(N+1)]
R = [0 for i in range(N+1)]

for i in range(N):
    L[i+1] = math.gcd(L[i], A[i])
    R[N - (i+1)] = math.gcd(R[N - i], A[N - (i+1)])

print(max([math.gcd(L[i], R[i+1]) for i in range(N)]))

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

int main(){
  int a;
    cin>>a;
  string b[110];
  for(int i=0;i<a;i++){
    cin >> b[i];
  }
  
  for(int j=0;j<a;j++){
    for(int i =0;i<a;i++){
    if((i!=j)&&(b[i] == b[j])){
      cout <<"No"<<endl;
      
      return 0;
    }
        if((i <a-1)&&(b[i][b[i].size()-1] != b[i+1][0])){
          cout << "No" <<endl;
          
          return 0;
        }
    }
  }
  cout <<"Yes" <<endl;
}
  
 


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    int n;
    cin >> n;

    vll a(n);
    rep(i,0,n) cin >> a[i];

    vector<vll> dp(n,vll(n,0));

    for(int i = n - 1; i >= 0; i--) {
        for(int j = i; j < n; j++) {
            if(i == j) {
                dp[i][j] = a[i];
            } else {
                dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j-1]);
            }
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}


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

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    string s, t;
    cin >> s >> t;
    int count=0;
    for(int i=0; i<s.length(); i++){
        if(s[i]!=t[i]) count++;
    }
    cout<<count<<"\n";
    return 0;
}


Measured memory_bytes: 3768
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        char[][] grid = new char[h][w];
        for (int i = 0; i < h; i++) {
            String next = sc.next();
            for (int j = 0; j < next.length(); j++) {
                char c = next.charAt(j);
                grid[i][j] = c;
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if ('.' != grid[i][j]) {
                    continue;
                }
                int count = count(grid, h, w, i, j);
                //System.out.println(count);
                grid[i][j] = (char) (count + '0');
            }
            System.out.println(new String(grid[i]));
        }
    }

    int count(char[][] grid, int h, int w, int i, int j) {
        int sum = 0;
        // upper left
        if (i - 1 >= 0 && j - 1 >= 0 && grid[i - 1][j - 1] == '#') {
            sum++;
        }
        // upper
        if (i - 1 >= 0 && grid[i - 1][j] == '#') {
            sum++;
        }
        // upper right
        if (i - 1 >= 0 && j + 1 <= w - 1 && grid[i - 1][j + 1] == '#') {
            sum++;
        }
        // left
        if (j - 1 >= 0 && grid[i][j - 1] == '#') {
            sum++;
        }
        // right
        if (j + 1 <= w - 1 && grid[i][j + 1] == '#') {
            sum++;
        }
        // lower left
        if (i + 1 <= h - 1 && j - 1 >= 0 && grid[i + 1][j - 1] == '#') {
            sum++;
        }
        // lower
        if (i + 1 <= h - 1 && grid[i + 1][j] == '#') {
            sum++;
        }
        // lower right
        if (i + 1 <= h - 1 && j + 1 <= w - 1 && grid[i + 1][j + 1] == '#') {
            sum++;
        }
        return sum;
    }
}


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

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

using namespace std;

char top[8] = {'a', 'd', 'g', 'j', 'm', 'p', 't', 'w'};
char mark[5] = {'.', ',', '!', '?', ' '};

int main(){
  int n;
  while(cin >> n and n){
    int res = 0;
    int cnt = 0;
    int total = 0;
    int tmp = 1;
    while(tmp < 1000){
      while(total < n){
        total += tmp;
        tmp++;
        cnt++;
      }
      while(total >= n and cnt > 0){
        if(total == n and cnt > 1) res++;
        total -= tmp-cnt;
        cnt--;
      }
    }
    cout << res << endl;
  }
  return 0;
}

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

#if DEBUG && !ONLINE_JUDGE
    #include "/home/tushar_garg/Desktop/cpp/debug.h"
#else
    #define dbg(x...)
#endif

typedef     long long                            ll; 
typedef     pair<ll, ll>                         pl; 
typedef     vector<ll>                           vl;
typedef     vector<char>                         vc;
typedef     vector<bool>                         vb; 
typedef     vector<vl>                           vvl; 
typedef     vector<pl>                           vll; 
typedef     map<ll, ll>                          dict; 
typedef     map<ll, ll, greater <ll> >           sdict; 
typedef     map<char, ll>                        mcl;
typedef     priority_queue<ll>                   pqi;
typedef     priority_queue<pl>                   pqii;
typedef     priority_queue<ll, vl, greater<ll>>  pqmini;

#define rep(i, a, n) for (auto i=(a)-((a)>(n)); i!=(n)-((a)>(n)); i+=1-2*((a)>(n)))
#define trav(i, a) for(auto &i:a)
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back
#define eb emplace_back
#define flash ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define QuickSilver cin.exceptions(cin.failbit),setprecision(12),cout.precision(12);
#define fill(a, b) memset(a, b, sizeof(a)
#define get(a) rep(i,0,sz(a))cin>>a[i];
#define sz(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define mod 1000000009

int main(){
	flash; QuickSilver;
	int n, w; cin>>n>>w;
	vl dp(1e5+1, w+1); dp[0]=0;
	rep(i,0,n){
		int w1, v1; cin>>w1>>v1;
		rep(j,1e5+1,v1) 
			dp[j]=min(w1+dp[j-v1], dp[j]);
	}
	ll ans=0; rep(i,0,1e5+1) if(dp[i]<=w) ans=i;
	cout<<ans<<"\n";
	return 0;
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

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

int main(int argc, char **argv)
{
	ll A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
	A *= 100;
	B *= 100;

	double per{-1};
	ll resw{0}, ress{0};


	REP(w, F+1)
	{
		REP(s, F+1)
		{
			if (w + s > F)
				continue;

			if (s*(100+E) > E*(w+s))
				continue;
			double tmp = 100*s/(double)(w+s);

			bool oks{false};
			bool okw{false};
			
			
			// can water
			ll N = w / A;
			for (ll a = 0; a <= N; ++a)
			{
				if ((w - A*a) % B == 0)
					okw = true;
			}
			
			// can suger
			N = s / C;
			for (ll c = 0; c <= N; ++c)
			{
				if ((s - C*c) % D == 0)
					oks = true;
			}

			if (oks && okw && per < tmp)
			{
				per = tmp;
				resw = w;
				ress = s;
			}
		}
	}

	std::cout << resw+ress << " " << ress << std::endl;
	// std::cout << "per : " << per << std::endl;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void calc(Vec2 p, Vec2 a, Vec2 b) {
    auto ab = b - a;
    auto ap = p - a;

    auto d = ab.normalize().dot(ap);
    auto m = a + ab.normalize() * d;

    auto x = p + (m - p) * 2;
    writefln("%.8f %.8f", x.x, x.y);
}

void main() {
    auto xs = readints();
    auto p1 = Vec2(xs[0], xs[1]);
    auto p2 = Vec2(xs[2], xs[3]);

    int q = readint();
    for (int i = 0; i < q; i++) {
        auto xy = readints();
        auto p = Vec2(xy[0], xy[1]);
        calc(p, p1, p2);
    }
}

struct Vec2 {
    immutable double x;
    immutable double y;

    this(double x, double y) {
        this.x = x;
        this.y = y;
    }

    Vec2 opAdd(Vec2 other) {
        return Vec2(this.x + other.x, this.y + other.y);
    }

    Vec2 opSub(Vec2 other) {
        return Vec2(this.x - other.x, this.y - other.y);
    }

    Vec2 opMul(double d) {
        return Vec2(this.x * d, this.y * d);
    }

    double dot(Vec2 other) {
        return this.x * other.x + this.y * other.y;
    }

    double cross(Vec2 other) {
        return this.x * other.y - other.x * this.y;
    }

    double mag() {
        return sqrt(magSq());
    }

    double magSq() {
        return this.x * this.x + this.y * this.y;
    }

    Vec2 normalize() {
        auto m = mag();
        if (m != 0 && m != 1)
            return Vec2(this.x / m, this.y / m);
        return this;
    }

    static double distance(Vec2 a, Vec2 b) {
        return (a - b).mag();
    }
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos,par[ohara],ran[ohara];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

void init(int nn) {
	for (int i=0; i<nn; i++) {
		par[i] = i;
		ran[i] = 0;
	}
}//初期化

ll root(ll xx){
    if(par[xx]==xx){
        return xx;
    }
    else{
        return par[xx]=root(par[xx]);
    }
}
//木の根を求めている。
 
bool same(ll xx,ll yy){
    return root(xx)==root(yy);
}
//同じ集合？？
 
void unite(ll xx,ll yy){
    xx=root(xx);
    yy=root(yy);
    if(xx==yy)return;
    
    if(ran[xx]<ran[yy]){
        par[xx]=yy;
    }
    else{
        par[yy]=xx;
        if(ran[xx]==ran[yy])ran[xx]++;
    }
}
//xとyの属する集合を併合
 
//-------------------------↓↓↓↓↓↓------------------------

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


       cin>>n>>m;

       map<ll,ll> mp;

       init(n);

       rep(i,m){
          cin>>a>>b;
          unite(a,b);
       }
      
      rep(i,n){
        mp[root(i+1)]++;
      }
  
      cmp=mp[root(1)];
      cmpp=mp[root(2)];
      cmp=max(cmp,cmpp);

      rep(i,n){
        pos=mp[root(i+1)];
        if(root(i+1)!=root(1)&&root(i+1)!=root(2))cnt++;
        else{
        mp[root(i+1)]=0;
        rrep(i,1,pos){
          ans+=i;
        }
        }
      }

      rrep(i,1,cnt){
        ans+=i;
      }

      ans+=cmp*cnt;

      Cout(ans-m);
      
     

       
return 0;
}


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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}

int n;
long long a, b, arr[100005];

bool check(long long booms){

    long long tot = 0;

    for(int i = 0; i < n; ++i){
        if(booms * b < arr[i])
            tot += (arr[i] - booms * b + a - 1) / a;
    }

    return tot <= booms;

}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    //

    cin >> n >> a >> b;

    a -= b;

    for(int i = 0; i < n; ++i)
        cin >> arr[i];

    long long mid, left = -1, right = 2e9;

    while(right - left > 1){
        mid = left + right >> 1;
        if(check(mid)) // doable???????? reeee
            right = mid;
        else
            left = mid;
    }

    cout << right << "\n";

    return 0;

}


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

using namespace std;
using ll = long long;

int main() {
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
        return 0;
    }
    vector<int> ans(n);
    vector<vector<int>> cnt(n);
    for(int i = 2;i <= n;++i) {
        int d;
        cout<<"? "<<1<<" "<<i<<endl;
        cin>>d;
        ans[i-1]=d;
        cnt[d].emplace_back(i-1);
    }

    int kind=-1;
    for(int i = 0;i < n;++i) {
        if(cnt[i].size()==1){
            kind=i;
            break;
        }
    }

    if(kind==-1) {
        ans[cnt[1][1]]=-1;
        int ofs=0;
        for(int i = 2;i < n;++i) {
            if(cnt[i].size()==0){
                ofs=i-1;
                break;
            }

            cout<<"? "<<cnt[1][0]+1<<" "<<cnt[i][0]+1<<endl;
            int d,d2;
            cin>>d;
            cout<<"? "<<cnt[1][0]+1<<" "<<cnt[i][1]+1<<endl;
            cin>>d2;

            if(d<d2){
                ans[cnt[i][1]]=-i;
            }
            else {
                ans[cnt[i][0]]=-i;
            }
        }
        vector<int> aans(n);
        for(int i = 0;i < n;++i) {
            ans[i]+=ofs;
            aans[ans[i]]=i+1;
        }
        cout<<"!";
        for(auto i:aans)cout<<" "<<i;
        cout<<endl;
    }
    else {

        int ofs=kind-1;
        for(int i = 1;i < kind;++i) {


            cout<<"? "<<cnt[kind][0]+1<<" "<<cnt[i][0]+1<<endl;
            int d,d2;
            cin>>d;
            cout<<"? "<<cnt[kind][0]+1<<" "<<cnt[i][1]+1<<endl;
            cin>>d2;

            if(d<d2){
                ans[cnt[i][1]]=-i;
            }
            else {
                ans[cnt[i][0]]=-i;
            }
        }
        vector<int> aans(n);
        for(int i = 0;i < n;++i) {
            ans[i]+=ofs;
            aans[ans[i]]=i+1;
        }
        cout<<"!";
        for(auto i:aans)cout<<" "<<i;
        cout<<endl;
    }

    return 0;
}



Measured memory_bytes: 3672
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a * b == 15) {
        cout << "*" << endl;
    } else {
        cout << "x" << endl;
    }
}

Measured memory_bytes: 256
import numpy as np

H,W=map(int,input().split())
a=[list(map(int, list(input().replace('#','1').replace('.','0')))) for _ in range(H)]

a = np.array(a)

dellist=[]
for i in range(a.shape[0]):
  if a[i,:].sum()==0:
    dellist.append(i)
a = np.delete(a,dellist,0)
    
dellist=[]
for j in range(a.shape[1]):
  if a[:, j].sum()==0:
    dellist.append(j)
a = np.delete(a,dellist,1)

ans=[]
for i in range(a.shape[0]):
  tmp=''
  for j in range(a.shape[1]):
    if a[i][j]==1:
      tmp += '#'
    else:
      tmp += '.'
  ans.append(tmp)
  
for i in range(len(ans)):
  print(ans[i])

Measured memory_bytes: 27416
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        int k=Integer.parseInt(sc.next());
        int l=Integer.parseInt(sc.next());
        UnionFindTree roads=new UnionFindTree(n);
        for(int i=0;i<k;i++){
            roads.union(Integer.parseInt(sc.next())-1,Integer.parseInt(sc.next())-1);
        }
        UnionFindTree trains=new UnionFindTree(n);
        for(int i=0;i<l;i++){
            trains.union(Integer.parseInt(sc.next())-1,Integer.parseInt(sc.next())-1);
        }
        HashMap<Pair,Integer> map=new HashMap<>();
        for(int i=0;i<n;i++){
            Pair p=new Pair(roads.find(i),trains.find(i));
            if (map.containsKey(p)){
                map.put(p,map.get(p)+1);
            }else{
                map.put(p,1);
            }
        }
        StringBuilder sb=new StringBuilder();
        for (int i=0;i<n;i++){
            if(i!=0){
                sb.append(" ");
            }
            Pair p=new Pair(roads.find(i),trains.find(i));
            sb.append(map.get(p));
        }
        System.out.println(sb);
    }

    static class Pair{
        int x;
        int y;
        public Pair(int x,int y){
            this.x=x;
            this.y=y;
        }
        public int hashCode(){
            return Objects.hash(x,y);
        }
        public boolean equals(Object o){
            Pair p = (Pair) o;
            return p.x==x && p.y==y;
        }
    }

    static class UnionFindTree{
        int[] par;
        int[] rank;
        public UnionFindTree(int size){
            this.par=new int[size];
            this.rank=new int[size];
            for(int i=0;i<size;i++){
                makeSet(i);
            }
        }
        public void makeSet(int i){
            par[i]=i;
            rank[i]=0;
        }
        public void union(int x,int y){
            int xRoot=find(x);
            int yRoot=find(y);
            if(rank[xRoot]>rank[yRoot]){
                par[yRoot]=xRoot; 
            }else if(rank[xRoot]<rank[yRoot]){
                par[xRoot]=yRoot;
            }else if(xRoot!=yRoot){
                par[yRoot]=xRoot;
                rank[xRoot]++;
            }
        }
        public int find(int v){
            if (par[v]!=v){
                par[v]=find(par[v]);
            }
            return par[v];
        }
        public boolean same(int x,int y){
            return find(x)==find(y);
        }
    }
}

Measured memory_bytes: 103872
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    string s; cin >> s;
    int r = 0, b = 0;
    for (int i = 0; i < N; i++) {
        if (s[i] == 'R') r++; else b++;
    }
    cout << (r > b ? "Yes" : "No") << endl;
    return 0;
}

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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (r <= x && (x + r) <= W) {
		if (r <= y && (y + r) <= H) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
using namespace std;
int main() {
  int a,b,i;
  long c;
  while(cin >> a >> b) {
    c=a+b,i=0;
    while(true) {
      if(c < 10)break;
      i++,c=c/10;
    }
    cout << ++i << endl;
  }
}

Measured memory_bytes: 0
while True:
    n,x = [int(x) for x in input().split()]
    if (n,x)==(0,0): break
    cnt=0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if i+j+k == x: cnt+=1
    print(cnt)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#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 perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
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 (b<a) { a=b; return 1; } return 0; }

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

    ll N;
    cin >> N;
    vector<ll> C(N), S(N), F(N);
    rep(i, N - 1) cin >> C[i] >> S[i] >> F[i];

    rep(i, N){
        ll ans = 0;
        for (ll j = i; j < N - 1; ++j){
            if(ans < S[j]) ans = S[j] + C[j];
            else ans += C[j] + (F[j] - ans % F[j]) % F[j];
        }
        print(ans);
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,h,a,b[100000],am;
  cin>>n>>h;
  for(int i=0;i<n;i++){
    cin>>a>>b[i];
    am=max(am,a);
  }
  sort(b,b+n);
  int cnt=0;
  for(int i=1;i<=n;i++){
    if(b[n-i]<am||h<=0)break;
    cnt++;
    h-=b[n-i];
  }
  if(h>0)cnt+=h/am+!!(h%am);
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <map>
using namespace std;
int num[12];
int n,cnt;
int solve(){ 

  map<int,int > mp;
  mp.clear();
  int f = 0;
  for(int i = 0 ; i < n ; i++ ){
    mp[num[i]]++; 
  }
  for(int i = 0 ; i < n ; i++ ){
    if(num[i] != mp[num[i]] )f = 1;
    num[i] = mp[num[i]];
  }

  if(f == 1){
    cnt++;
    solve();
  }
}

int main(){

  while( cin >> n,n ){

    for(int i = 0 ; i < n ; i++ ){
      cin >> num[i];
    }
    cnt = 0;
    solve();
    cout << cnt << endl;
    for(int i = 0 ; i < n ; i++ ){
      if(i == 0)cout << num[i];
      else cout <<" "<< num[i]; 
    }
    cout << endl;
  }
}

Measured memory_bytes: 1192