akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int N,M,Q,MIN;
int a[111111];
int LST[111111];
vector<int> pos[111111];
bool valid[111111];

struct Node{
	int prev,next;
	int val;
} node[111111];
int head,tail,Z;
int pnt[111111],cnt_bad;
int nodelen;

int bit[111111];
int lowbit(int x){
	return x&-x;
}
void add(int x){
	while(x <= M){
		bit[x]++;
		x+=lowbit(x);
	}
}
int query(int x){
	int r=0;
	while(x){
		r+=bit[x];
		x-=lowbit(x);
	}
	return r;
}

bool chk2(){
	if(node[head].next == -1)return true;
	int start = node[node[head].next].val;
	int end = node[tail].val;
	return end - start + 1 == nodelen + query(end) - query(start-1);
}
bool chk(){
	cnt_bad = 0;
	for(int i=1; i<=M; i++)
		valid[i] = true;

	head = tail = ++Z;
	node[Z].prev = -1;
	node[Z].next = -1;
	node[Z].val = 0;

	nodelen = 0;
	for(int i=1; i<=M; i++)
		if(!pos[i].empty()){
			if(tail != head){
				if(pos[node[tail].val].back() < pos[i].back())
					cnt_bad++;
			}
			++Z;
			node[Z].prev = tail;
			node[Z].next = -1;
			node[Z].val = i;
			pnt[i] = Z;

			node[tail].next = Z;
			tail = Z;
			
			nodelen++;
		}

	memset(bit,0,sizeof(bit));

	MIN = 1;
	for(int i=Q; i>=1; i--){
		if(!valid[a[i]])continue;
		int x = a[i];
		if(x == MIN){
			if(cnt_bad == 0 && chk2())return true;
		}
		int sz = (int)pos[x].size(), ct = 1;
		for(int j=sz-1; j>=0; j--){
			if(pos[x][j] < LST[ct]){
				LST[ct] = pos[x][j];
				++ct;
				if(ct > N)
					break;
			}
		}
		if(ct <= N)
			return false;
		valid[x] = false;

		int p = pnt[x];
		int prev_pnt = node[p].prev;
		int next_pnt = node[p].next;

		if(prev_pnt != head && pos[node[prev_pnt].val].back() < pos[x].back())cnt_bad--;
		if(next_pnt != -1 && pos[x].back() < pos[node[next_pnt].val].back())cnt_bad--;
		if(prev_pnt != head && next_pnt != -1 && pos[node[prev_pnt].val].back() < pos[node[next_pnt].val].back())cnt_bad++;

		node[prev_pnt].next = next_pnt;
		if(next_pnt!=-1)node[next_pnt].prev = prev_pnt;

		if(tail == p)
			tail = prev_pnt;
		nodelen--;
		add(x);

		while(MIN <= M && !valid[MIN])MIN++;
	}
	return true;
}
int main(){
	scanf("%d%d%d",&N,&M,&Q);
	for(int i=1; i<=Q; i++){
		scanf("%d",&a[i]);
		pos[a[i]].push_back(i);
	}
	for(int i=1; i<=N; i++)
		LST[i] = 123456789;
	puts(chk()?"Yes":"No");
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	for(int i=0;i<N;i++){
		int v=i+1;
		if(!(v%3)){
			cout << ' ' << i+1;
			continue;
		}
		while(v){
			if((v%10)==3){
				cout << ' ' << i+1;
				break;
			}
			v /= 10;
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
/*void toBinary(ll x){


    char s[100];
    ltoa(x , s , 2);
    cout << s << endl;
}*/

bool comp(int a , int b){

    return (a &-a)  > (b & -b) ;
}
const int N = 1e5 + 5  ;
int a[N];
int main()
{



    // 1010
    int n ;
    cin >> n ;
    int xo = 0 ;
    for(int i =0 ; i < n ; i ++){
        cin >> a[i];
        xo ^= a[i];
    }
    int res = 0 ;
    sort(a , a + n , comp );
    for(int i =0 ; i < n ; i ++)
    {
          int x = a[i];
          if(( x & -x ) & xo){
                xo = (xo ^ a[i]);
                xo ^= (a[i] -1);
                res ++ ;
          }

    }
    if(!xo){
        cout << res << endl;
    }else {
        puts("-1");
    }



    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

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

    vector<pair<ll, ll>> ab;

    ll tmp_a, tmp_b;
    for ( ll i = 0; i < n; i++ ) {
        cin >> tmp_a >> tmp_b;
        ab.emplace_back(tmp_a, tmp_b);
    }

    sort(ab.begin(), ab.end());

    ll price = 0;
    ll cnt = 0;
    ll loop_num = 0;
    while ( 1 ) {
//        cout << ab[loop_num].first << " " << ab[loop_num].second << endl;
        if ( cnt + ab[loop_num].second > m ) {
            price += ( m - cnt ) * ab[loop_num].first;
            break;
        }
        else {
            price += ab[loop_num].first * ab[loop_num].second; 
        }
        cnt += ab[loop_num].second;
//        cout << price << " " << cnt << endl;
        loop_num++;
    }

    cout << price << endl;

    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <string>
#include <limits>

using namespace std;

int count,minimum;

void pre(vector<vector<int> > &tree,int now)
{
	cout << " " << tree[now][0];
	for(int i=1;i<3;i++)
	{
		if(tree[now][i] != minimum)
		{
			pre(tree,tree[now][i]);
		}
	}
}

void ino(vector<vector<int> > &tree,int now)
{
	int size = tree[now].size();
	if(tree[now][1] == minimum && tree[now][2] == minimum)
	{
		cout << " " << tree[now][0];
	}
	else
	{
		if(tree[now][1]!=minimum)
		{
			ino(tree,tree[now][1]);
		}
		cout << " " << tree[now][0];
		if(tree[now][2]!=minimum)
		{
			ino(tree,tree[now][2]);
		}
	}
}

void print(vector<vector<int> > &tree)
{
	ino(tree,0);
	cout << endl;
	pre(tree,0);
	cout << endl;
}

void insert(vector<vector<int> > &tree,int key,int now)
{
	if(count == 0)					//root none
	{
		tree[0][0] = key;
	}
	else
	{
		if(tree[now][0] > key)		//left
		{
			if(tree[now][1] == minimum)	//child none
			{
				tree[now][1] = count;
				tree[count][0] = key;
			}
			else											//child exist
			{
				insert(tree,key,tree[now][1]);
			}
		}
		else						//right
		{
			if(tree[now][2] == minimum)	//child none
			{
				tree[now][2] = count;
				tree[count][0] = key;
			}
			else
			{
				insert(tree,key,tree[now][2]);
			}
		}
	}
}

void find(vector<vector<int> > &tree, int key,int now)
{
	if(tree[now][0]==key)
	{
		cout << "yes" << endl;
		return;
	}
	if(tree[now][0] > key)
	{
		if(tree[now][1] == minimum)
		{
			cout << "no" << endl;
		}
		else
		{
			find(tree,key,tree[now][1]);
		}
	}
	else
	{
		if(tree[now][2] == minimum)
		{
			cout << "no" << endl;
		}
		else
		{
			find(tree,key,tree[now][2]);
		}
	}
}

int main(void)
{
	count = 0;
	minimum = numeric_limits<int>::min();
    vector<vector<int> > tree;
	int n,num;
	string command;
	cin >> n;
    tree = vector<vector<int> >(n,vector<int>(3,minimum));

	for(int i=0;i<n;i++)
	{
		cin >> command;
		if(command == "insert")
		{
			cin >> num;		//input node num
			insert(tree,num,0);
			count++;
		}
		else if(command == "print")
		{
			print(tree);
		}
		else if(command == "find")
		{
			cin >> num;
			find(tree,num,0);
		}
	}

	return 0;
}

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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define endl        '\n'
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

namespace InOp{
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
}
using namespace InOp;

namespace ModOp{
template<class x,class y,class z> z add(x a,y b,z m){return (a+b)%m;}
template<class x,class y,class z> z sub(x a,y b,z m){return (a-b+m)%m;}
template<class x,class y,class z> z mul(x a,y b,z m){return ((ll)a*b)%m;}
template<class y,class z> z expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class x,class z> z inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y,class z> z div(x a,y b,z m){ll c=inv(b,m);return mul(a,c,m);}
}
using namespace ModOp;

namespace Debug{
template<class x> void deb(x a){cerr<<"a"<<": "<<a<<endl;}
template<class x,class y> void deb(x a,y b){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<endl;}
template<class x,class y,class z> void deb(x a,y b,z c){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<endl;}
template<class x,class y,class z,class xy> void deb(x a,y b,z c,xy d){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<" | "<<"d"<<": "<<d<<endl;}
}
using namespace Debug;

#define N  1000005

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,r,x,y,m,n;
        cin>>n>>m;
        ll ans=0;
        for(i=0;i<n;i++)
        {
            cin>>x>>y;
            if(x*x+y*y<=m*m)ans++;
        }
        cout<<ans;
    }
    return 0;
}

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

int main(void){
    int n,m;
    cin>>n>>m;
    vector<string> a(n),b(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    rep(y,n-m+1)rep(x,n-m+1){
        bool ok = true;
        rep(i,m)rep(j,m)if(a[y+i][x+j] != b[i][j]) ok = false;
        if(ok){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100002];
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
    IOS;
    ll n,k; cin>>n>>k;
    ll h[n+1];
    for(ll i=1;i<=n;i++) cin>>h[i];
    if(n <= k+1)
    {
        cout<<fabs(h[n]-h[1]);
        return 0;
    }
    dp[1] = 0;
    dp[2] = fabs(h[2] - h[1]);
    for(ll i=3;i<=n;i++)
    {
        dp[i] = 22222222222;
        for(ll j=1;j<=k;j++)
        {
            if(i-j >= 1)
            {
                ll num = fabs(h[i]-h[i-j]) + dp[i-j];
                dp[i] = min(dp[i] , num);
            }
        }
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1792
#include "math.h"
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ifor(i, a, b) for (int i = (a); i < (b); i++)
#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using lli = long long int;
using namespace std;
lli MOD = 1e9 + 7;
lli memo[300005] = {}, memo2[100010 * 3] = {};
int main()
{
    lli a[300005] = {};
    priority_queue<lli, vector<lli>, greater<lli>> foo;
    // iをpivotにしてi以前でn個でかいものを保持
    // reverseしてminusしてもっかい
    lli up = 0;
    int n;
    cin >> n;
    rep(i, 3 * n) cin >> a[i];
    rep(i, n)
    {
        up += a[i];
        foo.push(a[i]);
    }
    memo[n - 1] = up;
    for (int i = n; i < 2 * n; i++) {
        auto now = foo.top();
        if (now < a[i]) {
            up += a[i] - now;
            foo.pop();
            foo.push(a[i]);
        }
        memo[i] = up;
    }
    while (!foo.empty())
        foo.pop();
    up = 0;
    reverse(a, a + 3 * n);
    rep(i, 3 * n)
    {

        a[i] = -a[i];
    }
    rep(i, n)
    {
        up += a[i];
        foo.push(a[i]);
    }
    memo2[n - 1] = up;
    for (int i = n; i < 2 * n; i++) {
        auto now = foo.top();
        if (now < a[i]) {
            up += a[i] - now;
            foo.pop();
            foo.push(a[i]);
        }
        memo2[i] = up;
    }
    lli ans = -MOD * MOD;
    for (int i = n - 1; i < 2 * n; i++) {
        ans = max(ans, memo[i] + memo2[3 * n - i - 2]);
        //cout << memo[i] << " " << memo2[3 * n - i - 2] << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6388
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import itertools

n, m = map(int, readline().split())
lr = [list(map(int, readline().split())) for i in range(m)]
memo = [0] * (n + 1)
for l, r in lr:
    memo[l - 1] += 1
    memo[r] -= 1
cumsum = list(itertools.accumulate(memo))
cnt = 0
for i in range(n):
    if cumsum[i] == m:
        cnt += 1
print(cnt)


Measured memory_bytes: 32420
using System;
using System.Linq;

class D
{
	static void Main()
	{
		Console.ReadLine();
		var d = Console.ReadLine().Select((c, i) => new { c, i }).GroupBy(_ => _.c).Select(g => g.Select(_ => _.i).ToArray()).ToArray();

		var q = from i1 in d.Select(x => x[0])
				from i3 in d.Select(x => x.Last()).Where(i3 => i3 - i1 >= 2)
				select d.Count(x => x.Any(i2 => i1 < i2 && i2 < i3));
		Console.WriteLine(q.Sum());
	}
}


Measured memory_bytes: 15328
n,a,b = map(int,input().split())
mod = 10**9 + 7
all = pow(2, n, mod)
if all == 0:
    all = 10**9 + 6
else:
    all -= 1

a = min(n-a,a)
b = min(n-b,b)

a_fact = 1
a_inv = 1
for i in range(1,a+1):
    a_fact *= (n-i+1)%mod
    a_inv *= pow(i,mod-2,mod)
    a_fact %= mod
    a_inv %= mod
nca = a_fact * a_inv
nca %= mod

b_fact = 1
b_inv = 1
for i in range(1,b+1):
    b_fact *= (n-i+1)%mod
    b_inv *= pow(i,mod-2,mod)
    b_fact %= mod
    b_inv %= mod
ncb = b_fact * b_inv
ncb %= mod

ans = all - nca - ncb

while ans < 0:
    ans += mod
if ans >= mod:
    ans -= mod
print(ans)

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


int main()
{
	int n;
	scanf("%d",&n);
	
	vector<int> v(n+1);
	
	for(int i=1;i<=n;i++)
	scanf("%d",&v[i]);
	
	vector<int> dp(n+1);
	
	dp[1] = 0;
	int x = fabs(v[1]-v[2]);
	dp[2] = x;
	
	for(int i=3;i<=n;i++)
	dp[i] = min(dp[i-1]+fabs(v[i]-v[i-1]),dp[i-2]+fabs(v[i]-v[i-2]));
	
	printf("%d\n",dp[n]);
	
	return 0;
}

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

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) break;

    int maxvote = 0, winner=-1;;
    bool draw=false;
    vector<int> vote(26, 0);
    vector<int> log(n, -1);
    for(int i=0; i<n; i++){
      char tmp;
      cin >> tmp;
      int get = tmp-'A';
      log[i] = get;
      vote[get]++;
      if(maxvote == vote[get]){
        draw = true;
      }else if(maxvote < vote[get]){
        draw = false;
        winner = get;
        maxvote = vote[get];
      }
    }
    
    if(draw){
      cout << "TIE" << endl;
      continue;
    }

    int second=0;
    for(int i=0; i<26; i++){
      vote[i] = 0;
    }
    for(int i=0; i<n; i++){
      vote[log[i]]++;
      if(log[i]!=winner){
        second = max(second, vote[log[i]]);
      }
      if(second + n-i-1 < vote[winner]){
        cout << (char)(winner+'A') << " " << i+1 << endl;
        break;
      }
    }
    
  }
  return 0;
}

Measured memory_bytes: 3088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		
		boolean dislike[] = new boolean[10];
		
		for(int i = 0; i < k; i++) {
			dislike[sc.nextInt()] = true;
		}
		
		for(int i = n; ; i++) {
			String numStr = Integer.toString(i);
			boolean good = true;
			
			for(int j = 0; j < 10; j++) {
				if(dislike[j] && numStr.contains(Integer.toString(j))) {
					good = false;
					break;
				}
			}
			
			if(good) {
				System.out.println(i);
				return;
			}
		}
	}		
}


Measured memory_bytes: 34580
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	s := make([]string, h)
	for i := range s {
		fmt.Scan(&s[i])
	}

	dx := []int{-1, 0, 0, 1}
	dy := []int{0, -1, 1, 0}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if string(s[i][j]) == "." {
				continue
			}

			ok := false
			for k := 0; k < 4; k++ {
				x := i + dx[k]
				y := j + dy[k]

				if x < 0 || x >= h || y < 0 || y >= w {
					continue
				}
				if string(s[x][y]) == "#" {
					ok = true
				}
			}
			if !ok {
				fmt.Println("No")
				return
			}
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
import sys
from bisect import bisect_right as br
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
b.sort()
c.sort()
res = 0
bt = [0] * N
for j in range(N):
  y = b[j]
  k = br(c, y)
  bt[j] = N - k
csbt = [0] * (N + 1)
for i in range(N):
  csbt[i + 1] = csbt[i] + bt[i]
for i in range(N):
  x = a[i]
  j = br(b, x)
  if j < N:
    res += csbt[-1] - csbt[j]
print(res)

Measured memory_bytes: 92516
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vll x(N), y(N), z(N);
  for(int i = 0; i < N; i++){
    cin >> x.at(i) >> y.at(i) >> z.at(i);
  }
  
  ll ans = 0;
  for(int tmp = 0; tmp < (1<<3); tmp++){
    vll p(N, 0);
    for(int i = 0; i < N; i++){
      if((tmp >> 0) & 1) p.at(i) += x.at(i);
      else p.at(i) -= x.at(i);

      if((tmp >> 1) & 1) p.at(i) += y.at(i);
      else p.at(i) -= y.at(i);

      if((tmp >> 2) & 1) p.at(i) += z.at(i);
      else p.at(i) -= z.at(i);
    }
    sort(ALL(p), greater<ll>());
    ll sum = 0;
    for(int i = 0; i < M; i++){
      sum += p.at(i);
    }
    chmax(ans, sum);
  }
  cout << ans << endl;
}

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

w,a,b=map(int,input().split())

a1=a
a2=a+w
b1=b
b2=b+w

if a1<=b1:
    z=b1-a2
elif b1<=a1:
    z=a-b2

if z<=0:
    print("0")
else:
    print(z)


Measured memory_bytes: 2940
import java.util.*

open class MainKt {
    companion object Static {
        @JvmStatic fun main(args: Array<String> = arrayOf()) {
            solve()
        
    }

    val scanner = Scanner(System.`in`)

    fun printf(pattern: String, vararg args: Any): Unit {
        println(String.format(pattern, *args))
    }

    open fun println(line: String) {
        kotlin.io.println(line)
    }

    fun println(line: Int) {
        println(line.toString())
    }

    fun println(line: Long) {
        println(line.toString())
    }

    open fun readLine(): String {
        return scanner.nextLine()
    }

    fun readArg(): String {
        return readLine()
    }

    fun readInt(): Int {
        return readArg().toInt()
    }

    fun readLong(): Long {
        return readArg().toLong()
    }

    fun readIntList(): List<Int> {
        return readArgList().map { it.toInt() }
    }

    fun readLongList(): List<Long> {
        return readArgList().map { it.toLong() }
    }

    fun readArgList(): List<String> {
        return readLine().split(" ")
    }

    fun solve() {
        val mod = Math.pow(10.0, 9.0).toLong() + 7L
        val (n, m) = readLongList()
        val d = Math.abs(n - m)
        when (d) {
            0L -> {
                var f = 1L
                for (i: Long in 1..m) {
                    f = f * i % mod
                    f = f * i % mod
                }
                f = 2 * f % mod
                println(f)
            }
            1L -> {
                var f = 1L
                for (i: Long in 1..m) {
                    f = f * i % mod
                }
                for (i in 1..n) {
                    f = f * i % mod
                }
                println(f)
            }
            else -> {
                println(0)
            }
        }
    }
}
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N, i;
  cin >> N >> i;

  cout << N - i + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int k,x,i,j,low,high;
    scanf("%d%d",&k,&x);
    low=(x-(k-1));
    high=(x+(k-1));
    for(i=low;i<=high;i++){
        printf("%d ",i);
    }
    return 0;
}


Measured memory_bytes: 128
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  let [a, b, _, k] = input.split("\n")[0].split(' ').map(value => Number(value));
  if (k <= a) {
    console.log(k);
    return;
  } else {
    k = k - a;
  }
  if (k <= b) {
    console.log(a);
    return;
  } else {
    k = k - b;
  }
  console.log(a - k);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29900
#include <stdio.h>



int main(void)
{
	//変数の宣言
	int n;
	int ans;
	
	//データの読み込み
	scanf("%d",&n);
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	ans = 1110-n;
	
//	printf("計算部分終了\n");
	
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
}



Measured memory_bytes: 128
r1, r2 = 0, 0
while 1:
    try:
        a, b, c = map(int, raw_input().split(','))
        if a ** 2 + b ** 2 == c ** 2:
            r1 += 1
        elif a == b:
            r2 += 1
    except:
        break
print r1
print r2

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int X[1100], Y[1100];
vint d;
vector<char> w[1100];
string ldru = "LDRU";
signed main() {
    cin >> N;
    rep(i, N) { cin >> X[i] >> Y[i]; }
    for (int i = 1; i < N; i++) { if ((X[i - 1] + Y[i - 1] + X[i] + Y[i]) & 1) { fin(-1); }}
    if (~(X[0] + Y[0]) & 1) {
        d.push_back(1);
        rep(i, N) { X[i]++, w[i].push_back('L'); }
    }
    for (int i = 32; i >= 0; i--) { d.push_back(bit(i)); }
    rep(i, N) {
        for (int j = 32; j >= 0; j--) {
            int arm = bit(j);
            rep(k, 4) {
                int nx = X[i] + DX[k] * arm, ny = Y[i] + DY[k] * arm;
                if (abs(nx) + abs(ny) < arm) {
                    w[i].push_back(ldru[k]);
                    X[i] += DX[k] * arm, Y[i] += DY[k] * arm;
                    break;
                }
            }
        }
    }
    cout << d.size() << endl;
    rep(i, d.size()) { cout << d[i] << " "; }
    cout << endl;
    rep(i, N) {
        rep(j, w[i].size()) { cout << w[i][j]; }
        cout << endl;
    }
}

Measured memory_bytes: 384
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long n;
	cin >> n;
	long long ans = 1;
	for (long long i = 1; i <= n; ++i) {
		ans *= i;
		ans %= MAX_MOD;
	}
	cout << ans;
}


Measured memory_bytes: 256
def count_word(words, word):
    count = 0

    for w in words:
        if w == word:
            count += 1

    return count

n = int(input())

words = []
for i in range(n):
    words.append(input())

bind_letter = ""
for word in words:
    matches = count_word(words, word)
    if matches >= 2:
        print("No")
        exit()

    if bind_letter != "":
        if word[0] != bind_letter:
            print("No")
            exit()
    bind_letter = word[len(word) - 1]
    
print("Yes")

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int a[3],i,j,s,w,l;
    scanf("%d",&s);
    for(w=0;w<s;w++){
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    for(i=0;i<2;i++){
        for(j=i+1;j<3;j++){
            if(a[i]<a[j]){
                a[i] = a[i] ^ a[j];
                a[j] = a[i] ^ a[j];
                a[i] = a[i] ^ a[j];
            }
        }
    }
    if(a[0] * a[0] == a[1] * a[1] + a[2] * a[2]){
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }
    }
    return 0;
}

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



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}


vector<int> dp;
vector<vector<int> > G;

int dfs(int v) {
    if (dp[v]) return dp[v];
    int res = 0;
    for (int nv : G[v]) {
        chmax(res, dfs(nv) + 1);
    }
    return dp[v] = res;
}

void solve() {
    int n, m;
    cin >> n >> m;
    G.resize(n);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        G[u].eb(v);
    }
    
    dp.resize(n);
    rep(i, n) {
        dfs(i);
    }
    
    cout << *max_element(all(dp)) << endl;
}

/*
 bfs なら何回も見ないといけない
 
 なぜなら, 手前から見てるから
 
 dfs なら 1 度見れば確定する
 
 頂点 i はその遷移先すべてが確定している
 最下層を 0 として, 上に上がるたびに 1 を足す
 backtracking (後退解析)
 */


Measured memory_bytes: 8192
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include <memory>
#include <iomanip>

std::vector<int> parse_line(std::string const& line) {
    using namespace std;
    vector<int> result;
    istringstream s(line);
    string element;
    while (getline(s, element, ' ')) {
        stringstream buf;
        int value = 0;
        buf << element;
        buf >> value;
        result.push_back(value);
    }
    return std::move(result);
}
int main(int argc, char* argv[])
{
    using namespace std;
    while (true) {
        string line;
        getline(std::cin, line);
        auto elements = parse_line(line);
        auto length = elements[0];
        if (length == 0) break;
        vector<int> total(length + 1);
        size_t width = length + 1;
        for (size_t i = 0; i < length; ++i) {
            getline(cin, line);
            elements = parse_line(line);
            int sum = 0;
            for (size_t n = 0; n < length; ++n) {
                int val = elements[n];
                sum += val;
                total[n] += val;
                cout << setw(5) << val;
            }
            cout << setw(5) << sum << endl;
            total[length] += sum;
        }
        for (size_t i = 0; i < width; ++i) {
            cout << setw(5) << total[i];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <climits>
#include <numeric>

using namespace std;
using ll = long long;

int main() {
  ll n;
  cin >> n;
  vector<ll> vec(n);
  for (auto &v : vec)
    cin >> v;

  ll ans = INT_MAX;
  ll vsum = accumulate(vec.begin(), vec.end(), 0LL);
  partial_sum(vec.begin(), vec.end(), vec.begin());
  for (ll i = 0; i < n - 1; ++i)
    ans = min(ans, abs(vec[i] - (vsum - vec[i])));
  cout << ans << endl;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long int ll;
using namespace std;

int main()
{
    int k, x;
    cin >> k >> x;
    for(int i=x-k+1;i<=x+k-1;i++) cout << i << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

struct Point {
  double x;
  double y;
  Point(double x, double y): x(x), y(y) {}
};

Point get_top(Point p1, Point p2) {
  double pi3 = M_PI / 3;
  double x = (p2.x - p1.x) * cos(pi3) - (p2.y - p1.y) * sin(pi3) + p1.x;
  double y = (p2.x - p1.x) * sin(pi3) + (p2.y - p1.y) * cos(pi3) + p1.y;

  return Point(x, y);
}

vector<Point> koch(Point start, Point end, int depth) {
  auto p1 = Point((start.x * 2 + end.x) / 3, (start.y * 2 + end.y) / 3);
  auto p2 = Point((start.x + end.x * 2) / 3, (start.y + end.y * 2) / 3);
  
  auto top = get_top(p1, p2);

  vector<Point> t;
  if (!depth) {
    t.push_back(start);
    t.push_back(end);
  }

  if (depth > 0) {
    for (auto p: koch(start, p1, depth - 1)) t.push_back(p);
    t.pop_back();
    for (auto p: koch(p1, top, depth - 1)) t.push_back(p);
    t.pop_back();
    for (auto p: koch(top, p2, depth - 1)) t.push_back(p);
    t.pop_back();
    for (auto p: koch(p2, end, depth - 1)) t.push_back(p);
  }

  return t;
}

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

  Point start(0, 0), end(100.0, 0);
  auto t = koch(start, end, n);
  
  for (auto p: t) 
    printf("%.10lf %.10lf\n", p.x, p.y);
}



Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
int main(){
    int n,ans=0;
    string s;
    cin>>n>>s;
    rep(i,n-2) if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') ans++;
    cout<<ans;
}

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

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

void solve(long long N, std::vector<long long> A){

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long in;
  map<long long, bool> tab;

  for(int i = 0 ; i < N ; i++){
    cin >> in;

    if(tab.count(in) > 0) {
      cout << NO << endl;
      return 0;
    }
    else {
      tab[in] = true;
    }
  }

  cout << YES << endl;

    return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define loop(i, a, n) for(ll i = (a); i < (n); i++)
using namespace std;
using ll = int64_t;

int main(){
    ll x; cin >> x;

    ll limit = 1000;
    loop(a, -limit, limit)loop(b, -limit, limit){
        ll a5 = a*a*a*a*a;
        ll b5 = b*b*b*b*b;
        if((a5 - b5) == x) {
            cout << a << ' ' << b << endl;
            return 0;
        }
    }

    return 0;
}

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

using namespace std;

char a[1005][1005];

int main(){
	int m, n, res = 0;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			res = 0;
			if(a[i][j] == '#'){
				cout << '#';
				continue;
			}
			if(a[i][j + 1] == '#') res++;	
			if(a[i][j - 1] == '#') res++;
			if(a[i + 1][j] == '#') res++;
			if(a[i - 1][j] == '#') res++;
			if(a[i + 1][j + 1] == '#') res++;
			if(a[i - 1][j - 1] == '#') res++;
			if(a[i + 1][j - 1] == '#') res++;
			if(a[i - 1][j + 1] == '#') res++;
			cout << res;
		}
		cout << "\n";
	}
	return 0;
}

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

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < n-1; i++) {
        a[i + 1] = gcd(a[i], a[i + 1]);
    }
    int ans = a[n - 1];
    cout << ans << endl;
}

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

int main(){

    int N, K;
    cin >> N >> K;

    long long cnt = 0, buf = K;
    cnt += buf;

    for(int i=1; i<N; i++){
        buf = K - 1;
        cnt *= buf;
    }

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

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

int main(){
    int n;  cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end(),greater<int>());
    int Alice(0),Bob(0);
    for(int i=0;i<n;i++){
        if(i%2==0)
            Alice += a[i];
        else
            Bob += a[i];
    }
    
    cout << Alice-Bob << endl;
    
    return 0;
}


Measured memory_bytes: 3580
s = input()
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            print('No')
            exit()
    else:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int a[100009],b[100009],c[100009];
int main() {
    int n,k;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    for(int i=2;i<=n;i++){
        a[i]+=max(b[i-1], c[i-1]);
        b[i]+=max(a[i-1], c[i-1]);
        c[i]+=max(b[i-1], a[i-1]);
    }
    cout<<max(a[n], max(b[n], c[n]))<<endl;
}


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

int main() {
 int n,acnt=0,bcnt=0;
 cin >> n;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long b=0,c=0;

  sort(a.begin(),a.end(),greater<long long>());
    for(int i=0;i<n;i++){
      if(a[i]==a[i+1]){
        if(b==0)b=a[i];
        else if(c==0)c=a[i];
        i++;
      }
    }
    cout <<  (long long)b*c << endl;
  }


Measured memory_bytes: 1024
#include <iostream>

int main(){
    int a,b,c,d,e,f,g,h,i,j;
    std::cin >> a >> b >>c >> d >> e >> f >> g >> h >>i >>j;
    std::cout << a+b+c+d+e+f+g+h+i+j <<std::endl;
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 10005
#define MAX_E 30005
#define NIL -1
#define WHITE 0
#define BLACK 1
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

class Edge {
    ll t, w;
    Edge(ll t, ll w): t(t), w(w) {}
};

ll N, A, B;
ll h[100000];

bool C(ll x) {
    ll cnt=0;
    for(ll i=0; i<N; i++) {
        ll hh=h[i]-B*x;
        if(hh<=0) continue;
        cnt+=hh/A;
        if(hh%A) cnt++;
    }
    
    if(cnt<=x) return 1;
    else return 0;
}

int main(void) {
    cin >> N >> A >> B;
    A-=B;
    ll i;
    for(i=0; i<N; i++) {
        cin >> h[i];
    }
    
    ll left=0, right=INF, mid;
    
    while(left+1<right) {
        mid=(left+right)/2;
        if(C(mid)) {
            right=mid;
        }else {
            left=mid;
        }
    }
    
    prin(right);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
using namespace std;
int n[4];
int main(){
    cin >> n[0] >> n[1] >> n[2] >> n[3];
    sort(n, n+4);
    if(n[0]==1) if(n[1]==4) if(n[2]==7) if(n[3]==9){
        cout <<"YES"<<endl;
        return 0;
    }
    cout <<"NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define MOD 1000000007
template <typename Type>
istream &operator>>(istream &in, vector<Type> &vec) {
    ll n = vec.size();
    for (ll i = 0; i < n; i++)
        in >> vec[i];
    return in;
}
template <typename Type>
ostream &operator<<(ostream &out, vector<Type> &vec) {
    for (auto val : vec)
        out << val << " ";
    return out;
}
#define PI 3.14159265
void solve()
{
    ll n,x,t;
    cin>>n>>x>>t;
    ll c = n/x;
    if(n%x!=0)
    c++;
    ll ans = t*c;
    cout<<ans<<endl;
}
int main()
{
    ll t=1;
    // cin>>t;
    while(t--)
    solve();
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    
    int a[4];
    for(int i = 0; i < 4; i++)
    {
        a[i] = s[i] - '0';
    }
    
    if(a[0] + a[1] + a[2] + a[3] == 7){
        cout <<a[0]<<'+'<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] + a[1] + a[2] - a[3] == 7){
        cout <<a[0]<<'+'<<a[1]<<'+'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] + a[1] - a[2] + a[3] == 7){
        cout <<a[0]<<'+'<<a[1]<<'-'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] + a[1] - a[2] - a[3] == 7){
        cout <<a[0]<<'+'<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] - a[1] + a[2] + a[3] == 7){
        cout <<a[0]<<'-'<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] - a[1] + a[2] - a[3] == 7){
        cout <<a[0]<<'-'<<a[1]<<'+'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] - a[1] - a[2] + a[3] == 7){
        cout <<a[0]<<'-'<<a[1]<<'-'<<a[2]<<'+'<<a[3]<<"=7"<<endl;
    }
    else if(a[0] - a[1] - a[2] - a[3] == 7){
        cout <<a[0]<<'-'<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<"=7"<<endl;
    }
    
    return 0;
}


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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)


int main()
{
	int n;
	cin>>n;
	int a[n];
	ffor(i,0,n) cin>>a[i];
    int dp[n];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    ffor(i,2,n)
    {
    	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
def main():
    n = int(input())
    words = {}
    for i in range(n):
        s = input()
        if s not in words.keys():
            words[s] = 0

        words[s] += 1

    counts = []
    for i in words.keys():
        counts.append((words[i],i))

    counts.sort()
    highest = []
    max_count = counts[-1][0]
    while counts and counts[-1][0] == max_count:
        highest.append(counts.pop()[1])

    highest.sort()
    for i in highest:
        print(i)

main()


Measured memory_bytes: 45272
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
using namespace std;
double dp[3000][3000]={};
signed main(){
	int n;
	cin>>n;
	double d,ans=0;
	dp[0][0]=1;
	f(i,n){
		cin>>d;
		f(j,i+2){
			if(j==i+1) dp[i+1][j]=dp[i][j-1]*d;
			else if(j) dp[i+1][j]=dp[i][j]*(1-d)+dp[i][j-1]*d;
			else dp[i+1][j]=dp[i][j]*(1-d);
		}
	}
	for(int i=(n+1)/2;i<=n;i++){
		ans+=dp[n][i];
	}
	printf("%.10f",(ans));
	return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

typedef long long ll;

int gcd(int a,int b){
    int dividend = max(a,b);
    int divider = min(a,b);
    
    if (divider == 0) return dividend;

    while (dividend % divider != 0){
        int r = dividend % divider;
        dividend = divider;
        divider = r;
    }
    return divider ;


}

int main(){
    int k;
    cin >> k;
    ll count = 0;
    int num_gcd;
    rep(a,k){
        rep(b,k){
            rep(c,k){
                num_gcd = gcd(a+1,b+1);
                num_gcd = gcd(num_gcd,c+1);
                count += num_gcd;
            }

        }
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26
const int maxn = 2e5 + 10;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr); 
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    map<pair<int,int>,int> en;
    for(int i = 0; i < n-1; i++) {
        int a,b;
        cin >> a >> b;
        if(a>b) swap(a,b);
        --a;
        --b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
        en[make_pair(a,b)]=i;
    }
    int sn=0;
    for(int i = 1; i < n; i++) {
        if(g[i].size()>g[sn].size()) sn=i;
    }
    int ct=g[sn].size();
    int ans[n-1];
    vector<int> color(n,-1);
    queue<int> que;
    que.push(sn);
    color[sn]=0;
    while(!que.empty()) {
        int v=que.front();
        que.pop();
        int pc=1;
        for (int nv : g[v]) {
            if (color[nv] != -1) continue;

            if(color[v]==pc) pc++;
            color[nv]=pc;
            pc++;
            que.push(nv);

            int tv=v;
            int tnv=nv;
            if(tv>tnv) swap(tv,tnv);
            int ten=en[make_pair(tv,tnv)];
            ans[ten]=color[nv];
        }
    }

    cout << ct << "\n";
    for(int i = 0; i < n-1; i++) {
        cout << ans[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 13184
N=int(input())
L=list(map(int, input().split()))

ct=0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]<L[j]+L[k] and L[j]<L[k]+L[i] and L[k]<L[i]+L[j] and \
               L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                ct+=1
                # print(i,j,k)

print(ct)

Measured memory_bytes: 74100
<?php

fscanf(STDIN, '%s', $a);
fscanf(STDIN, '%s', $b);

$ok = true;
for ($i=0; $i < strlen($a); $i++) {
    if (substr($a, $i, 1) !== substr($b, strlen($b) - 1 -$i, 1)) {
        $ok = false;
        break;
    }
}

if ($ok) {
    echo 'YES';
} else {
    echo 'NO';
}

echo PHP_EOL;


Measured memory_bytes: 16216
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a int
	var b string
	fmt.Scan(&a, &b)
	bb, _ := strconv.Atoi(strings.Replace(b, ".", "", 1))

	fmt.Println(a * bb / 100)
}


Measured memory_bytes: 1824