akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <cmath>

using namespace std;

string res;

//bfs
void solve(int left,int num){

//  printf("left:%d,num:%d\n",left,num);
  
  if(num<0)
    return;

  if(num==0){
    //cout<<"--"<<res<<"--"<<endl;
    //printf("res:%lu\n",res.size());
    res.resize(res.size()-1);
    cout<<res<<endl;
    res.push_back(' ');
    return;
  }

  for(int i=left;i>0;i--){
    res.append(to_string(i));
    res.push_back(' ');
    solve(i,num-i);
    res.resize(res.size()-to_string(i).size()-1);
  }
  return;
}

int main(int args, char *argc[]){
  int num;
  while(cin>>num,num){
    solve(num,num);
    res.clear();
  }
  return 0;
}


Measured memory_bytes: 3216
from collections import Counter

n = int(input())
A = list(map(int,input().split()))

s = set(A)
c = Counter(A)
m2 = [1 if v%2==0 else 0 for v in c.values()]
if sum(m2)%2 == 0:
  print(len(s))
else:
  print(len(s)-1)

Measured memory_bytes: 24288
#include<bits/stdc++.h>
using namespace std;
long long int arr[200000],brr[200000],drr[200000];
int main()
{
      long long int n,d;
        cin>>n>>d;
        for(long long int i=0;i<n;i++)
        {
            cin>>arr[i]>>brr[i];
        }
        for(long long int i=0;i<n;i++)
        {
            drr[i]=(arr[i]*arr[i])+(brr[i]*brr[i]);
        }
        long long int ans=0;
        long long int sqd=d*d;
        for(long long int i=0;i<n;i++)
        {
            if(sqd>=drr[i])
            {
                ans++;
            }
        }
        cout<<ans<<"\n";

        
    
    return 0;
}

Measured memory_bytes: 8252
S = input()

if int(S[-1]) == 2 or int(S[-1]) == 4 or int(S[-1]) == 5 or int(S[-1]) == 7 or int(S[-1]) == 9:
    print('hon')
elif int(S[-1]) == 0 or int(S[-1]) == 1 or int(S[-1]) == 6 or int(S[-1]) == 8:
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9088
#include <cstdio>
#include <cmath>
 
#define r 6378.1
 
int main()
{
    double a, b, c, d;
 
    while (true) {
	scanf("%lf %lf %lf %lf" ,&a ,&b ,&c ,&d);
	if (a == -1 && b == -1 && c == -1 && d == -1) {
	    break;
	}
 
	a = a * M_PI / 180;
	b = b * M_PI / 180;
	c = c * M_PI / 180;
	d = d * M_PI / 180;
 
	double e = cos(a)*cos(b);
	double f = sin(b)*cos(a);
	double g = sin(a);
	double h = cos(c)*cos(d);
	double i = sin(d)*cos(c);
	double j = sin(c);
 
	double dist = acos(e*h + f*i + g*j);  
	printf("%d\n", (int)(r*dist+0.5));
    }
    return 0;
}

Measured memory_bytes: 2964
#include <iostream>
#include <algorithm>

int main() {
    int a[3];
    int r;

    std::cin >> a[0] >> a[1] >> a[2];
    std::sort(a, a + 3);

    r = a[0] * a[1] / 2;
    std::cout << r << std::endl;

    return 0;
}


Measured memory_bytes: 256
O = input()
E = input()
P = ""
if len(O) - len(E) == 0:
    for i in range(len(E)):
        P = P + O[i] + E[i]
else:
    for i in range(len(E)):
        P = P + O[i] + E[i]
    P = P + O[-1]
print(P)

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

long long int gcd(long long int x, long long int y){
 long long int tmp;
 long long int r;
 if(x > y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = y % x;
  while(r!=0){
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}

int main(){
    long long int a,b,c,d,i;
    cin >> a >> b >> c >> d;
    long long int ans=(b-a+1)-(b/c-(a-1)/c)-(b/d-(a-1)/d);
    long long int g=c*d/gcd(c,d);
    ans += (b/g-(a-1)/g);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int h[1000000];
int main ()
{int n;
int k;
cin>>n;
cin>>k;
for (int i=0;i<n;i++)
cin>>h[i];
int sum=0;
for (int i=0;i<n;i++)
{
if (h[i]>=k)
sum++;

}
cout <<sum;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
//#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
  cin >> n ;
  cout << n*n*n << endl ;
}
 
int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n = read(&mut stdin_lock, &mut buf, b' ');
    let k = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(n, k));
}

fn solve(n: u8, k: u8) -> u8 {
    if n % k == 0 { 0 } else { 1 }
}

#[test]
fn example1() {
    assert_eq!(1, solve(7, 3))
}

#[test]
fn example2() {
    assert_eq!(0, solve(100, 10))
}

#[test]
fn example3() {
    assert_eq!(0, solve(1, 1))
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    VL x(5);
    cin>>x[0]>>x[1]>>x[2]>>x[3]>>x[4]>>k;
    bool able = true;
    LL max_x = *max_element(ALL(x));
    LL min_x = *min_element(ALL(x));
    able = (max_x - min_x) <= k;
    if(!able){
        PUTS(":(");
    }
    else{
        PUTS("Yay!");
    }
}

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

int main()
{
    int k, a, b;
    cin>>k>>a>>b;
    
    int near = a/k;
    int val = k*near;
    if((val >= a && val <= b) || (val + k >= a && val + k <= b))
    {
        cout<<"OK";
    }
    else
    {
        cout<<"NG";
    }
    return 0;
}
  
  

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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;}
const long long INF=1LL<<60;
//set<int>::iterator it;



int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n,i;
	string s,t;
	cin>>n>>s>>t;
	if(s==t){
		cout<<s.length()<<endl;
		return 0;
	}
	if(s.length()==1){
		cout<<2<<endl;
		return 0;
	}
	for(i=1;i<n;i++){
		if(s.substr(i,n-i)==t.substr(0,n-i)){
			s+=t.substr(n-i,i);
			cout<<s.length()<<endl;
			return 0;
		}
	}
	cout<<n*2<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
const int MaxN = 55;
const int Pt = 1e9 + 7;
typedef long long LL;
using namespace std;
LL dp[MaxN + 5][MaxN + 5];
int n;
char s[MaxN + 5], t[MaxN + 5];
void Init(){
	memset(dp, 0, sizeof(dp));
	scanf("%s", s + 1);
	scanf("%s", t + 1);
}
void Solve(){
	int tt = 0;
	if(s[1] == t[1]) dp[1][1] = 3, tt = 2;
	else dp[2][2] = 6, tt = 3;
	for(int i = tt;i <= n;i++){
		if(s[i] == t[i]){
			if(s[i - 1] == t[i - 1]) dp[i][i] = dp[i - 1][i - 1] * 2 % Pt; 
			else dp[i][i] = dp[i - 1][i - 1];
		}
		else{
			if(s[i - 1] == t[i - 1]) dp[i + 1][i + 1] = dp[i - 1][i - 1] * 2 % Pt;
			else dp[i + 1][i + 1] = dp[i - 1][i - 1] * 3 % Pt;
			i++;
		}
	}
	printf("%lld\n" , dp[n][n] % Pt);
}
int main()
{
	while(~scanf("%d", &n)){
		Init();
		Solve();
	}
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;
typedef long double ldouble;

const int MOD = 1e9 + 7;
int D[1000010];
ll S[1000010];

void solve(){
	int n; scanf("%d", &n);
	D[0] = 1; D[1] = n;
	S[0] = 1; S[1] = n + 1;
	for(int i=2;i<=n;i++){
		D[i] = ((ll)(n-1) * (i-2) + (ll)(n - i + 1) * n + D[i-1] + (i>=3?S[i-3]:0)) % MOD;
		S[i] = (S[i-1] + D[i]) % MOD;
	}
	printf("%d\n", D[n]);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  boost::for_each(vc, [&os, &vc](T value) {
    os << value;
    if (value != vc.back())
      os << ' ';
    });
  return os;
}

template<class T1, class T2>
inline
std::ostream&
operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  //using std::string;
  //string S{}; std::cin >> S;
  
  ui N{}; std::cin >> N;
  typedef std::vector<ui> Vec;
  Vec dif(N);
  rep(0, N) std::cin >> dif[i];

  boost::sort(dif);
  ui half = N / 2;
  ui ans = dif[half] - dif[half - 1];
  std::cout << ans << '\n';

  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 640
n = int(input())
count_dict = dict()
for i in range(n):
    x = input()
    if x in count_dict:
        count_dict[x] += 1
    else:
        count_dict[x] = 1
max_count = 0
for i in count_dict:
    if count_dict[i] > max_count:
        max_count = count_dict[i]
ans = []
for i in count_dict:
    if count_dict[i] == max_count:
        ans.append(i)
ans = sorted(ans)
for i in ans:
    print(i)

Measured memory_bytes: 32988
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
typedef long long lli;
int n;

void ReadInput()
{
    cin >> n;
}

void Solve()
{
    for(int i = 1; i < 10; ++i)
        if(n % i == 0 && n / i <= 9)
        {
            cout << "Yes\n";
            return;
        }
    cout << "No\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 256
my ($a, $b, $c, $d) = split(/\s+/, <>);

while ($a > 0 && $c > 0) {
    $c -= $b;
    last if $c <= 0;
    $a -= $d 
}

if ($a > 0) {
    print "Yes\n";
} else {
    print "No\n";
}


Measured memory_bytes: 4824
n, m= map(int, input().split())
if n==m:
    print(n)
else:

    A=[2**i for i in range(50)]
    #print(A)
    tmp1=""
    tmp2=""
    
    for num,i in enumerate(A):
        if num==0:
            if (n)//2%2==0:
                tmp1="1"
            else:
                tmp1="0"
            if (m+1)//2%2==0:
                tmp2="1"
            else:
                tmp2="0"
            continue
        
        a1=(n-1)//i
        b1=(n-1)%i
        a2=m//i
        b2=m%i
        if a1%2==1 and b1%2==0:
            tmp1="1"+tmp1
        else:
            tmp1="0"+tmp1

        if a2%2==1 and b2%2==0:
            tmp2="1"+tmp2
        else:
            tmp2="0"+tmp2

    #print(tmp1)
    #print(tmp2)
    tmp1=int(tmp1, 2)
    tmp2=int(tmp2, 2)
    #out=(bin(tmp1 ^ tmp2))
    print(tmp1 ^ tmp2)



Measured memory_bytes: 3064
n,k = map(int, input().split())
h = [[] for i in range(n)]
for i in range(n):
    h[i] = int(input())
h.sort()

ans = float("inf")
for i in range(n-k+1):
    a = h[i+k-1]-h[i]
    ans = min(ans, a)
print(ans)


Measured memory_bytes: 10592
# -*- coding: utf-8 -*-

import sys
import os
import math


N_str = input().strip()
min_digit = len(N_str)

N = int(N_str)

MAX = int(math.sqrt(N)) + 1
min_digit = float('inf')

for i in range(1, MAX + 1):
    if N % i == 0:
        # 割れる
        digit0 = len(str(i))
        digit1 = len(str(int(N / i)))
        digit = max(digit0, digit1)
        if digit < min_digit:
            min_digit = digit
print(min_digit)


Measured memory_bytes: 3060
(let ((str "abcdefghijklmnopqrstuvwxyz")
        (w (read-line)))
    (loop :for c :in (concatenate 'list str)
          :collect (count c w))
    (if (null (remove-if #'evenp
                         (loop :for c
                                 :in (concatenate 'list str)
                               :collect (count c w))))
        (princ "Yes")
        (princ "No")))
  (terpri)


Measured memory_bytes: 7524
MOD = 10**9+7
n = int(input())
S = input()
def main():
  dp = [[0]*(n+1) for _ in range(n+1)]
  for j in range(n):
    dp[1][j] = 1
  for i, s in enumerate(S, 1):
    if s == "<":
      dp[i+1][n-(i+1)] = dp[i][n-i]
      for j in range(n-i-2, -1, -1):
        dp[i+1][j] = dp[i+1][j+1] + dp[i][j+1]
        dp[i+1][j] %= MOD
    else:
      dp[i+1][0] = dp[i][0]
      for j in range(1, n-i):
        dp[i+1][j] = dp[i+1][j-1] + dp[i][j]
        dp[i+1][j] %= MOD
  ans = dp[n][0]
  print(ans)
if __name__ == "__main__":
  main()

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

int f(string s){
    int r = 0;
    r = (s[0] - '0')*100 + (s[1] - '0')*10 + (s[2] - '0');
    return r;
}

int main() {
    string s;
    cin >> s;
    int ans = 1000;
    for(int i=0;i<s.size()-2;i++){
        ans = min(ans, abs(f(s.substr(i,3)) - 753));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
ans=len(s)
length=len(s)
for i in range(len(s)-1):
    if (s[i]=="1" and s[i+1]=="0") or (s[i]=="0" and s[i+1]=="1"):
        maximum=max(i+1, length-i-1)
        ans=min(ans, maximum)
print(ans)


Measured memory_bytes: 41456
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

int N;

bool judge(int n) {
    int t = N;
    while(t%n==0) t/=n;
    return t%n==1;
}

signed main() {
    cin >> N;
    int res = (N==2 ? 1 : 2);

    //N-1の約数をNから引き続けていけば、Nは1になる
    //√(N-1)以下で√(N-1)ではない約数には、それぞれ
    //対応する√(N-1)以上の約数が存在することに注意する
    for(int i=2; i*i<=N-1; i++) {
        if((N-1)%i==0) res += (i*i==N-1 ? 1 : 2);
    }

    //除算を行えるのは、最初にKがNの約数だった場合である
    //そのうち、最後まで処理を行った際にN=1となるものだけを数える
    for(int i=2; i*i<=N; i++) {
        if(N%i==0) res += judge(i);
    }

    cout << res << endl;

    return 0;
}

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

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string u;
    rep(i, sz(s)) { u += s[i]; u += t[i]; }
    cout << u << endl;
}


Measured memory_bytes: 3640
#include<iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
    int saikoro,point,i,j=0;
    double rate,result=0;
    cin >> saikoro >> point;
    cout<< fixed;
    for( i = 1 ;i <= saikoro ;i++){
      if( point > i){
        for( j = 1; point > i * std::pow( 2.0, j ); j++){
        }
      }
      rate = saikoro  * std::pow( 2.0 , j );
      result  += (1/rate);
      j=0;
    }
    std::cout << std::setprecision(12)<<result << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin, stdout, stderr, setrecursionlimit
from functools import lru_cache

setrecursionlimit(10**7)

mod = 10**9 + 7

def solve():
    def binom(n, k):
        res = (modfact[n] * factinv[k]) % mod
        res = (res * factinv[n - k]) % mod
        return res

    h, w, a, b = map(int, input().split())
    ans = 0
    modfact = [1] * (h + w)
    factinv = [1] * (h + w)

    for i in range(1, h + w):
        modfact[i] = (i * modfact[i - 1]) % mod
        factinv[i] = (pow(i, mod - 2, mod) * factinv[i - 1]) % mod

    for i in range(h - a):
        ans += (binom(b + i - 1, i) * binom(w + h - b - i - 2, h - i - 1)) % mod
        ans %= mod

    print(ans)

'''
@lru_cache(maxsize=None)
def binom(n, k):
    res = (modfact(n) * factinv(k)) % mod
    res = (res * factinv(n - k)) % mod
    return res

@lru_cache(maxsize=None)
def modfact(n):
    if n == 0:
        return 1

    return (n * modfact(n - 1)) % mod

@lru_cache(maxsize=None)
def factinv(n):
    if n == 0:
        return 1

    return (pow(n, mod - 2, mod) * factinv(n - 1)) % mod
'''

if __name__ == '__main__':
    solve()

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

int main() {
	while (true) {
		int n, x;
		cin >> n >> x;
		if (n == 0 && x == 0) return 0;
		ll sum = 0;
		for (int i = 1; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) {
						sum++;
					}
				}
			}
		}
		cout << sum << endl;
	}
	return 0;
}



Measured memory_bytes: 3108
import java.util.*;
public class Main {
	public static void main(String[] args){
		// get numbers
		Scanner sc = new Scanner(System.in);        
		String b = sc.next();
        String ans = "";

        if (b.equals("A")) {
            ans = "T";
        } else if (b.equals("T")) {
            ans = "A";
        } else if (b.equals("C")) {
            ans = "G";
        } else {
            ans = "C";
        }

		// output
        System.out.println(ans);
        sc.close();
	}
}

Measured memory_bytes: 21588
#include<iostream>
#include<cmath>
using namespace std;
int main() {
	double q;
	while (cin >> q) {
		if (q == -1)return 0;
		double x = q / 2;
		while (abs(x*x*x - q) >= 0.00001*q) 
			x = x - ((x*x*x - q) / (3 * x*x));
		if (q == -1)return 0;
		printf("%.10f\n", x);
	}
}

Measured memory_bytes: 3120
#include<bits/stdc++.h>
/* #define int long long */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define MOD 1000000007
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; }
 
signed main(){
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    if(abs(x) == d && k%2 == 0){
        cout << x << endl;
        return 0;
    }
    ll res = min(k, x/d);
    ll ans = min(abs(x - d*res), abs(x - k*d));
    if((k - res) % 2 == 0 || res == k) cout << ans << endl;
    else cout << abs(ans - d) << endl;
}

Measured memory_bytes: 3548
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := []byte{}
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	var N, X, T int = nextInt(), nextInt(), nextInt()
	var result int
	if N%X == 0 {
		result = T * N / X
	} else {
		result = T * (N/X + 1)
	}
	fmt.Println(result)
}


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

using namespace std;


typedef long long ll;
const int maxn = (int) 1e5 + 1;

int n;
int a, u[3][maxn], p[maxn], s[maxn], ans;
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a;
        u[i % 2][a]++;
    }
    for(int i = 1; i <= 100000; i++){
        p[i] = max(p[i - 1], u[0][i]);
    }
    for(int i = 100000; i >= 1; i--){
        s[i] = max(s[i + 1], u[0][i]);
    }
    for(int i = 1; i <= 100000; i++){
        ans = max(ans, max(p[i - 1], s[i + 1]) + u[1][i]);
    }
    cout << n - ans;
}


Measured memory_bytes: 1792
n = int(input())

li = list(map(int, input().split()))
sum_diff = 0

for i in range(len(li)):
    if i > 0:
        diff = li[i] - li[i - 1]
        if li[i] - li[i - 1] < 0:
            li[i] = li[i] + abs(diff)
            sum_diff += abs(diff)
print(sum_diff)


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

#define ll long long

ll cost[100001][101],n,W,c[100001],w[100001];
bool ready[100001][101];

ll dp(ll weight,ll item)
{
    if(item==0)
        return 0;
    if(ready[weight][item])
        return cost[weight][item];
    ready[weight][item]=1;
    if(weight<w[item])
        return cost[weight][item]=dp(weight,item-1);
    return cost[weight][item]=max(dp(weight,item-1),dp(weight-w[item],item-1)+c[item]);
}

int main()
{
//    freopen("a.in","r",stdin);
    cin>>n>>W;
    for(ll i=1;i<=n;i++)
        cin>>w[i]>>c[i];
    cout<<dp(W,n);
}




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

import static java.lang.Integer.parseInt;

/**
 * Planetary Exploration
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int M, N, K;
		line = br.readLine();
		M = parseInt(line.substring(0, line.indexOf(' ')));
		N = parseInt(line.substring(line.indexOf(' ') + 1));
		K = parseInt(br.readLine());

		//
		int[][] J = new int[M + 1][N + 1];
		int[][] O = new int[M + 1][N + 1];
		int[][] I = new int[M + 1][N + 1];

		for (int i = 0; i < M; i++) {
			line = br.readLine();
			for (int j = 0; j < N; j++) {
				switch (line.charAt(j)) {
					case 'J':
						J[i + 1][j + 1] = 1;
						break;
					case 'O':
						O[i + 1][j + 1] = 1;
						break;
					case 'I':
						I[i + 1][j + 1] = 1;
						break;
				}
			}
		}

		//sum up 'J'
		for (int i = 1; i <= M; i++) {
			for (int j = 1; j <= N; j++) {
				J[i][j] += J[i][j - 1];
			}
		}

		for (int j = 1; j <= N; j++) {
			for (int i = 1; i <= M; i++) {
				J[i][j] += J[i - 1][j];
			}
		}

		//sum up 'O'
		for (int i = 1; i <= M; i++) {
			for (int j = 1; j <= N; j++) {
				O[i][j] += O[i][j - 1];
			}
		}

		for (int j = 1; j <= N; j++) {
			for (int i = 1; i <= M; i++) {
				O[i][j] += O[i - 1][j];
			}
		}

		//sum up 'I'
		for (int i = 1; i <= M; i++) {
			for (int j = 1; j <= N; j++) {
				I[i][j] += I[i][j - 1];
			}
		}

		for (int j = 1; j <= N; j++) {
			for (int i = 1; i <= M; i++) {
				I[i][j] += I[i - 1][j];
			}
		}

		//solve
		StringBuilder sb = new StringBuilder();

		for (int k = 0; k < K; k++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a, b, c, d;
			a = parseInt(st.nextToken());
			b = parseInt(st.nextToken());
			c = parseInt(st.nextToken());
			d = parseInt(st.nextToken());

			int j, o, i;
			j = J[c][d] - J[a - 1][d] - J[c][b - 1] + J[a - 1][b - 1];
			o = O[c][d] - O[a - 1][d] - O[c][b - 1] + O[a - 1][b - 1];
			i = I[c][d] - I[a - 1][d] - I[c][b - 1] + I[a - 1][b - 1];

			sb.append(j).append(' ');
			sb.append(o).append(' ');
			sb.append(i).append('\n');
		}

		System.out.print(sb.toString());
	}
}

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

int main()
{
	int n, point[100], sum = 0, ave = 0, max = 0, min = 0;
	while( cin >> n && n != 0){

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

		sort(point, point + n);


		for(int i = 1; i < n-1; i++){
			sum += point[i];
		}
		ave = sum / (n-2);
		cout << ave << endl;

		sum = 0;
		ave = 0;
		min = 0;
		max = 0;
	}

	return 0;
}

Measured memory_bytes: 3088
#!/usr/bin/perl

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);

my $t = 0;
for(my $i=1;$i<=$n;$i++){
  my $up = int($n/$i);
  $t += $i * ( $up * ( $up + 1 ) / 2 );
}
print "$t\n";



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];

int main(){
    vector<int> N(4); collect(N, 4);
    sort(all(N));
    int ans[4] = {1,4,7,9};
    bool makeable = true;
    rep(i,4) if(N[i] != ans[i]) makeable = false;
    cout << (makeable ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    ll count = 0;
    for(int i=0;i<m;++i)
    {
        int tmp;
        cin >> tmp;
        count += tmp;
    }

    cout << (count > n ? -1 : n - count) << endl;
}

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

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

    
    for( int i=1;i<n ;i++ )
        for( int j=0; j<n-1; j++)
            if(arr[j] > arr[j+1])
            {
                int temp;
                temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
                m++;
                
            }
            
    for( int i=0; i<n-1 ;i++ )
        cout<<arr[i]<<" ";
    cout<<arr[n-1]<<endl;
    
    cout<<m<<endl;


	return 0;
}

Measured memory_bytes: 1160
n = gets.chop.to_i

INF = n


dp = [n]*(n+1)

dp[0] = 0

n.times do |i|

  (0..6).each do |j|
    hop = 6**j
    break if hop + i > n
    dp[i+hop] = [dp[i+hop], dp[i]+1].min
  end

  (0..6).each do |j|
    hop = 9**j
    break if hop + i > n
    dp[i+hop] = [dp[i+hop], dp[i]+1].min
  end
end

p dp[n]

Measured memory_bytes: 2556
#include<iostream>

int main(){
	int year, a, b;

	std::cin >> year;
	if (year == 2){
		std::cin >> a >> b;
	}

	if (year == 1){
		std::cout << "Hello World" << std::endl;
	}
	else{
		std::cout << a + b << std::endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vec<int> a(N);
  vec<int> b(N);
  REP(i, N) {
    int val = 21000 * (i + 1);
    a[i] = val;
    b[N - 1 - i] = val;
  }
  REP(i, N) {
    int p;
    cin >> p;
    p--;
    a[p] += i;
    b[p] += i;
  }
  REP(i, N) cout << a[i] << " ";
  cout << "\n";
  REP(i, N) cout << b[i] << " ";
  cout << "\n";
}

Measured memory_bytes: 1024
import sys
import math
import itertools
import statistics
n,m=map(int,input().split())
side=[]
for _ in range(m):
    side.append(tuple(map(int,input().split())))
per_lis =[i for i in list(itertools.permutations(list(range(1,n+1)))) if i[0]==1]
ans=0
for one_case in per_lis:
    tmp=0
    for i in range(n-1):
        if ((one_case[i],one_case[i+1]) in side) or ((one_case[i+1],one_case[i]) in side):
            tmp+=1
    if tmp==n-1:
        ans+=1
print(ans)



Measured memory_bytes: 81824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int gcd(int a, int b){
    while(b != 0){
        int c = b;
        b = a % b;
        a = c;
    }
    return a;
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A.at(i);
    
    int ans = A.at(0);
    rep(i, N) ans = gcd(ans, A.at(i));
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    string s;
    cin >> s;
    
    bool ans = true;
    bool N = false;
    bool S = false;
    bool W = false;
    bool E = false;
    
    for ( auto& a : s ) {
        
        if ( a == 'N' ) { N = true; }
        if ( a == 'S' ) { S = true; }
        if ( a == 'W' ) { W = true; }
        if ( a == 'E' ) { E = true; }
        
    }
    
    if ( N != S ) { ans = false; }
    if ( W != E ) { ans = false; }
    
    cout << ( ans ? "Yes" : "No" ) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

long long int r, s ,p;

long long int func(char c){
    if(c == 'r'){
        return p;
    }
    if(c == 's'){
        return r;
    }
    if(c == 'p'){
        return s;
    }
    return 0;
}

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    scanf("%lld %lld %lld", &r, &s, &p);
    char s[n+1];
    scanf("%s", s);
    long long int ans = 0;
    for(int i=0; i<k; i++){
        char pre = s[i];
        long long int buf = func(s[i]);
        for(int j=i+k; j<n; j+=k){
            if(pre == s[j]){
                pre = '&';
            }else{
                buf += func(s[j]);
                pre = s[j];
            }
        }
        ans += buf;
        //printf("%lld\n", ans);
    }
    printf("%lld", ans);

    return 0;
}

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

int64_t mod = 998244353 ;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


vector<int> getprime(int n){
    vector<int> p(0) ;
    vector<bool> table(n+1,0) ;
    for (int i = 2; i <= n; i++)
    {
        if (table.at(i) == 0)
        {
            p.push_back(i) ;
            for (size_t j = 2; j < n/i ; j++)
            {
                table.at(i*j) = 1 ;
            }
            
        }
        
    }
    return p ;
}

int main(){
    int n,k ;
    cin >> n >> k ;
    vector<pair<int64_t,int64_t> > p(n,pair<int64_t,int64_t>()) ;
    for (int i = 0; i < n; i++)
    {
        cin >> p.at(i).first >> p.at(i).second ;
    }
    int64_t ans = INT64_MAX ;
    sort(p.begin(),p.end()) ;
    for (int i = 0; i < n-k+1; i++)
    {
        vector<int64_t> y(0) ;
        for (int j = i; j < n; j++)
        {
            y.push_back(p.at(j).second) ;
            if (y.size() < k)
            {
                continue ;
            }
            int64_t xl = p.at(j).first - p.at(i).first ;
            int64_t yl = INT64_MAX ;
            sort(y.begin(),y.end()) ;
            for (int jj = 0; jj < y.size()-k+1 ; jj++)
            {
                yl = min(yl,y.at(jj+k-1) - y.at(jj)) ;
            }
            ans = min(ans,xl*yl) ;
        }
        

    }
    cout << ans << endl ;

}

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

#define int long long

using namespace std;
const int N = 5e5;

int n, sum(0), m(0);
int fa[N];
struct node {
	int x, y, point;
} a[N];
struct edge {
	int x, y, v;
} e[N];

int read(void) {
    int s = 0, w = 0;
    char c = getchar();
    while (c < '0' || c > '9') w |= c == '-', c = getchar();
    while (c >= '0' && c <= '9') s = s * 10 + c - 48, c = getchar();
    return w ? -s : s;
}

bool pig1(node p1,node p2) {return p1.x < p2.x;} 
bool pig2(node p1,node p2) {return p1.y < p2.y;}
bool pig3(edge p1,edge p2) {return p1.v < p2.v;}
void add(int x,int y,int v) {e[++m] = {x,y,v};} 
int get(int x) {
	if (fa[x] == x) return x;
	return fa[x] = get(fa[x]);
}

signed main(void)
{
	n = read();
	for (int i=1;i<=n;++i) {
		a[i].x = read();
		a[i].y = read();
		a[i].point = i;
		fa[i] = i;
	}
	sort(a+1,a+n+1,pig1);
	for (int i=1;i<n;++i) 
		add(a[i].point,a[i+1].point,abs(a[i].x-a[i+1].x));
	sort(a+1,a+n+1,pig2);
	for (int i=1;i<n;++i) 
		add(a[i].point,a[i+1].point,abs(a[i].y-a[i+1].y));
	sort(e+1,e+m+1,pig3);
	for (int i=1;i<=m;++i)
	{
		int x = e[i].x;
		int y = e[i].y;
		if (get(x) == get(y)) continue;
		sum += e[i].v;
		fa[get(x)] = get(y);
	}
	cout << sum << endl;
	return 0;
}

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

int main(){
  int n,m;
  cin >> n >> m;
  int h[n+1];
  int gh[n+1] = {0};
  for(int i=0; i<n; ++i){
    cin >> h[i+1];
  }
  for(int j=0; j<m; ++j){
    int r,l;
    cin >> r >> l;
    if(h[r] > h[l]){
      gh[l] = 1;
    }else if(h[r] < h[l]){
      gh[r] = 1;
    }else{
      gh[r] = 1;
      gh[l] = 1;
    }
  }
  int sum = 0;
  for(auto i: gh){
    if(!i){
      ++sum;
      //cout << i;
    }
  }
  cout << sum -1 << endl;
  return 0;
}


Measured memory_bytes: 4400
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]

row = [False] * h
col = [False] * w

for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = "")#改行しない
        print()#改行

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

main(){
    int a, b, ab;
    int qa, qb;

    cin >> a >> b >> ab;
    cin >> qa >> qb;

    int ans =0;
    while( qa and qb and (2*ab < a+b) ){
        qa--;
        qb--;
        ans += ab*2;
    }
    cout << ans + qa*min(2*ab,a) + qb*min(2*ab,b) << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        while(true) {
            int h = scanner.nextInt();
            int w = scanner.nextInt();
            if (h == 0 && w == 0) {
                break;
            }
            for(int row = 0; row < h; row++){
                for(int col = 0; col < w; col++){
                    if((row%2==0 && col%2==0)||(row%2==1 && col%2==1)){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();
        }
        scanner.close();
    }
}



Measured memory_bytes: 35080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    string S;
    cin >> S;
    int s=S.size();
    string alpha="abcdefghijklmnopqrstuvwxyz";
    vector<int> count(26,0);
    if (s!=26){
        rep (i,s){
            count[S[i]-'a']++;
        }
        rep (i,26){
            if (count[i]==0){
                S+='a'+i;
                cout << S << endl;
                break;
            }
        }
    }
    else {
        bool finished=false;
        for (int i=s-1;i>=0;i--){
            int x=S[i]-'a';
            count[x]++;
            for (int j=x+1;j<26;j++){
                if (count[j]==1){
                    string T=S.substr(0,i);
                    T+='a'+j;
                    cout << T << endl;
                    finished=true;
                    break;
                }
            }
            if (finished){
                break;
            }
        }
        if (!finished){
            cout << -1 << endl;
        }
    }
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
from collections import Counter
data=Counter(a)
if n%2==0:
    if 0  in a:
        print(0)
        exit()
    else:
        for i in data.values():
            if i!=2:
                print(0)
                exit()
    print((2**(n//2))%mod)
else:
    if a.count(0)!=1:
        print(0)
        exit()
    else:
        a.remove(0)
        data=Counter(a)
        for i in data.values():
            if i!=2:
                print(0)
                exit()
    print((2**(n//2))%mod)

Measured memory_bytes: 14692
#include <stdio.h>
#include <math.h>

int main(){
    int n;
    int i;
    int counter = 0;
    double a;
    scanf("%d",&n);
    for (i = 0; i < n; i++) {
        if(counter == 0){
            a = 100000;
        }
        a = a * 1.05;
        a = a / 1000;
        a = ceil(a);
        a= a * 1000;
        counter++;
    }
    printf("%.0f\n",a);
    return 0;
}

Measured memory_bytes: 632
#include<stdio.h>
#define N 105
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INF 1000000
#define NIL -1

int n, head = 0, tail = 0;
int color[N], d[N], array[N][N], e[N], Q[N];

void Enqueque(int x){
  Q[tail] = x;
  tail++;
}

void BFS(int s){
  int i, u, next;
  for(i = 1; i < n+1; i++){
      color[i] = WHITE;
      d[i] = NIL;
  }

  color[s] = GRAY;
  d[s] = 0;
  Enqueque(s);

  while(head != tail){
    u = Dequeque();
    for(i = 1; i <= n; i++){
      if((color[i] == WHITE) && (array[u][i] == 1)){
	color[i] = GRAY;
	d[i] = d[u] + 1;
	Enqueque(i);
      }
    }
    color[u] = BLACK;
  }
}

int Dequeque(){
  head++;
  return Q[head - 1];
}
 
main(){

  scanf("%d", &n);

  int i, u, e, v, j;
  for(i = 1; i < n+1; i++){
    for(j = 1; j < n+1; j++){
      array[i][j] = 0;
    }
  }

  for(i = 1; i < n+1; i++){
    scanf("%d%d", &u, &e);
    for(j = 1; j <= e; j++){
      scanf("%d", &v);
      array[i][v] = 1;
    }
  }

  BFS(1);
  
  for(i = 1; i < n+1; i++){
    printf("%d ", i);
    printf("%d\n", d[i]);
  }
  return 0;
}

Measured memory_bytes: 640
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

o = arr_data[0][0]
e = arr_data[1][0]



strdata=""
for v in range(0, len(e)):

    strdata += o[v]

    strdata += e[v]

if len(o)>len(e):
    
    strdata += o[-1]




print(strdata)
    

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


int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i = 0; i < N; ++i) {
    cin >> D.at(i);
  }
  ll result = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      result += D.at(i) * D.at(j);
    }
  }
  cout << result << endl;
}

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

int main(){
    int x;
    cin >>x;
    
    int a = (int)x/500;
    int b = (x - a*500)/5;
    
    int ans  = 1000* a + 5*b;
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
let a = 1000000007;;

let f x y =
  let rec pow m n b b2 b3 = match n with
      0 -> 1
    | 1 -> ((b mod a) * (b3 mod a)) mod a
    | _->let c = match b2 with
             1 -> (m mod a)
           | _ -> ((b2 mod a)*(b2 mod a)) mod a
         in
         pow m (n/2) ((b mod a)*(b mod a)) c ((if n mod 2 = 0 then 1 else c)*(b3 mod a))
  in
  let g z = Printf.printf "%d\n" z
  in g (pow x y x 1 1);;
Scanf.scanf "%d %d" f;;

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

int main()
{
    vector<int> A(9, 0);
    for (int i = 0; i < 9; i++)
    {
        cin >> A.at(i);
    }
    int N;
    cin >> N;
    vector<int> B(N, 0);
    for (int j = 0; j < N; j++)
    {
        cin >> B.at(j);
    }

    for (int x = 0; x < 9; x++)
    {
        for (int y = 0; y < N; y++)
        {
            if (A.at(x) == B.at(y))
            {
                A.at(x) = 0;
                break;
            }
            
        }
    }
    
    if (A.at(0) == 0 && A.at(1) == 0 && A.at(2) == 0 || A.at(3) == 0 && A.at(4) == 0 && A.at(5) == 0 || A.at(6) ==0 && A.at(7) ==0 && A.at(8) == 0)
    {
        cout << "Yes";
    }

    else if (A.at(0) ==0 &&  A.at(3) ==0 && A.at(6) == 0 || A.at(1) ==0 && A.at(4) ==0 && A.at(7) == 0 || A.at(2) ==0 && A.at(5) ==0 && A.at(8) == 0 )
    {
        cout << "Yes";
    }

    else if (A.at(0) == 0 && A.at(4) == 0 && A.at(8) == 0 || A.at(2) == 0 &&A.at(4) ==0 && A.at(6) == 0)
    {
        cout << "Yes";
    }
    
    
    
    else
    {
        cout << "No";
    }
    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define N 1000005
using namespace std;

typedef long long ll;

ll a, b;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld %lld",&a ,&b);
	if(abs(a - b) <= 1)
		printf("Brown\n");
	else
		printf("Alice\n");

	return 0;
}

Measured memory_bytes: 256