akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 200010;
const u64 MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const int INF = 1000000010;

int n, m;
char s[MAXN], t[MAXN];

map<ll, set<int> > F;

int main()
{
	
	cin >> n >> m >> s >> t;
	int d = __gcd(n, m);
	ll L = (ll)n*m/d;
	for (int i = 0; i < n; ++ i)
		F[L/n*i].insert(s[i]);
	for (int i = 0; i < m; ++ i)
		F[L/m*i].insert(t[i]);
	for (auto p : F)
		if (p.Y.size() > 1)
		{
			puts("-1");
			return 0;
		}
	cout << L << endl;
	
	return 0;
}


Measured memory_bytes: 23808
#include <bits/stdc++.h> 
using namespace std; 
int comp(const void* a, const void* b) 
{ return *(int*)a > *(int*)b ; } 
int findNumberOfTriangles(int arr[], int n) 
{  
	qsort(arr, n, sizeof( arr[0] ), comp); 
	 int count = 0;  
	for (int i = 0; i < n - 2; ++i) 
	{ 
		int k = i + 2; 
		
		for (int j = i + 1; j < n; ++j) 
		{ 
			while (k < n && arr[i] + arr[j] > arr[k]) 
			++k; 

			if(k > j) 
			count += k - j - 1; 
		} 
	} 

	return count; 
} 
int main() 
{ 
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i]; 

	cout<<findNumberOfTriangles( arr,n); 

	return 0; 
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll Mod = (ll)(1e9) + 7;
typedef vector<vector<ll>> matrix;
matrix A;
int n;
ll K;

matrix operator * (matrix u,matrix v){
    matrix c;
    int n = u.size();
    c.resize(n,vector<ll> (n,0));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                c[i][j] = (c[i][j] + (u[i][k]*v[k][j]) % Mod)% Mod;
    return c;            
}

matrix I(int n){
    matrix c(n,vector<ll> (n));
    for (int i = 0; i < n; i++) c[i][i] = 1;
    return c;
}

matrix powmatrix(const matrix&  x,ll y){
    matrix res = I(n);
    matrix u = x;
    while (y){
        if (y & 1) res = res * u;
        u = u * u;
        y >>= 1;
    }
    return res;

}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> K;
    A.resize(n,vector<ll> (n));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) cin >> A[i][j];

    matrix Ans = powmatrix(A,K);
    ll ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) ans = (ans + Ans[i][j]) % Mod;

    cout << ans;    
    return 0;
}

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

int main(){
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  int minA=100001;
  int minB=100001;
  for(int i=0; i<A; i++){
    cin >> a.at(i);
    minA = min(minA, a.at(i));
  }
  for(int i=0; i<B; i++){
    cin >> b.at(i);
    minB = min(minB, b.at(i));
  }
  int minset=2000001;
  for(int i=0; i<M; i++){
    int x, y, c;
    cin >> x >> y >> c;
    minset=min(minset, a.at(x-1)+b.at(y-1)-c);
  }
  cout << min(minA+minB, minset) << endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<int> C(N);
  vector<int> V(N);
  for(int i=0;i<N;++i){cin>>V.at(i);}
  for(int i=0;i<N;++i){cin>>C.at(i);}

  int sum=0;
  for(int i=0;i<N;++i){
    if(V.at(i)-C.at(i)>0){
      sum=sum+(V.at(i)-C.at(i));
    }
  }

  cout<<sum<<endl;
}

Measured memory_bytes: 256
require "stringio"

gets
xs = gets.strip.split(" ").map(&:to_i)

sorted = xs.sort
a = sorted[xs.size / 2 - 1]
b = sorted[xs.size / 2]

s = StringIO.new
xs.each do |x|
  if x <= a
    s.puts b
  elsif x >= b
    s.puts a
  end
end

s.rewind
puts s.read(s.size - 1)


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

int main()
{
    long long H;
    cin >> H;

    int count = 0;
    while (H > 1) {
        H /= 2;
        count++;
    }

    long long ans, add;
    ans = add = 1;
    for (int i = 0; i < count; i++) {
        add *= 2;
        ans += add;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int N , sum=0,Max=0,A;
  cin>>N;
  vector<int> ans(N);
  for(int i=0;i<N;i++){
    cin>>ans[i];
    sum+=ans[i];
  }
  A=sum;
  if(A%10!=0) cout<<A<<endl;
  else{
  for(int i=0;i<N;i++){
    sum=A;
    sum-=ans[i];
    if(sum%10!=0){
      Max=max(Max,sum);
    }
  }
  cout<<Max<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

signed main(){
  fastio
  int n;cin>>n;
  vector<string>s(n);
  vector<pair<int,int>>a(n);
  for(int i=0;i<n;i++){
    int mi=0,bal=0;
    cin>>s[i];
    for(int j=0;j<s[i].size();j++){
      if(s[i][j]=='(') bal++;
      else             bal--;
      mi=min(mi,bal);
    }
    a[i].first=abs(mi);   // clsoe
    bal+=abs(mi);
    a[i].second=bal;  //open
    // cout<<a[i].first<<" "<<a[i].second<<"\n";
  }
  sort(a.begin(),a.end(),[&](pair<int,int>a,pair<int,int>b){
    return min(-a.first,-a.first+a.second-b.first)>min(-b.first,-b.first+b.second-a.first);
  });
  // for(auto x:a){
  //   cout<<x.first<<" "<<x.second<<"\n";
  // }
  int bal=0,mi=0;
  for(int i=0;i<n;i++){
    bal-=a[i].first;
    mi=min(mi,bal);
    bal+=a[i].second;
  }
  if(mi<0 || bal!=0){
    cout<<"No\n";
  }else{
    cout<<"Yes\n";
  }
  return 0;
}

Measured memory_bytes: 42244
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;

int X[] = {-1, 0, 1, 1, 1, 0, -1, -1};
int Y[] = {1, 1, 1, 0, -1, -1, -1, 0};

void solve() {
    int a, b;
    cin >> a >> b;
    if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}

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

Measured memory_bytes: 256
import sys

N = int(input())
B=[]
for i in range(N):
    b=list(map(int,input().split()))
    B.append(b)
for i in range(N-2):
    if B[i][0]==B[i][1]:
        if B[i+1][0]==B[i+1][1]:
            if B[i+2][0]==B[i+2][1]:
                print("Yes")
                sys.exit()
print("No")

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()

{
    long long N, M;
    cin >> N >> M;

    if (N < M)
    {
        cout << (N + M / 2) / 2 << endl;
    }
    else
    {
        cout << M / 2 << endl;
    }
}

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

int main() {
	string p;
	int N,M;
	vector<vector<string>> NN,MM;
	cin >>N>>M;
	string sbuf;
	vector<string> vbuf;
	for(int i =0;i<N;i++){
		cin >> sbuf;
		vbuf.clear();
		for(int j=0;j<N;j++){
			vbuf.push_back(sbuf.substr(j,1));
		}
		NN.push_back(vbuf);
	}
	for(int i =0;i<M;i++){
		cin >> sbuf;
		vbuf.clear();
		for(int j=0;j<M;j++){
			vbuf.push_back(sbuf.substr(j,1));
		}
		MM.push_back(vbuf);
	}
	
	bool fit = true;
	for(int x = 0;x<N-M+1;x++){
		for(int y = 0;y<N-M+1;y++){
			fit =true;
			for(int i  =0;i<M;i++){
				for(int j =0;j<M;j++){
					if(NN[i+x][j+y] != MM[i][j])
						fit = false;
					if(!fit)
						break;
				}
				if(!fit)
					break;
			}
			if(fit)
				break;
		}
		if(fit)
			break;
	}
	
	
	if(fit)
		cout<< "Yes";
	else
		cout<<"No";

	
	return 0;
}

Measured memory_bytes: 512
package main

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

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main() {
	a, b, c := ScanInt(), ScanInt(), ScanInt()
	if (a == b && a != c) || (b == c && b != a) || (a == c && a != b) {
		P("Yes")
	} else {
		P("No")
	}
	close(O)
	oWg.Wait()
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e8))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(1e8))
	go func(writer *bufio.Writer) {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt() int {
	intStr := ScanWord()
	i, err := strconv.Atoi(intStr)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}


Measured memory_bytes: 7808
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
-----------------------
local a = read.l()
if a:lower() == a then
    print('a')
else
    print('A')
end

Measured memory_bytes: 2688
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  for(int i = n; i > 0; i--){
    if(sqrt(i)==(int)sqrt(i)){
      x = i;
      break;
    }
  }
  OUT(x);
}

Measured memory_bytes: 256
def divx(a,b,x):
	return b//x - (a-1)//x
def gcd(a,b):
	if not b:
		return a
	return gcd(b,a%b)

a,b,c,d=[int(x) for x in input().split(' ')]
lcm=(c*d)//gcd(c,d)
# print(divx(a,b,c))
# print(divx(a,b,d))
# print(divx(a,b,lcm))
ans=divx(a,b,c)+divx(a,b,d)-divx(a,b,lcm)
print(b-a+1-ans)

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

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


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	ll L;
	cin>>n>>L;
	long double ans;
	deque<pair<long double,int>> q;
	{
		long double t;
		int v;
		cin>>t>>v;
		cout<<t<<endl;
		ans = t*v;
		q.push_back(mkp(t,v));
	}
	rep(i,1,n){
		long double t;
		int v;
		cin>>t>>v;
		int tv = v;
		while(1){
			auto x = q.back();
			if(tv == x.se){
				ans -= x.fi * x.se;
				q.pop_back();
				break;
			}
			else if(tv < x.se){
				ans -= x.fi * tv;
				q.back().se -= tv;
				break;
			}
			else{
				ans -= x.fi * x.se;
				tv -= x.se;
				q.pop_back();
			}
		}
		ans += t*v;
		cout<<ans/L<<endl;
		while(1){
			if(q.size()==0){
				q.push_front(mkp(t,v));
				break;
			}
			auto x = q.front();
			if(t <= x.fi){
				t = (t*v + x.fi*x.se)/(v+x.se);
				v += x.se;
				q.pop_front();
			}
			else{
				q.push_front(mkp(t,v));
				break;
			}
		}
		// cout<<"hoge "<<endl;
		// for(auto x: q){
		// 	cout<<x.fi<<" "<<x.se<<endl;
		// }
		// cout<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 33108
#include<stdio.h>
int main(){
    int a,b,c,d;
    int flag1 = 0;
    int flag2 = 0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    
    while(1){
        c -= b;
        if(c <= 0){
            flag1 = 1;
            break;
        }
        a -= d;
        if(a <= 0){
            flag2 = 1;
            break;
        }
    }
    if(flag1 == 1) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 1660
from collections import Counter

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N,P = map(int, open(0).read().split())
p = prime_factorize(P)
c = Counter(p)
ans = 1
for x in c.items():
    if x[1] >= N:
        ans *= pow(x[0],(x[1]//N))
print(ans)

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

int N;
const int MAX_N = 200005;
int a[MAX_N],b[20],c[20];

int main(){
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	a[N] = (1<<20)-1;

	long long ans = 0;
	for(int i=0;i<N;i++){
		for(int j=0;j<20;j++){
			while(b[j]<=N && c[j]<2){
				if(a[b[j]]>>j&1)c[j]++;
				b[j]++;
			}
		}
		int x = N+1;
		for(int j=0;j<20;j++){
			x = min(x,b[j]);
		}

		ans += x-i-1;
		for(int j=0;j<20;j++){
			if(a[i]>>j&1)c[j]--;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <iterator>      // std::next prev


using namespace std;


int main() {   
    std::ios::sync_with_stdio(false);
	string a,b,c;
	cin>>a>>b>>c;
	int as = a.size();
	int bs = b.size();
	if(a[as-1]==b[0] && b[bs-1] == c[0])
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	
	return 0;
}


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

int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    string S;

    cin>>S;

    for(int i=S.size();i>0;i--){
        cout<<"x";
    }

    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
//#pragma GCC target ("1avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back 
const int M=10000000000;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main()
{
  fastio;
  int t=1;
  //cin>>t;
  while(t--)
  {
   int a,b;
   char op;
   cin>>a>>op>>b;
   if(op=='+')
    cout<<a+b;
   else 
    cout<<a-b;
  }
  return 0;
}


Measured memory_bytes: 3616
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    int n = s.length()-1;
    char c = s.charAt(n);
    if(c=='3'){
      System.out.println("bon");
    }
    else if(c=='0' || c=='1' || c=='6' || c=='8'){
      System.out.println("pon");
    }
    else{
      System.out.println("hon");
    }
  }
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

map< int,map<int,int> > mp;
// int mp[10][10];

int main(){
  int x,y,s;
  REP(i,10)REP(j,10)mp[i][j]=0;
  while(~scanf("%d,%d,%d",&x,&y,&s)){
    if(x<0)break;
    if(s==1){
      // small
      mp[x][y]++;
      mp[x-1][y]++;
      mp[x+1][y]++;
      mp[x][y-1]++;
      mp[x][y+1]++;
    }else if(s==2){
      // mid
      FOR(i,x-1,x+2){
        FOR(j,y-1,y+2){
          mp[i][j]++;
        }
      }
    }else{
      // big
      FOR(i,x-1,x+2){
        FOR(j,y-1,y+2){
          mp[i][j]++;
        }
      }
      mp[x-2][y]++;
      mp[x+2][y]++;
      mp[x][y-2]++;
      mp[x][y+2]++;
    }
  }
  int cnt = 0;
  int mx = 0;
  REP(i,10)REP(j,10){
    if(mp[i][j]==0)++cnt;
    else mx=max(mx,mp[i][j]);
  }
  cout<<cnt<<endl;
  cout<<mx<<endl;
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  string s, t;
  cin >> s >> t;
  int ans = -1;
  for (int i = 0; i < s.size(); i++) {
    int cnt = 0 ;
    bool ok = true;
    for (int j = 0; j < t.size(); j++) {
      if (i + j >= s.size()) {
	ok = false;
      }
      if (s[i + j] == t[j]) cnt++;
    }
    if(ok) ans = max(ans, cnt);
  }

  cout << t.size() - ans << endl;
  return 0;
}


Measured memory_bytes: 3640
def round_(i):
    if int(i*10)%10 < 4:
        return int(i)
    else:
        return int(i) + 1

tot = 0
qua = 0
count = 0
while(1):
    try:
        p,q = [int(i) for i in input().split(",")]
        count += 1
        tot += p*q
        qua += q
    except EOFError:
        print(tot)
        print(round_(qua/count))
        break


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#include <algorithm>

#define int long long

using namespace std;

typedef vector<int> vi;

string s;
int n, w, h, z, inpa, inpb, inf = 1000000007;
vi a, res;

signed main()
{
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    scanf("%lld %lld %lld", &h, &w, &n);
    res.assign(10, 0);
    z = (h - 2) * (w - 2);
    for (int nn = 0; nn < n; nn++)
    {
        scanf("%lld %lld", &inpa, &inpb);
        for (int i = 0; i <= 2; i++)
        {
            for (int j = 0; j <= 2; j++)
            {
                int aa = inpa - i, bb = inpb - j;
                if (aa > 0 && bb > 0 && aa <= h - 2 && bb <= w - 2)
                {
                    a.push_back(inf * (aa) + bb);
                }
            }
        }
    }
    sort(a.begin(), a.end());
    /*
    for(int i=0;i<a.size();i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
    */
    int num = 1;
    for (int i = 0; i < a.size(); i++)
    {
        if (a[i] == a[i + 1])
        {
            ++num;
        }
        else
        {
            ++res[num];
            --z;
            num = 1;
        }
    }
    printf("%lld\n", z);
    for (int i = 1; i < 10; i++)
    {
        printf("%lld\n", res[i]);
    }
    return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<int> p(N);
  for(int i=1;i<100;i++){
    for(int k=1;k<100;k++){
      for(int j=1;j<100;j++){
        int A=i*i+j*j+k*k+i*k+k*j+j*i-1;
        if(A>=N){
          break;
        }
        else{
          p[A]++;
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    cout<<p[i]<<endl;
  }
}

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

using namespace std;

int main() {
	long long n, k;
	cin >> n >> k;
	
	vector<long long> x(n);
	
	for (long long i = 0; i < n; ++i) {
		cin >> x[i];
	}
	
	long long offset, total, result = 9223372036854775807;
	for (long long i = 0; i + k - 1 < n; ++i) {
		total = x[i + k - 1];
		offset = x[i];
		
		if (offset < 0) {
			if (total >= 0) {
				total = max(abs(offset), total) + min(abs(offset), total) * 2;
			} else {
				total = abs(offset);
			}
		}
		
		if (total < result)
			result = total;
	}
	
	cout << result << endl;
}

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

int main() {
    int N, D, X;
    cin >> N >> D >> X;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int res = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= D;) {
            res++;
            j += A[i];
        }
    }

    cout << res + X << endl;
}

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

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<vector<int>> vv(N + 1, vector<int> (M));
  for (int i = 0; i < N + 1; i++) {
    for (int j = 0; j < M; j++) {
      int t;
      cin >> t;
      vv.at(i).at(j) = t;
    }
  }
  int cnt = 0;
  for (int i = 1; i < N + 1; i++) {
    int S = C;
    for (int j = 0; j < M; j++) {
      S += vv.at(0).at(j) * vv.at(i).at(j);
    }
    if (S > 0) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,n,temp,x,ans=-1;
	cin>>a>>b>>n;
	temp=min(b-1,n);
	ans=floor(a*temp/b)-a*floor(temp/b);
	cout<<ans;
	return 0;
}

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

using namespace std;
#define int long long

signed main(){
    string S;
    cin >> S;
    
    for(int i=0;i<S.length()-1;i++){
        if(S[i]=='A' && S[i+1]=='C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
bool nn;
int main() {
	int n,m;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> m;
		if (m % 2 == 0) {
			if (m % 3 != 0 && m % 5 != 0)nn = true;
		}
	}
	if (nn == true)cout << "DENIED";
	else cout << "APPROVED";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include <vector>
using namespace std;
int main( )
{
	string s;
	cin >> s;
	int len = s.length( );
	int ans = 0;
	string last = s.substr( 0, 1 );
	ans ++;
	for( int i = 1; i < len; )
	{
		string t = s.substr( i, 1 );
		if( t == last )
		{
			if( i + 2 <= len )
			{
				ans ++;
				last = s.substr( i, 2 );
				i += 2;
			}
			else
				break;
		}
		else
		{
			ans ++;
			last = t;
			i ++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 832
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var line = consoleReader.SplitInt();
            var N = line[0];
            var K = line[1];

            double once = 1.0 / N;
            double res = 0;
            //int count = 0;
            int pow = 1;
            for (; pow < K; pow *= 2) { }

            for (int i = 1; i <= N; i++)
            {
                while (pow > 1 && pow * i / 2 >= K)
                {
                    pow /= 2;
                }
                res += once / pow;
            }

            return res;
        }

        public const int mod = 1000000007;
        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

    #region Console
    public class ConsoleReader { public virtual string String() => Console.ReadLine(); public int Int() => int.Parse(String()); public long Long() => long.Parse(String()); public ulong ULong() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt() => String().Split().Select(int.Parse).ToArray(); public long[] SplitLong() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitULong() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); } public IEnumerable<int> RepeatInt(int count) { for (int i = 0; i < count; i++) yield return Int(); } public IEnumerable<long> RepeatLong(int count) { for (int i = 0; i < count; i++) yield return Long(); } public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); } public IEnumerable<int[]> RepeatSplitInt(int count) { for (int i = 0; i < count; i++) yield return SplitInt(); } }
    #endregion
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  int ans = 0;
  int D,E,F;
  D = A;
  E = B;
  F = C;
  for (int i = 0; i < 30; i++) {
    if (A%2 == 1 || B%2 == 1 || C%2 == 1) {
      break;
    }
    else if (A == B && B == C) {
      ans = -1;
      break;
    }
    else {
      ans++;
      A = E/2+F/2;
      B = F/2+D/2;
      C = D/2+E/2;
      D = A;
      E = B;
      F = C;
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
ll dp[4][3010][3010];
ll x[3030][3030];
int main()
{
    int r, c, k; cin>>r>>c>>k;
    for(int i=0; i<k; i++){
        int a, b, v;
        cin>>a>>b>>v;
        a--; b--;
        x[a][b]=v;
    }
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            for(int l=0; l<4; l++) dp[l][i][j]=-1;
        }
    }
    dp[0][0][0]=0;
    if(x[0][0]) dp[1][0][0]=x[0][0];
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            for(int l=0; l<4; l++){
                if(dp[l][i][j]==-1) continue;
                if(i<r-1){
                    dp[0][i+1][j]=max(dp[0][i+1][j], dp[l][i][j]);
                    if(x[i+1][j]) dp[1][i+1][j]=max(dp[1][i+1][j], dp[l][i][j]+x[i+1][j]);
                }
                if(j<c-1){
                    dp[l][i][j+1]=max(dp[l][i][j+1], dp[l][i][j]);
                    if(x[i][j+1] && l+1<=3) dp[l+1][i][j+1]=max(dp[l+1][i][j+1], dp[l][i][j]+x[i][j+1]);
                }
            }
        }
    }
    ll ans=0;
    for(int i=0; i<=3; i++) ans=max(ans, dp[i][r-1][c-1]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 356468
import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String S=sc.next();
        S=S.toLowerCase();
        int ans=0;
        while(true){
            String T=sc.next();
            if(T.equals("END_OF_TEXT")) break;
            T=T.toLowerCase();
            if(S.equals(T)) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26152
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265359

using namespace std;

/*ll powMod(ll a, ll y)
{
    ll ans = 1;
    
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % MOD; 
  
        y = y>>1;
        a = (a*a) % MOD; 
    } 
    return ans;
}*/

/*ll modInv(ll a)
{
    return powMod(a, MOD-2);	
}*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}




Measured memory_bytes: 384
#include <iostream>
using namespace std;
#define rep(i, n) for(int i=1;i<n;i++)

int main(){
    int n;
    cin >> n;
    while(1){
        if(n>=1000){
            n = n-1000;
        }else{
            break;
        }
    }
    if(n == 0){
        cout << 0 << endl;
    }else{
        cout << 1000-n << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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 gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n;
    cin >> n;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    std::sort(all(a));
    int flag = 0;
    int big = 0;
    int small = 0;
    if (a[0] == a[n - 1]) {
        flag = 1;
    } else if (a[0] + 1 == a[n - 1]) {
        flag = -1;
    }
    if (flag == 1) {
        int count = 0;
        if (a[0] != n - 1 && a[0] > n / 2) {  //pairがいる
            flag = 0;
        }
    } else if (flag == -1) {
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            count++;
            if (a[i] != a[i + 1]) {
                break;
            }
        }
        if (2 * (a[n - 1] - count) > (n - count) || count >= a[n - 1]) {
            flag = 0;
        }
    }
    if (flag == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

int main()
{
    //高橋体A攻撃B
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    for (int i = 0; A >= 0 || C >= 0;i++)
    {
        C = C - B;
        if (C <= 0)
        {
            cout << "Yes" << endl;
            break;
        }
        A = A - D;
        if (A <= 0)
        {
            cout << "No" << endl;
            break;
        }
    }
}


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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    int x;
    cin >> x;

    cout << (x < 1200 ? "ABC" : "ARC") << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
vector<string> split(const string &s, char delim) {
	vector<string> elems;
	string item;
	for (char ch : s) {
		if (ch == delim) {
			if (!item.empty())
				elems.push_back(item);
			item.clear();
		} else {
			item += ch;
		}
	}
	if (!item.empty())
		elems.push_back(item);
	return elems;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
// 本体

ll dp[3002][3002] = {};

int main() {
	IOS();
	ll n, s;
	cin >> n >> s;
	ll MOD = 998244353;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= s; j++) {
			dp[i + 1][j] = dp[i][j] * 2;
			if (j >= a[i]) {
				dp[i + 1][j] += dp[i][j - a[i]];
			}
			dp[i + 1][j] %= MOD;
		}
	}
	dump(dp[n][s]);
}

Measured memory_bytes: 74028
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    string ans = "";
    REP(i,n){
        ans += {s[i]};
        ans += {t[i]};
    }
    cout << ans << endl;

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    REP(i, M) cin >> L[i] >> R[i];

    int lower = 0, higher = N;
    REP(i, M){
        lower = max(lower, L[i]);
        higher = min(higher, R[i]);
    }
    cout << max(0, higher-lower+1) << endl;
    
    return 0;
}

Measured memory_bytes: 1152
import math

N = int(input())
A = 0
B = 0
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a_num = [i+1 for i in range(N)]
b_num = [i+1 for i in range(N)]

for i in range(N):
    a_idx = a_num.index(a[i])
    b_idx = b_num.index(b[i])
    a_num.pop(a_idx)
    b_num.pop(b_idx)

    A = A + math.factorial(N-i)*((a_idx)/(N-i))
    B = B + math.factorial(N-i)*((b_idx)/(N-i))


print("{}".format(int(abs(A-B))))

Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 0

for i in range(N):
  ans += min(A[i], B[i]) + min(A[i+1], max(B[i] - A[i], 0))
  A[i+1] = max(0, A[i+1] - max(B[i] - A[i], 0))
    
print(ans)

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

string s[]={"pon","pon","hon","bon","hon","hon","pon","hon","pon","hon"};

int main(){
   int n; cin>>n; n%=10;
   cout<<s[n]<<endl;
   return 0;
}

Measured memory_bytes: 3628
import sys,itertools,copy
input = sys.stdin.readline
N=int(input().strip())
Bn=[int(x) for x in input().strip().split()]
ans=[]
v=[]
def isok(l,Bn=Bn):
    cnt=len(Bn)-1
    flag=True
    for i,n in enumerate(reversed(l)):
        while cnt>=0:
            if n == Bn[cnt]:
                cnt-=1
                break
            elif Bn[cnt] < len(l)-i:
                flag=False
                break
            else:
                cnt-=1
        else:
            flag=False
        if not flag:
            return False
    else:
        return True

for i in range(1,N+1):
    flag=False
    for ii in range(i,0,-1):
        test=copy.deepcopy(ans)
        test.insert(ii-1,ii)
        if isok(test):
            ans.insert(ii-1,ii)
            v.append(ii)
            flag=True
            break
    if not flag:
        v=[-1]
        break

for a in v:
    print(a)


Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;

typedef long long ll;

int n, l[2003], c[2003];

void insert(int x) {
    for (int i = x; i < 2001; i += i & -i)
        c[i] += 1;
}
int sum(int x) {
    int res = 0;
    for (int i = x; i; i -= i & -i)
        res += c[i];
    return res;
}
int main(){
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> l[i];
    sort(l + 1, l + 1 + n);
    int res = 0;
    for (int i = 1; i <= n; i++) {
        res += (sum(2003) - sum(l[i]));
        //cout << res << endl;
        for (int j = 1; j < i; j++) {
            insert(l[i] + l[j]);
        }
    }
    cout << res << endl;
}



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

const int mod = 1e9 + 7;
const long long INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//using ll = long long;
//using P = pair<int,int>;

// dp[N][W] : 1~N-1個の中から荷物を選び, 重さWのとき, 価値の合計の最大値を表す


int main(){
    int N, W;
    cin >> N >> W;
    
    vector<int> v(N), w(N);
    
    rep(i, N) cin >> v[i] >> w[i];
    
    vector<vector<long long> > dp(110, vector<long long>(10101));
    
   for (int i = 0; i < 110; i++){
       for (int j = 0; j < 10101; j++) dp[i][j] = -1;
   }
   
   dp[0][0] = 0;
    
    for (int i = 0; i < N; i++){
        for (int j = 0; j <= W; j++){
            
            chmax(dp[i+1][j], dp[i][j]); //i番目の荷物を選ばない
            
            if (j >= w[i]) chmax(dp[i+1][j], dp[i][j - w[i]] + v[i]);
        }
    }
    
    // 答えは, dp[N][0], dp[N][1], dp[N][2],,, dp[N][W]の中の最大値である.
    long long ans = 0;
    
    for (int w = 0; w <= W; w++) ans = max(ans, dp[N][w]);
    
    cout << ans << endl;
}


Measured memory_bytes: 11604
use std::io::BufRead;
fn main() {
 let s=std::io::stdin();
 for l in s.lock().lines(){
  let v:Vec<usize>=l.unwrap().split_whitespace()
   .map(|x|x.parse().unwrap())
   .collect();
  if v==[0,0]{break}
  println!("{}",("#".repeat(v[1])+"\n").repeat(v[0]));
 }
}


Measured memory_bytes: 5032