akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	sc := NewScanner()
	A := sc.NextIntArray()
	K := sc.NextInt()
	cnt := 0
	for i := 1; i < 3; i++ {
		for A[i-1] >= A[i] {
			A[i] *= 2
			cnt++
			if cnt > K {
				fmt.Println("No")
				return
			}
		}
	}
	fmt.Println("Yes")

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1772
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

void solve() {
	static const int MAXN = 1e5;
	static int p[MAXN], q[MAXN];

	int x, y, a, b, c;
	priority_queue<int> heap;

	cin >> x >> y >> a >> b >> c;
	for (int i = 0; i < a; ++i) cin >> p[i];
	for (int i = 0; i < b; ++i) cin >> q[i];
	for (int i = 0; i < c; ++i) {
		int r;
		cin >> r;
		heap.push(r);
	}
	sort(p, p + a, greater<int>());
	sort(q, q + b, greater<int>());

	for (int i = 0; i < x; ++i) heap.push(p[i]);
	for (int i = 0; i < y; ++i) heap.push(q[i]);

	ll ans = 0;
	for (int i = 0; i < x + y; ++i) {
		ans += heap.top();
		heap.pop();
	}
	cout << ans << "\n";
}

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int o_o = 1;
  if (!o_o) cin >> o_o;
  for (; o_o; --o_o) solve();
  return 0;
}


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

int main() {
	long N; cin >> N;
	vector<long> a(N);
	long sum=0, dd=((1+N)*N)/2;
	for(int i=0; i<N; ++i){
	    cin >> a[i];
	    sum += a[i];
	}
	if(sum%dd>0){
	    cout << "NO" << endl;
	    return 0;
	}
	sum /= dd;
	long cnt=0;
	for(int i=0; i<N; ++i){
	    if((a[i]-a[(i+1)%N]+sum)%N>0 || a[i]-a[(i+1)%N]+sum<0){
	        cout << "NO" << endl;
	        return 0;
	    }
	    cnt += (a[i]-a[(i+1)%N]+sum)/N;
	}
	if(cnt==sum) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


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

int main()
{
  int n,x;
  while(true){
    int nya = 0;
    cin >> n >> x;
    if ( n == 0 && x == 0 ) return 0;

    for (int i=1; i<=n; i++)
    {
      for (int j=i+1; j<=n; j++)
      {
        for (int k=j+1; k<=n; k++)
        {
          if ( i+j+k == x )
          {
            nya += 1;
            break;
          }
        }
      }
    }

    cout << nya << endl;
  }
}

Measured memory_bytes: 1160
import java.util.*;
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double a,b,c,d,e,f,x,y;
		while(sc.hasNextInt()){
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			d = sc.nextInt();
			e = sc.nextInt();
			f = sc.nextInt();
			x=(c*e-b*f)/(a*e-b*d);
			y=(f*a-c*d)/(a*e-d*b);
			if(x==-0){
				x=0;
			}
			if(y==-0){
				y=0;
			}
			System.out.printf("%.3f %.3f\n",x,y);
		}	
	}
}

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

int main() {
	int n;
	vector<double>v;
	vector<char>a, b, c, d, e, f;
	double ba;
	int ca=0, cb=0, cc=0, cd=0, ce=0, cf=0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin>>ba;
		v.push_back(ba);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < n; i++) {
		if (v[i] < 165) { ca++; }
		else if (v[i] >= 165 && v[i] < 170) { cb++; }
		else if (170 <= v[i] && v[i] < 175) { cc++; }
		else if (175 <= v[i] && v[i] < 180) { cd++; }
		else if (180 <= v[i] && v[i] < 185) { ce++; }
		else { cf++; }
	}
	cout << "1:";
	for (int i = 0; i < ca; i++) {
		a.push_back('*');
		cout << a[i];
	}
	cout << '\n'<<"2:";
	for (int i = 0; i < cb; i++) {
		b.push_back('*');
		cout << b[i];
	}
	cout << '\n' << "3:";
	for (int i = 0; i < cc; i++) {
		c.push_back('*');
		cout << c[i];
	}
	cout << '\n' << "4:";
	for (int i = 0; i < cd; i++) {
		d.push_back('*');
		cout << d[i];
	}
	cout << '\n' << "5:";
	for (int i = 0; i < ce; i++) {
		e.push_back('*');
		cout << e[i];
	}
	cout << '\n' << "6:";
	for (int i = 0; i < cf; i++) {
		f.push_back('*');
		cout << f[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    unsigned long long N, B, R;
    cin >> N >> B >> R;
    unsigned long long res = N % (B + R), loop = N / (B + R);
    if(res > B) cout << (loop + 1) * B << endl;
    else cout << loop * B + res << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{  
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++)
		cin>>a.at(i);
	sort(a.begin(),a.end(),greater<int>());
	int64_t s=0;
	for(int i=1;i<n;i++)
		s+=a.at(i/2);
	cout<<s<<endl;
}


Measured memory_bytes: 4008
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

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

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;

int main() {
	int n, m, i, j, k;
	lli ans;
	vector< pair<lli,lli> > ab;

	cin >> n >> m;

	rep(i, n) {
		cin >> j >> k;
		ab.push_back(make_pair(j, k));
	}
	sort(ab.begin(), ab.end());

	ans = 0;
	k = 0;
	rep(i, n) {
		if (k + ab[i].second >= m) {
			ans += ab[i].first*(m - k);
			break;
		}
		else {
			ans += ab[i].first*ab[i].second;
			k += ab[i].second;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 2420
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  double r;cin>>r;
  printf("%.12lf\n",2*r*M_PI);
  return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n;++i){
        if(i<10)
            ans++;
        if(i>99 && i<1000)
            ans++;
        if(i>9999 && i!=100000)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int x = 0;
		int y = 0;
		int tmp = 0;
		Scanner sc= new Scanner(System.in);

		while( true ) {

			x = sc.nextInt();
			y = sc.nextInt();

			if( ( x == 0 ) && ( y == 0 ) ) {
				break;
			}

			if( x > y ) {
				tmp = x;
				x = y;
				y = tmp;
			}
			
			System.out.println( x + " " + y );
		}
		sc.close();
	}

}


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

using namespace std;

typedef pair<int, int> pii;
typedef pair< pii, int> piii;

int T, P, R;
int wrong[55][11];

int main() {
	while (1) {
		cin >> T >> P >> R; if (T == 0 && P == 0 && R == 0) break;
		
		memset(wrong, 0, sizeof(wrong));
		
		vector<piii> result;
		for (int i = 0; i < T; i++) {
			result.push_back(make_pair( make_pair(0, 0), i + 1));
		}
		
		for (int i = 0; i < R; i++) {
			int t, p, time;
			string mes;
			cin >> t >> p >> time >> mes;
			
			if (mes == "CORRECT") {
				result[t - 1].first.first--;
				result[t - 1].first.second += wrong[t][p] * 1200 + time;
			} else {
				wrong[t][p]++;
			}
		}
		
		sort(result.begin(), result.end());
		
		for (int i = 0; i < T; i++) {
			piii p = result[i];
			cout << p.second << " " << -p.first.first << " " << p.first.second << endl;
		}
	}
	
	return 0;
}

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

using namespace std;

#define ll long long



int main()
{
    int n, k;
    cin >> n >> k;
    vector <pair <int, int>> edge;
    for (int i=0; i<n; ++i)
        for (int j=i+1; j<n; ++j)
            edge.push_back({i, j});

    if (k > (n-1) * (n-2) / 2)
        cout << -1;
    else {
        for (int i=0; i<k; ++i)
            edge.pop_back();
        cout << n * (n - 1) / 2 - k << endl;
        for (auto e:edge)
            cout << e.first + 1 << " " << e.second + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int a,b;
	scanf("%d",&a);
	if(a>194){
		b=5;
	}else{
		if(a>188){
			b=4;
		}else{
			if(a>164){
				b=3;
			}else{
				if(a>134){
					b=2;
				}else{
					if(a>104){
						b=1;
					}else{
						b=0;
					}
				}
			}
		}
	}
	printf("%d",b);
	return 0;
}

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

int main()
{
	int k;
	cin >> k;
	vector<vector<int>> al(10);
	al[0] = { 0,1 };
	al[9] = { 8,9 };
	for (int i = 1; i <= 8; i++) {
		for (int j = i - 1; j <= i + 1; j++) al[i].push_back(j);
	}

	ll count = 0;
	queue<ll> q;
	for (int i = 1; i < 10; i++) q.push(i);
	for (int i = 0; i < k - 1; i++) {
		ll s = q.front();
		q.pop();
		for (int j = 0; j < al[s % 10].size(); j++) q.push(s * 10 + al[s % 10][j]);
	}
	cout << q.front() << endl;
}


Measured memory_bytes: 1792
def partition(A,p,r):

	x = A[r]
	i = p - 1

	for j in range(p,r):
		if A[j] <= x:
			i += 1
			A[i],A[j] = A[j],A[i]

	A[i+1],A[r] = A[r],A[i+1]

	return i+1

if __name__ == '__main__':

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

	end = len(A)
	p = 0
	r = end - 1
	cnt = partition(A,p,r)

	ans = []
	for i,j in enumerate(A):
		if i == cnt:
			ans.append("["+str(j)+"]")
		else:
			ans.append(str(j))

	print(" ".join(ans))
	



Measured memory_bytes: 16596
#include<bits/stdc++.h>
using namespace std;
void die()
{
	cout<<"UNRESTORABLE\n";
	exit(0);
}
int main()
{
	string S,T;
	cin>>S>>T;
	int LS=S.length(),LT=T.length(),Last_Pos;
	bool Flag=false;
	for(int i=0;i<LS-LT+1;i++)
	{
		bool F=true;
		for(int j=0;j<LT;j++)
			if(S[i+j]!=T[j]&&S[i+j]!='?')
			{
				F=false;
				break;
			}
		if(F)
			Last_Pos=i,
			Flag=true;
	}
	if(!Flag)
		die();
	for(int i=0;i<LS;i++)
		if(S[i]=='?')
			S[i]='a';
	cout<<S.substr(0,Last_Pos)<<T<<S.substr(Last_Pos+LT)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    cout << min(C, B / A) << endl;
    return 0;
}

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

mod = 10**9 + 7


ans = 1
cnt = [0 for i in range(3)]
for i in range(n):
    count = 0
    for j in range(3):
        if cnt[j] == a[i]:
            count += 1
    ans *= count
    ans %= mod
    for j in range(3):
        if cnt[j] == a[i]:
            cnt[j] += 1
            break


print(ans)

Measured memory_bytes: 53004
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
 
using namespace std;
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
	if(a>b)
		return a;
	return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 
 
 
 
int main()
{
	
	int n,k;
    cin>>n>>k;
    ll sum=0;
    vector <ll> h(n);
    for(int i=0;i<n;i++)
        cin>>h[i];
    sort(h.begin(),h.end());
    int i=n-1;
    i-=(min(n,k));
    while(i>=0)
    {
        sum+=h[i];
        i--;
    }
    cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <math.h>
#include <stdio.h>
#include<map>
#include<queue>
#define INF 100000000
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
int main(){
	int n,m,k,l,a,h;
	while(cin>>n>>m>>l>>k>>a>>h,n||m||l||k||h||a){
		vector<vector<int> > cost(n,vector<int>(n,INF));
		map<int,bool> hos;
		for(int i=0;i<l;i++){
			int x;
			cin>>x;
			hos[x]=true;
		}

		for(int i=0;i<k;i++){
			int x,y,t;
			cin>>x>>y>>t;
			cost[x][y]=t;
			cost[y][x]=t;
		}

		priority_queue<PP,vector<PP>,greater<PP> > que;
		vector<vector<int> > d(101,vector<int>(101,INF));
		que.push(PP(0,P(a,m)));
		//時間、位置、残り
		d[a][m]=0;
		//場所,残り
		int ans=-1;
		while(!que.empty()){
//							cout<<"--"<<endl;
			PP p=que.top();
			que.pop();
			int now=p.second.first,time=p.first,left=p.second.second;
			if(now==h){
				ans=time;
				break;
			}
			if(hos[now])
			for(int i=1;i+left<=m;i++){
				if(d[now][left+i]>time+i){
					que.push(PP(time+i,P(now,left+i)));
					d[now][left+i]=time+i;
				}
			}
			for(int i=0;i<n;i++){
				if(cost[now][i]==INF){
					continue;
				}
//				cout<<"aaaaaaaaa"<<endl;
				if(left-cost[now][i]>=0&&d[i][left-cost[now][i]]>time+cost[now][i]){
					que.push(PP(time+cost[now][i],P(i,left-cost[now][i])));
					d[i][left-cost[now][i]]=time+cost[now][i];
				}
			}
		}
		if(ans==-1)
		cout<<"Help!"<<endl;
		else
		cout<<ans<<endl;
	}
	return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N), diff;
  REP(i, N){
    cin >> A[i];
  }
  REP(i, N){
    cin >> B[i];
  }
  REP(i, N){
    if(A[i] > B[i]){
      diff.push_back(A[i] - B[i]);
    }
  }
  sort(diff.rbegin(), diff.rend());
  ll sum = 0;
  int cnt = 0;
  REP(i, N){
    if(A[i] >= B[i]) continue;
    sum += B[i] - A[i];
    cnt++;
  }
  ll diff_sum = 0;
  REP(i, diff.size()){
    if(sum <= diff_sum) break;
    cnt++;
    diff_sum += diff[i];
  }
  if(diff_sum < sum){
    cout << -1 << endl;
  }
  else{
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll N;
	cin >> N;
	vll L(N);
	rep(i, 0, N) {
		cin >> L[i];
	}

	ll ans = 0;
	rep(i, 0, N) {
		rep(j, i + 1, N) {
			rep(k, j + 1, N) {
				vll m(3);
				m[0] = L[i];
				m[1] = L[j];
				m[2] = L[k];
				sort(m.begin(), m.end());

				if (m[0]!=m[1]&&m[1]!=m[2]&&m[2] < m[0] + m[1]) {
					ans++;
					// cout << i << " " << j << " " << k << endl;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>

using namespace std;

typedef long long ll;

int main()
{
  int n, m;
  cin >> n >> m;
  int sum = 0;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  int result = 0;
  for (int x : a) {
    if (x * 4 * m < sum) {
      continue;
    }
    result++;
  }
  cout << ((result >= m) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
A = []
for i in range(3):
    line = list(map(int, input().split()))
    A.append(line)

N = int(input())

bingo = [[False] * 3 for i in range(3)]

def num_check(num):
    for i in range(3):
        for j in range(3): 
            if A[i][j] == num:
                bingo[i][j] = True

# bingo input
for i in range(N):
    num = int(input())
    num_check(num)

bingo_check = False
# row check
for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[i][j]
        if count == 3:
            bingo_check = True

# col check
for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[j][i]
        if count == 3:
            bingo_check = True

# cross check
count = 0
for i in range(3):
    count += bingo[i][i]
if count == 3:
    bingo_check = True

count = 0
for i in range(3):
    count += bingo[i][2-i]
if count == 3:
    bingo_check = True

print("Yes") if bingo_check else print("No")

    


Measured memory_bytes: 3064
using namespace std;
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define ll long long
#define ld long double
#define pi 3.1415926535897932384626433832795028841971693993
#define ee 2.718281828459045
#define mod 1000000007
#define MOD mod
#define sec setprecision
using namespace std;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll 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;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a)%mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	
}
int main() {
	int n;
	cin >> n;
	vector<int>v(n);
	vector<int>c(n);
	rip(i, n)cin >> v[i];
	rip(i, n)cin >> c[i];
	vector<int>a(n);
	rip(i, n) {
		a[i] = v[i] - c[i];
	}
	int count = 0;
	rip(i, n) {
		if (a[i] >= 0)count += a[i];
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
    int dp[210][2],T[210],strP[210][2],n,m,maxT,minT,P;
    scanf("%d%d",&n,&m);
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&T[i]);
        strP[i][0] = 0;
        strP[i][1] = 100;
    }
    for(int i = 0; i < m; i++)
    {
        scanf("%d%d%d",&minT,&maxT,&P);
        for(int j = 0; j < n; j++)
        {
            if(minT <= T[j] && T[j] <= maxT)
            {
                strP[j][0] = max(strP[j][0],P);
                strP[j][1] = min(strP[j][1],P);
            }
        }
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 2; j++)
        {
            if(i == 0)dp[i][j] = 0;
            else
            {
                dp[i][j] = max(
                    dp[i - 1][j] + abs(strP[i - 1][j] - strP[i][j]),
                    dp[i - 1][(j + 1) % 2] + abs(strP[i - 1][(j + 1) % 2] - strP[i][j])
                );
            }
        }
    }
    /*for(int i = 0; i < 2; i++)
    {
        for(int j = 0; j < n; j++)
        {
            printf("%2d ",dp[j][i]);
        }
        printf("\n");
    }*/
    printf("%d\n",max(dp[n - 1][0],dp[n - 1][1]));
}

Measured memory_bytes: 2752
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

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

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

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

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

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [isize; n],
    }

    let a = {
        let mut t = vec![0];
        for x in a {
            t.push(x);
        }
        t.push(0);
        t
    };

    let mut s = 0;
    for i in 1..n + 2 {
        s += (a[i] - a[i - 1]).abs();
    }
    for i in 1..n + 1 {
        println!(
            "{} ",
            s - (a[i - 1] - a[i]).abs() - (a[i + 1] - a[i]).abs() + (a[i + 1] - a[i - 1]).abs()
        );
    }
}


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

// 辺を表す構造体
struct edge{
    int from, to;
    long long cost;
};

constexpr long long INF = 1LL << 61;

bool bellman_ford(int v, int s, vector<long long>& cost, const vector<edge>& g){
    cost.resize(v);
    fill(cost.begin(), cost.end(), INF);
    cost[s] = 0;

    for(int i = 0 ; i < v ; ++i){
        for(auto& e : g){
            if(cost[e.from] < INF && cost[e.to] > cost[e.from] + e.cost){
                if(i == v - 1){
                    return false;
                }
                cost[e.to] = cost[e.from] + e.cost;
            }
        }
    }

    return true;
}

int main(){
    int v, e, r;
    cin >> v >> e >> r;

    vector<edge> g;
    for(int i = 0 ; i < e ; ++i){
        int s, t;
        long long d;
        cin >> s >> t >> d;
        g.push_back({s, t, d});
    }

    vector<long long> cost;
    if(bellman_ford(v, r, cost, g)){
        for(int i = 0 ; i < v ; ++i){
            if(cost[i] < INF){
                cout << cost[i] << endl;
            }else{
                cout << "INF" << endl;
            }
        }
    }else{
        cout << "NEGATIVE CYCLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 3156
// https://atcoder.jp/contests/abc052/tasks/arc067_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, m, cnt;
vector<pll> pf;

void pfn(vector<pll> &s, int t)
{
  for (pll &a : s)
  {
    while (t % a.first == 0)
    {
      t /= a.first;
      a.second++;
    }
  }
  if (t != 1)
    s.push_back(make_pair(t, 1ll));
  return;
}

int main()
{
  cnt = 1;
  m = 1;
  REP(i, 9)
  {
    m *= 10;
  };
  m += 7;

  cin >> N;
  FOR(i, 2, N + 1)
  {
    pfn(pf, i);
  }

  for (pll &a : pf)
    cnt = (cnt * (a.second + 1)) % m;

  cout << cnt << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define M ((1UL<<31)-1)

int seg[600000];

int min(int x, int y) {
    return (x < y ? x : y);
}

void init(void) {
    for(int i=0; i<600000; i++)
        seg[i] = M;
}

void update(int i) {
    seg[i] = min(seg[2*i+1], seg[2*i+2]);
    if(i) update((i-1)/2);
}

int find(int x, int y, int l, int r, int i) {
    if(r<x || y<l) return M;
    if(x<=l && r<=y) return seg[i];
    return min(find(x,y,l,(l+r)/2,i*2+1), find(x,y,(l+r)/2+1,r,i*2+2));
}


int main(void) {
    int n,q;
    scanf("%d%d",&n,&q);
    init();
    for(int i=0; i<q; i++) {
        int c,x,y;
        scanf("%d%d%d",&c,&x,&y);
        if(c) {
            printf("%d\n", find(x,y,0,(1<<18)-1,0));
        } else {
            seg[x+(1<<18)-1] = y;
            update((x+(1<<18)-1-1)/2);
        }
    }
}

Measured memory_bytes: 5088
#pragma region
#ifndef LOCAL_DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);
#define fio                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, vector<pair<T, U>> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++)
    os << "{" << v[i].first << ", " << v[i].second << "}" en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) os << v[i] << " ";
  os en;
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) is >> v[i];
  return is;
}

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#pragma endregion

ll mod = 1e9 + 7;  // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

void solvetestcase() {
  ll n, x, t;
  cin >> n >> x >> t;
  ll ans = (n / x) * t;
  ans += (n % x == 0) ? 0 : t;
  cout << ans en;
}

int main() {
  fio;
  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/

Measured memory_bytes: 3648
antlist = []
for i in range(5):
    antlist.append(int(input()))
k = int(input())

for i in range(5):
    for j in range(i+1,5):
        if i==j:continue
        if antlist[j] - antlist[i] > k:
            print(":(")
            exit()

print("Yay!")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;

int main() {
    int x;
    cin >> x;
    int ans=int(x/500)*1000;
    x%=500;
    ans+=int(x/5)*5;
    cout << ans << endl;
}

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

int main(void){
    int n, w; while(cin >> n >> w, n | w){
    vector<int> v(100, 0);
    double ans = 0.01;
    int mostright = 0;
    for(int i = 0; i < n; i++){
        int tmp; cin >> tmp;
        v[ tmp/w ]++;
        mostright = max(mostright, tmp/w);
    }
    int highest = *max_element(v.begin(), v.end());
    for(int i = 0; i <= mostright; i++){
        ans += ((mostright - i) / (double)mostright) * (v[i] / (double)highest);
    }
    cout << fixed << setprecision(8) << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


signed main() {
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		int num = ceil(1.0*n/1000);
		int val = num*1000 - n;
		cout<<val;
		
	}
	
}

Measured memory_bytes: 3628
//ABC091A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if(a+b >= c){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#A
n = int(input())
print(3*n**2)
#B
#n, d = map(int, input().split())
#canseerange = 2*d+1
#if n % canseerange == 0:
#    print(int(n/canseerange))
#else:
#    print(int(n/canseerange)+1
#C
#n = int(input())
#ans = 0
#most1 = 0
#most2 = 0
#ed = False
#for i in range(n):
#    t = int(input())
#    ed = False
#    if most1 <= t:
#        most2 = most1
#        most1 = t
#        ans = i
#        ed = True
#    elif most2 <= t and ed == False:
#        most2 = t
#for i in range(n):
#    if i==ans:print(most2)
#    else:print(most1)
#D


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a, b, c, k; cin >> a >> b >> c >> k;
    cout << min(a, k) - max(0ll, k - (a + b)) << endl;
    return 0;
}

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

int compare_int(const void *a,const void *b){
    return *(int*)b-*(int*)a;
}

int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    int i;
    long sum=0;
    int h[n+1];
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    qsort(h,n,sizeof(int),compare_int);

    for(i=k;i<n;i++){
        sum += h[i];
    }
    printf("%ld",sum);
    return 0;
}






Measured memory_bytes: 1788
#include<stdio.h>

int main(){
  int k,x;
  scanf("%d%d",&k,&x);
  int buf = x-k+1;
  if(buf <-1000000){
    buf = -1000000;
  }
  for(int i=buf;i<x;i++){
    printf("%d ",i);
  }
  for(int i=x;i<x+k;i++){
    if(i > 1000000){
      break;
    }
    printf("%d ",i);
  }

  return 0;
}

Measured memory_bytes: 128
n = int(input())
p_list = list(map(int, input().split()))
i_sum = 0
p_min = p_list[0]

for i in range(n):
    if p_min >= p_list[i]:
        i_sum += 1
        p_min = p_list[i]
    else:
        continue
print(i_sum)


Measured memory_bytes: 75472
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int Inf = (1<<30);
ll inf = (1LL<<60);
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	int i;
	int a[110];
	int ans = 0;
	int cheak = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		ans += a[i];
		if (a[i] % 10 == 0) cheak++;
	}
	sort(a, a + n);
	if (cheak == n) {
		cout << 0;
		return 0;
	}
	else if (ans % 10 != 0) {
		cout << ans;
		return 0;
	}
	else if (ans % 10 == 0) {
		for (i = 0; i < n; i++) {
			if (a[i] % 10 == 0) continue;
			ans -= a[i];
			if (ans % 10 != 0) break;
		}
	}
	cout << ans;
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
int n, m, mx;
string s[105], t;
map<string, int> mp;
int main() {
	int i;
	cin>>n;
	for(i=0; i<n; i++) cin>>s[i], mp[s[i]]++;
	cin>>m;
	while(m--) cin>>t, mp[t]--;
	for(i=0; i<n; i++) mx = max(mx, mp[s[i]]);
	cout<<mx;
	return 0;
}


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

int main()
{
    int N;
    cin >> N;
    set<int> se;
    for(int a = 0;a < N;a++){
        int b;
        cin >> b;
        se.insert(b);
    }
    cout<<se.size()<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split()))
wcnt = 0

for i in range(n):
    if p[i] != i+1:
        wcnt += 1

if wcnt == 0 or wcnt == 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  int A,B;cin >> A >> B;
  int ans=0;
  int outlet =1;
  
  while(outlet < B){
  	--outlet;
    outlet += A;
    ++ans;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x, i, j) cerr << #x << "------------" << "\n";cerr << "from " << i << " to " << j << "\n";for(ll k=i; k<=j; k++) cerr << x[k] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
const ll mod = 1e9 + 7;
const ll inf = 1e11 + 5;
const int MaxN = 2e5 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((c <= (a + b)) ? (b + c) : (a + 2 * b + 1)) << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h=sc.nextInt();
        int w=sc.nextInt();
        String[] input=new String[h];
        boolean[][] inp=new boolean[h][w];
        Queue<Integer>y=new ArrayDeque<>();
        Queue<Integer>x=new ArrayDeque<>();
        for(int i=0;i<h;i++){
            input[i]=sc.next();
            for(int j=0;j<w;j++){
                inp[i][j]=input[i].charAt(j)=='#';
                if(inp[i][j]){
                    y.add(i);
                    x.add(j);
                }
            }
        }
        int visited=x.size();
        int ans=0;
        int[] numsx={1,0,-1,0};
        int[] numsy={0,1,0,-1};
        int sizetmp;
        while(true){
            if(visited==h*w){
                System.out.println(ans);
                return;
            }
            ans++;
            sizetmp=x.size();
            for(int i=0;i<sizetmp;i++){
                for(int j=0;j<4;j++){
                    try{
                        if(!inp[y.peek()+numsy[j]][x.peek()+numsx[j]]){
                            inp[y.peek()+numsy[j]][x.peek()+numsx[j]]=true;
                            visited++;
                            y.add(y.peek()+numsy[j]);
                            x.add(x.peek()+numsx[j]);
                        }
                    }catch(Exception e){}
                }
                x.remove();
                y.remove();
            }
        }
        
        
    }

}



Measured memory_bytes: 68308
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(true){
      int h = sc.nextInt();
      int w = sc.nextInt();
      int i,j;
      for(i=0;i<h;i++){
        if(i==0||i==h-1){
          for(j=0;j<w;j++){
            System.out.printf("#");
          }
        }else{
          System.out.printf("#");
          for(j=1;j<w-1;j++){
            System.out.printf(".");
          }
          System.out.printf("#");
        }
        System.out.printf("\n");
      }
      if(h==0 && w==0) break;
      System.out.printf("\n");
    }
    sc.close();
  }
}


Measured memory_bytes: 56880
#![allow(non_snake_case,unused_imports)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let N = buf_it.next().unwrap().parse::<usize>().unwrap();
    let S:Vec<_> = buf_it.next().unwrap().chars().collect();
    let Q = buf_it.next().unwrap().parse::<usize>().unwrap();

    let K:Vec<_> = (0..Q).map(|_|
        buf_it.next().unwrap().parse::<usize>().unwrap()
    ).collect();

    let mut D:Vec<i64> = (0..N+1).map(|_| 0).collect();
    let mut cntM:Vec<i64> = (0..N+1).map(|_| 0).collect();
    let mut sumM:Vec<i64> = (0..N+1).map(|_| 0).collect();
    let mut ans:Vec<i64> = (0..Q).map(|_| 0).collect();
    for (i,&s) in S.iter().enumerate(){
        D[i+1] = D[i];
        cntM[i+1] = cntM[i];
        sumM[i+1] = sumM[i];
        match s {
            'D' => { D[i+1] += 1;},
            'M' => {
                cntM[i+1] += 1;
                sumM[i+1] += D[i];
            },
            'C' => {
                for (j,&k) in K.iter().enumerate(){
                    let ik = max(0,(i as isize) - (k as isize) +1) as usize;
                    let rstD = D[ik];
                    ans[j] += (sumM[i]-sumM[ik]) - rstD * (cntM[i]-cntM[ik]);
                }
            },
            _ => {},
        }
    }

    for &out in &ans{
        println!("{}",out);
    }

}


Measured memory_bytes: 36088
#include <bits/stdc++.h>
#pragma GCC diagnostic warning "-Wall"
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  
  for(int i=0;i<N;i++)
    cin >> A.at(i);
  
  int i=0;
  int s=0;
  
  while(i<1000000000){
    
    for(int j=0;j<N;j++){
      s+=A.at(j)%2;
    }
    
    if(s==0){
      
      for(int j=0;j<N;j++)
        A.at(j)/=2;
      
      i++;
      
    }
    
    else
      break;
    
  }
  cout << i;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
x = sorted(map(int, input().split()))
ret = 1000000000000000000
for s in range(n - k + 1):
    e = s + k - 1
    if x[e] <= 0:
        ret = min(ret, -x[s])
    elif x[s] <= 0:
        ret = min(ret, x[e] - x[s] + min(-x[s], x[e]))
    else:
        ret = min(ret, x[e])
print(ret)


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

//define ll long long;
//define ar array;

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

    // a^2 = b^2 + c^2 - 2bc cosA

    long double a, b, h, m;
    cin >> a >> b >> h >> m;

    // 1 second 
    long double total = 12.0 * 60.0;
    long double hour_ang = ((h*60.0 + m) / total) * 2.0 * M_PI;

    long double minute_ang = (m / 60.0) * 2.0 * M_PI;

    long double ang = max(hour_ang, minute_ang) - min(hour_ang, minute_ang);

    long double ans = sqrt((a*a) + (b*b) - (2.0*a*b* cos(ang)));
    cout << setprecision(20) <<  ans << endl;


    return 0;
}



Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}

D getExpectation(D x) {
   return perform(x)/x;
}

int main()
{
    cin>>N;
    Int times=25-N;
    cout<<"Christmas"<<" ";
    for(int i=0;i<times;++i) cout<<"Eve " ;
}

Measured memory_bytes: 27040