akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;

const int MAX_V = 200;
const int MAX_N = 200;
const int INF = 0x3f3f3f3f;
// 辺を表す構造体（行き先、容量、逆辺）
struct edge { int to, cap, rev; };

vector<edge> G[MAX_V];  // グラフの隣接リスト表現
bool used[MAX_V];   // DFSですでに調べたかのフラグ

// fromからtoへ向かう容量capの辺をグラフに追加する
void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size() - 1});
}

// 増加パスをDFSで探す
int dfs(int v, int t, int f) {
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t) {
  int flow = 0;
  for(;;) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
}

int main() {
  int N;
  vvi reds(MAX_N, vi(MAX_N, -1)), blues(MAX_N, vi(MAX_N, -1));
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a, b; cin >> a >> b;
    reds[a][b] = i + N;
  }
  for (int i = 0; i < N; i++) {
    int a, b; cin >> a >> b;
    blues[a][b] = i;
  }
  for (int a = 0; a < 2*N; a++) {
    for (int b = 0; b < 2*N; b++) {
      if (blues[a][b] != -1) {
        for (int c = 0; c < a; c++) {
          for (int d = 0; d < b; d++) {
            if (reds[c][d] != -1) {
              // printf("(%d, %d) -> (%d, %d)\n", a, b, c, d);
              add_edge(blues[a][b], reds[c][d], 1);
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    add_edge(2*N, i, 1);
    add_edge(N+i, 2*N+1, 1);
  }
  cout << max_flow(2*N, 2*N+1) << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 1e+18
#define int long long
using namespace std;

signed main(){
	int d,w;
	while(cin >> d >> w,w){
		int field[15][15],ans = 0;
		for(int i = 0;i < d;i++){
			for(int j = 0;j < w;j++){
				cin >> field[i][j];
			}
		}
		for(int i = 0;i < d;i++){
			for(int j = 0;j < w;j++){
				for(int k = i + 2;k < d;k++){
					for(int l = j + 2;l < w;l++){
						int inmax = 0,outmin = INF,sum = 0;
						for(int a = i;a <= k;a++){
							for(int b = j;b <= l;b++){
								if(a == i || a == k || b == j || b == l){
									outmin = min(outmin,field[a][b]);
								}else{
									inmax = max(inmax,field[a][b]);
								}
							}
						}
						if(inmax < outmin){
							for(int a = i + 1;a < k;a++){
								for(int b = j + 1;b < l;b++){
									sum += outmin - field[a][b];
								}
							}
						}
						ans = max(ans,sum);
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll n,k;cin>>n>>k;
	vector<ll>v;
	ll sum = 0;
	for(int i=0;i<n;i++)
	{
		int x;cin>>x;
		v.push_back(x);
		sum+= x;
	}
	sort(v.rbegin(),v.rend());
	for(int i=0;i<v.size();i++)
	{
		if(i>=k) break;
		sum -= v[i];
	}
	cout<<sum<<"\n";
	return 0;
}

Measured memory_bytes: 2420
/**
  *  Worg
  */
#include <cstdio>

//FILE *fin = freopen("main.in", "r", stdin); FILE *fout = freopen("main.out", "w", stdout);

const int kMaxN = 500 + 5;

int N, M, D;

char answer[kMaxN][kMaxN];

void GiveColor(int x, int y, int zoneX, int zoneY) {
    if(zoneX % 2 == 0) {
        if(zoneY % 2 == 0) {
            answer[x][y] = 'R';
        } else {
            answer[x][y] = 'Y';
        }
    } else {
        if(zoneY % 2 == 0) {
            answer[x][y] = 'G';
        } else {
            answer[x][y] = 'B';
        }
    }
}

void BuildAnswer() {
    const int minX = 0, minY = -N+1;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < M; j++) {
            int x = i + j, y = j - i;
            int zoneX = (x - minX) / D, zoneY = (y - minY) / D;

            //printf("%d %d %d %d\n", x, y, zoneX, zoneY);
            GiveColor(i, j, zoneX, zoneY);
        }
    }
}

void WriteOutput() {
    for(int i = 0; i < N; i++) {
        printf("%s\n", answer[i]);
    }
}

int main() {
    scanf("%d%d%d", &N, &M, &D);

    BuildAnswer();

    WriteOutput();
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define N 1000000

int main(void)
{
    bool a[N];
    int n, count;
    rep(i,N)
        a[i] = true;
    a[0] = a[1] = false;
    for(int i=0;i*i<=N;i++)
    {
        if(a[i])
            for(int j=i*i;j<N;j+=i)
                a[j] = false;
    }
    
    while(cin >> n)
    {
        count = 0;
        
        rep(i,n+1)
        {
            if(a[i])
                count++;
        }
        cout << count << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2136
# include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int gcd(long int a, long int b){
  if(a > b){
    swap(a, b);
  }
  if(a == 0){
    return b;
  } else{
    return gcd(b % a, a);
  }

}

int main(){

  long int A, B, C, D;
  cin >> A >> B >> C >> D;
  long int p = gcd(C, D);
  long int lcm = C * D / p;
  long int cnt1, cnt2, cnt3;
  cnt1 = B / C - (A-1) / C;
  cnt2 = B / D - (A-1) / D;
  cnt3 = B / lcm - (A-1) / lcm;
  long int ans;
  ans = B-A+1 - (cnt1 + cnt2 - cnt3);
  cout << ans << endl;

}

Measured memory_bytes: 256
#/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define add accumulate
  #define ll long long int
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define vll vector<ll>
  #define lb lower_bound
  #define ub upper_bound
  #define pll pair<ll,ll>
  #define vpll vector<pll>
  #define all(v) v.begin(), v.end()
  #define rep(i,k,n) for(int i=k;i<n;i++)
  #define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
  const int md=1e8;
  const int MAX=1e5+1;
  //
  //
  int main(){
  	string str;
  	cin>>str;
  	ll ans=0;
  	rep(i,0,str.length())
  		ans+=(str[i]=='o');
  	if(ans+15-str.length()>=8)
  		cout<<"YES";
  	else
  		cout<<"NO";
  	return 0;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  string s[n];
  for(int i=0;i<n;i++)
  {
    cin>>s[i];
  }
  map<string ,int>str;
  for(int i=0;i<n;i++)
  { 
    ++str[s[i]];
  }
  int count=0;
  for(auto it=str.begin();it!=str.end();it++)
  {
    if(it->second == 1)
    {
      count++;
    }
  }
  if(count == str.size())
    {
      for(auto it=str.begin();it!=str.end();it++)
        cout<<it->first<<endl;
    }
  else
  {
  string arg_max = " "; 
  int current_max=0;
  for(auto it=str.begin();it!=str.end();it++)
  {
    if(it->second > current_max)
    {
    	arg_max = it->first;
      	current_max = it->second;
    }
  }
  for(auto it=str.begin();it!=str.end();it++)
   {
    if(it->second == current_max)
  //cout<<arg_max;
      cout<<it->first<<endl;
   }
  }
 // auto max=get_max(str);
//std::cout << max.first; //<< "=>" << max.second << std::endl; 
 // }
  return 0;
}																																																											

Measured memory_bytes: 26752
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define pb     push_back
#define inf     2e18
#define low     -2e18
#define PI        acos(-1.0)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
const int sz = 1e5+9;

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    string str1,str2;
    cin>>str1>>str2;
    n = str1.size();
    m  =str2.size();
    ll ans  = inf;
    for(i=0;i<=n-m;i++)
    {
        x =0;
        for(j=0;j<m;j++)
        {
            if(str1[i+j]!=str2[j])
                x++;
        }
        //cout<<i<<" "<<x<<endl;
        ans = min(ans,x);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;

    String[] in_C;

    int cnt;

    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));

      /*----------------
       * 引数
       *----------------*/
      in_C = new String[9];
      for(cnt=0; cnt<3; cnt++)
      {
        in_str = new String(in_stream.readLine());

        in_C[(cnt*3) + 0] = in_str.substring(0, 1);
        in_C[(cnt*3) + 1] = in_str.substring(1, 2);
        in_C[(cnt*3) + 2] = in_str.substring(2, 3);
      }

      System.out.println(in_C[0] + in_C[4] + in_C[8]);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}


Measured memory_bytes: 19156
n = int(input())
a_list = list(map(int, input().split()))
a_dict = {}
for i, a in enumerate(a_list):
    a_dict[a] = i
result_list = []
for key in sorted(list(a_dict.keys())):
    result_list.append(str(a_dict[key]+1))
print(' '.join(result_list))

Measured memory_bytes: 24388
C = [list(map(int, input().split())) for i in range(3)]

for row in range(3):
    for col in range(3):
        if C[row][col] - C[(row+1)%3][col] != C[row][(col+1)%3] - C[(row+1)%3][(col+1)%3]:
            print('No')
            exit()

for col in range(3):
    for row in range(3):
        if C[row][col] - C[row][(col+1)%3] != C[(row+1)%3][col] - C[(row+1)%3][(col+1)%3]:
            print('No')
            exit()

print('Yes')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ar array
#define uint unsigned int
#define ld long double
struct debug {
~debug() {cerr << "\n";}
template<class C> debug& operator<<(C c) {cerr << c; return *this;}
};
#define var(x) " [" << #x << ": " << x << "]"

int n, x, t, k;

void sol() {
	cin >> n >> x >> t;
	if(n%x==0) {
		k=n/x;
	}
	else {
		k=n/x+1;
	}
	cout << t*k << "\n";
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	sol();
	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	for (auto & e: v)
	{
		cin >> e;
	}
	
	sort(v.begin(), v.end());
	string ans = "YES";
	for (int i=1; i<v.size(); i++)
	{
		if (v.at(i-1) == v.at(i))
		{
			ans = "NO";
			break;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024
<?php

fscanf(STDIN, "%d", $n);

$a = fgets(STDIN);
$array = explode(' ', $a);

rsort($array);

$cnt = 0;

$alice = 0;
$bob = 0;
foreach ($array as $value) {
    if ($cnt % 2 == 0) {
        $alice += $value;
    } else {
        $bob += $value;
    }
    $cnt++;
}

echo $alice - $bob;

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
int dp[1<<18][50];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n][2];
  for (int i = 0; i < n; ++i) cin >> a[i][0], a[i][0]--;
  for (int i = 0; i < n; ++i) cin >> a[i][1], a[i][1]--;
  for (int p = 1; p < (1<<n); ++p) {
    for (int x = 0; x < 50; ++x) dp[p][x] = 2e9;
    int pos = __builtin_popcount(p)-1;
    int xc = pos+1;
    for (int i = 0; i < n; ++i) {
      if ((1<<i) & p) {
        xc--;
        int ov = a[i][(pos^i)&1];
        for (int x = 0; x <= ov; ++x) {
          dp[p][ov] = min(dp[p][ov], dp[p^(1<<i)][x]+xc);
        }
      }
    }
  }
  int res = 2e9;
  for (int x = 0; x < 50; ++x) {
    res = min(res, dp[(1<<n)-1][x]);
  }
  if (res == 2e9) res = -1;
  cout << res << endl;
}


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

int dp[100005], a[100005];
int n,k;

int solve(int n, int k)
{
    dp[0]=0;
    for(int i=0; i<n; i++)
    {
        for(int j=1; j<=k && (i+j)<=n; j++)
        {
            dp[i+j]=min(dp[i+j], dp[i]+abs(a[i+j]-a[i]));
        }
    }
    return dp[n-1];

}
int main()
{
    cin>>n>>k;
    memset(dp, 1000000, sizeof(dp));
    for(int i=0; i<n; i++)
        cin>>a[i];
    cout<< solve(n,k) <<endl;
}



Measured memory_bytes: 4400
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 2147483647;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }


struct SegmentTree {
    int n;
    vector<int> data;

    SegmentTree(int n_) {
        n = 1;
        while (n < n_) n *= 2;

        data.resize(2*n-1);
        rep(i, 2*n-1) data[i] = INF;
    }

    // i番目(0-index)の値をaに変更する
    void update(int i, int a) {
        i += n - 1;
        data[i] = a;
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = min(data[2*i + 1], data[2*i + 2]);
        }
    }

    // [a, b)の最小値を求める
    int query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return data[k];
        else {
            int vl = query(a, b, 2*k+1, l, (l+r)/2);
            int vr = query(a, b, 2*k+2, (l+r)/2, r);
            return min(vl, vr);
        }
    }
};

int main() {
    int n, q;
    cin >> n >> q;

    SegmentTree st(n);
    rep(i, q) {
        int com; cin >> com;
        if (com == 0) {
            int x, y; cin >> x >> y;
            st.update(x, y);
        } else {
            int x, y; cin >> x >> y;
            cout << st.query(x, y+1, 0, 0, st.n) << endl;
        }
    }
}



Measured memory_bytes: 3864
#include <iostream> 
#include <sstream> // istringstream
#include <string> // 文字列
#include <algorithm> // アルゴリズム
#include <cmath> // 
#include <vector> // vector
#include <set> // set
#include <map> // map

using namespace std;

int main()
{   
    // input sample
    long long N, D; 
    cin >> N >> D;
    long long X[N], Y[N];
    for (int i = 0; i < N; ++i) cin >> X[i] >> Y[i]; 

    long long cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (X[i]*X[i] + Y[i]*Y[i] <= D*D) {
            cnt++;
        }
    } 

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    int a, b, c, d, e, f;   cin >> a >> b >> c >> d >> e >> f;
    map<double, pair<ll, ll>> mp;
    rep(i, 31){
        rep(j, 31){
            ll w = a*i+b*j;
            if(f<=w) break;
            rep(x, 101){
                rep(y, 101){
                    ll s = x*c+y*d;
                    if(w*e<s || f<s+100*w) break;
                    if(0<100*w+s)
                        mp[s*1.0/(100*w+s)] = {100*w+s, s};s*1.0/(100*w+s);
                }
            }
        }
    }
    
    cout << mp.rbegin() -> second.first << ' ' << mp.rbegin() -> second.second << endl;
}


Measured memory_bytes: 3900
package main

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

var sc = bufio.NewScanner(os.Stdin)

type st struct {
	ind int
	min int64
}

func main() {
	var S string
	fmt.Scan(&S)
	maxcount := 0
	count := 0

	for _, c := range S {
		if string(c) == "R" {
			count++
			maxcount = Max(maxcount, count)
		} else {
			count = 0
		}
	}
	fmt.Println(maxcount)
	// sc.Split(bufio.ScanRunes)
}
func bc(s string, pos int) string {
	ch := "1"
	if string(s[pos]) == "1" {
		ch = "0"
	}
	pre := string(s[:pos])
	post := ""
	if pos != len(s)-1 {
		post = string(s[pos+1:])
	}
	tmp := pre + ch + post
	return tmp
}
func popCount(n string) int {
	count := 0
	for _, s := range n {
		if string(s) == "1" {
			count++
		}
	}
	return count
}
func chc(m [][]bool, p int) [][]bool {
	ret := make([][]bool, len(m))
	for i, l := range m {
		tmp := []bool{}
		for _, c := range l {
			if i == p {
				tmp = append(tmp, false)
			} else if c == true {
				tmp = append(tmp, true)
			} else {
				tmp = append(tmp, false)
			}
		}
		ret[i] = tmp
	}
	return ret
}
func chl(m [][]bool, p int) [][]bool {
	ret := make([][]bool, len(m))
	for j, l := range m {
		tmp := []bool{}
		for i, c := range l {
			if i == p {
				tmp = append(tmp, false)
			} else if c == true {
				tmp = append(tmp, true)
			} else {
				tmp = append(tmp, false)
			}
		}
		ret[j] = tmp
	}
	return ret
}
func helper(ma [][]bool) int {
	count := 0
	for _, l := range ma {
		for _, c := range l {
			if c == true {
				count++
			}
		}
	}
	return count
}
func nextLine() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int64 {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return int64(i)
}
func MySort(a []int) {
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })

}
func SortedBinaryAppend(sortedArr []int, targetValue int) []int {
	return []int{}
}
func SortedBinaryDelete(sortedArr []int, targetValue int) []int {
	return []int{}
}
func SortedBinarySearch(sortedArr []int, targetValue int) int {
	post := len(sortedArr) - 1
	pre := 0
	for {
		div := (post + pre) / 2
		tim := sortedArr[div]
		if tim == targetValue {
			return pre + div
		} else if tim > targetValue {
			post = tim
		} else {
			pre = tim
		}
		if pre == post {
			return -1
		}
	}
}
func Abs(i int) int {
	if i < 0 {
		return -1 * i
	}
	return i
}
func Min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func CalcNum(tate int, yoko int, A int, B int, dp *map[[2]int]int) int {
	if (*dp)[[2]int{tate, yoko}] != 0 {
		return (*dp)[[2]int{tate, yoko}]
	}
	return yoko*CalcNum(tate-1, yoko, A, B, dp) + tate*CalcNum(tate, yoko-1, A, B, dp)
}
func arrSum(arr []int) int {
	sum := 0
	for _, a := range arr {
		sum += a
	}
	return sum
}
func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}
func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}


Measured memory_bytes: 1772
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt(),b = scanner.nextInt(),c = scanner.nextInt();
		if(b * 2 == a + c){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}

}


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

a = map(int, input().split())
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
tmp = -1

for i in a:
  ans += b[i - 1]
  if tmp + 1 == i:
    ans += c[tmp - 1]
  tmp = i
print(ans)

Measured memory_bytes: 3064
cnt = 0
def merge(L,R):
    global cnt
    n = len(L)+len(R)
    cnt += n
    A = []
    i = j = 0
    L.append(-1)
    R.append(-1)
    for _ in range(n):
        if L[i] >= R[j]:
            A.append(L[i])
            i += 1
        else:
            A.append(R[j])
            j += 1
    return A

def mergeSort(A):
    if len(A)==1: return A
    m = len(A)//2
    return merge(mergeSort(A[:m]),mergeSort(A[m:])) 
    

if __name__=='__main__':
    n=int(input()) 
    A=list(map(int,input().split()))
    print(*mergeSort(A)[::-1])
    print(cnt)

Measured memory_bytes: 63780
#include <bits/stdc++.h>
#define INF 10000000000
using namespace std;
int main()
{
  int n, q;
  cin >> n;
  vector<int> s(n);
  for (int i = 0; i < n; ++i)
  {
    cin >> s.at(i);
  }
  cin >> q;
  int t;
  int ans = 0;
  for (int i = 0; i < q; ++i)
  {
    cin >> t;
    if (t == *lower_bound(s.begin(), s.end(), t))
    {
      ans += 1;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
int main(){
    int X,A,B;
    cin >> X >> A >> B;
    X -= A;
    cout << X%B << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[]args)throws IOException{
		
		BufferedReader br=
			new BufferedReader(new InputStreamReader(System.in));
		
		String str=br.readLine();

		String[] num=str.split(" ");

		int a=Integer.parseInt(num[0]);
		int b=Integer.parseInt(num[1]);
		int c=Integer.parseInt(num[2]);
		
		if(a<b && b<c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

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

int main(){
    long long n;
    cin >> n;
    long long dekai=1000000007,ans=0,sum=0;
    vector<long long> a(n);
    for(long long i=0;i<n;i++){
        cin >> a.at(i);
    }
    for(long long i=0;i<n;i++){
        ans+=(sum*a.at(i)%dekai);
        ans%=dekai;
        sum+=(a.at(i)%dekai);
        sum%=dekai;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4832
let n = stdin.ReadLine() |> int64

let rec pre x = (if x < 1L then 1L else 5L * pre (x - 1L))
let p x = 2L * (pre x)

let ans = [for i in 1L..25L -> (n / (p i))] |>List.sum

if (n % 2L) = 0L then ans else 0L
|>stdout.WriteLine

Measured memory_bytes: 11348
N, Q = map(int, input().split())
S = input()
li = [list(map(int, input().split())) for _ in range(Q)]

ACList = list()
prevA = False
accum = 0
for i in range(N):
    if prevA and S[i] =='C':
        accum += 1
    if S[i] == 'A':
        prevA = True
    else:
        prevA = False
    ACList.append(accum)

for i in range(Q):
    print( ACList[li[i][1]-1] - ACList[li[i][0]-1] )



Measured memory_bytes: 30636
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int A, B;
  cin >> A >> B;
  if(A > 2 * B) cout << A - 2 * B << endl;
  else cout << "0" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vl vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;
  std::cin >> n;
  string s;
  std::cin >> s;
  string ans = "";
  for(int i=0;i<s.size();i++){
    ll now = s[i] - 'A';
    now = (now+n)%26;
    char t = 'A' + now;
    ans += t;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

int main(){
  int n,a,b,i,dom,abr;
  dom = 0;
  abr = 0;
  scanf("%d%d%d",&n,&a,&b);
  char str[100001];
  scanf("%s",str);
  for(i=0;i<n;i++){
    if(str[i]=='c'){
      printf("No\n");
    }else if(str[i]=='a'){
      if(dom+abr < a+b){
        printf("Yes\n");
        dom++;
      }else{
        printf("No\n");
      }
    }else{
      if(dom+abr < a+b && abr < b){
        printf("Yes\n");
        abr++;
      }else{
        printf("No\n");
      }
    }
  }
  return 0;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(i,n)        for(int i=0;i<n;i++)
#define rrep(i,n)       for(int i=n-1;i>=0;i--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void ayushmehta651()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
}

int32_t main()
{
	ayushmehta651();
	string s, t;
	cin >> s >> t;

	int ans = 0;

	if (s.length() == t.length())
	{
		rep(i, s.length())
		{
			if (s[i] != t[i])
				ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}













bool compare(string &s1, string &s2)
{
	return s1.size() < s2.size();
}

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

map<char, int>mp;
int main() {
	string s; cin >> s;
	for (char c : s)mp[c]++;
	bool flag = true;
	for (auto p : mp) {
		if (p.second % 2)flag = false;
	}
	puts(flag ? "Yes" : "No");
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    for (int i=0; i<N; i++) cin >> A[i];
    int x=0, count=0;
    for (int i=0; i<N; i++){
        count++;
        if (A[x]==2){
            cout << count << endl;
            return 0;
        }
        x=A[x]-1;
    }
    cout << -1 << endl;
}

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

int light[33], push[33];
int n, c;
int memo[33][1<<17];

int input(int p ,int q){
  int a;
  for(int i=15;i>-1;i--){
    cin >> a;
    if(p) light[q] |= a<<i;
    else push[q] |= a<<i;
  }
}

int solve(int p, int bit){
  
  if(p == n) return 0;
  if(~memo[p][bit]) return memo[p][bit];

  int ans = 0;
  for(int i=0;i<c;i++){
    int cnt = __builtin_popcount(bit&push[i]);
    int next = (bit^push[i])&bit;
    ans = max(solve(p+1, next|light[p+1])+cnt, ans);
  }

  return memo[p][bit] = ans;
}

int main(){

  while(cin >> n >> c){
    if(!n && !c) break;

    memset(light, 0, sizeof(light));
    memset(push, 0, sizeof(push));
    memset(memo, -1, sizeof(memo));

    for(int i=0;i<n;i++) input(1, i);
    for(int i=0;i<c;i++) input(0, i);
    
    cout << solve(0, light[0]) << endl;
  }

}

Measured memory_bytes: 18068
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstring>
#include<queue>
#include<stack>

using namespace std;

#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define eloop(i,a,b) for(ll i=a; i<=b; i++)
#define sll(x) scanf("%lli", &x)
#define sll2(x,y) scanf("%lli", &x, &y)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define intMax INT_MAX
#define nl printf("\n");

int main(){
    ll T=1;// sll(T);
    while(T--){
        ll n; sll(n);
        vll v(n);
        loop(i,0,n){
            ll t; sll(t); v[i] = t;
        }
        int d[n];
        memset(d,0,sizeof d);
        d[n-2] = abs(v[n-1] - v[n-2]);
        for(ll i= n-3; i>=0;i--){
            d[i] = min(abs(v[i+1] - v[i]) + d[i+1], abs(v[i+2] - v[i]) + d[i+2]);
        }

        //loop(i,0,n) cout << d[i] << " ";
       // nl

        cout << d[0] << endl;

        
    }
    return 0;
}

Measured memory_bytes: 4584
package main

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

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	nums := io.ScanInts(n)
	q := io.ScanInt()
	operations := io.Scan2DInts(q, 2)
	numCountMap := map[int]int{}
	for _, n := range nums {
		numCountMap[n] += 1
	}
	var sum int
	for k, v := range numCountMap {
		sum += k * v
	}
	for _, op := range operations {
		from := op[0]
		to := op[1]
		count := numCountMap[from]
		numCountMap[from] = 0
		numCountMap[to] += count
		fmt.Println(sum + (to-from)*count)
		sum = sum + (to-from)*count
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 16300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int x;
    cin >> x;
    int f=0,y=x;
    while(x){
        f+=x%10;
        x/=10;
    }
    if(y%f==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
   int a[5],k,i;
   for(i=0;i<5;i++)
   {
       scanf("%d",&a[i]);

   }
   scanf("%d",&k);
   sort(a,a+5);
   if(k<a[4]-a[0])
        printf(":(\n");
   else
        printf("Yay!\n");
   return 0;
}


Measured memory_bytes: 256
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  
 
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007


void Solve()
{
	string s;
	cin>>s;
	
	if(s[2]==s[3] && s[4]==s[5])
	{
		cout<<"Yes";	
	}	
	else cout<<"No";
}


signed main() 
{
	speed	
		
	ll q=1;	
	//cin>>q;	
	
	while(q--)	
	Solve();	
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
struct Point{
	double x;
	double y;
};
void koch(int n,Point a,Point b){
	if(n == 0) return ;
	
	Point s,t,u;//依次操作分出三个点
	double th = M_PI * 60.0 / 180.0;
	
	s.x = (2.0 * a.x + 1.0 * b.x) / 3;
	s.y = (2.0 * a.y + 1.0 * b.y) / 3;
	t.x = (1.0 * a.x + 2.0 * b.x) / 3;
	t.y = (1.0 * a.y + 2.0 * b.y) / 3;
	//旋转矩阵求得 
	//		 ( cos(th), sin(th))
	//		 (-sin(th), cos(th))
	//逆时针旋转th° 三角函数sin(Φ+θ) 
	u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
	u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
	
	koch(n-1,a,s);
	printf("%.8f %.8f\n",s.x,s.y);
	
	koch(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	
	koch(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	
	koch(n-1,t,b);	  
}
int main(){
	Point a,b;
	int n;
	scanf("%d",&n);
	
	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;
	
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.x,b.y);
	
	return 0;
} 


Measured memory_bytes: 2736
def change(n, t)
    count = [0,0,0,0]
    c = t - n
    [500,100,50,10].each_with_index do |a,i|
        count[3-i] += c / a
        c %= a
    end
    return count
end
nf = false
loop do
    n = gets.to_i
    break if n == 0
    puts if nf
    nf = true
    c = gets.split.map{|cc| cc.to_i}
    m = n
    min = [n,n,n,n]
    t = 10 * c[0] + 50 * c[1] + 100 * c[2] + 500 * c[3]
    ch = change(n, t)
    ans = [10,50,100,500].zip(c.zip(ch).map{|a,b| a > b ? a - b : 0}).select{|i,c| c > 0}
    ans.each do |a|
        puts "#{a[0]} #{a[1]}"
    end
end

Measured memory_bytes: 6120
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,c,k;
  cin >> n >> c >> k;
  vl t(n);
  rep(i,n){
    cin >> t[i];
  }
  sort(t.begin(),t.end());
  ll a=t[0];
  ll bus=1;
  ll cnt=0;
  ll i=0;
  while(i<n){
    if(cnt>=c||t[i]>a+k){
      bus++;
      a=t[i];
      cnt=0;
    }
    else{
      i++;
      cnt++;
    }
  }
  cout << bus << endl;
}

Measured memory_bytes: 1024
def ensure(s):
    flag = 0
    c = len(s)//2
    for i in range(c):
        if s[i]!=s[-1*(i+1)]:
            flag = 1
            continue
    return flag

S = input()
N = len(S)

flag1 = ensure(S)

flag2 = ensure(S[:int(((N-1)/2))])

flag3 = ensure(S[int(((N+3)/2)-1):])

ans = 'Yes' if flag1==0 and flag2==0 and flag3==0 else 'No'
print(ans)

Measured memory_bytes: 3064
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a,b,c,d = map(int,input().split())
    if abs(a - c) <= d:
        print('Yes')
    elif abs(a - b) <= d and abs (b - c) <= d:
        print('Yes')
    else:
        print('No')
    return

if __name__=='__main__':
    main()


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K,i,pt;
  double p;
  double sum=0;
  cin>>N>>K;
  for(i=1;i<=N;i++){
    pt=i;
    p=1.0/N;
    while(pt<K){
      pt*=2;
      p/=2;
    }
    sum+=p;
  }
  cout<<setprecision(15)<<sum<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] <= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) left = mid;
		else right = mid;
	}
	/* left は条件を満たす最大の値、right は条件を満たさない最小の値になっている */
	return left;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	string s;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		string d1, d2;
		cin >> d1 >> d2;
		if (d1 == d2) {
			ans++;
			if (ans == 3) {
				cout << "Yes";
				return 0;
			}
		}
		else {
			ans = 0;

		}
	}
	cout << "No";
}

Measured memory_bytes: 3600
a, b = map(int, input().split())
s = input()
for i in range(a+b+1):
  if i != a:
    if s[i] < '0' or s[i] > '9':
      print('No')
      break
  else:
    if s[i] != '-':
      print('No')
      break
else:
  print('Yes')


Measured memory_bytes: 2940
# N = int(input())
import numpy as np
N, M, C = map(int, input().split())
# h, w = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.array([[0] * M for i in range(N)])

for i in range(N):
    A[i] = list(map(int, input().split()))
# print(A)
# p, *a = map(int, input().split())
# print(p, "\n", a)
cnt = 0
for i in range(N):
    tmp = 0
    for j in range(M):
        tmp += A[i][j] * B[j]
    if tmp+C > 0:
        cnt += 1
print(cnt)

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

int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;
    for (int i = 0; i < 2*N; i++) {
        if (!(i&1)) cout << S[i/2];
        else cout << T[i/2];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,k,cnt=0;
    cin>>a>>b>>c>>k;
    while(b<=a)
    {
    	b = b*2;
    	cnt++;
    }
    while(c<=b)
    {
    	c = c*2;
    	cnt++;
    }
    if(cnt>k)
    	cout<<"No\n";
    else
    	cout<<"Yes\n";
    return 0;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10 ** 5)


readline =sys.stdin.readline

def process():
    k,s = map(int,readline().rstrip().split())
    cnt=0

    for i in range(0,k+1):
        for j in range(0,k+1):
            z = s-(i+j)
            if z>=0 and z<=k:
                cnt+=1
    
    return cnt


print(process())

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

struct UnionFind {
    vector<int> par;
    int cnt;
    UnionFind(int size_) : par(size_, -1), cnt(size_) { }
    bool merge(int x, int y){
        x = find(x); y = find(y);
        if (x != y) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y]; par[y] = x;
            cnt--;
        }
        return x != y;
    }
    bool get(int x, int y){
        return find(x) == find(y);
    }
    int find(int x){
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }
};

int main(){
    char g[30][30];
    while(cin >> g[0]){
        UnionFind uf(144);
        rep(i,11) cin >> g[i+1];
        rep(i,12)rep(j,12){
            if(i != 11 && g[i][j] == g[i+1][j]){
                uf.merge(i*12 + j , i*12 + j + 12);
            }
            if(j != 11 && g[i][j] == g[i][j+1]){
                uf.merge(i*12 + j , i*12 + j + 1);
            }
        }
        set<int> isl;
        rep(i,12)rep(j,12){
            if(g[i][j] == '1') isl.insert(uf.find(i*12+j));
        }
        cout << isl.size() << endl;
    }
}

Measured memory_bytes: 1168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	int N, W;
	cin >> N >> W;
	vl w(N);
	vector<vl> v(4);
	ll p;
	rep(i,0,N) {
		int weight, val;
		cin >> weight >> val;
		if(i==0) p = weight;
		v[(weight-p)].pb(val);
	}
	rep(i,0,4) {
		while(v[i].size() != N) {
			v[i].pb(0);
		}
	}
	rep(i,0,4) {
		sort(v[i].rbegin(), v[i].rend());
		v[i].insert(v[i].begin(),1,0);
		rep(j,1,N+1) {
			v[i][j] = v[i][j-1] + v[i][j];
		}
	}
	ll ret = 0;
	rep(a,0,N+1) rep(b,0,N+1) rep(c,0,N+1) rep(d,0,N+1) {
		if(a+b+c+d > N) continue;
		ll curW = p * a + (p+1) * b + (p+2) * c + (p+3) * d;
		if(curW > W) continue;
		ret = max(ret, v[0][a] + v[1][b] + v[2][c] + v[3][d]);
	}
	cout << ret << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string n;
  cin >> n;
  
  if ((n[0] == n[1] && n[0] == n[2]) || (n[1] == n[2] && n[1] == n[3])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if((a == b && b != c) ||(a == c && b != c) ||(c == b && b != a)){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

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

bool isbracket(char c)
{
    return (c == '[' || c == ']' || c =='(' || c == ')');
}


string rem(string str)
{
    string res;

    for(int i=0; i<str.size(); i++)
	if(isbracket(str[i])) res += str[i];

    return res;
    
}

bool solve(string in)
{
    string s = rem(in);
    stack<char> brackets;
    brackets.push('!');
    
    for(int i=0; i<s.size(); i++) {
	char c = s[i];

	if( c == '(' || c == '[' )
	    brackets.push(c);
	else {
	    if ( c == ')' && (brackets.top() != '(') ) return false;
	    if ( c == ']' && (brackets.top() != '[') ) return false;

	    brackets.pop();
	}
    }

    if ( brackets.size() != 1 ) return false;

    return true;
}

int main()
{
    string str;
    
    while(1) {
	getline(cin, str);

	if ( str.size() == 1 ) break;

	bool res = solve(str);

	cout << (res ? "yes" : "no") << endl;
    }
    
}


	    
	
	

Measured memory_bytes: 904
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

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

ll memo[20][10];
ll go(int t, int d) {
  ll &res = memo[t][d];
  if(res < 0) {
    if(t == 1) {
      res = 1;
    } else {
      res = 0;
      if(d-1 >= 0) {
        res += go(t-1, d-1);
      }
      res += go(t-1, d);
      if(d+1 <= 9) {
        res += go(t-1, d+1);
      }
    }
  }
  return res;
}

void hoge(ll K, int tFrom, int dFrom) {
  for(int t = tFrom; ; ++t) {
    for(int d = dFrom; d <= 9; ++d) {
      ll x = go(t, d);
      if(K <= x) {
        printf("%d", d);
        if(t == 1) {
          return;
        } else {
          hoge(K, t-1, max(d-1, 0));
          return;
        }
      } else {
        K -= x;
      }
    }
  }
}

int main(void) {
  ll K;
  cin >> K;
  memset(memo, -1, sizeof memo);
  hoge(K, 1, 1);
  puts("");
  return 0;
}


Measured memory_bytes: 888