akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){

    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if(x >= 0 & y >= 0 & W >= (x+r) & H >= (y+r)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;

}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
const char duom[] ="i.txt";
long long dp[100005][3];

int a[1000005];
int b[1000005];
int c[1000005];

int main()
{
  // ifstream cin (duom);
   int n;
   cin >>n;
   for(int i=0;i<n;i++)
   {
       cin >>a[i]>>b[i]>>c[i];
   }
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    cout << max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);

    return 0;
}



Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)




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

  int h,w,n;
  cin >> h >> w >> n;
  int ans = h;
  vector<pair<int,int>> cor(n);
  rep(i,n){
    cin >> cor[i].first >> cor[i].second;
  }
  sort(cor.begin(),cor.end());
  int offset = 0;
  rep(i,n){
    int x = cor[i].first;
    int y = cor[i].second;
    if(x==y+offset){
      offset++;
    }
    else if(x<y+offset+1) continue;
    else{
      ans = min(ans,x-1);
    }
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 1792
/*AOJ-ITP-2-2*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		int[] sort =  {a,b,c}; 
		int v=0;
		
		if(!(a >= 1 || b >= 1 || c >= 1 || a <= 10000 || b <= 10000 || c <= 10000)){System.exit(1);}
		
		while(!(sort[0] <= sort[1] && sort[1] <= sort[2])){
			for(int i = 1 ; i < sort.length ; i++){
				if(sort[i-1] > sort[i]){
					v = sort[i-1];
					sort[i-1] = sort[i];
					sort[i] = v;
				}
			}
		}
		
		System.out.println(sort[0] + " " + sort[1] + " " + sort[2]);
		
	}
}

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

int main(){
  string s;
  cin >> s;
  int n=s.size()/2;
  int ans=0;
  for(int i=0;i<n;i++){
    int x=1;
    for(int j=0;j<i;j++){
      x*=(s.at(i+j)==s.at(j));
    }
    if(x) ans=i;
  }
  cout << 2*ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mxn= 5e5+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    rishabh();
    int t;
    
    t=1;
    while(t--){
        int n,k;
        cin>>k>>n;
        vector<ll> vec, diff;
        for(int i=0;i<n;i++){
            int x;
            cin>>x;
            vec.push_back(x);
        }
        if(vec.size()==1){
            cout<<0;
            return 0;
        }
        sort(vec.begin(), vec.end());
        ll ans=0;
        priority_queue<ll> pq;
        for(int i=1;i<n;i++){
            ans=ans+vec[i]-vec[i-1];
            pq.push(vec[i]-vec[i-1]);
        }
        while(k-->1&&!pq.empty()){
            ans=ans-pq.top();
            pq.pop();
        }
        cout<<ans;
    }
}

Measured memory_bytes: 5456
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

bool used[256];
int N, mod = 1000000007;
int dp[109][64];

void init() {
	for (int i = 0; i < 256; i++) {
		int col[4], s = 1;
		for (int j = 0; j < 4; j++) { col[j] = (i / s) % 4; s *= 4; }
		for (int j = 0; j <= 3; j++) {
			if (j != 3) swap(col[j], col[j + 1]);
			if (col[0] == 0 && col[1] == 1 && col[2] == 2) used[i] = true;
			if (col[1] == 0 && col[2] == 1 && col[3] == 2) used[i] = true;
			if (j != 3) swap(col[j], col[j + 1]);
		}
	}
}

int main() {
	init();
	cin >> N;
	if (N == 3) {
		cout << "61" << endl;
	}
	else {
		for (int i = 0; i < 64; i++) dp[3][i] = 1;
		for (int i = 4; i <= N; i++) {
			for (int j = 0; j < 64; j++) {
				if (dp[i - 1][j] == 0) continue;
				for (int k = 0; k < 4; k++) {
					int val = j + 64 * k;
					if (used[val] == true) continue;
					dp[i][val / 4] += dp[i - 1][j];
					dp[i][val / 4] %= mod;
				}
			}
		}
		int sum = 0;
		for (int i = 0; i < 64; i++) { sum += dp[N][i]; sum %= mod; }
		cout << sum << endl;
	}
	return 0;
}

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

using namespace std;
#define ll long long

const int N = 1e5 + 5;
ll INF = 998244353;


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;
    cin>>n>>k;

    vector<ll> dp(n+1,0);
    vector<ll> psum(n+1,0);
    vector<pair<int,int>> val;

    for(int i=0;i<k;i++)
    {
        int a,b;
        cin>>a>>b;
        val.push_back({a,b});
    }

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

    dp[n] = 1;
    psum[n] = 1;

    int i = n-1;
    while(i > 0)
    {
        ll tmp = 0;
        for(int j=0;j<k;j++)
        {
            if( val[j].first + i > n)
                break;
            ll t = psum[i+val[j].first];
            int p = val[j].second + i + 1;
            if(  p<= n)
                t =  (t - psum[p])%INF;
            tmp = (tmp + t)%INF;
            tmp = (tmp + INF)%INF;
        }

        dp[i] = tmp;
        psum[i] = (tmp + psum[i+1])%INF;
        //cout<<dp[i]<<" "<<psum[i]<<endl;
        i--; 
    }

    cout<<dp[1]<<endl;
}


Measured memory_bytes: 6380
#include<stdio.h>
int main(void)
{
    int a[10000]={0},b,c[10]={0},d;
    int i,j,k,l;

    while(scanf("%d",&b)!=EOF){
        if(b == 0)return 0;
    for(i=0;i<b;i++)
    {
        scanf("%d",&a[i]);
        for(j=0;j<10;j++)
            {
                if(j == a[i])c[j]++;
            }
    }
     for(k=0;k<10;k++)
            {
                if(c[k]<=0) printf("-");
                else
                {
                    for(l=0;l<c[k];l++)
                    {
                        printf("*");
                    }
                }
               printf("\n");
               c[k]=0;
            }

    }
    return 0;
}

Measured memory_bytes: 616
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<math.h>
#include<map>
#include<unordered_map> 
#include<vector>
#include<queue>
#include<set>
#include<bits/stdc++.h>
#include<deque> 
#include<bitset>
#include<string>
#define N 40
#define K 300005
#define MOD 1e9+7
#define int long long 
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int max(int a, int b){
    if(a>b)
        return a;
    return b;
}

int32_t main(){
	int n, w;
	cin>>n>>w;
	int we[n], v[n];
	for(int i=0;i<n;i++){
		cin>>we[i]>>v[i];
	}
    int dp[n + 1][w + 2];
	for(int i=0;i<n;i++){
		for(int j=0;j<=w;j++){
            dp[i][j] = 0;
			//dp[i][j] - upto i items and given weight j what val can you achieve
			if(i == 0){
				if(we[i] <= j)
					dp[i][j] = v[i];
			}
			else{
				dp[i][j] = dp[i-1][j];
				if(j >= we[i]){
					dp[i][j] = max(dp[i][j], dp[i-1][j - we[i]] + v[i]);
				}
			}
            //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
        
	}
	cout<<dp[n-1][w];
}

Measured memory_bytes: 78336
def IN(): return map(int,input().split())
ans = pow(2,31); mod = pow(10,9)+7
h,n=IN()
A=[]; dp=[pow(2,31)]*111111
for i in range(n):
  x,y=IN()
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(h+1111):
    dp[i+a]=min(dp[i+a],dp[i]+b)
for i in range(h,11111):
  ans=min(ans,dp[i])
print(ans)


Measured memory_bytes: 43500
s=list(input())
mod=10**9+7
for i in range(len(s)):
    if s[i]=='?':
        s[i]=-1
    else:
        s[i]=int(s[i])

dp=[[0]*13 for i in range(len(s)+1)]
s.reverse()
dp[0][0]=1
y=[]
x=1
for i in range(len(s)):
    if s[i]!=-1:
        z=s[i]*x

        for j in range(13):
            dp[i+1][(j+z)%13]+=dp[i][j]%mod
    else:
        for j in range(10):
            y.append((x*j)%mod)

        for k in range(13):
            for l in range(len(y)):
                dp[i+1][(k+y[l])%13]+=dp[i][k]%mod
        y=[]
    x=(x*10)%13
        
print(dp[len(s)][5]%mod)
            
        
        


     

    


Measured memory_bytes: 71708
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>

using namespace std;

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

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

	int maxi = a[0];
	int gcd = a[0];
	bool ok = false;
	for (auto e : a) {
		gcd = __gcd(gcd, e);
		maxi = max(maxi, e);
		if (k == e) {
			ok = true;
		}
	}

	if (maxi >= k && k % gcd == 0) {
		ok = true;
	}

	cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}


Measured memory_bytes: 640
oni,oniv = map(int, input().split())
ko,kov = map(int, input().split())
t = int(input())

if kov >= oniv:
    ans = "NO"
else:
    if oni > ko:
        oniAfter = oni - oniv*t
        koAfter = ko - kov*t
        if oniAfter <= koAfter:
            ans = "YES"
        else:
            ans = "NO"
    else:
        oniAfter = oni + oniv*t
        koAfter = ko + kov*t
        if oniAfter >= koAfter:
            ans = "YES"
        else:
            ans = "NO"

print(ans)

Measured memory_bytes: 9200
def main():
    x = int(input())
    a_lst = []
    b_lst = []
    for i in range(400):
        a_lst.append(-200 + i)
    for i in range(400):
        b_lst.append(-200 + i)

    flag = False
    for i in range(len(a_lst)):
        for j in range(len(b_lst)):

            a = a_lst[i]
            b = b_lst[j]
            if a ** 5 - b ** 5 == x:
                print(a, b)
                flag = True
                break

        if flag:
            break


if __name__ == '__main__':
    main()

Measured memory_bytes: 9140
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/
ll gcd(ll a, ll b) {
	ll t;    // 補助変数
	while (b != 0) {          
		t = a%b; a = b; b = t;   	}
	return a;                   
}

int T;
ll a, b, c, d;
ll start;
void judge() {
	if (a < b) {
		cout << "No" << endl;
		return;
	}
	if (b > d) {
		cout << "No"<<endl;
		return;
	}
	if (a - (a / b)*b > c) {
		cout << "No"<<endl;
		return;
	}
	if (d%b == 0) {
		cout << "Yes" << endl;
		return;
	}
	if (c >= b) {
		cout << "Yes" << endl;
		return;
	}
	if (gcd(b, d) == 1) {
		if (c + 1 - b < 0) {
			cout << "No" << endl;
			return;
		}
		else {
			cout << "Yes" << endl;
			return;
		}
	}
	else {
		ll e = gcd(b, d);
		start =a - ((a - (c + 1)) /e)*e;
		if (start - b < 0) {
			cout << "No" << endl;
			return;
		}
		else{
			cout << "Yes" << endl;
			return;
		}
	}
}

int main()
{
	cin >> T;

	for (int i = 0; i < T; i++) {
		cin >> a >> b >> c >> d;
		judge();
	}
	return 0;
}


Measured memory_bytes: 256
let () = Scanf.scanf "%d %d %d" @@ fun a b k ->
  if b - a <= 2 * k - 2 then
    for i = a to b do
      Printf.printf "%d\n" i
    done
  else begin
    for i = a to a + k - 1 do
      Printf.printf "%d\n" i
    done;
    for i = b - k + 1 to b do
      Printf.printf "%d\n" i
    done
  end


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

long long gcd(long long x, long long y){
    if(y == 0){
        return x;
    }
    return gcd(y, x%y);
}

int main(){
    long long n, k;
    cin >> n >> k;

    long long ma = 0, g = 0;
    long long a;

    for(int i = 0; i < n; i++){
        cin >> a;
        ma = max(ma, a);
        g = gcd(g, a);
    }

    if(k <= ma and k % g == 0){
        printf("POSSIBLE\n");
    }
    else{
        printf("IMPOSSIBLE\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;


signed main(){
  string S;cin>>S;
  if(S.at(0)!='A'){
    print("WA");
    re 0;
  }
  int C_cnt=0;
  int tmp;
  REP(i,2,S.size()-1){
    tmp=S[i]-'a';
    if(S[i]=='C'){
      C_cnt++;
    }
    else if(!(0<=tmp&&tmp<26)){
      print("WA");
      re 0;
    }
  }
  int tmp1=S[1]-'a',tmp2=S[S.size()-1]-'a';
  if(C_cnt==1&&(0<=tmp1&&tmp1<26)&&(0<=tmp2&&tmp2<26)){
    print("AC"); re 0;
  }
  print("WA");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define maxn	500005
#define inf		int(21e8)
#define mod		int(1e9+7)
#define db		double
#define ll		long long
#define si 		stack<int>
#define qi 		queue<int>
#define vi 		vector<int>
#define pi 		pair<int, int>
#define pq  	priority_queue< int, vector<int>, greater<int> >
using namespace std;
ll powmod(ll a, ll b) {
	ll res = 1; a %= mod;
	for (; b; b >>= 1)
		res = (res * ((b & 1) ? a : 1)) % mod,
		a = a * a % mod;
	return res;
}
ll gcd(ll a, ll b) {
	return b ? gcd(a, b) : a;
}
int main() {
	int a;
	cin >> a;
	cout << a + a * a + a * a * a;
	return 0;
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10**5)
N,M = map(int, input().split())
input = sys.stdin.readline
LRD = [ [int(j) for j in input().split()] for _ in range(M)]

data = [x for x in range(N+1)]
rank = [0]  * (N+1)
diff_weight = [0] * (N+1)

def root(x):
    if data[x] == x:
        return x
    else:
        r = root( data[x] )
        diff_weight[x] += diff_weight[ data[x] ]
        data[x] = r
        return r

def weight(x):
    # _ = root(x)
    return diff_weight[x]


def diff(x,y):
    return weight(y) - weight(x)

def merge(x,y,w):
    w  += weight(x); w -= weight(y)
    x = root(x)
    y = root(y)
    if x == y: return False
    if rank[x] < rank[y]: x,y = y,x; w = -w
    if rank[x] == rank[y]: rank[x] += 1
    data[y] = x
    diff_weight[y] = w
    return True

def issame(x,y):
    return root(x) == root(y)

for i in range(M):
    L,R,D = LRD[i]
    # print(L,R,D)
    if not issame(L,R):
        _  = merge(L,R,D)
    else:
        if diff(L,R) != D:
            print("No")
            exit(0)
            
print("Yes")

    
    


Measured memory_bytes: 46892
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int a, b, c;
    cin >> a >> b >> c;

    if(a == b) cout << c << endl;
    if(a == c) cout << b << endl;
    if(c == b) cout << a << endl;
    

}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
priority_queue<int> q;
int main()
{
    long long n,m,a,sum;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        q.push(a);
    }
    sum=0;
    int t;
    for(int i=0;i<m;i++)
    {
        t=q.top()/2;
        q.pop();
        q.push(t);
    }
    while(!q.empty())
    {
        sum+=q.top();
        q.pop();
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<char,int> P;

//少数点表示
//cout << std::fixed << std::setprecision(14) <<double値

string ope(string t,int l,int r){
    string u = t.substr(l,r-l+1);
    auto n = u.size();
    rep(i,n){
        u[i] = (u[i] == 'L'?'R':'L');
    }
    reverse(u.begin(),u.end());
    t.insert(r+1,u);
    return t;
}

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<P> p;
    int count = 0;
    int rc = 0,lc = 0;
    rep(i,n-1){
        //(a[i] == 'R') ? rc++ : lc++;
        if(s[i] == s[i+1]){
            count++;
        }
    }
    int ans = min(count + 2*k, n-1);
    cout << ans << endl;
    return 0;

}

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

int main() {
  int N;
  cin >> N;
  int a[N];
  rep(i,N) {
    cin >> a[i];
  }

  sort(a, a+N);
  reverse(a, a+N);
  int A = 0, B = 0;
  rep(i,N) {
    if(i%2==0) {
      A += a[i];
    } else {
      B += a[i];
    }
  }

  cout << A-B << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <string>
#include <map>
#include <queue>
#include <list>

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define vint vector<int>
#define INF 1e9

using namespace std;
typedef long long  ll;

char IntToChar(int n){
    char tmp = 'a' + n;
    return tmp;
}

#define Z 26

int main(){

    ll n;
    cin >> n;

    string ans;

    while(n >= Z){
        n = n -1;
        ans += IntToChar(n%Z);
        n = n/Z;
    }

//    p(n%Z);
    if(n != 0){ans += IntToChar(n-1);}
    reverse(ans.begin(), ans.end());

    p(ans);

    return 0;
}


Measured memory_bytes: 3128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.AGC_Challenge
{
    class _016_B
    {
        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            Array.Sort(array);
            if (array[n - 1] - array[0] > 1)
            {
                WriteLine("No");
                return;
            }

            int multis = 0;
            int alones = 0;
            for(int i = 0; i < n; i++)
            {
                if (array[n - 1] == array[i]) multis++;
                else alones++;
            }
            if (multis == n && array[n - 1] == n - 1)
            {
                WriteLine("Yes");
                return;
            }

            if (multis == 1)
            {
                WriteLine("No");
                return;
            }

            int multiMin = 1;
            int multiMax = multis / 2;
            if(array[n-1]< alones+multiMin
                || array[n - 1] > alones + multiMax)
            {
                WriteLine("No");
                return;
            }
            WriteLine("Yes");
            return;
        }

        private static string Read() { return ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 16864
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)

	oddCount := 0
	evenCount := 0

	for i := 1; i <= k; i++ {
		if i%2 == 0 {
			evenCount++
		} else {
			oddCount++
		}
	}
	fmt.Println(oddCount * evenCount)
}


Measured memory_bytes: 1764
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean[] a = new boolean[107];
        a[0] = true;
        for(int i = 0; i < 100; i++) {
            if(a[i]) {
                a[i + 4] = true;
                a[i + 7] = true;
            }
        }
        System.out.println(a[n] ? "Yes" : "No");
    }
}


Measured memory_bytes: 22740
x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
w = p[a-x:a] + q[b-y:b] + r
w.sort()
print(sum(w[len(w)-(x+y):len(w)]))

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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 100 * 1000 + 17;

int n, a[MAXN];
map<int, int> mp;
set<int> s;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i], s.insert(a[i]), mp[a[i]]++;
	if (s.size() > 3)
		return cout << "No\n", 0;
	if (s.size() == 1) {
		if (mp[0] != n)
			return cout << "No\n", 0;
		return cout << "Yes\n", 0;
	}
	if (n % 3 != 0)
		return cout << "No\n", 0;
	if (s.size() == 3) {
		for (auto i : s)
			if (mp[i] ^ mp[a[1]])
				return cout << "No\n", 0;
		if (!s.count((*s.begin()) ^ (*s.rbegin())))
			return cout << "No\n", 0;
		return cout << "Yes\n", 0;
	}

	if (mp[0] * 2 != mp[*s.rbegin()])
		return cout << "No\n", 0;
	cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 7808
N = int(input())
H = list(map(lambda h: int(h), input().split(" ")))

def f(A):
  if len(A) == 0:
    return 0
  elif len(A) == 1:
    return A[0]
  elif len(A) == 2:
    return max(A)

  c = 0
  if A.count(0) == 0:
    c += min(A)
    A = [a - min(A) for a in A]

  B = split_list(A)
  ret = []
  for j in range(len(B)):
    ret.append(f(B[j]))

  return c + sum(ret)

def split_list(A):
  B = []
  tmp = []
  for i in range(len(A)):
    if A[i] != 0:
      tmp.append(A[i])
    else:
      if len(tmp) > 0:
        B.append(tmp)
        tmp = []
  else:
    if len(tmp) > 0:
      B.append(tmp)
  return B

print(f(H))


Measured memory_bytes: 9196
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int main()
{
    string S;
    cin>>S;
    S[3]='8';
    cout<<S<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0; i<N; i++)
#define lint long long
#define square_vector(name,N,M) vector<vector<lint>>name(N,vector<lint>(M,0))
#define sort(V) sort(V.begin(),V.end())

int main() {
  char X,Y;
  cin >> X >> Y;
  lint a = X - Y;
  if (a > 0) {
    cout << ">" << endl;
  }
  if (a == 0) {
    cout << "=" << endl;
  }
  if (a < 0) {
    cout << "<" << endl;
  }
    
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
????????????????????????????????? ??§?????§  
??????????????? ??§?????§ ???????´<_??? ?????? Welcome to My Coding Space!
???????????? ??? ?´_???`??????/??? ???i     
?????????????????????????????? ???  |???|     
????????? /?????? /??£??£??£??£/??????|  
??? ???_(__??????/???    ???/ .| .|????????????  
??? ????????????/????????????/??????u??????  
---------------------------------------------------------------------------------------------------*/




int N, A[101010];
//--------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    int st = 0; // =1:??????, =2:????°?
    int cn = 1;
    int ans = 1;
    rep(i, 1, N) {
        if (A[i - 1] < A[i]) {
            if (st == 1) {
                cn++;
            }
            else {
                ans = max(ans, cn);
                st = 1;
                cn = 2;
            }
        }

        if (A[i - 1] > A[i]) {
            if (st == 2) {
                cn++;
            }
            else {
                ans = max(ans, cn);
                st = 2;
                cn = 2;
            }
        }

        //printf("[%d]\n", ans);
    }

    ans = max(ans, cn);
    cout << ans << endl;
}

Measured memory_bytes: 3536
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define UP(i,x,y) for(i=x;i<=y;i++)
#define DOWN(i,x,y) for(i=x;i>=y;i--)
#define MEM(a,x) memset(a,x,sizeof(a))
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid + 1, r
#define lowbit(x) (x&-x)
using namespace std;
int cost[50][50];
int d[50];
bool vis[50];
int V;
int dijks(int s)
{
    fill(d,d+V+1,INF);
    fill(vis,vis+V+1,false);
    d[s] = 0;
    while(true) {
        int v = -1;
        for(int u = 0; u <= V; u++)
            if(!vis[u]&&(v==-1||d[u]<d[v]))
                v=u;
        if(v==-1)
            break;
        vis[v] = true;
        for(int u = 0; u <= V; u++)
            d[u] = min(d[u], d[v] + cost[v][u]);
    }
    int sum = 0;
    for(int j = 0; j <= V; j++)
        sum+=d[j];
    return sum;
}

int main()
{
    int n;
    while(cin>>n&&n) {
        memset(cost, INF, sizeof cost);
        int x, y, len;
        V = 0;
        for(int i = 0; i < n; i++){
            scanf("%d%d%d", &x, &y, &len);
            cost[x][y] = cost[y][x] = len;
            V = max(max(x,y),V);
        }
        int minn=INF, idx;
        for(int i = 0; i <= V ;i++){
            int sum = dijks(i);
            if(sum<minn){
                minn = sum;
                idx = i;
            }
        }
        printf("%d %d\n",idx, minn);
    }
    return 0;
}



Measured memory_bytes: 3180
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N, sum = 0;
  cin >> N;
  vec<ll> A(N);
  REP(i, N) {
    cin >> A[i];
    sum += A[i];
  }

  ll answer = numeric_limits<ll>::max(), acc = 0;
  REP(i, N) {
    answer = min(answer, abs((sum - acc) - acc));
    acc += A[i];
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 4776
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int k,n,i,max=0;
  cin >> k >> n;
  vector<int>a(n);
  for(i=0; i<n; i++){
    cin >> a.at(i);
  }
  for(i=0; i<n-1; i++){
    int j=i+1;
    if(max<a.at(j)-a.at(i)){
      max=a.at(j)-a.at(i);
    }
  }
  if(k-a.at(n-1)+a.at(0)>max){
    max=k-a.at(n-1)+a.at(0);
  }
  cout << k-max << endl;

}


Measured memory_bytes: 1152
class Node:
  def __init__(self, key):
    self.key = key
    self.right = None
    self.left = None

class BST:
  root = None
  def insert(self, key):
    x = self.root
    y = None
    z = Node(key)
    while x != None:
      y = x
      if(z.key < y.key):
        x = x.left
      elif(y.key < z.key):
        x = x.right
    
    if y is None:
      # 初回
      self.root = z
    else:
      if z.key < y.key:
        y.left = z
      elif y.key < z.key:
        y.right = z
        
  def preorder(self, par):
    if par is not None:
      print(" {}".format(par.key), end="")
      self.preorder(par.left)
      self.preorder(par.right)
  
  def inorder(self, par):
    if par is not None:
      self.inorder(par.left)
      print(" {}".format(par.key), end="")
      self.inorder(par.right)
      
  def find(self, key):
    x = self.root
    y = None
    z = Node(key)
    flag = False
    while x != None: 
      y = x
      if(z.key < y.key):
        x = x.left
      elif(y.key < z.key):
        x = x.right
      else:
        flag = True
        break
    return flag
    
  
n = int(input())
bst = BST()
for _ in range(n):
  query = input().split()
  if query[0] == "insert":
    bst.insert(int(query[1]))
  elif query[0] == "find":
    print("yes" if bst.find(int(query[1])) else "no")
  elif query[0] == "print":
    # 中間巡回順, 先行巡回順
    root = bst.root
    bst.inorder(root)
    print()
    bst.preorder(root)
    print()



Measured memory_bytes: 85280
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
bool used[10001];
int main(){
  int n,a,b,c,x;
  while(cin>>n>>a>>b>>c>>x,n||a||b||c||x){
    int id = 0;
    int t = 0;
    int ans = -1;
    vector<int> y(n);
    for(int i=0;i<n;++i) cin>>y[i];
    while(true){
      if(y[id]==x) ++id;
      if(id==n){
	ans = t;
	break;
      }
      ++t;
      x = (a*x+b)%c;
      if(t>10000) break;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


const int MAX = 3000000;
const ll MOD = 1e9+7;
ll fac[MAX], finv[MAX], inv[MAX];

void combinit() {
	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;
	}
}
ll comb(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;
}

ll r1, c1, r2, c2;

ll g(int x, int y) {
	return (comb(x+y+2, x+1) - 1+MOD)%MOD;
}

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

	combinit();

	cin >> r1 >> c1 >> r2 >> c2;
	ll ans = g(r2, c2) - g(r1 - 1, c2) - g(r2, c1 - 1) + g(r1 - 1, c1 - 1) + 10LL*MOD;
	puts(ans % MOD);
	return 0;
}

Measured memory_bytes: 70528
#define M 26
P[M],A[M],B[M];
int R(a){return P[a]==a?a:(P[a]=R(P[a]));}
char s[99];main(k,l,x,y){for(;scanf("%d",&l),l;puts(k<M?"NG":"OK")){
	for(k=0;k<M;k++)A[k]=B[k]=0,P[k]=k;
	for(k=0;k<l;k++)scanf("%s",s),x=*s-97,y=s[strlen(s)-1]-97,A[x]++,B[y]++,P[R(x)]=R(y);
	for(k=0;k<M;k++){if(abs(A[k]-B[k])||((A[k]|B[k])&&R(*s-97)!=R(k)))break;}
}exit(0);}

Measured memory_bytes: 588
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"At Be Co"# => r#"ABC"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        c: String,
    }

    if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
        "vowel"
    } else {
        "consonant"
    }.to_string()
}

Measured memory_bytes: 4352
//AtCoder 085
#include<bits/stdc++.h>
using namespace std;
typedef long long lld;

int main(){
	std::ios::sync_with_stdio(false);
	lld n,h;
	cin>>n>>h;
	vector<lld > u,d;
	u.resize(n);
	d.resize(n);
	
	lld mx=LLONG_MIN;
	for(lld i=0;i<n;i++){
		cin>>u[i]>>d[i];
		if(u[i]>mx){
			mx=u[i];
		}
	}
	sort(d.begin(),d.end());
	lld ans=0;
	lld H=h;
	for(lld i=n-1;i>=0 && H>0;i--){
		if(d[i]>=mx){
			H-=d[i];	
			ans++;
		}	
	}
	H=max(0LL,H);
	lld aa=H/mx;
	if(H%mx){
		aa++;
	}
	cout<<aa+ans<<"\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

///#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,avx,sse4.1,sse4.2,mmx")
///#pragma GCC optimize ("unroll-loops")
///#pragma GCC optimize ("Ofast")
///#pragma GCC optimize ("O3")

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define ff first
#define ss second
#define db double
#define ld long double
#define pb push_back
#define what(x) cerr << #x << " = " << x << '\n'

const int N = 1e6 + 5, M = 3e3 + 5;
const int inf = 1e18 + 100, mod = 1e9 + 7;
const ld eps = 1e-9, Pi = atan2(0, -1);

template < class T >
using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

template < class T >
using ordered_multiset = tree < T, null_type, less_equal < T >, rb_tree_tag, tree_order_statistics_node_update >;

mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l, int r){
    return mt_rnd_64() % (r - l + 1) + l;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, sum = 0;
    cin >> n >> m;
    for (int i = 1; i <= m; ++i)
    {
        int x;
        cin >> x;
        sum += x;
    }

    if (sum > n) cout << -1;
    else cout << n - sum;
    return 0;
}
/// hto ya? zvychayna domohospodarka chy president Ykrainy?


Measured memory_bytes: 3592
H, W, A, B = map(int, input().split())
ans = [['0']*W for _ in range(H)]

for y in range(H):
    for x in range(W):
        if x < A and y < B:
            ans[y][x] = '1'
        elif x >= A and y >= B:
            ans[y][x] = '1'

for line in ans:
    print(''.join(line))


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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v.at(i);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int j = v.at(0)+1, ans = 0;
  rep(i, n) {
    // cout << ans << " " << j << " " << v.at(i) << endl;
    if (j > v.at(i)) {
      ans++;
      j = v.at(i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3608
package main

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

/*-----------Main-----------*/

func main() {
	k := readI()
	s := readS()
	if len(s) <= k {
		fmt.Println(s)
	} else {
		fmt.Println(s[:k] + "...")
	}

}

/*-----------Utilities-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-2.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}

func max(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] > m {
			m = a[i]
		}
	}
	return m
}

func min(a []int) int {
	l := len(a)
	m := a[0]
	for i := 1; i < l; i++ {
		if a[i] < m {
			m = a[i]
		}
	}
	return m
}

func sortI(a []int) []int {
	sort.Ints(a)
	return a
}

func reverse(a []int) []int {
	l := len(a)
	r := make([]int, l)
	for i := 0; i < l; i++ {
		r[i] = a[l-i-1]
	}
	return r
}

func countI(a []int, b int) int {
	l := len(a)
	var c int
	for i := 0; i < l; i++ {
		if a[i] == b {
			c++
		}
	}
	return c
}


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

def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    A = list(map(int, input().split()))

    return N, A


def main(A: list) -> None:
    """
    メイン処理.

    Args:\n
        A (list): 身長(1 <= A_i <= 10**9)
    """
    # 求解処理
    ans = 0
    highest = 0
    for A_n in A:
        highest = max(highest, A_n)
        ans += max(highest - A_n, 0)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N, A = get_input()

    # メイン処理
    main(A)


Measured memory_bytes: 31008
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;
#define PI 3.14159265358979323846264338327950L
const int mod =  998244353;



void solve(){
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    
    int all = 0;
    rep(i,n) (all ^= a[i]);
    
    
    rep(i,n){
        int ans = all^a[i];
        cout << ans << " ";
    }
}



int main(){
    solve();
}




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

int main(void) {
    double x1, y1, x2, y2, dx2, dy2, dis;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    dx2 = (x2 - x1)*(x2 - x1);
    if (dx2 < 0) dx2 *= (-1.0);
    dy2 = (y2 - y1)*(y2 - y1);
    if (dy2 < 0) dy2 *= (-1.0);
    dis = sqrt(dx2 + dy2);
    printf("%f\n", dis);

    return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;

struct Node {
	ll p;
	Node *prev, *next;
};

int main() {
	string s; cin >> s;

	int A = s[0] - '0';
	int B = s[1] - '0';
	int C = s[2] - '0';
	int D = s[3] - '0';

	if (A + B + C + D == 7) {
		printf("%d+%d+%d+%d=7", A, B, C, D);
	}
	else if (A - B + C + D == 7) {
		printf("%d-%d+%d+%d=7", A, B, C, D);
	}
	else if (A + B - C + D == 7) {
		printf("%d+%d-%d+%d=7", A, B, C, D);
	}
	else if (A + B + C - D == 7) {
		printf("%d+%d+%d-%d=7", A, B, C, D);
	}
	else if (A - B - C + D == 7) {
		printf("%d-%d-%d+%d=7", A, B, C, D);
	}
	else if (A + B - C - D == 7) {
		printf("%d+%d-%d-%d=7", A, B, C, D);
	}
	else if (A - B + C - D == 7) {
		printf("%d-%d+%d-%d=7", A, B, C, D);
	}
	else if (A - B - C - D == 7) {
		printf("%d-%d-%d-%d=7", A, B, C, D);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
//error_reporting(0);
//$A = explode(" ",trim(fgets(STDIN)));
//$N=trim(fgets(STDIN));
list($N,$A,$B) = explode(" ",trim(fgets(STDIN)));
//$N=trim(fgets(STDIN));
//わからんｗｗ
$s = abs($A - $B)%2;
if ($s == 0) printf("Alice\n");
else printf("Borys\n");


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

using namespace std;

int main(int argc, const char * argv[]) {
   
    int H,A,ans;
    cin >> H >> A;
    if(H%A==0)ans=H/A;
    else ans = H/A +1;
    cout << ans;
    return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  int total = 0;
  for(int i = 0; i < n; i++) {
    cin >> x.at(i);
    if(x.at(i) < k - x.at(i)) {
      total += 2 * x.at(i);
    } else {
      total += 2 * (k-x.at(i));
    }
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>

#define for0(i, N)    for (ll i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (ll i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (ll i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (ll i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (ll i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (ll i = (x), a = 0; a < (N);   \
                              i = (i + 1) % (N), ++a)

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, int){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);
    ll n, m;

    cin >> n >> m;

    // vll v(n, 0);

    vector<ll> v2(n, -1);
    for0(i, m){
        int t, k;
        cin >> t >> k;
        --t;
        if(v2[t] != -1 && v2[t] != k){cout << -1; return 0;}
        v2[t] = k;
    }

    // if(n != 1 && v2[0] == 0){cout << -1; return 0;}

    if (n == 1) {
        cout << (v2[0] == -1 ? 0 : v2[0]);
        return 0;
    }

    if(v2[0] == 0){cout << -1; return 0;}

    for(auto &&x = v2.begin();x != v2.end(); ++x){
        if (x == v2.begin() && *x == -1) {
            cout << 1;
        }else
        cout << (*x == -1 ? 0 : *x);
    }

    return 0;
}


Measured memory_bytes: 256