akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<tuple>
#include<set>
#include<map>
#include<algorithm>
using namespace std;

struct Record {
  int tid, pid, time;
  bool correct;
};

struct Team {
  Team() {
    penalty = 0;
  }
  set<int> solved;
  map<int, int> WA;
  int penalty;
};

// Solved Problems, Penalty, Team ID
typedef tuple<int, int, int> Score;

int main() {
  int M, T, P, R;
  while (cin >> M >> T >> P >> R && M) {
    vector<Record> records(R);
    for (int i = 0; i < R; i++) {
      int m, t, p, j;
      cin >> m >> t >> p >> j;
      records[i].pid = --p;
      records[i].tid = --t;
      records[i].time = m;
      records[i].correct = (j == 0);
    }

    vector<Team> teams(T);
    for (Record r : records) {
      if (teams[r.tid].solved.find(r.pid) != teams[r.tid].solved.end()) {
        continue;
      } else if (r.correct) {
        teams[r.tid].solved.insert(r.pid);
        teams[r.tid].penalty +=
          teams[r.tid].WA[r.pid] * 20 + r.time;
      } else {
        teams[r.tid].WA[r.pid]++;
      }
    }

    vector<Score> team_result(T);
    for (int i = 0; i < T; i++) {
      get<0>(team_result[i]) = -teams[i].solved.size();
      get<1>(team_result[i]) = teams[i].penalty;
      get<2>(team_result[i]) = -i;
    }

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

    for (int i = 0, len = team_result.size(); i < len; i++) {
      Score s = team_result[i];
      if (i > 0) {
        Score p = team_result[i - 1];
        cout << 
          (get<0>(p) == get<0>(s) && get<1>(p) == get<1>(s)?"=":",");
      }
      cout << -get<2>(s)+1;
    }
    cout << endl;
  }
}

Measured memory_bytes: 1272
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

colored = [[0]*w for _ in range(h)]

color = 0
for ai in a:
    color += 1
    count = 0
    for i in range(w):
        for j in range(h):
            if i % 2 == 0:
                if colored[j][i] == 0:
                    colored[j][i] = color
                    count += 1
                    if count == ai:
                        break
            else:
                if colored[h-1-j][i] == 0:
                    colored[h-1-j][i] = color
                    count += 1
                    if count == ai:
                        break
        else:
            continue
        break
#print(colored)
for i in range(h):
    print(*colored[i])

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

int main(){
  int long long A,B,K;cin>>A>>B>>K;
  if(A-K>=0){
    cout << A-K << " " << B <<endl;
  }
  else if(A+B-K>=0){
    cout <<"0 " << A+B-K << endl;
  }
  else{
    cout <<"0 0"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <queue>
#include <set>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	std::vector<int> deg(n, 0), to(n);
	std::vector<std::vector<int>> edges(n);
	for(int i = 0; i < n; i++) {
		std::cin >> to[i];
		to[i]--;
		deg[to[i]]++;
		edges[to[i]].push_back(i);
	}
	std::vector<int> a(n, -1);
	std::queue<int> q;
	for(int i = 0; i < n; i++) {
		if(deg[i] == 0) {
			q.push(i);
		}
	}
	while(!q.empty()) {
		int on = q.front();
		q.pop();
		std::set<int> wtf;
		for(auto other : edges[on]) {
			assert(a[other] != -1);
			wtf.insert(a[other]);
		}
		int mex = 0;
		while(wtf.count(mex)) mex++;
		a[on] = mex;
		deg[to[on]]--;
		if(deg[to[on]] == 0) {
			q.push(to[on]);
		}
	}
	auto check = [&](const std::vector<int> &cyc, int val) {
		int lst = val;
		for(int i = 1; i <= (int) cyc.size(); i++) {
			int on = cyc[i % (int) cyc.size()];
			std::set<int> wtf;
			for(auto other : edges[on]) {
				if(a[other] == -1) {
					wtf.insert(lst);
				} else {
					wtf.insert(a[other]);
				}
			}
			int mex = 0;
			while(wtf.count(mex)) mex++;
			lst = mex;
		}
		return lst == val;
	};
	for(int i = 0; i < n; i++) {
		if(deg[i] == 0) continue;
		std::vector<int> cyc;
		cyc.push_back(i);
		for(int j = to[i]; j != i; j = to[j]) cyc.push_back(j);
		//std::cout << "cycle is:"; for(auto j : cyc) std::cout << ' ' << j; std::cout << std::endl;
		std::set<int> wtf;
		for(auto other : edges[i]) {
			if(a[other] != -1) {
				wtf.insert(a[other]);
			}
		}
		int mex = 0;
		while(wtf.count(mex)) {
			mex++;
		}
		int mex2 = mex+1;
		while(wtf.count(mex2)) {
			mex2++;
		}
		if(!check(cyc, mex) && !check(cyc, mex2)) {
			std::cout << "IMPOSSIBLE\n";
			return 0;
		}
		for(auto x : cyc) {
			deg[x] = 0;
		}
	}
	std::cout << "POSSIBLE\n";
}

Measured memory_bytes: 16516
/*input

*/

#include <bits/stdc++.h>
#include <unistd.h>

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define UQ(x) (x).resize(distance((x).begin(),unique(x.begin(),x.end())))

using namespace std;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rnd64(chrono::high_resolution_clock::now().time_since_epoch().count());

ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2) ans*=a, ans%=(mod);
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}

void solve(){
	ll i,j,_;
	ll n,d;
	cin>>n>>d;
	ll a,b,ans = 0;
	rep(i,0,n) cin>>a>>b, ans += (a*a + b*b <= d*d);
	cout << ans << endl;
}

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




Measured memory_bytes: 3604
program abc119d
  implicit none
  integer a, b, q, i, si, ti
  integer(8) s1, s2, t1, t2, d(4)
  integer(8), dimension(:), allocatable :: s, t, x
  integer(8), parameter :: inf = 10_8**11

  read *, a, b, q
  allocate(s(a), t(b), x(q))
  read *, s, t, x
  s = [-inf, s, inf]
  t = [-inf, t, inf]
  do i = 1, q
     si = bsrch(s, x(i))
     ti = bsrch(t, x(i))
     s1 = x(i) - s(si - 1)
     s2 = s(si) - x(i)
     t1 = x(i) - t(ti - 1)
     t2 = t(ti) - x(i)
     d(1) = merge(s1, t1, s1 > t1)
     d(2) = merge(s2, t2, s2 > t2)
     d(3) = merge(s1 + t2 * 2, s1 * 2 + t2, s1 > t2)
     d(4) = merge(t1 + s2 * 2, t1 * 2 + s2, t1 > s2)
     print *, minval(d)
  end do
contains
  integer function bsrch(ary, v)
    integer(8), intent(in) :: ary(:), v
    integer low, mid, high

    low = lbound(ary, 1)
    high = ubound(ary, 1)

    do while (low < high)
       mid = low + (high - low) / 2
       if (ary(mid) < v) then
          low = mid + 1
       else
          high = mid
       end if
    end do
    bsrch = low
  end function bsrch
end program abc119d


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

#define MAXN 3005
#define MAXK 1000000
#define int long long
#define LL long long
#define pii pair<long, long>
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
using namespace std;

int N;
int mod = 1e9+7;
double p[MAXN];
double dp[MAXN][MAXN];

signed main() {
    fastio;
    cin >> N;
    for (int i = 1; i <= N; i++) 
        cin >> p[i];
    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= i; j++) {
            dp[i][j] = dp[i-1][j] * (1 - p[i]) + (j-1>=0) * dp[i-1][j-1] * p[i];
        }
    }
    double ans = 0;
    for (int j = 0; j <= N; j++)
        if (j > N-j) ans += dp[N][j];
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 69120
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	int n;
	Card array[];
	HashMap<Card, Integer> map;
	public static void main(String args[]) {
		new Main().run();
	}
	Main() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		array = new Card[n];
		map = new HashMap<Card,Integer>();
		for (int i = 0; i < n; i++) {
			String a = scan.next();
			array[i] = new Card(a.charAt(0), scan.nextInt());
			map.put(array[i], i);
		}
	}
	void run() {
		quicksort(array,0,n);
		Card bef = array[0];
		boolean stable = true;
		for (int i = 1; i < n; i++) {
			if (bef.num == array[i].num) {
				if (map.get(bef) >= map.get(array[i])) {
					stable = false;
					break;
				}
			}
			bef = array[i];
		}
		System.out.println(stable?"Stable":"Not stable");
		for (int i = 0; i < n; i++) {
				System.out.println(array[i]);
		}
	}
	int partition(Card[] A, int p, int r) {
		int x = A[r-1].num;
		int i = p - 1;
		for (int j = p; j < r- 1; j++) {
			if (A[j].num <= x) {
				i++;
				Card tmp = A[i];
				A[i] = A[j];
				A[j] = tmp;
			}
 		}
		Card tmp = A[i+1];
		A[i+1] = A[r-1];
		A[r-1] = tmp;
		return i+1;
	}
	void quicksort(Card[] A, int p, int r) {
		if (p < r) {
			int q = partition(A,p,r);
			quicksort(A,p,q);
			quicksort(A,q+1,r);
		}
	}
	class Card {
		char suit;
		int num;
		Card before;
		Card(char a, int b) {
			suit = a;
			num = b;
		}
		public String toString() {
			return suit + " " + num;
		}
	}
}



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


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

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

int main() {
  int c[101] =  { 0 };
  int a, b;
  while (cin >> a >> b) {
    if (a + b == 0) {
      int t = 0;
      for (int i = 3; i < 101; i++) {
        t += c[i] % 2;
      }
      if (t == 0 && c[1] % 2 && c[2] % 2) {
        cout << "OK" << endl;
      } else {
        cout << "NG" << endl;
      }

      memset(c, 0, sizeof(c));

    } else {
      c[a]++;
      c[b]++;
    }    
    
  }
  
  return 0;
}

Measured memory_bytes: 3056
#include<iostream>
using namespace std;
char Solve(char c)
{
  if(isupper(c))
  {
    return 'A';
  }
  else
  {
    return 'a';
  }
}
int main()
{
  char c;
  cin>>c;
  cout<<Solve(c)<<"\n";
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;

ll D;
ll c[26+1];
ll s[365+1][26+1];
ll t[365+1];

ll last[365+1];

int main(){
    cin>>D;
    repn(i,26) cin>>c[i];
    repn(i,D) repn(j,26) cin>>s[i][j];
    repn(i,D) cin>>t[i];

    ll v=0;
    repn(d,D){
        ll maxi=s[d][t[d]];
        ll idx=t[d];
        //cout<<idx<<':'<<maxi<<endl;
        v+=maxi;
        last[idx]=d;
        repn(i,26) v-=c[i]*(d-last[i]);
        cout<<v<<endl;
    }
}

Measured memory_bytes: 3668
#include<stdio.h>
int main(void){
    int H,W,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0){
            break;
        }
        for(i = 0; i < 1000; i++);
        for(i=1;i<=H;i++){
            for(j=1;j<=W;j++){
                if(i==1||i==H||j==1||j==W){
                    printf("#");
                }
                else{
                    printf(".");
                }
            }
        printf("\n");
        }

        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define int                  long long int
#define ff                   first
#define ss                   second
#define pb                   push_back
#define mp                   make_pair
#define pii                  pair<int,int>
#define vi                   vector<int>
#define mi                   map<int,int>
#define pqb                  priority_queue<int>
#define pqs                  priority_queue<int,vi,greater<int>>
#define setbits(x)           __builtin_popcountll(x)
#define zrobits(x)           __builtin_ctzll(x)
#define mod                  1000000007
#define inf                  1e18
#define precise(x,y)         fixed<<setprecision(y)<<x
#define w(x)                 int x;cin>>x;while(x--)
#define endl                 "\n"
#define no_of_digit(n)       floor(log10(n))+1
#define copyarr(a,b,n)       copy_n(a,n,b)
mt19937                      rng(chrono::steady_clock::now().time_since_epoch().count());

//*******************to check if all number in array are positive*******************
//all_of(arr,arr+n,[](int x){return x>0;})?cout<<"positive":cout<<"some negative";


//*******************to check if any element in array is negative*******************
//any_of(arr,arr+n,[](int x){return x<0;})?cout<<"Any negative":cout<<"All positive";


int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //*****************Enter the code here*******************//
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"Draw";
    }
    else if(a==1){
        cout<<"Alice";
    }
    else if(b==1)
    {
        cout<<"Bob";
    }
    else if(a<b){
        cout<<"Bob";
    }
    else 
        cout<<"Alice";
    return 0;
}


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

int main(){
    int n;
    string s;;

    cin >> n;
    cin >> s;

    int len = s.size();

    for (int i = 0; i < len; i++){
        for (int j = 1; j <= n; j++){
            if (s[i] == 'Z') s[i] = 'A';
            else s[i] += 1;
        }
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

ll solve(ll n, ll x, ll m){
    VL r(m);
    deque<ll> dq;
    rep(i, min(n, m)){
        r[x]++;
        dq.push_back(x);
        x *= x;
        x %= m;

        // 巡回検出
        if (r[x] != 0) break;
    }

    // 残りの数
    n -= dq.size();

    if (n != 0){
        // ループサイズ
        while(dq.front() != x) dq.pop_front();
        ll loop_sz = dq.size();

        // 何回ループするかを計算し、ループする数に対して加算する
        ll nq = n / loop_sz;
        while(!dq.empty()){
            ll y = dq.front(); dq.pop_front();
            r[y] += nq;
        }

        // 残りは普通に計算する
        ll nr = n % loop_sz;
        while(nr--){
            r[x]++;
            x *= x;
            x %= m;
        }
    }

    ll ans = 0;
    rep(i,m) ans += (ll)i * r[i];
    return ans;
}

int main(){
    ll n, x, m;
    cin >> n >> x >> m;
    cout << solve(n, x, m) << endl;
    
    return 0;
}

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

#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast
int gcd(int a, int b){
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
int main()
{
	JJ;
	int n; cin >> n;
	long sum = 0;
	FOR(i, 1, n + 1){
		FOR(j, 1, n + 1){
			FOR(k, 1, n + 1){
				sum += gcd(i, gcd(j, k));
			}
		}
	}
	cout << sum << endl;



	return 0;
}


Measured memory_bytes: 3644
type ABC(stream:System.IO.TextReader) =
  member this.Scan4 f1 f2 f3 f4 = stream.ReadLine().Split() |> (fun a -> (f1 a.[0], f2 a.[1], f3 a.[2], f4 a.[3]))

let util = ABC(stdin)

let rec gcd64 (a:int64) (b:int64) =
  match a % b with
  | 0L -> b
  | c -> gcd64 b c

let A,B,C,D = util.Scan4 int64 int64 int64 int64
let E = C * D / (if C > D then gcd64 C D else gcd64 D C) // gcm

[C;D;E]
|> List.map (fun a -> B/a - (A-1L)/a)
|> fun xs -> B - A + 1L - (xs.[0] + xs.[1] - xs.[2])
|> printfn "%d"


Measured memory_bytes: 14044
N = int(input())
h = list(map(int, input().split()))

DP=[0]*(N)
DP[0]=0
DP[1]=abs(h[1]-h[0])
#print(DP)
for i in range(2,N):
    DP[i]=min(DP[i-1]+abs(h[i]-h[i-1]),DP[i-2]+abs(h[i]-h[i-2]))
    #print(DP)
print(DP[N-1])

Measured memory_bytes: 85012
package main

import (
	"fmt"
)

func main() {
	var A, B, C, X, Y int
	fmt.Scan(&A, &B, &C, &X, &Y)

	ans := 99999999999999
	for i := 0; i <= 100000; i++ {
		p := (i * 2 * C) + (max(0, X-i) * A) + (max(0, Y-i) * B)
		if p < ans {
			ans = p
		}
	}

	fmt.Println(ans)
}

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


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n;
		n = sc.nextInt();
		int[]  h = new int [n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}

		int ans = 0;
		int out = 0;

		for( int i = 0; i < h.length; i++ ) {
			if( out < h[i] ) {
				ans += h[i] - out;
				out =  h[i];
			}else {
				out = h[i];
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
#include <stdio.h>
int main(void)
{
    int n;
    scanf("%d", &n);

    int R0, R1;
    scanf("%d\n%d", &R0, &R1);

    int min;
    min = (R0 < R1) ? R0 : R1;

    int g;
    g = R1 - R0;

    n -= 2;
    int R, t;

    while (n--) {
        scanf("%d", &R);
        t = R - min;
        g = (g < t) ? t : g;
        min = (R < min) ? R : min;
    }

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

    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <math.h>
using namespace std;


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

	long int A[N];
	long int B[N];
	long int sum = 0;

	for(int i=0;i<N;i++){
		cin >> A[i];
		sum += A[i];
	}
	sum /= 2;
	for(int i=0;i<N-1;i+=2){
		sum -= A[i];
	}
	B[N-1] = sum;
	B[0] = A[N-1] - B[N-1]; 
	for(int i=1;i<N-1;i++){
		B[i] = A[i-1] - B[i-1];
	}

	for(int i=0;i<N;i++){
		cout << B[i]*2 << " ";
	}
	cout << endl;
	


}

    


Measured memory_bytes: 2816
#include <iostream>
#include <fstream>
using namespace std;
const int nmax=200005;
int in[nmax],ap[nmax],v[nmax];
int n,m,i,ans,x,j,y;
void del(int poz)
{
    if(poz-ap[poz]+1>=1)
    {
     in[poz-ap[poz]+1]--;
     if(in[poz-ap[poz]+1]==0)
        ans++;
    }
    ap[poz]--;
}
void add(int poz)
{
    ap[poz]++;
    if(poz-ap[poz]+1>=1)
    {
     in[poz-ap[poz]+1]++;
     if(in[poz-ap[poz]+1]==1)
        ans--;
    }
}
int main()
{
    //freopen("data.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>x,ap[x]++,v[i]=x;
    for(i=1;i<=n;i++)
        for(j=max(1,i-ap[i]+1);j<=i;j++)
           in[j]++;
    for(i=1;i<=n;i++)
        if(!in[i])
          ans++;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        del(v[x]);
        add(y);
        v[x]=y;
        cout<<ans<<'\n';
    }
    return 0;
}


Measured memory_bytes: 3840
#include<iostream>
using namespace std;
int main()
{
    long long int sum = 0LL;
    int n; cin >> n;

    for(long long int i=1;i<=n;i++)
    {
        if(i%3==0 || i%5==0) continue;
        sum+=i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3152
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
even, odd = v[::2], v[1::2]

set_e, set_o = set(even), set(odd)
E, O = Counter(even), Counter(odd)
ce, co = E.most_common(), O.most_common()
e1, o1 = ce[0][0], co[0][0]

if e1 != o1:
    a, b = ce[0][1], co[0][1]
    print(n-a-b)
    exit()
if len(set_o) == 1 and len(set_e) == 1:
    print(len(even))
    exit()
if len(set_o) == 1:
    a = ce[1][1]
    print(len(even)-a)
    exit()
if len(set_e) == 1:
    a = co[1][1]
    print(len(odd)-a)
    exit()

e2, o2 = ce[1][0], co[1][0]
ce1, co1 = ce[0][1], co[0][1]
ce2, co2 = ce[1][1], co[1][1]

print(min(n-ce1-co2, n-ce2-co1))

Measured memory_bytes: 26048
#include <stdio.h>
int main(void){
  int n, h[100000] = {0};
  scanf("%d", &n);getchar();
  if(n == 1){
    printf("Yes\n");
    return 0;
  }
  for(int i = 0; i < n; i++){
    scanf("%d", &h[i]);getchar();
  }
  for(int i = 0; i < n - 1; i++){
    if(i == 0 && h[0] > h[1]){
    	h[0]--;
    }else if(h[i] < h[i + 1]){
    	h[i + 1]--;
    }
  }
  for(int i = 0; i < n - 1; i++){
  	if(h[i] > h[i + 1]){
    	printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する
vector<vector<int> > d;//頂点iからjまでの最短距離,間に編がない場合はINFが入る。
int V;//超点数


//0beginの場合
void washall() {
    for (int k = 0; k < V; k++) {
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                if (d[i][j] > d[i][k] + d[k][j]) {
                    d[i][j] = d[i][k] + d[k][j];
                }
            }
        }
    }
}

int main() {
    V = 10;
    d = vector<vector<int> > (10,vector<int>(10,0));
    int w,h;
    cin >> w >> h;
    for(int i = 0; i <= 9; i++){
        for(int j = 0; j <= 9; j++){
            cin >> d[i][j];
        }
    }

    washall();

    ll ans = 0LL;
    REP(i,0,w){
        REP(j,0,h){
            int tmp;
            cin >> tmp;
            if(tmp == -1 or tmp == 1){

            }else{
                ans += d[tmp][1];
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  vector<vector<int>> sp(4, vector<int>(3, 1));
  sp.at(1) = {0, 1, 1};
  sp.at(2) = {1, 0, 1};
  sp.at(3) = {1, 1, 0};

  int N, K;  
  cin >> N >> K;
  
  vector<int> A(N + 1);
  for (int i = 0 ; i < K; i++) {
    int a,b;
    cin >> a >> b;
    A.at(a) = b;
  }
  
 vector<vector<vector<int64_t>>> dp(N + 1,
         vector<vector<int64_t>>   (4, 
                 vector<int64_t>   (4, 0)));

  
  if (A.at(1) > 0) dp.at(1).at(0).at(A.at(1)) = 1;
  else {
    dp.at(1).at(0).at(1) = 1;
    dp.at(1).at(0).at(2) = 1;
    dp.at(1).at(0).at(3) = 1;
  }
  
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 1; k < 4; k++) {
        
        if (A.at(i+1) > 0 ) {
          if(j == k && k == A.at(i+1)) continue;
          dp.at(i+1).at(k).at(A.at(i+1)) += dp.at(i).at(j).at(k) % 10000;;
        } else {
          for (int l = 1; l < 4; l++) {
            if(j == k && k == l) continue;
            dp.at(i+1).at(k).at(l) += dp.at(i).at(j).at(k) % 10000;;
          }
        }
      }
    }
  }
  
  int ans = 0;
  for (int i = 1; i < 4; i++) {
    for (int j = 1; j < 4; j++) {
      ans += dp.at(N).at(i).at(j) ;
    }
  }

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


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

#define LL long long

int main(){
	

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

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

	vector<LL> v;
	for(int i=0;i<n;i++){
		LL a;cin>>a;
		v.push_back(a);
	}

	LL ans = LLONG_MAX;

	LL mini = v[0],maxi = v[k-1];

	for(int i=0;i<n-k+1;i++){
		mini = v[i];maxi = v[i+k-1];
		if(mini>=0 && maxi>=0){
			ans = min(ans,maxi);
		}else if(mini<=0 && maxi<=0){
			ans = min(ans,-mini);
		}else if(mini<=0 && maxi>=0){
			ans = min(ans,min(2*abs(mini)+maxi,abs(mini)+2*maxi));
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1400
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
	Scanner scan=new Scanner(System.in);
	String a=scan.next();
	int b=scan.nextInt();
	for(int i=0;i<a.length();i++) {
		if(i%b==0) {
			System.out.print(a.charAt(i));
		}
	}
	System.out.println();
	}
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>

#define M 1045627
#define L 14

char H[M][L];

int getChar(char ch);
int getKey(char str[]);
int h1(int key);
int h2(int key);
int find(char str[]);
int insert(char str[]);

int main(void)
{
  int i;
  int n,h;
  char str[L],com[9];
    
  for(i=0;i<M;i++)
    {
      H[i][0]='\0';
    
      scanf("%d", &n);
    
      for(i=0;i<n;i++)
	{
	  scanf("%s%s",com,str);
        
	  if(com[0]=='i')
	    {
	      insert(str);
	    }
	  else
	    {
	      if(find(str))
		{
		  puts("yes");
		}
	      else
		{
		  puts("no");
		}
	    }
	}
    
      return 0;
    }
}

int getChar(char ch)
{
  if(ch=='A')
    {
      return 1;
    }
  else if(ch=='C')
    {
      return 2;
    }
  else if(ch=='G')
    {
      return 3;
    }
  else if(ch=='T')
    {
      return 4;
    }
  else
    {
      return 0;
    }
}

int getKey(char str[])
{
  int i;
  int sum=0,p=1;

  for(i=0;i<strlen(str);i++)
    {
      sum+=p*(getChar(str[i]));
      p*=5;
    }
  return sum;
}

int h1(int key)
{
  return key%M;
}

int h2(int key)
{
  return 1+(key%(M-1));
}

int find(char str[])
{
  int i;
  int key,h;
   
  key=getKey(str);
    
  for(i=0;;i++)
    {
      h=(h1(key)+i*h2(key))%M;
	
      if(strcmp(H[h], str)==0)
	{
	  return 1;
	}	
      else if(strlen(H[h])==0)
	{
	  return 0;
	}
    }   
}

int insert(char str[])
{
  int i;
  int key,h;
    
  key=getKey(str);
    
  for(i=0;;i++)
    {
      h=(h1(key)+i*h2(key))%M;
	
      if(strcmp(H[h],str)==0)
	{
	  return 1;
	}
      else if(strlen(H[h])==0)
	{
	  strcpy(H[h],str);
	    
	  return 0;
        }
    }
    
  return 0;
}



Measured memory_bytes: 16004
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const long long MAXS = 114514;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
long long h,w,a,b,c;
long long res = inf;
long long cut1(long long h,long long w){
    for(long long i=1;i<=w-1;i++){
        a=h/2*i;
        b=(h+1)/2*i;
        c=h*(w-i);
        res = min(res,max({a,b,c})-min({a,b,c}));
    }
}
long long cut2(long long h,long long w){
    for(long long i=1;i<=w-1;i++){
        a=h*i;
        b=(w-i)/2*h;
        c=(w-i+1)/2*h;
        res = min(res,max({a,b,c})-min({a,b,c}));
    }
}
signed main(){
    cin>>h>>w;
    cut1(h,w);
    cut1(w,h);
    cut2(h,w);
    cut2(w,h);
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector< vector<long long>>
#define mi map<int,int>
#define pi pair<int,int>

#define Fori(i,a,b) for(int i=a; i<b; i++)
#define Ford(i, a, b) for(int i=a; i>=b; i--)

#define pb push_back
#define mp make_pair

#define read(a, n) for(int i=0; i<n; i++) cin >> a[i];
#define print(x) cout << "X: == " << x << endl;
#define printMap(a) for(auto it=a.begin() ; it!= a.end() ; it++) {cout << it->first << "  " << it->second << endl; }
#define printVector(a) for(auto it = a.begin() ; it!= a.end() ;it++) {cout << *it << endl;}

using namespace std;
int main() {
    IOS
    ll n;
    cin >> n;
    map<ll, ll> a;
    Fori(i, 0, n) {
        ll x; cin >> x;
        a[x]++;
    }
    ll q;
    cin >> q;
    ll sum = 0;
    for(auto it=a.begin(); it!=a.end(); it++) {
        sum += (it->second) * (it->first);
    }
    Fori(i, 0, q) {
        ll b, c;
        cin >> b >> c;
        sum = sum - (a[b] * b) + (a[b] * c);
        a[c] += a[b];
        a[b] = 0;
        // for(auto it=a.begin(); it!=a.end(); it++) {
        //     sum += (it->second) * (it->first);
        // }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 9608
while True:
    n=input()
    if n==0:break
    D=[raw_input().split() for i in range(n)]
    D.sort()
    L=[[False]*30 for i in range(n)]
    P=[0]*n
    for i in range(n):
        for j in D[i][2:]:
            L[i][int(j)]=True
    for i in range(30):
        cnt=0
        for j in range(n):
            if L[j][i]:
                cnt+=1
        for j in range(n):
            if cnt==n:
                P[j]+=1
            elif cnt==1 and L[j][i]:
                P[j]+=n
            elif L[j][i]:
                P[j]+=n-cnt+1
    minInt=min(P)
    print minInt,D[P.index(minInt)][0]

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

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

    int N, Q;
    cin >> N >> Q;
    for(int i = 0; i < Q; ++i){
        int u, v;
        cin >> u >> v;
        if(N == 1)  cout << u << '\n';
        else{
            --u, --v;
            while(u != v){
                ((u > v ? u : v) -= 1) /= N;
            }
            cout << u + 1 << '\n';
        }
    }
}

Measured memory_bytes: 3632
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		while(sc.hasNextLine()){
			char[] str=sc.nextLine().toCharArray();
			StringBuilder res=new StringBuilder();
			for(int i=0;i<str.length;i++){
				if(str[i]=='@'){
					i++;
					int n=str[i]-'0';
					i++;
					for(int j=0;j<n;j++){
						res.append(str[i]);
					}
				}else{
					res.append(str[i]);
				}
			}
			ln(res);
		}
	}

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

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
// a_day_of_takahashi.c

#include <stdio.h>

int answer1();

int main()
{
  int answer = answer1();
  printf("%d\n", answer);
}


int answer1()
{
  int month, day;
  int answer;

  /*** input ***/
  scanf("%d %d", &month, &day);

  answer = month;
  if ( day < month ){
    answer--;
  }
  return answer;
}



Measured memory_bytes: 128
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
ans = sum(s)
if_flag = False
tmp = 0
if ans%10==0:
    for i in range(n):
        tmp = ans-s[i]
        if not tmp%10==0:
            ans -= s[i]
            if_flag = True
            break
    if not if_flag:
        ans = 0
print(ans)  

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fori(i,a,b) for(int i=a;i<=b;i++)

unordered_map<ll,ll> mp;

int main()
{
    ll n,ip;
    cin>>n;
    vector<ll>a,b(n,0);
    for(ll i=0;i<n;i++)
    {
        cin>>ip;
        a.push_back(ip);
    }
    int cnt=0;
    for(ll i=0;i<n-1;i++)
    {
        if(a[i+1]>a[i])
        {
            cnt=0;
            b[i]=cnt;
        }
        else
        {
            cnt++;
            b[i]=cnt;
        }
    }
    int max=0;
    for(ll i=0;i<n;i++)
    {
        if(b[i]>max)max=b[i];
    }
    cout<<max;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;// std::cout, std::cin
int main()
{
	int A, B,  i;
	std::cin >> A >> B;
	if (A == 1 ) {
		std::cout << B << endl;
		return 0;		
	}
	else {
		int min = B - (A - 1);
		int max = B + (A - 1);
		for (i = min; i <= max; i++) {
			std::cout << i << endl;
		}
		return 0;	
	}
}

Measured memory_bytes: 256
def comb_num(n, x)
	result = 0
	for i in 1..n
		for j in i..n
			for k in j..n
				if (i + j + k == x) && ([i, j, k].uniq == [i, j, k])
					result+=1
				end
			end
		end
	end
	return result
end

inputs = gets.strip().split(" ").map{|i| i.to_i}
n, x = inputs[0], inputs[1]

until n == 0 && x == 0
	puts comb_num(n, x)
	inputs = gets.strip().split(" ").map{|i| i.to_i}
	n, x = inputs[0], inputs[1]
end


Measured memory_bytes: 6892
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]
# print(a)
q = []
for i in range(H):
    if i % 2 == 0:
        for j in range(W):
            q.append([i, j])
    elif i % 2 == 1:
        for j in range(W - 1, -1, -1):
            q.append([i, j])
# print(q)
N = 0
ans_arr = []
for qi in range(len(q)):
    i = q[qi][0]
    j = q[qi][1]
    if a[i][j] % 2 == 0:
        pass
    elif a[i][j] % 2 == 1 and qi != len(q) - 1:
        N += 1
        a[i][j] -= 1
        a[q[qi + 1][0]][q[qi + 1][1]] += 1
        ans_arr.append([i, j, q[qi + 1][0], q[qi + 1][1]])

print(N)
for x1, x2, x3, x4 in ans_arr:
    print(x1 + 1, x2 + 1, x3 + 1, x4 + 1)


Measured memory_bytes: 118808
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define int long long int
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define MOD 1000000007
#define MAX 200005
#define sz size()
ll power(ll n,ll x)
{
    if(x==0)   return 1;
    if(x%2==0) return power(n*n,x/2);
    else       return n*power(n*n,x/2);
}
bool prime(ll n)
{
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0) return false;
    return true;
}
ll powermode(ll n,ll x)
{
    if(x==0) return 1;
    ll y=((n%MOD)*(n%MOD))%MOD;
    if(x%2==0)  return powermode(y,x/2)%MOD;
    else    return ((n%MOD)*(powermode(y,x/2)%MOD))%MOD;
}
ll inv(ll a){ return powermode(a,MOD-(ll)2);}
ll mul(ll x,ll y) { return ((x%MOD)*(y%MOD))%MOD; }
ll sum(ll x,ll y) { return ( x%MOD+ y%MOD) %MOD;}
ll sub(ll x,ll y) {  return ((x%MOD)-(y%MOD)+MOD)%MOD;}
ll divide(ll x,ll y) { return mul(x,inv(y));}
ll N;
ll dfs(ll n, vector<ll>&v, vector< vector<ll> > &adj, vector<ll> &vis)
{
    ll cnt=0;
    vis[n]=true;
    for(auto x:adj[n])
    {
        if(!vis[x])
        {
            ll xx=dfs(x,v,adj,vis);
            cnt+=xx;
            v.pb( xx*(N-xx));
        }
    }
    return cnt+1;
}
ll i,j;
   void solve()
   {
       ll n;
       cin>>n;
       ll a[n];
       for(i=0;i<n;i++)
         cin>>a[i];
    ll ans=0;
    for(i=1;i<n;i++)
    {
        if(a[i-1]>a[i])
        {ans+=a[i-1]-a[i];
        a[i]=a[i-1];
        }
    }
    cout<<ans;
   }
   
            signed main()
            {
               FAST;
               ll q=1;
            //    cin>>q;
	            while(q--)
                {
                   solve();
                }
            }



Measured memory_bytes: 5180
#include <iostream>
using namespace std ;
int main () {

int a , b,z ;
cin >> a >> b >>z;
if ((a==5)&& (b==7 ) && (z==5 )){
    cout << "YES";
}
else if ((a==7)&& (b==5 ) && (z==5 )){
    cout << "YES";
}
else if ((a==5)&& (b==5 ) && (z==7 )){
    cout << "YES";
}

else {
    cout << "NO";
}


return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
#define REP(i,n) for (int i = 1; i<= (n); i++)
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
const long double PI = acos(-1);
using ll = long long;
using ld = long double;
using namespace std;

int main() {
    ld a,b;
    cin >> a >> b;
    cout << ll(a*b) << endl;
    return 0;
}

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

int main(){
	// n 人が d 日間の合宿に参加した
	// 合宿後に残っていたチョコレートは x 個であった
	int n, d, x;
	cin >> n >> d >> x;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	int ans = x;
	for(int num: a){
		for(int i = 1; i <= d; i += num){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main()
{
int n,i,m,a[100],s,co;float c;
s=0;co=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s+=a[i];
}
c=s/(float)(4*m);
for(i=0;i<n;i++)
{
if(a[i]>=c)
co++;
}
if(co>=m)
printf("Yes\n");
else
printf("No\n");
}

Measured memory_bytes: 128
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()
c = 0
for i in range(3):
  if S[i] == T[i]:
    c += 1
    
print(c)
  

Measured memory_bytes: 5196
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int n, h;
int a[224514];
signed main() {
	cin >> h >> n;
	rep(i, n)cin >> a[i];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	if (ans >= h)puts("Yes");
	else puts("No");
	ggr
}


Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	doin();
	int n, t, p = -1, ans = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t;
		if (t >= p)
			ans++, p = t;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x=sc.nextInt();
if(x%2==0){
	System.out.println(0.5);
}else{
	double n=(double)x;
	double b=(double)((n+1)/2);
	System.out.println(b/n);
}
	}
}

Measured memory_bytes: 23892
N=int(input())
x=[list(map(int,input().split())) for _ in range(N)]

v={}
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        vect=[x[i][0]-x[j][0],x[i][1]-x[j][1]]
        vs=str(vect[0])+","+str(vect[1])
        if vs in v:
            v[vs]+=1
        else:
            v[vs]=1

VM=0
for m in v:
    VM=max(VM,v[m])
print(N-VM)

Measured memory_bytes: 3316
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


m = list(input())
#print(m)
answer = 0
num_b = 0
for i in range(len(m)):
    if m[i] == 'W':
        answer += num_b
    else:
        num_b += 1

print(answer)


Measured memory_bytes: 24352
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    cin>>d>>n;
    if(n<100){
    if(d==0)
    cout<<n<<endl;
    else if(d==1)
    cout<<100*n<<endl;
    else
    cout<<100*100*n<<endl;
    }
    else{
        if(d==0)
            cout<<"101"<<endl;
        else if(d==1)
            cout<<101*n<<endl;
        else cout<<101*100*n<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

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

	ret := 0.0
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		ret += 1 / float64(a)
	}

	fmt.Println(1 / ret)
}


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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 5e5 + 5, LOG = 20;

int main() {
 
	sync;

	string s; cin >> s;
	int ans = sz(s);
	for (int i = 1; i < sz(s); i++) if (s[i] != s[i - 1]) ans = min(ans, max(i, sz(s) - i));
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
	int a, b, c;
	int aa, bb, cc;
	int pa = -1, pb = -1, pc = -1;
	int count = 0;

	cin >> a >> b >> c;

	while (true) {
		if (a == pa && b == pb && c == pc) {
			count = -1;
			break;
		}else if (a == pa && b == pc && c == pb) {
			count = -1;
			break;
		}else if (a == pb && b == pa && c == pc) {
			count = -1;
			break;
		}else if (a == pb && b == pc && c == pa) {
			count = -1;
			break;
		}else if (a == pc && b == pa && c == pb) {
			count = -1;
			break;
		}else if (a == pc && b == pb && c == pa) {
			count = -1;
			break;
		}

		pa = a;
		pb = b;
		pc = c;

		if (a % 2 == 0) {
			aa = a / 2;
		}
		else {
			break;
		}

		if (b % 2 == 0) {
			bb = b / 2;
		}
		else {
			break;
		}

		if (c % 2 == 0) {
			cc = c / 2;
		}
		else {
			break;
		}

		a = bb + cc;
		b = cc + aa;
		c = aa + bb;

		count++;
	}

	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

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

// i番目(0-index)にnが来た
int dig(int i, int n){
  if(i%2 == 1) n*=2;
  if(n>9) n = n/10 + n%10;
  return n;
}

int n,m;
string id;
int a[10];
unsigned int dp[100000][10];

int main(){
  cin >> n >> id >> m;
  rep(i,0,m) cin >> a[i];
  
  reverse(id.begin(), id.end());

  memset(dp,0,sizeof(dp));
  dp[0][0] = 1;
  rep(i,0,n){
    rep(j,0,10){
      if(id[i] != '*'){
        dp[i+1][(j+dig(i,id[i]-'0'))%10] += dp[i][j];
      } else {
        rep(k,0,m){
          dp[i+1][(j+dig(i,a[k]))%10] += dp[i][j];
        }
      }
    }
  }

  cout << dp[n][0] << endl;
  return 0;
}

Measured memory_bytes: 5240
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL memo[3005][3005][2];
LL datas[3005];
const LL INF=1e15;
LL solve(int L, int R, bool con)
{
	if(L>R) return 0;
	if(memo[L][R][con]!=-INF) return memo[L][R][con];
	if(!con)
	{
		return memo[L][R][con]=max(datas[L]+solve(L+1, R, con^1), datas[R]+solve(L, R-1, con^1));
	}
	else
	{
		return memo[L][R][con]=min(solve(L+1, R, con^1)-datas[L], solve(L, R-1, con^1)-datas[R]);
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	for(int a=1;a<=n;a++)
	{
		scanf("%lld", &datas[a]);
	}
	for(int a=1;a<=n;a++)
	{
		for(int b=1;b<=n;b++)
		{
			memo[a][b][0]=-INF;
			memo[a][b][1]=-INF;
		}
	}
	printf("%lld\n", solve(1, n, 0));
	return 0;
}

Measured memory_bytes: 141440