akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
long long int MOD = 1000000007;
/*
cin >> n;
vi a(n);
rep(i,n)cin>>a[i];
*/
int n;
int main(){
	int N,K;
	cin>>N>>K;
	vector<ll> a(N),b(N);
	ll num[114514],num2[114514];
	rep(i,N)cin>>a[i];
	ll hoge=0;
	for(int i=0;i<N;i++){
		if(a[i]>0)hoge+=a[i];
		b[i]=hoge;
	}
	ll sum=0;
	rep(i,K)sum+=a[i];
	num[0]=sum;
	num2[0]=b[N-1]-b[K-1];
	ll ans=num2[0]+max((ll)0,num[0]);
	for(int i=K;i<N;i++){
		sum=sum-a[i-K]+a[i];
		num[i-K+1]=sum;
		num2[i-K+1]=b[i-K]+b[N-1]-b[i];
	}
	
	for(int i=0;i<=N-K;i++){
		ans=max(ans,num2[i]+max((ll)0,num[i]));
		//cout<<num2[i]<<" "<<num[i]<<endl;
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint a(n);
    vvint x(n, vint(n, -1)), y(n, vint(n, -1));
    rep(i, n) {
        cin >> a[i];
        rep(j, a[i]) {
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }

    int ans = 0;

    rep(i, 1 << n) {
        vbool flg(n, false);
        bool c = true;
        int tmp = 0;
        rep(j, 15) {
            if ((i >> j) & 1) {
                flg[j] = true;
                tmp++;
            }
        }
        rep(j, n) {
            if (flg[j] == 0) continue;
            rep(k, a[j]) {
                if (y[j][k] != flg[x[j][k]]) c = false;
            }
        }
        if (c) ans = max(ans, tmp);
    }

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

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

public class Main {
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        String s = sc.next();
        int k = sc.nextInt();
        String ans = "";
        
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) != s.charAt(k - 1)) {
                ans += "*";
            } else {
                ans += s.charAt(k - 1);
            }
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int n, m; cin >> n >> m;
    if(m==1){
        cout << 0 << endl;
        return 0;
    }
    if(n>=m){
        cout << 0 << endl;
        return 0;
    }
    vector<int> xs(m);
    for(int i=0; i<m; ++i){
        cin >> xs[i];
    }
    sort(xs.begin(), xs.end());
    vector<int> diffs(m-1);
    for(int i=0; i<m-1; ++i){
        diffs[i]=xs[i+1]-xs[i];
    }
    sort(diffs.begin(), diffs.end());
    int sum=accumulate(diffs.begin(), diffs.end()-(n-1), 0);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

int main(){
    int n; cin >> n;
    priority_queue<str> pq;
    str tmp;
    rep(i, n){
        cin >> tmp;
        pq.push(tmp);
    }
    int ans = 1;
    str now = pq.top();
    pq.pop();
    while(!pq.empty()){
        if(now != pq.top()){
            ans += 1;
            now = pq.top();
        }
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11656
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = (0 until n).map { sc.next() }
    println(problem089c(n, s))
}

fun problem089c(n: Int, s: List<String>): Long {
    var count = 0L
    val list = (0..5).map { 0 }.toMutableList()
    for (i in 0 until n) {
        when (s[i].take(1)) {
            "M" -> list[0] += 1
            "A" -> list[1] += 1
            "R" -> list[2] += 1
            "C" -> list[3] += 1
            "H" -> list[4] += 1
            else -> {
            }
        }
    }
    for (i in 0 until list.size) {
        for (j in i until list.size) {
            for (k in j until list.size) {
                if (i != j && i != k && j != k) {
                    count += list[i].toLong() * list[j].toLong() * list[k].toLong()
                }
            }
        }
    }
    return count
}

Measured memory_bytes: 59364
A, B, M = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
X = 0
Y = 0
C = 0
Sum = min(a) + min(b)
Min = 10**8

for _ in range(M):
    x, y, c = map(int, input().split())
    tmp = (a[x-1] + b[y-1]) - c
    if Min > tmp:
        Min = tmp

if Sum < Min:
    print(Sum)
    exit()
print(Min)

Measured memory_bytes: 18736
import math
n = 100000
integer = [i for i in range(2,n+1)]
prime = []
while integer[0] <= math.sqrt(n):
    p = integer[0] 
    prime.append(p)
    integer = [i for i in integer if i % p != 0]
prime = prime + integer
like = []
likesum = [0]*(n+1)
for i in range(len(prime)):
    if (prime[i]+1)//2 in prime:
        like.append(prime[i])
for i in range(n):
    if i in like:
        likesum[i+1] = likesum[i] + 1
    else:
        likesum[i+1] = likesum[i]    
q = int(input())
for i in range(q):
    l,r = map(int,input().split())
    print(likesum[r+1]-likesum[l])


Measured memory_bytes: 53920
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,x;
  scanf("%d%d",&n,&k);
  int i;
  for(i = 1;i<=n;i++)
 scanf("%d",&x);
    printf("%d\n",(int)ceil((n-1)*1.0/(k-1)));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll MIN=MOD;

ll Sixmin(ll N){
  ll mi=0;
  rep(i,MOD){
    if(pow(6,i)>N){
      mi=i-1;
      break;
    }
  }
  return mi;
}

ll Ninemin(ll N){
  ll mi=0;
  rep(i,MOD){
    if(pow(9,i)>N){
      mi=i-1;
      break;
    }
  }
  return mi;
}

void dfs(ll N,ll SM,ll NM,ll C){
  if(SM<=0 && NM<=0){
    MIN=min(MIN,C+N);
    return;
  }
  if(C>=MIN-1){
    return;
  }
  ll SN=N-pow(6,SM);
  ll NN=N-pow(9,NM);
  dfs(NN,Sixmin(NN),Ninemin(NN),C+1);
  dfs(SN,Sixmin(SN),Ninemin(SN),C+1);
}

int main(){
  ll N;cin >> N;
  ll SM=Sixmin(N);
  ll NM=Ninemin(N);
  dfs(N,SM,NM,0LL);
  cout << MIN << endl;
}

Measured memory_bytes: 384
s_L = [str(val) for val in input()]
n = len(s_L)

p_1,p_2 = [],[]
for val in range(n):
    if val%2 ==0:
        p_1.append("0")
        p_2.append("1")
    else:
        p_1.append("1")
        p_2.append("0")
counter1,counter2 = 0,0

for val in range(n):
    if p_1[val] == s_L[val]:
        counter1 +=1
    else:
        counter2 +=1
print(min(counter1,counter2))


Measured memory_bytes: 55860
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int> qi;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<vl> mat;
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define ft first
#define sd second
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mp make_pair
#define fr(i,n)for(ll i=0;i<(n);i++)
#define ifr(i,n)for(ll i=(n)-1;i>=0;i--)
const int nmax = 40, abmax = 10,inf = 1000000;

int a[nmax], b[nmax], c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];
int main(){
    int n,ma,mb;cin>>n>>ma>>mb;

    fr(i,n)cin>>a[i]>>b[i]>>c[i];
    //初期化
    fr(i,n+1){
        fr(ca,nmax*abmax+1){
            fr(cb,nmax*abmax+1){
                dp[i][ca][cb] = inf;
            }
        }
    }
    dp[0][0][0] = 0;
    fr(i,n){
        fr(ca,nmax*abmax+1){
            fr(cb,nmax*abmax+1){
                if(dp[i][ca][cb]==inf)continue;
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb],dp[i][ca][cb]);
                dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
            }
        }
    }

    int ans = inf;
    for(int ca = 1;ca<=nmax*abmax; ++ca){
        for(int cb = 1;cb<=nmax*abmax;++cb){
            if(ca*mb==cb*ma)ans = min(ans, dp[n][ca][cb]);
        }
    }
    if(ans==inf)cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 25984
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
void solve(int n, int x){
  int ans = 0;
  for(int i = 1; i <= n - 2; i++){
    for(int j = i + 1; j <= n - 1; j++){
      for(int k = j + 1; k <= n; k++){
        if(i + j + k == x){
          ans ++;
        }
      }
    }
  }
  cout << ans << endl;
}
int main(void){
  int n;
  int x;
  cin >> n >> x;
  while(!(n == 0 && x == 0)){
    solve(n, x);
    cin >> n >> x;
  }  
  return 0;
}



Measured memory_bytes: 3076
function prime(max){
   var arr=[];
   for(var i=0;i<=max;i++)arr[i]=i;
   arr[0]=false;
   arr[1]=false;
   var sqrt=Math.floor(Math.sqrt(max));
   for(var i=2;i<=sqrt;i++){
      if(arr[i]==false)continue;
         for(var j=i+i;j<=max;j+=i){
            arr[j]=false;
         }
   }
   var result=[];
   for(var i=0;i<=max;i++){
      if(arr[i]!==false)result.push(arr[i]);
   }
   return result;
}
var PRIME=prime(100000);

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
arr.some(function(v){
   if(v=="0 0 0")return true;
   var mab=v.split(" ").map(Number);
   var m=mab[0];
   var a=mab[1];
   var b=mab[2];
   var ans=[0,0,0];
   for(var p=0;p<PRIME.length;p++){
      for(var q=p;q<PRIME.length;q++){
         var pq=PRIME[p]*PRIME[q];
         if(pq>m)break;
         if(PRIME[q]*a <= PRIME[p]*b && ans[2]<pq)ans=[PRIME[p],PRIME[q],pq]
      }
   }
   console.log(ans[0]+" "+ans[1]);
});

Measured memory_bytes: 26328
S = input()
N = len(S)
target = ['A', 'C', 'G', 'T']
ans = []
for i in range(N):
    ret = 0
    for j in S[i:N]:
      if not j in target:
        break
      ret += 1
    ans.append(ret)
    i = j
print(max(ans))

Measured memory_bytes: 8856
#include <iostream>
#include <vector>
#include<string>
#include<algorithm>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
int main() {
	float N;
	float p;
	int a;
	cin >> N;
	a = (N + 1) / 2;
	p = a / N;
	cout << p << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
comb(a,b)
aはでかいほどいい。bはa/2に近いほどいい
3C0,1,2,3= 3C1or2  3/2or3/2+1
4C0,1,2,3,4=4C2 4/2
*/
int main(){
  ll N, M=0; cin>>N;
  vector<ll> A;
  for(int i=0; i<N; i++){
    ll a; cin>>a;
    A.emplace_back(a);
    M=max(M,a);
  }
  ll second=-1,val=1e9,sep1,sep2;
  sep1=M/2;
  sep2=(M+1)/2;
  for(int i=0; i<N; i++){
    if(A[i]==M) continue;
    ll temp1=abs(sep1-A[i]);
    ll temp2=abs(sep2-A[i]);
    if(temp1<val){
      val=temp1;
      second=i;
    }
    if(temp2<val){
      val=temp2;
      second=i;
    }
  }
  cout<<M<<" "<<A[second]<<endl;
}

Measured memory_bytes: 1400
import heapq

n,m,s,t=map(int,input().split())
TRAIN=[None]*m

for i in range(m):
    TRAIN[i]=list(map(int,input().split()))


YEN=[10**16]*(n+1)#sから国iまで行くときの最小円
SNOOK=[10**16]*(n+1)#国iからtまで行くときの最小スヌーク
YEN[s]=0
SNOOK[t]=0


TRAINMAP=[[] for i in range(n+1)]

for i in range(m):
    TRAINMAP[TRAIN[i][0]]+=[(TRAIN[i][1],TRAIN[i][2],TRAIN[i][3])]
    TRAINMAP[TRAIN[i][1]]+=[(TRAIN[i][0],TRAIN[i][2],TRAIN[i][3])]



checking=[(0,s)]

while checking:

    cost,checktown=heapq.heappop(checking)
    
    for i in TRAINMAP[checktown]:
        if YEN[i[0]]>cost+i[1]:
            YEN[i[0]]=cost+i[1]
            heapq.heappush(checking,(cost+i[1],i[0]))

checking=[(0,t)]

while checking:

    cost,checktown=heapq.heappop(checking)
   
    for i in TRAINMAP[checktown]:
        if SNOOK[i[0]]>cost+i[2]:
            SNOOK[i[0]]=cost+i[2]
            heapq.heappush(checking,(cost+i[2],i[0]))



MONEY=[10**16]*(n+1)
MONEY[n]=YEN[n]+SNOOK[n]

for i in range(n-1,0,-1):
    if YEN[i]+SNOOK[i]<MONEY[i+1]:
        MONEY[i]=YEN[i]+SNOOK[i]
    else:
        MONEY[i]=MONEY[i+1]


for i in range(1,n+1):
    print(10**15-MONEY[i])


Measured memory_bytes: 71132
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N;
	cin >> N;
	string s1, s2;
	cin >> s1 >> s2;

	ll rsl = 0;
	int idx = 0;
	bool flag = true;
	if(s1[0] == s2[0]) {
		rsl = 3;
		idx++;
	} else {
		rsl = 6;
		idx += 2;
		flag = false;
	}
	
	int mod = 1e9 + 7;
	while(idx < s1.size()) {
		if(s1[idx] == s2[idx]) {
			if(flag) (rsl *= 2) %= mod;
			idx++;
			flag = true;
		} else {
			if(flag) (rsl *= 2) %= mod;
			else (rsl *= 3) %= mod;
			idx += 2;
			flag = false;
		}
	}

	cout << rsl << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
int n;
cin>>n;
string s,t;
cin>>s>>t;
int ans=2*n;
rep(i,n){
  if (s.substr(n-i-1,i+1)==t.substr(0,i+1)){
    ans=2*n-i-1;
  }
}
cout<<ans<<endl;
return 0;
}


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

class Jewelry{
  public:
    int m_V,m_C;
  Jewelry(int V,int C){
    m_V = V;
    m_C = C;
  }
  bool operator<(const Jewelry &another) const
  {
    return m_V - m_C > another.m_V - another.m_C;
  };
};

int main(){
  int ans = 0,N;
  vector<Jewelry> jewelList;
  vector<int> tmpV,tmpC;
  cin >> N;
  for(int i=0;i<N;i++){
    tmpV.push_back(0);
    cin >> tmpV[i];
  }
  for(int i=0;i<N;i++){
    tmpC.push_back(0);
    cin >> tmpC[i];
    jewelList.push_back(Jewelry(tmpV[i],tmpC[i]));
  }
  std::sort(jewelList.begin(),jewelList.end());
  for(int i=0;i<N;i++){
    //cout << jewelList[i].m_V <<" "<< jewelList[i].m_C << endl;
    if(jewelList[i].m_V > jewelList[i].m_C){
      ans += jewelList[i].m_V - jewelList[i].m_C;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

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

ll solve(int A, int B){
	ll ans = 0;
	ll g = gcd(A,B);
	// ote(g);//
	// ote(A/g);//
	// ote(B/g);//
	ans = (A/g) * (B/g) * g;
	return ans;
}

int main(){
	int A,B; cin>>A>>B;
	ote(solve(A,B));
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, x, B = input().split()
    ans = A[0] + x[0] + B[0]
    print(ans.upper())



if __name__ == '__main__':
    main()


Measured memory_bytes: 9056
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    string S[110];
    rep(i, H) cin >> S[i];
    bool a[110] = {};
    bool b[110] = {};
    rep(i, H) {
        bool ok = false;
        rep(j, W) {
            if(S[i][j] == '#') ok = true;
        }
        a[i] = ok;
    }
    rep(j, W) {
        bool ok = false;
        rep(i, H) {
            if(S[i][j] == '#') ok = true;
        }
        b[j] = ok;
    }
    rep(i, H) {
        if(!a[i]) continue;
        rep(j, W) {
            if(!b[j]) continue;
            cout << S[i][j];
        }
        cout << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(void){
    int N, ans = 0;
    std::cin >> N;
    for (int i = 0; i < N; ++i){
        int a;
        std::cin >> a;
        ans += a - 1;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3600
def xgcd a, b
	x, y, u, v = 1, 0, 0, 1
	until b == 0
		q, a, b = a/b, b, a%b
		x, y, u, v = u, v, x-q*u, y-q*v
	end
	return a, x, y
end
def imod a, m
	d, x, y = xgcd a, m
	return nil unless d == 1
	return 0<x ? x : x+m
end

X, Y = gets.split.map(&:to_i)
MOD = 1000000007
(p 0; exit) unless (X+Y)%3 == 0
L, R = [Y-(X+Y)/3, 2*(X+Y)/3-Y].minmax
(p 0; exit) if L < 0
p((R+1..L+R).inject(1){|s,n| s*n%MOD } * imod((1..L).inject(1){|s,d| s*d%MOD },MOD) % MOD)


Measured memory_bytes: 1788
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
int main()
{
	int num;
	scanf("%d", &num);
	multiset<ll>s1, s2;
	ll t1 = 0, t2 = 0;
	ll bef;
	ll ans = 0;
	for (int i = 0; i < num; i++)
	{
		ll za, zb;
		scanf("%lld%lld", &za, &zb);
		if (i == 0)
		{
			t1 = t2 = za;
			s1.insert(0), s2.insert(0);
		}
		else
		{
			t1 -= zb - za;
			t2 += bef;
			multiset<ll>::iterator it1 = s1.end();
			it1--;
			ll s = (*it1) + t1;
			multiset<ll>::iterator it2 = s2.begin();
			ll t = (*it2) + t2;
			if (za < s)
			{
				s1.erase(it1);
				s2.insert(s - t2);
				s1.insert(za - t1);
				s1.insert(za - t1);
				ans += s - za;
			}
			else if (za <= t)
			{
				s1.insert(za - t1);
				s2.insert(za - t2);
			}
			else
			{
				s2.erase(it2);
				s1.insert(t - t1);
				s2.insert(za - t2);
				s2.insert(za - t2);
				ans += za - t;
			}
		}
		bef = zb - za;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

ll dp[121][4][4][4][4], ans;
int N;
// 0->A 1->T 2->G 3->C

int main()
{
    cin >> N;
    for (int i = 0; i < 4; i++)
        dp[1][i][0][0][0] = 1;
    for (int i = 0; i < 4; i++)
    {
        dp[2][i][0][0][0] = dp[1][0][0][0][0];
        dp[2][i][1][0][0] = dp[1][1][0][0][0];
        dp[2][i][2][0][0] = dp[1][2][0][0][0];
        dp[2][i][3][0][0] = dp[1][3][0][0][0];
    }

    for (int j = 0; j < 4; j++)
    { //今
        for (int k = 0; k < 4; k++)
        { //1個前
            for (int l = 0; l < 4; l++)
            { //2個前
                if (j == 3 && k == 2 && l == 0)
                    continue;
                if (j == 2 && k == 3 && l == 0)
                    continue;
                if (j == 3 && k == 0 && l == 2)
                    continue;
                ll s = 0;
                for (int p = 0; p < 4; p++)
                    s += dp[3 - 1][k][l][p][0];
                dp[3][j][k][l][0] += s % mod;
                dp[3][j][k][l][0] %= mod;
            }
        }
        //cout << "OK" << endl;
    }

    for (int i = 4; i <= N; i++)
    {
        for (int j = 0; j < 4; j++)
        { //今
            for (int k = 0; k < 4; k++)
            { //1個前
                for (int l = 0; l < 4; l++)
                { //2個前
                    for (int r = 0; r < 4; r++)
                    {
                        if (j == 3 && k == 2 && l == 0)
                            continue;
                        if (j == 2 && k == 3 && l == 0)
                            continue;
                        if (j == 3 && k == 0 && l == 2)
                            continue;
                        if (j == 3 && k == 2 && r == 0)
                            continue;
                        if (j == 3 && l == 2 && r == 0)
                            continue;

                        ll s = 0;
                        for (int p = 0; p < 4; p++)
                            s += dp[i - 1][k][l][r][p];
                        dp[i][j][k][l][r] += s % mod;
                        dp[i][j][k][l][r] %= mod;
                    }
                }
            }
            //cout << "OK" << endl;
        }
    }

    for (int i = 0; i < 4; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            for (int k = 0; k < 4; k++)
            {
                for (int l = 0; l < 4; l++)
                {
                    //cout << dp[N][i][j][k] << endl;
                    ans += dp[N][i][j][k][l] % mod;
                    ans %= mod;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const mod = 998244353;
map <string, int> f;

int Solve(string &s) {
  if (f.find(s) != f.end()) return f[s];
  if (s.size() == 0) return 1;
  if (s.size() == 1) return (s[0] & 1) + 1;
  int len = s.size();
  string L, R;
  L.push_back(s[0]);
  for (RI i = 1; i < len; ++i)
    R.push_back(s[i]);
  int ans = 1ll * Solve(L) * Solve(R) % mod;
  for (RI i = 1; i <= len / 2; ++i) {
    L.clear();
    for (RI j = 0; j < i; ++j) L.push_back(s[j]);
    for (RI j = i, k = j + i; k <= len; j += i, k += i) {
      for (RI l = j; l < k; ++l)
        L[l - j] = min(L[l - j], s[l]);
      R.clear();
      for (RI l = k; l < len; ++l)
        R.push_back(s[l]);
      ans = (ans + 1ll * Solve(L) * Solve(R) % mod) % mod;
    }
  }
  return f[s] = ans;
}

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  string s; cin >> s;
  printf("%d\n", Solve(s));

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 6144
n = int(input())
flag = "Yes "
words = []
for i in range(n):
    words.append(input())
beforeW = ""
counter = 0
for w in words:
    if beforeW == "":
        beforeW = w
        continue
    else:
        tailChar = beforeW[-1:]
        headChar = w[0]
        if tailChar == headChar:
            if words.count(w) == 1:
                beforeW = w
                continue
            else:
                flag = "No "
                break
        else:
            flag = "No "
            break
print(flag)

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

void compress(vector<int>& v) {
	auto vs = v;
	sort(vs.begin(), vs.end());
	vs.erase(unique(vs.begin(), vs.end()), vs.end());
	for (auto& val : v) {
		val = lower_bound(vs.begin(), vs.end(), val) - vs.begin();
	}
}

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	compress(A);
	map<int, int> st;
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		auto it = st.upper_bound(-A[i]);
		if (it == st.end()) {
			++cnt;
			st[-A[i]]++;
		}
		else {
			--it->second;
			if (it->second == 0) st.erase(it);
			st[-A[i]]++;
		}
	}
	cout << cnt << endl;
	return 0;
}


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

int main()
{
	string str;
	long long n;
	long long res;
	cin >> str >> n;
	if(str.size() == 1){
		cout << n / 2 << endl;
		return 0;
	}else {
		int r = 0;
		int xx = str.size();
		for(int i = xx - 1; i > 0; i--){
			if(str[i] != str[i - 1]) {
				r = i;
				break;
			}
		}
		if(r == 0) cout << n * str.size() / 2 << endl;
		else{
			str = str + str;
			int lll = 1;
			int cnt = 0;
			for(int i = r; i < r + str.size() / 2 ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res = cnt * (n - 1);	
			lll = 1;
			cnt = 0;
			for(int i = 0; i < r ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res += cnt;
			res = res + (str.size() / 2 - r) / 2;
			cout << res << endl;
		}	
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include <iomanip>
#include <sstream>

using namespace std;


class ID{
public:
    int i;
    int P;
    long long Y;
    int ans;
};
bool cmp0(const ID &a, const ID &b){
    return a.i < b.i;
}

bool cmp1(const ID &a, const ID &b){
    return a.P < b.P;
}

bool cmp2(const ID &a, const ID &b){
    return a.Y < b.Y;
}

int main(void){
    int N,M;
    cin >> N >> M;
    vector<ID> idlist;
    idlist.resize(M);
    for(int i = 0; i < M;i++){
        cin >> idlist[i].P >> idlist[i].Y;
        idlist[i].i = i;
    }
    
    stable_sort(idlist.begin(),idlist.end(),cmp2);
    stable_sort(idlist.begin(),idlist.end(),cmp1);
    int imemo;
    int ians = 1;
    int flag = 0;
    for(int i = 0; i < M;i++){
        //cout << idlist[i].P <<" "<<idlist[i].Y<<endl;
        if(flag == 0){
            imemo = idlist[i].P;
            idlist[i].ans = ians; 
            ians++;
            flag = 1;
        }else if(flag == 1&&imemo == idlist[i].P){
            idlist[i].ans = ians; 
            ians++;
        }else{
            ians = 1;
            imemo = idlist[i].P;
            idlist[i].ans = ians; 
            ians++;
        }
    
    }
    
    stable_sort(idlist.begin(),idlist.end(),cmp0);
    string s;
    for(int i = 0; i < M;i++){
        ostringstream sout;
        sout << std::setfill('0') << std::setw(6) << idlist[i].P;
        sout << std::setfill('0') << std::setw(6) << idlist[i].ans;
        s = sout.str();
        cout << s<<endl;
        //cout << idlist[i].P<<idlist[i].ans<<endl;
    }
    
    
    
}


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;

ll N, M, Q, A, B, C, D, E, X, Y, Z, arr[100005];

string s;

vector<pi> v;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N >> M;
	for (int i = 1; i <= N; ++i){
		cin >> A;
		v.push_back(pi(A,1));
	}
	for (int i = 1; i <= M; ++i){
		cin >> B >> C;
		v.push_back(pi(C,B));
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	X = 0, Y = N;
	for (int i = 0; i < v.size(); ++i){
		if (Y < v[i].second){
			X += Y*v[i].first;
			break;
		}
		else{
			X += v[i].second*v[i].first;
			Y -= v[i].second;
		} 
	}
	cout << X << '\n';
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  if(y>=x){
    int ans = min({a*x+b*y,2*c*x+b*(y-x),2*c*max(x,y)});
    cout << ans << endl;
    return 0;
  }else{
    int ans = min({a*x+b*y,2*c*y+a*(x-y),2*c*max(x,y)});
    cout << ans << endl;
    return 0;
  }
}

Measured memory_bytes: 3632
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

const llong INF = 2e18;

llong power5(llong x) {
   llong res = 1;
   for (int i = 0; i < 5; ++i)
      res *= x;
   return res;
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   map<llong,int> S;

   for (llong a = 0; ; ++a) {
      llong a5 = power5(a);
      if (a5 >= INF) break;
   // cerr << a << ' ' << a5 << endl;
      S[a5] = a;
      S[-a5] = -a;
   }

   int X;
   cin >> X;

   for (auto p : S) {
      llong b5;
      int b;
      tie(b5, b) = p;
      auto it = S.find(b5 + X);
      if (it != S.end()) {
         cout << it->second << ' ' << b << '\n';
         return 0;
      }
   }
   assert(false);

   return 0;
}


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

#define ll long long 
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pb push_back
#define eb emplace_back
#define ii pair<ll,ll> 
#define fi first
#define se second

int m, d, ans = 0;

int main(){
	scanf("%d %d", &m, &d);
	FOR(i, 1, m+1){
		FOR(j, 2, 10) FOR(k, 2, 10){
			int tmp = 10*j + k;
			if(tmp <= d && j*k == i){
				ans++;
			} 
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

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

func main() {
	sc.Split(bufio.ScanWords)
	
	n := scanInt()
	v := make([]float64, n)
	for i := 0; i < n; i++ {
		v[i] = float64(scanInt())
	}

	sort.Float64s(v)

	ans := 0.0
	a := 1.0
	for i := n-1; i > 0; i-- {
		a *= 2.0
		ans += v[i]/a
	}

	ans += v[0]/a

	fmt.Println(ans)

}


Measured memory_bytes: 640
-9
#                         author:  kagemeka 
#                         created: 2019-11-09 11:51:37(JST)
### modules
## from standard library
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   
# import scipy.misc      
# import numpy as np 


def f(n):
    if n == 0:
        return ''
    else:
        if n % 2 == 0:
            return f(n // (-2)) + '0'
        else:
            return f((n - 1) // (-2)) + '1'
    
 
def main():
    n = int(sys.stdin.readline().rstrip())
    
    if n == 0:
        ans = '0'
    else:
        ans = f(n)
    print(ans)
    





if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
int main(){
  int n, x, t, a, b;
  scanf("%d %d %d ",&n, &x, &t);
 
  a = ceil((double)n / (double)x);
  b = a * t;
  printf("%d",b);
  return (0);
}  
    

Measured memory_bytes: 1732
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String a = scan.nextLine();
		String line = scan.nextLine();
		String[] array = line.split(" ");
		for(int i = array.length-1;i>=0;i--){
			if(i!=0){
				System.out.print(array[i]+" ");
			}else{
				System.out.print(array[i]);
			}
		}
		System.out.println();
	}
}

Measured memory_bytes: 26192
class Binary_Indexed_Tree:
    def __init__(self, n):
        """
        :param n: 最大の要素数
        """
        self.n = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length() - 1

    def sum(self, i):
        """ 区間[0,i) の総和を求める """
        s = 0
        i -= 1
        while i >= 0:
            s += self.tree[i]
            i = (i & (i + 1)) - 1
        return s

    def built(self, array):
        """ array を初期値とするBITを構築 """
        for i, a in enumerate(array):
            self.add(i, a)

    def add(self, i, x):
        """ i 番目の要素に x を足す """
        while i < self.n:
            self.tree[i] += x
            i |= i + 1

    def get(self, i, j):
        """ 部分区間和 [i, j) """
        if i == 0:
            return self.sum(j)
        return self.sum(j) - self.sum(i)

    def lower_bound(self, x, equal=False):
        """ (a0+a1+...+ai < x となる最大の i, その時の a0+a1+...+ai )
             a0+a1+...+ai <= x としたい場合は equal = True
             二分探索であるため、ai>=0 を満たす必要がある"""
        sum_ = 0
        pos = -1  # 1-indexed の時は pos = 0
        if equal:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] <= x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i
        else:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] < x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i

        return pos, sum_

    def __getitem__(self, i):
        """ [a0, a1, a2, ...] """
        return self.get(i, i + 1)

    def __iter__(self):
        """ [a0, a1, a2, ...] """
        for i in range(self.n):
            yield self.get(i, i + 1)

    def __str__(self):
        text1 = " ".join(["element:            "] + list(map(str, self)))
        text2 = " ".join(["cumsum(1-indexed):  "] + list(str(self.sum(i)) for i in range(1, self.n + 1)))
        return "\n".join((text1, text2))


mod = 998244353
n, k = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(k)]
for i in range(k):
    a[i][0] -= 1
b = Binary_Indexed_Tree(n)
dp = [0] * n
dp[0] = 1
b.add(0, 1)
for i in range(1, n):
    for l, r in a:
        dp[i] += b.get(max(0, i - r), max(0, i - l))
    dp[i] %= mod
    b.add(i, dp[i])
print(dp[-1])


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

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

    int2(a, b);
    vector<string> yui(a);
    rep(i, a) {
        cin >> yui[i];
    }

    vi cnt(26, 0);
    rep(i, a) {
        rep(j, b) {
            cnt[yui[i][j] - 'a']++;
        }
    }

    vi kyoko(4, 0);
    rep(i, cnt.size()) {
        kyoko[cnt[i]%4]++;
    }

    if (a % 2 && b % 2) {
        if (kyoko[3]) {
            kyoko[3]--;
            kyoko[1]++;
            kyoko[2]++;
        }
        if (kyoko[3]) {
            cout << "No" << endl;
            return 0;
        }
        if (kyoko[1] == 1 && 
                kyoko[2] <= (a/2+b/2)) {
            cout << "Yes" << endl;
            return 0;
        } else {
            cout << "No" << endl;
            return 0;
        }
    } else if (a % 2) {
        if (kyoko[3] || kyoko[1]) {
            cout << "No" << endl;
            return 0;
        }
        if (kyoko[2] <= b / 2) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
        return 0;
    } else if (b % 2) {
        if (kyoko[3] || kyoko[1]) {
            cout << "No" << endl;
            return 0;
        }
        if (kyoko[2] <= a / 2) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
        return 0;
    } else {
        if (kyoko[1] || kyoko[2] || kyoko[3]) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	string s;
	cin>>s;
	bool ok=false;
	if(s.size()>=4){
		if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
			ok=true;
		}
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A_list = list(map(int,input().split()))
output = 1
flug = 0

if 0 in A_list:
    print(0)
    flug = 1
if flug != 1:
    for i in range(N):
        output *= A_list[i]
        
        if (output > 10 ** 18):
            print(-1)
            flug = 1
            break
if(flug != 1):
    print(output)

Measured memory_bytes: 87608
#include <stdio.h>

int main(){

    int N,M,a[50],b[50],c[50]={0};

    scanf("%d %d",&N,&M);

    for (int i=0; i<M; i++)
    {
        scanf("%d",&a[i]);
        scanf("%d",&b[i]);
    }
    
    for (int i=0; i<N+1; i++)
    {
        for (int j=0; j<M; j++)
        {
            if (a[j]==i)
                c[i]++;
            if (b[j]==i)
                c[i]++;
        }
    }
    
    for (int i=1; i<N+1; i++)
    {
        printf("%d\n",c[i]);
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int check(int x);

int main(void)
{
    int a, b;

    scanf("%d  %d", &a, &b);
    if (check(a) == check(b))
        printf("Yes");
    else
        printf("No");

    return 0;
}

int check(int x)
{
    if(x == 4 || x == 6 || x == 9 || x == 11)
        return 2;
    else if(x == 2)
        return 3;
    else
        return 1;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    double ans = 0;
    for(int i = 0; i < n; i++)
    {
        int a; cin >> a;
        ans += 1.0 / a;
    }
    cout << 1.0 / ans << endl;
    return 0;
}



Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int h, w, k;
vector<vector<char>> a;

const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

void solve() {
	cin >> h >> w >> k;
    a.assign(h, vector<char>(w, '?'));
    int sx, sy;
    vector<vector<int>> dist(h, vector<int>(w, inf));
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
            if(a[i][j] == 'S') {
                dist[i][j] = 0;
                sx = i, sy = j;
            }
        }
    }
    queue<pair<int, int>> que;
    que.push({sx, sy});
    while(!que.empty()) {
        P p = que.front(); que.pop();
        int x = p.fr, y = p.sc;
        rep(i, 4) {
            int nx = x + dx[i], ny = y + dy[i];
            if(0 <= nx && nx < h && 0 <= ny && ny < w && a[nx][ny] == '.' && dist[nx][ny] == inf) {
                dist[nx][ny] = dist[x][y] + 1;
                que.push({nx, ny});
            }
        }
    }
    int ans = inf;
    rep(i, h) {
        rep(j, w) {
            if(dist[i][j] <= k) {
                chmin(ans, 1 + (i + k - 1) / k);
                chmin(ans, 1 + (j + k - 1) / k);
                chmin(ans, 1 + (h - 1 - i + k - 1) / k);
                chmin(ans, 1 + (w - 1 - j + k - 1) / k);
            }
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 1000000007;
/*
2000000011 is prime
2000000033 is prime
*/

ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}


ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}

 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r;
ll k,ans;
ll x[500005],y[500005],z[500005];
char s[500005];
ll dp[505][505];

void classfy(ll a,ll b,ll c){
    if(c == 1){
        for(int i=a;i<=b;i++){
            for(int j=a;j<=b;j++){
                dp[i][j] = c;
                dp[j][i] = c;
            }
        }
        return;
    }else{
        ll mid = (a + b) / 2;
        classfy(a,mid,c-1);
        classfy(mid+1,b,c-1);
        for(int i=a;i<=mid;i++){
            for(int j=mid+1;j<=b;j++){
                dp[i][j] = c;
                dp[j][i] = c;
            }
        }
    }
    return;
}


int main(){
    cin >> n;
    c = 0;
    a = 1;
    while(n > a){
        a *= 2;
        c++;
    }
    
    classfy(1,n,c);
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            pe(dp[i][j]);
        }
        el;
    }
    return 0;
}






Measured memory_bytes: 4480