akhauriyash/Code-Regression huggingface dataset:
data = list(map(int,input().split()))

a_hp = data[0]
a_at = data[1]
b_hp = data[2]
b_at = data[3]

while True:
    if b_hp - a_at <= 0:
        print("Yes")
        break
    elif b_hp - a_at > 0:
        b_hp -= a_at
    
    if a_hp - b_at <= 0:
        print("No")
        break
    elif a_hp - b_at > 0:
        a_hp -= b_at

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

using namespace std;

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, a, b) for (int i = a; i < b; i++)

int main()
{
	int n;
	cin >> n;
	if (n % 2 != 0) n = 2 * n;
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> W(n,0);
    int sum =0;
    rep(i,n){
        cin >> W[i];
        sum+=W[i];
    }
    // cout << sum << endl;
    int mi = 1e9;
    int sum2 = 0;
    for(int i=0; i<n-1; i++){
        sum2+=W[i];
        // cout << "sum2 = " <<sum2 << endl;
        // cout << abs(sum - sum2) - sum2 << endl;
        if(abs( (sum - sum2)- sum2) < mi) mi =abs( (sum - sum2)- sum2);
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <functional>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;




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

    int n, m;
    cin >> n >> m;
    int times = 1;
    int i;
    for(i = 0; i < m; i++) {
        times *= 2;
    }
    cout << times * (m * 1900 + (n - m) * 100);
    return 0;
}



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

typedef long long ll;

const ll MAX_N = 1e5 + 5;
ll n, ans;
ll A[MAX_N];
ll B[MAX_N];
vector <ll> v;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (ll i = 0; i < n; i++) {
		cin >> A[i] >> B[i];
		ans -= B[i];
		v.push_back(A[i] + B[i]);
	}

	sort(v.begin(), v.end());
	for (ll i = n - 1; 0 <= i; i -= 2)
		ans += v[i];

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

Measured memory_bytes: 2676
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a;
	int color[20];
	for (int i = 0; i < 15; i++) {
		color[i] = 0;
	}
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a < 400) color[0]++;
		else if (a < 800) color[1]++;
		else if (a < 1200) color[2]++;
		else if (a < 1600) color[3]++;
		else if (a < 2000) color[4]++;
		else if (a < 2400) color[5]++;
		else if (a < 2800) color[6]++;
		else if (a < 3200) color[7]++;
		else color[8]++;
	}
	int ans = 0;
	for (int i = 0; i < 8; i++) {
		if (color[i] != 0) {
			ans++;
		}
	}
	if (ans == 0) {
		cout << 1 << " " << ans + color[8] << endl;
	}
	else {
		cout << ans << " ";
		ans += color[8];
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N;
    cin >> N;
    vector<ll> A(N+1);
    REP(i,N+1)cin >> A[i];
    if(N == 0){
        if(A[0] == 1){
            cout << 1 << "\n";
        }else{
            cout << -1 << "\n";
        }
    }else{
        bool able = 1;
        ll ablecount = 1;
        REP(i,N+1){
            ablecount-=A[i];
            if(ablecount < 0){
                able = 0;
                break;
            }
            ablecount*=2;
            if(ablecount > LLONG_MAX/20){
                able = 1;
                break;
            }
        }
        if(able){
            ll maxi = 0;
            vector<ll> nowwant(N+1);
            RREP(i,N+1){
                if(i != N){
                    nowwant[i] = nowwant[i+1] + A[i];
                }else{
                    nowwant[N] = A[i];
                }
                maxi+=nowwant[i];
            }
            ll able = 1;
            REP(i,N+1){
                if(nowwant[i] - able>=0){
                    maxi -= nowwant[i] - able;
                    able -= A[i];
                    able *= 2;
                }else{
                    break;
                }
            }
            cout << maxi << "\n";
        }else{
            cout << -1 << "\n";
        }
    }
}

Measured memory_bytes: 4784
import java.util.*;
import java.io.*;

public class Main {

    void solve() {
	int N = sc.nextInt();
	int M = sc.nextInt();

	int x[] = new int[M];
	int y[] = new int[M];

	for (int i = 0; i < M; i++) {
	    x[i] = sc.nextInt();
	    y[i] = sc.nextInt();
	}

	boolean ans[] = new boolean[N+1];
	int num[] = new int[N+1];

	for (int i = 0; i <= N; i++) {
	    ans[i] = false;
	}

	for (int i = 0; i <= N; i++) {
	    num[i] = 1;
	}

	ans[1] = true;

	for (int i = 0; i < M; i++) {
	    num[x[i]]--;
	    num[y[i]]++;
	    if (ans[x[i]] == true && num[x[i]] == 0) {
		ans[x[i]] = false;
		ans[y[i]] = true;
	    } else if (ans[x[i]] == true && num[x[i]] != 0){
		ans[y[i]] = true;
	    } else {
		continue;
	    }
	}

	int a = 0;
	for (int i = 1; i <= N; i++) {
	    if (ans[i] == true) {
		a++;
	    }
	}

	System.out.println(a);
    }

    void print(int[] a) {
	out.print(a[0]);
	for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
	out.println();
    }

    public static void main(String[] args) throws Exception {
	new Main().run();
    }

    MyScanner sc = null;
    PrintWriter out = null;
    public void run() throws Exception {
	sc = new MyScanner(System.in);
	out = new PrintWriter(System.out);
	for (;sc.hasNext();) {
	    solve();
	    out.flush();
	}
	out.close();
    }

    class MyScanner {
	String line;
	BufferedReader reader;
	StringTokenizer tokenizer;

	public MyScanner(InputStream stream) {
	    reader = new BufferedReader(new InputStreamReader(stream));
	    tokenizer = null;
	}
	public void eat() {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		try {
		    line = reader.readLine();
		    if (line == null) {
			tokenizer = null;
			return;
		    }
		    tokenizer = new StringTokenizer(line);
		} catch (IOException e) {
		    throw new RuntimeException(e);
		}
	    }
	}
	public String next() {
	    eat();
	    return tokenizer.nextToken();
	}
	public String nextLine() {
	    try {
		return reader.readLine();
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	public boolean hasNext() {
	    eat();
	    return (tokenizer != null && tokenizer.hasMoreElements());
	}
	public int nextInt() {
	    return Integer.parseInt(next());
	}
	public long nextLong() {
	    return Long.parseLong(next());
	}
	public double nextDouble() {
	    return Double.parseDouble(next());
	}
	public int[] nextIntArray(int n) {
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) a[i] = nextInt();
	    return a;
	}
    }
}


Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
   int cnt=1;
   int m=0;
   bool is=0;
   for(int i=0;i<3;i++)
   {
       if(i+1<3){
       if(s[i]=='R' && s[i+1]=='R')
       {
           is=1;
           cnt++;
       }
       }
   }
    if(s=="SSS"){
    cout<<0;
   }
   else {
    cout<<cnt;
   }
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>

using namespace std;


int main() {

    long N;
    cin >> N;

    vector<long> as;

    for (long i = 0; i < 3 * N; i++) {
        long a;
        cin >> a;
        as.push_back(a);
    }

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

    long f = 0;
    long l = 3 * N - 1;

    long sum = 0;

    while (l > f) {

        sum += as[l - 1];

        f += 1;
        l -= 2;
    }

    cout << sum << "\n";


    return 0;
}

Measured memory_bytes: 5104
r={'N':(1,5,2,3,0,4),'S':(4,0,2,3,5,1),'E':(3,1,0,5,4,2),'W':(2,1,5,0,4,3)}
d=input().split()
for x in input():
    d=[d[y]for y in r[x]]
print(d[0])

Measured memory_bytes: 7476
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;


int main(){

ll n,k;
cin >> n >>k;

int h[n];
rep(i,n)cin >> h[i];
int ans=0;
rep(i,n){
    if(h[i]>=k)ans++;
}

cout << ans << endl;

return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main() {
    int W; cin >> W;
    int H; cin >> H;
    int N; cin >> N;

    vector<int> x, y, a;
    rep(i, N) {
       int xx; cin >> xx;
       int yy; cin >> yy;
       int aa; cin >> aa;
       x.push_back(xx);
       y.push_back(yy);
       a.push_back(aa);
    }

    int xbegin = 0;
    int xend = W;
    int ybegin = 0;
    int yend = H;

    rep(i, N) {
        switch (a[i]) {
            case 1:
                if (xbegin < x[i]) xbegin = x[i];
                break;
            case 2:
                if (xend > x[i]) xend = x[i];
                break;
            case 3:
                if (ybegin < y[i]) ybegin = y[i];
                break;
            case 4:
                if (yend > y[i]) yend = y[i];
                break;
        }
    }
    if (((xend - xbegin) <= 0) || ((yend - ybegin) <= 0)) cout << 0 << endl;
    else cout << (xend - xbegin) * (yend - ybegin) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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


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


#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
int main(){
    int n,m,l=1,r=n,a,b;
    cin>>n>>m;
    REP(i,m){
        cin>>a>>b;
        l=max(a,l);
        r=min(b,r);
    }
    cout<<max(0,r-l+1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>

using namespace std;





int main()
{
	string signal[10] = {
		"0111111",	//0
		"0000110",	//1
		"1011011",	//2
		"1001111",	//3
		"1100110",	//4
		"1101101",	//5
		"1111101",	//6
		"0100111",	//7
		"1111111",	//8
		"1101111"	//9
	};
	int n;
	int num;
	string now_signal;
	string send_signal;
	
	while (cin >> n)
	{
		if (n == -1) break;
		now_signal = "0000000";
		for (int i=0; i<n; i++)
		{
			cin >> num;
			send_signal = "";
			for (int j=0; j<7; j++)
			{
				if (now_signal[j] == signal[num][j])
				{
					send_signal += "0";
				} else {
					send_signal += "1";
				}
			}
			cout << send_signal << endl;
			now_signal = signal[num];
		}
	}
	
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(void) {
	int x, a, b; cin >> x >> a >> b;
	if (b <= a) { cout << "delicious" << endl; }
	else if (b - a > x) { cout << "dangerous" << endl; }
	else cout << "safe" << endl;
	return 0;
}

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

int main() {
    int N, A, B; cin >> N >> A >> B;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        int sum = 0, x = i;
        while (x > 0) {
            sum += x % 10;
            x /= 10;
        }
        if (sum <= B && A <= sum) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <cassert>
#include <random>
#include <stack>
#include <ctime>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    long n;
    cin >> n;
    long m = 1;
    for (; m * (m + 1) / 2 < n; m++);
    VI ans;
    long sum = 0;
    for (int i = 1; i <= m; i++) {
        if (i != m * (m + 1) / 2 - n) {
            ans.push_back(i);
            sum += i;
        }
    }
    assert(sum == n);
    for (auto a: ans) {
        cout << a << endl;
    }
}


Measured memory_bytes: 384
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time,heapq
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n,m = invr()
    a = inlt()
    a = list(map(lambda x : x * (-1),a))
    heapq.heapify(a)
    for i in range(m):
      heapq.heappush(a,-(-heapq.heappop(a) // 2))
    print(-sum(a))
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)

def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))

def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))
#-----------------------------------------------------------------------#
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Measured memory_bytes: 94232
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}

int get4(int a[],int d){
	return a[d+3]*1000+a[d+2]*100+a[d+1]*10+a[d];
}

int main(void){
	int m,n,a[72],i,j;
	char *t[72];
	for(i=0;i<72;i++){
		t[i]=(char *)calloc(10,sizeof(char));
	}
	t[4]="Man";
	t[8]="Oku";
	t[12]="Cho";
	t[16]="Kei";
	t[20]="Gai";
	t[24]="Jo";
	t[28]="Jou";
	t[32]="Ko";
	t[36]="Kan";
	t[40]="Sei";
	t[44]="Sai";
	t[48]="Gok";
	t[52]="Ggs";
	t[56]="Asg";
	t[60]="Nyt";
	t[64]="Fks";
	t[68]="Mts";
	while(1){
		m=in();
		n=in();
		if(m==0){
			break;
		}
		memset(a,0,sizeof(a));
		a[0]=1;
		for(i=0;i<n;i++){
			for(j=0;j<72;j++){
				a[j]*=m;
			}
			for(j=0;j<71;j++){
				a[j+1]+=a[j]/10;
				a[j]%=10;
			}
		}
		for(i=68;i>=0;i-=4){
			int tmp=get4(a,i);
			if(tmp!=0){
				printf("%d",tmp);
				printf("%s",t[i]);
			}
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 624
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while(getline(ss,x,c)) v.emplace_back(x); return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

unordered_map<int,int> dp[2][112];

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n,p;
  cin>>n>>p;
  vector<int> x(n),y(n);
  rep(i,n) cin>>x[i]>>y[i];
  unordered_map<int,int> *cur=dp[0],*nxt=dp[1];
  cur[0][0]=0;
  //cout<<n<<","<<p<<endl;h
  rep(i,n){//cout<<i<<endl;
    rep(j,112) nxt[j].clear();
    rep(j,i+1)for(pii p:cur[j]){
      if(max(0,x[i]-p.X)>=y[i]){
	if(nxt[j+1].count(0)==0 || nxt[j+1][0]>p.Y) nxt[j+1][0]=p.Y;
      }else{
	int t=y[i]-max(0,x[i]-p.X);
	if(nxt[j+1].count(t)==0 || nxt[j+1][t]>p.Y+t) nxt[j+1][t]=p.Y+t;
      }
      if(nxt[j].count(0)==0 || nxt[j][0]>p.Y) nxt[j][0]=p.Y;
    }
    // rep(j,110)if(nxt[j].size()){
    //   cout<<j<<":";for(pii p:nxt[j])cout<<p.X<<","<<p.Y<<"  ";cout<<endl;
    // }
    swap(nxt,cur);
  }
  int re=0;
  rep(i,112)for(pii q:cur[i])if(q.Y<=p) re=i;
  cout<<re<<endl;
  return 0;
}

Measured memory_bytes: 3184
#include <stdio.h>
int main()
{
	long long int N, A,B;
	scanf("%lld %lld %lld",&N,&A,&B);
    if(A>B)printf("0");else{
	if(N>=2)printf("%lld", (N-2)*(B-A) +1);
    
    if(N==1){if(A==B)printf("1");else printf("0");}}
    
    
 
 
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
main(){
  double heikin;
  int gokei=0,sum=0,a,b,i=0;
 
  while(scanf("%d,%d",&a,&b)!=EOF){
    gokei+=a*b;
    sum+=b;
    i++;
  }
  heikin=(double)(sum)/(double)(i)+0.5;
  printf("%d\n%.0f\n",gokei,heikin);
  return 0;
}

Measured memory_bytes: 628
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M;
    cin >> N >> M;
    vector<int>V(N);
    rep(i,0,N)cin >> V[i];
    vector<P> T(M);
    rep(i,0,M){
        int a,b;
        cin >> a >> b;
        T[i] = P(b,a);
    }
    sort(V.begin(), V.end());
    sort(T.rbegin(), T.rend());

    int idx = 0;
    ll sum = 0;
    rep(i,0,M){
        rep(j,0,T[i].second){
            if(V[idx] < T[i].first && idx < N){
                sum += T[i].first;
                idx++;
            }else{
                i=M;
                break;
            }
        }
    }
    for(int i = idx;i < N;i++){
        sum += V[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<queue>
#include<algorithm>
#define INF 999999999
using namespace std;

int res[101];
int G[101][101] = {0};

int main() {
    int n, u, v, k;
    std::queue<int> Q;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> u >> k;
        for (int j = 0; j < k; j++) {
            std::cin >> v;
            G[u - 1][v - 1] = 1;
        }
    }

    for (int i = 0; i < n; i++) res[i] = INF;

    Q.push(0);
    res[0] = 0;

    while (! Q.empty()) {
        u = Q.front();
        for (int i = 0; i < n; i++) {
            if (G[u][i]) {
                Q.push(i);
                res[i] = std::min(res[i], res[u] + 1);
                G[u][i] = 0;
            }
        }
        Q.pop();
    }

    for (int i = 0; i < n; i++) {
        if (res[i] != INF) std::cout << i + 1 << " " << res[i] << "\n";
        else std::cout << i + 1 << " -1\n";
    }

    return 0;
}


Measured memory_bytes: 3116
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
const int D_MAX_V=2102;
const int D_v_size=2102;
struct D_wolf{
	int t,c,r;
	D_wolf(){t=c=r=0;}
	D_wolf(int t1,int c1,int r1){
		t=t1;c=c1;r=r1;
	}
};
vector<D_wolf>D_G[D_MAX_V];
int D_level[D_MAX_V];
int D_iter[D_MAX_V];

void add_edge(int from,int to,int cap){
	D_G[from].push_back(D_wolf(to,cap,D_G[to].size()));
	D_G[to].push_back(D_wolf(from,0,D_G[from].size()-1));
}
void D_bfs(int s){
	for(int i=0;i<D_v_size;i++)D_level[i]=-1;
	queue<int> Q;
	D_level[s]=0;
	Q.push(s);
	while(Q.size()){
		int v=Q.front();
		Q.pop();
		for(int i=0;i<D_G[v].size();i++){
			if(D_G[v][i].c>0&&D_level[D_G[v][i].t]<0){
				D_level[D_G[v][i].t]=D_level[v]+1;
				Q.push(D_G[v][i].t);
			}
		}
	}
}
int D_dfs(int v,int t,int f){
	if(v==t)return f;
	for(;D_iter[v]<D_G[v].size();D_iter[v]++){
		int i=D_iter[v];
		if(D_G[v][i].c>0&&D_level[v]<D_level[D_G[v][i].t]){
			int d=D_dfs(D_G[v][i].t,t,min(f,D_G[v][i].c));
			if(d>0){
				D_G[v][i].c-=d;
				D_G[D_G[v][i].t][D_G[v][i].r].c+=d;
				return d;
			}
		}
	}
	return 0;
}
int max_flow(int s,int t){
	int flow=0;
	for(;;){
		D_bfs(s);
		if(D_level[t]<0)return flow;
		for(int i=0;i<D_v_size;i++)D_iter[i]=0;
		int f;
		while((f=D_dfs(s,t,99999999))>0){flow+=f;}
	}
	return 0;
}
int g[110][110];
int x[1100];
int y[1100];
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a){
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)
			g[i][j]=999999999;
		for(int i=0;i<a;i++)g[i][i]=0;
		for(int i=0;i<b;i++){
			int p,q,r;scanf("%d%d%d",&p,&q,&r);
			g[p][q]=g[q][p]=r;
		}
		for(int k=0;k<a;k++)for(int i=0;i<a;i++)for(int j=0;j<a;j++)
			g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
		for(int i=0;i<D_MAX_V;i++){
			D_G[i].clear();
			D_iter[i]=D_level[i]=0;
		}
		for(int i=0;i<c;i++)scanf("%d%d",x+i,y+i);
		int s=c*2;
		int t=c*2+1;
		for(int i=0;i<c;i++){
			add_edge(s,i,1);
			add_edge(i+c,t,1);
		}
		for(int i=0;i<c;i++)for(int j=0;j<c;j++){
			if(y[i]>=y[j])continue;
			if(y[i]+g[x[i]][x[j]]<=y[j]){
				add_edge(i,j+c,1);
			}
		}
		printf("%d\n",c-max_flow(s,t));
	}
}

Measured memory_bytes: 26116
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1; char ch=getchar();
    while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();}
    return x*f;
}

const int N = 5005;
const int MOD = 1000000007;

struct edge{int go,next;} e[N<<1]; int cnt=0,last[N]; inline void ins(int u,int v) {e[++cnt].go=v; e[cnt].next=last[u]; last[u]=cnt;}

int n,ans=0;
int f[N];
int size[N],dp[N][N];

inline void add(int *a,int n,int *b,int m) {
	int ret[N];	rep(i,0,n+m) ret[i]=0;
	rep(i,0,n) rep(j,0,m) {
		ret[i+j]=(ret[i+j]+(LL)a[i]*b[j])%MOD;
		if (j%2==0) ret[i]=(ret[i]+MOD-(LL)((LL)a[i]*b[j]%MOD)*f[j/2])%MOD;
	}
	rep(i,0,n+m) a[i]=ret[i];
}

inline void dfs(int x,int fa) {
	size[x]=1; dp[x][1]=1;
	for (int i=last[x];i;i=e[i].next) {
		if (e[i].go==fa) continue;
		dfs(e[i].go,x);
		add(dp[x],size[x],dp[e[i].go],size[e[i].go]);
		size[x]+=size[e[i].go];
	}
}

int main() {

	#ifndef ONLINE_JUDGE
	//	freopen("data.in","r",stdin);
	//	freopen("data.out","w",stdout);
	#endif

	n=read(); rep(i,1,n-1) {int u=read(),v=read(); ins(u,v); ins(v,u);}
	f[0]=1; rep(i,1,n/2) f[i]=((LL)(2*i-1)*f[i-1])%MOD; dfs(1,0);
	for (int i=2;i<=n;i+=2) ans=(ans+(LL)f[i/2]*dp[1][i])%MOD;
	printf("%d\n",ans);

	return 0;
	
}


Measured memory_bytes: 96896
#!/usr/bin/env python
# coding: utf-8

from collections import Counter

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    ds = Counter()
    for _ in range(n):
        s = input()
        s = "".join(sorted(s))
        ds[s] += 1
    ans = 0
    for c in ds.values():
        ans += (c-1)*c//2
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, n;
	cin >> a >> b >> n;
	ll r = 0, l = n + 1;
	ll now = 0;
	auto f = [&](ll x) {
		ll res = floor(a * x / b) - a * floor(x / b);
		return res;
	};
	while (l - r > 1) {
		ll mid = (l + r) / 2;
		if (now <= f(mid)) {
			now = f(mid);
			r = mid;
		}
		else l = mid;
	}
	cout << now << endl;
	return 0;
}


Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m,l,r;
    s="aeiou";
    char c;
    cin>>c;
    for(char cc:s)
    {
        if(c==cc)
        {
            cout<<"vowel\n";
            return 0;
        }
    }
    cout<<"consonant\n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll                          long long
#define in(a)                       ll a; cin>>a;
#define in2(a,b)                    ll a,b; cin>>a>>b;
#define in3(a,b,c)                  ll a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                ll a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              ll a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define pb                          push_back
#define bhar(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"                       
#define ce(x)                       cout<<x<<"\n";
#define nl                          cout<<endl;
#define jaldi                       ios_base::sync_with_stdio(false);cin.tie(NULL);
#define dekh_lo                     ce("dekh_lo");
#define sz(x)                       (ll)x.size()
#define re                          return

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;

const ll mod=1e9+7;
const ll N=4e5+5;
ll i,j;

/*


*/

void solve(){
    in(n);
    vi a(n); vi b(n);
    for(i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(i=0;i<=n-3;i++){
        bool f=0;
        for(j=i;j<i+3;j++){
            if(a[j]!=b[j]){
                f=1;
            }
        }
        if(!f){
            ce("Yes");
            re;
        }
    }
    ce("No");
}

int32_t main(){
    // jaldi
    ll t; 
    // cin>>t;
    t=1;     
    while(t--){
        solve();
    }
}

/*


*/

  

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int h = sc.nextInt();
		int w = sc.nextInt();

		for (int i = 0; i < w + 2; i++) {
			System.out.print('#');
		}
		System.out.println();

		for (int i = 0; i < h; i++) {
			System.out.println('#' + sc.next() + '#');
		}

		for (int i = 0; i < w + 2; i++) {
			System.out.print('#');
		}
		System.out.println();
		sc.close();
	}

}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && b[i] == c[i]) {
            continue;
        } else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) {
            ans++;
        } else {
            ans += 2;
        }
    }

    cout << ans << "\n";
    return 0;
}

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

int main(){
int A,B,C,D;
cin>>A>>B>>C>>D;
if(A+B==C+D){
  cout<<"Balanced"<<endl;
  }
else if(A+B>C+D){
  cout<<"Left"<<endl;
  }
else{
  cout<<"Right"<<endl;
  }

}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

farm=[]
latt=[]

for i,x in enumerate(a):
    if i%2 == (n-1)%2:
        farm.append(x)
    else:
        latt.append(x)
farm.reverse()
ans = farm + latt

print(*ans)

Measured memory_bytes: 26180
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> a(h+1,vector<char>(w+1));
  vector<vector<int>> dp(h+1,vector<int>(w+1));
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin >> a[i][j];
      if(a[i][j]=='#'){
        continue;
      }
      if(i==1&&j==1){
        dp[1][1]=1;
      }
      else{
        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
      }
    }
  }
  cout << dp[h][w] << endl;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define PRECISION(x) cout << fixed << setprecision(x); 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(i,n) for (int i = 0; i < n; ++i)
#define DO(X) while(X--)
#define DRI(X) int (X); cin >> X
#define DRII(X, Y) int X, Y; cin >> X >> Y
#define DRIII(X, Y, Z) int X, Y, Z; cin >> X >> Y >> Z
#define read(X) for(int &ele : (X)) cin >> ele
#define readI(X) for(int idx = 1; idx < SZ((X)); ++idx) cin >> (X)[idx]
#define debug(x) cerr << '>' << #x << ':' << x << endl
#define MP make_pair
#define PB push_back
#define F first
#define S second

using namespace std;
typedef long long LL;
const int INF = 1<<29;
inline int in() { int x; cin >> x; return x; }
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }

int main(){
	FAST_IO 
	string oneS, twoS; cin >> oneS >> twoS;
	cout << twoS << oneS << "\n";
	return 0;
}

Measured memory_bytes: 256
n = int(input())
lsta = [0] + list(map(int,input().split()))
lstb = [0] + list(map(int,input().split()))
lstc = [0] + list(map(int,input().split()))
ans = 0
kept = -10
for i in range(1,n+1):
    ans += lstb[lsta[i]]
    if lsta[i] == kept + 1:
        ans += lstc[kept]
    kept = lsta[i]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int K, X;
  cin >> K >> X;
  int L = max(-1000000, X-K+1);
  int R = min(1000000, X+K-1);
  cout << L;
  for (int i=L+1; i<=R; i++) {
    cout << ' ' << i;
  }
  cout << endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i <= n; i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

typedef long long ll;

using namespace std;

/////////////////////////////////////////////////

int r;

void input()
{
    cin >> r;
}

void solve()
{
    cout << r * r << endl;
}

/////////////////////////////////////////////////

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

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

int dist(vector<int> a, vector<int> b){
  int tmp = 0;
  for(int i = 0; i < a.size(); i++){
    tmp += (a[i] - b[i]) * (a[i] - b[i]);
  }
  return tmp;
}

bool int_check(int n){
  bool flag = false;
  for(int i = 1; i <= 200; i++){
    if(n == i * i){
      flag = true;
      break;
    }
  }
  return flag;
}



int main(){
  int N,D;
  cin >> N >> D;
  vector<vector<int>> v(N,vector<int>(D));
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++){
      cin >> v[i][j];
    }
  }
  
  int ans = 0;
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      if(int_check(dist(v[i],v[j])))ans++;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        arr: [usize; n],
    }

    let vec_even = arr.iter().filter(|e| !**e&1 > 0).collect::<Vec<&usize>>();
    let cnt_even = vec_even.len();
    let cnt_4 = vec_even.iter().filter(|e| **e%4==0).count();
    if cnt_4*2+1 >= n {
        println!("Yes");
    } else {
        if n-cnt_even <= cnt_4 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}

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

x=[int(i)for i in input().split()]


count=1

state=0

for i in range(1,n):
    a=state
    d=x[i]-x[i-1]
    if(d>0):
        state=1
    elif(d==0):
        pass
    elif(d<0):
        state=-1
    if(state*a==-1):
        count+=1
        state=0

    


print(count)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll Xor(ll a,ll b){
    return a * (a & 1) ^ b * !(b & 1) ^ !!(((a ^ b) + 1) & 2);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a,b,i,ans;
    cin>>a>>b;
    cout<<Xor(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d', $n, $k);

$ans = 0;
for($i = 1; $i <= $n; $i++) {
    $p = $i;
    $j = 0;
    while ($p <= $k - 1) {
        $p *= 2;
        $j++;
    }
    $ans += 1 / $n * 1 / (2 ** $j);
}
echo $ans . PHP_EOL;

Measured memory_bytes: 4728
/**
*    created: 14.06.2020 20:53:39
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    int x, y;
    cin >> x >> y;
    rep(t,101){
        rep(k,101){
            if(2*t+4*k==y){
                if(t+k==x){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> w(n);
    for(int i = 0; i < n; i++) {
        cin >> w[i];
    }
    bool ok = true;
    set<string> se;
    se.insert(w[0]);
    for(int i = 1; i < n; i++) {
        if(se.count(w[i])) {
            ok = false;
        }
        if(w[i - 1].back() != w[i].front()) {
            ok = false;
        }
        se.insert(w[i]);
    }
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
   long sx,sy,tx,ty,i;
   cin>>sx>>sy>>tx>>ty;
   for(i=1;i<=(tx-sx);i++)
    cout<<"R";
    for(i=1;i<=(ty-sy);i++)
    cout<<"U";
    for(i=1;i<=(tx-sx);i++)
    cout<<"L";
    for(i=1;i<=(ty-sy);i++)
    cout<<"D";
    cout<<"D";
    for(i=1;i<=(tx-sx+1);i++)
    cout<<"R";
    for(i=1;i<=(ty-sy+1);i++)
    cout<<"U";
    cout<<"L";
    cout<<"U";
    for(i=1;i<=(tx-sx+1);i++)
    cout<<"L";
    for(i=1;i<=(ty-sy+1);i++)
    cout<<"D";
    cout<<"R";
    return 0;
}

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

int main(){
  int a,N,max=0,min=1000000001;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> a;
    if(a>max){max=a;}
    if(a<min){min=a;}
  }
  cout << max-min << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
ll n,bas=5,ans;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	if(n&1) return puts("0"),0;
	n/=2;
	while(1){
		ans+=n/bas;
		if(n/bas<5) break;
		bas*=5;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAXS 100000
#define MAXT 50000

int binarySearch(int A[],int n,int key )
{
  int left=0,right=n,mid;
  while(left<right){
    mid = (left+right)/2;
    if( key == A[mid] )
      return 1;
    else if( key > A[mid] )
      left = mid+1;
    else
      right = mid;
  }
    return 0;
  
}

int main()
{
  int n,q,S[MAXS],T[MAXT],i,count=0;

  scanf("%d",&n);
  for( i=0 ; i<n; i++ ){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for( i=0 ; i<q ; i++ ){
    scanf("%d",&T[i]);
    if( binarySearch(S,n,T[i]) )
      count++ ;
  }


  printf("%d\n",count);

  return 0;
  
}



Measured memory_bytes: 2316
#include<iostream>
using namespace std;
 
int main(){
 
  int h[5];
  int f[4];
 
  while(1){
    for(int i=0;i<4;i++) f[i]=0;
    for(int i=0;i<5;i++){
      cin>>h[i];
      if(h[i]==0) break;
      f[h[i]]=1;
    }
    if(h[0]==0) break;
 
    int x[2], cnt=0;
    for(int i=1;i<4;i++){
      if(f[i]==1)
    x[cnt++]=i;
      //cout<<i<<" "<<f[i]<<endl;
    }
    //cout<<"    "<<cnt<<" "<<x<<endl;
    if(cnt==2){
      if(x[0]==1&&x[1]==2){
    for(int i=0;i<5;i++){
      if(h[i]==1) cout<<1<<endl;
      else cout<<2<<endl;
    }
      }
      if(x[0]==1&&x[1]==3){
    for(int i=0;i<5;i++){
      if(h[i]==1) cout<<2<<endl;
      else cout<<1<<endl;
    }
      }
      if(x[0]==2&&x[1]==3){
    for(int i=0;i<5;i++){
      if(h[i]==2) cout<<1<<endl;
      else cout<<2<<endl;
    }
      }
    }else{
      for(int i=0;i<5;i++) cout<<3<<endl;
    }
  }
   
  return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair
#define MOD 2019

using namespace std;

int main(){

    int N;
    cin >> N;
    if(N>=1000)cout << "ABD" << endl;
    else cout << "ABC" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define MIN 1
 
int main(void){
 
    int a, b;
    scanf("%d %d", &a, &b);
 
    if(a >= MIN && b <= MAX){
 
        printf("%d %d\n", a * b, 2 * (a + b));
    }
    return 0;
}

Measured memory_bytes: 2624
# -*- coding: utf-8 -*-
W, H, N = map(int, input().split())
area = [[1] * H for i in range(W)]

def fill(x0, y0, x1, y1):
    for j in range(x1 - x0):
        for k in range(y1 - y0):
            area[x0+j][y0+k] = 0
  
for i in range(N):
    x, y, a = map(int, input().split())
    x0 = x if a == 2 else 0
    y0 = y if a == 4 else 0
    x1 = x if a == 1 else W
    y1 = y if a == 3 else H
    fill(x0, y0, x1, y1)

print(sum(map(sum, area)))
  


Measured memory_bytes: 3064
def solve(n, H):
    count = 0
    max_count = 0

    prev = H.pop(0)
    for h in H:
        if h <= prev:
            count += 1
        else:
            if max_count < count:
                max_count = count
            count = 0
        prev = h

    if max_count < count:
        max_count = count

    return max_count

_n = int(input())
_H = list(map(int, input().split()))
print(solve(_n, _H))

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, d, x; cin >> n >> d >> x;
  vector<int> A(n); rep(i, n) cin >> A[i];
  ll ans = x;
  rep(i, n) ans += (d-1)/A[i]+1;
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 3604
//Build Stairs

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    int n;cin>>n;
    vector<ll>a(n);
    rep(i,0,n)cin>>a[i];
    ll c=0,t=0;
    rep(i,0,n-1){
        if(a[i]>a[i+1]){
            if(a[i]>t)t=a[i];
            if(a[i]<t){cout<<"No"<<nnn;return 0;}
            a[i]--;
            c++;
        }
        if(a[i]>a[i+1]){cout<<"No"<<nnn;return 0;}

    }
    cout<<"Yes"<<nnn;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define INF 1000000007
using namespace std;

int n,m,dp[100010][20],val[100010];
int num[20][20];
vector<int> v;

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int a,b,c;
		cin>>a>>b>>c;
		num[a][b]=num[b][a]=c;
	}
	val[0]=0;
	for(int i=1;i<(1<<n);i++){
		v.clear();
		for(int j=1;j<=n;j++) if(i&(1<<(j-1))){
			v.push_back(j); 
		}
		val[i]=val[i^(1<<(v[0]-1))];
		for(int j=1;j<v.size();j++){
			val[i]+=num[v[0]][v[j]];
		}
	}
	for(int i=0;i<(1<<n);i++) for(int j=1;j<=n;j++) dp[i][j]=INF;
	for(int i=1;i<(1<<n);i++){
		if(i==1) dp[i][1]=0;
		for(int j=1;j<=n;j++) if(i&(1<<(j-1))){
			int xx=(1<<(j-1));
			for(int k=1;k<=n;k++) if((!(i&(1<<(k-1))))&&(num[j][k]!=0)){
				int yy=(1<<(k-1));
				int sum=val[i^xx^yy]-val[i^xx];
				dp[i^yy][k]=min(dp[i^yy][k],dp[i][j]+sum);
			}
			int zz=((1<<n)-1)^i;
			for(int mask=zz;mask>0;mask=(mask-1)&zz){
				int sum=val[i^xx^mask]-val[i^xx]-val[mask];
				dp[i^mask][j]=min(dp[i^mask][j],dp[i][j]+sum);
			}
		}
	}
	cout<<dp[(1<<n)-1][n]<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG dpmatome/a.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int N;
    cin >> N;
    int h[N + 1];
    for(int i = 1; i <= N; i++){
        cin >> h[i];
    }

    int dp[N + 1];
    dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    for(int i = 3; i <= N; i++){
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[N] << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main(void){
	int n,i,j,m,count;
	scanf("%d",&n);
	count=n;
	int a[n];
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		j=2;
		while(j<=sqrt(a[i])){
			if(a[i]%j==0){
				count--;
				break;
			}else{
				j++;
			}
		}
	}
	printf("%d\n",count);
}


Measured memory_bytes: 2100