akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define SZ(x) ((int)((x).size()))

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

template<class TH>
void _dbg(const char* name, TH val){
    clog << name << ": " << val << endl;
}
template<class TH, class... TA>
void _dbg(const char* names, TH curr_val, TA... vals) {
    while(*names != ',') clog << *names++;
    clog << ": " << curr_val << ", ";
    _dbg(names+1, vals...);
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
    #define dbg_arr(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg(...)
    #define dbg_arr(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    LL A, V;
    cin >> A >> V;
    LL B, W;
    cin >> B >> W;
    LL T;
    cin >> T;
    if (V <= W) {
        cout << "NO\n";
        return 0;
    }
    if (llabs(B-A) <= T * (V-W)) {
        cout << "YES\n";
        return 0;
    } else {
        cout << "NO\n";
        return 0;
    }
}


Measured memory_bytes: 3656
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	v := getNextInt64(scanner)

	var coins [4][]int64

	for i := 0; i < 4; i++ {
		coins[i] = make([]int64, n)
		for ii := 0; ii < n; ii++ {
			coins[i][ii] = getNextInt64(scanner)
		}
	}

	ab := make(IntMap, 1)
	cd := make(IntMap, 1)

	for i := 0; i < n; i++ {
		for ii := 0; ii < n; ii++ {
			ab.increment(coins[0][i] + coins[1][ii])
		}
	}
	for i := 0; i < n; i++ {
		for ii := 0; ii < n; ii++ {
			cd.increment(coins[2][i] + coins[3][ii])
		}
	}

	var ans int64

	for key, val := range ab {
		ans += val * cd.get(v-key)
	}
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

// IntMap ...
type IntMap map[int64]int64

func (m IntMap) get(key int64) int64 {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}
func (m IntMap) increment(key int64) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}



Measured memory_bytes: 142292
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ld long double
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int n;
  cin >> n;
  ll k[n+1];
  k[0]=0;
  rep(i,n)cin >> k[i+1];
  ll ans=0;
  if(k[1]!=0){
    cout << -1 << endl;
    return 0;
  }
  rep(i,n){
    if(k[i]+1<k[i+1]){
      cout << -1 << endl;
      return 0;
    }
    if(k[i+1]==0)continue;
    if(k[i]+1==k[i+1])ans++;
    else{
      ans+=k[i+1];
    }
  }
  cout << ans << endl;
}  


Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;
string D[8] = { "","SAT","FRI","THU","WED","TUE","MON" ,"SUN" };

int main(void) {

	string S;

	cin >> S;

	for (int i = 1; i <= 7; i++) {
		if (S == D[i]) { cout << i << endl; }
	}



	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int t;
    cin >> t;
    int d = t % 10;
    string ans;
    if (d == 3) {
        ans = "bon";
    } else if (d == 0 || d == 1 || d == 6 || d == 8) {
        ans = "pon";
    } else {
        ans = "hon";
    }

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

Measured memory_bytes: 3128
a,b,c,k = map(int,input().split())

ans = 0

ans += min(a,k)
k -= min(a,k)

ans += min(b,k) * 0
k -= min(b,k)

ans += min(c,k) * -1
k -= min(c,k) #これはなくてもよい

print(ans)

Measured memory_bytes: 9152
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int sum = 0;
  int mx = 0;
  rep(i, N)
  {
    int p;
    cin >> p;
    if (mx < p)
      mx = p;

    sum += p;
  }

  cout << sum - mx / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

// UVa 11504

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int k = in.nextInt();
		int s = in.nextInt();
		
		int answer = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = x; y <= k; y++) {
				int z = s - y - x;
				if (y <= z && z <= k) {
					if (x == y && y == z && x == z) {
						answer += 1;
					} else if (x == y || y == z || x == z) {
						answer += 3;
					} else {
						answer += 6;
					}
				}
			}
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 21332
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int D, N;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> D >> N;

    int i = 1;
    while (D--) i *= 100;
    if (N == 100) N++;
    cout << i * N << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define THIS_YEAR 2004
#define DAY_FIRST 2 // 0~6 (last year 12/31 is First day)

int main(void)
{
	int month[12] = {31,  // 1
					 28,  // 2
					 31,  // 3
					 30,  // 4
					 31,  // 5
					 30,  // 6
					 31,  // 7
					 31,  // 8
					 30,  // 9
					 31,  // 10
					 30,  // 11
					 31}; // 12
	char theday[7][10] = {"Monday",
						  "Tuesday",
						  "Wednesday",
						  "Thursday",
						  "Friday",
						  "Saturday",
						  "Sunday"};
	int mon, day;
	int i;

	if ( (THIS_YEAR % 4) == 0 ||
		 ( (THIS_YEAR % 100) == 0 && THIS_YEAR % 400 == 0) ) {
		
		month[1] = 29;
	}

	while (1) {
		scanf("%d %d", &mon, &day);
		if (mon == 0) break;
		
		for (i = 0; i < mon - 1; i++) {
			day += month[i];
		}
		
		day = (day + DAY_FIRST) % 7;

		printf("%s\n", theday[day]);
	}

	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    map<ll, int> cnt;
    int n;
    cin >> n;
    cnt[0] = 1;
    ll sm = 0;
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ll x;
        cin >> x;
        sm += x;
        ans += cnt[sm];
        cnt[sm]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 12800
from collections import Counter as C
r=range
while True:
    n,m=map(int, input().split())
    if n==0:break
    d=dict(zip(r(1,m+1),[0]*m))
    for i in r(n):
        l=list(map(int, input().split()))
        for j in r(len(l)):
            if l[j]:d[j+1]+=1
    print(' '.join(map(str,[k for k,_ in C(d).most_common()])))

Measured memory_bytes: 7964
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n").map(Number);
var index=0;
while(true){
   var n=arr[index];
   index++;
   if(n==0)break;
   var stone=[];
   while(n--){
      stone.push(arr[index]);
      index++;
   }
   var ary=[];
   var flag=false;
   stone.forEach(function(v,i){
      flag=!flag;
      if(flag)ary.push(v);
      else {
         if(ary[ary.length-1]==v)ary.push(v);
         else{
            ary.push(v);
            i--;
            while(true){
               if(i<0 || ary[i]==v)break;
               else {
                  ary[i]=v;
                  i--;
               }
            }
         }
      }
   });
   var cnt=0;
   ary.forEach(function(v){
      if(v==0)cnt++;
   });
   console.log(cnt);
}

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

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9,mod=1e9+7;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans,cnt[100005];

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}

int main(){
	//IO();
	scanf("%s",s);
	scanf("%d",&q);
	deque<char> dq;
	for(int i=0;s[i];i++)
		dq.push_back(s[i]);
	bool rev=false;
	while(q--){
		int t;
		scanf("%d",&t);
		if (t==1)
			rev=!rev;
		else{
			char c;
			scanf("%d %c",&x,&c);
			if (x==1){
				if (rev)
					dq.push_back(c);
				else
					dq.push_front(c);
			}
			else{
				if (rev)
					dq.push_front(c);
				else
					dq.push_back(c);
			}
		}
	}
	string ans;
	while(!dq.empty()){
		ans+=dq.front();
		dq.pop_front();
	}
	if (rev)
		reverse(ans.begin(),ans.end());
	printf("%s\n",ans.c_str());
}


Measured memory_bytes: 1412
#include<iostream>

using namespace std;

int main()
{
	int s=0,t=0;
	string a;
	cin>>a;
	for(int i=0;i<a.length();i++)
	{
		if(a[i]=='S')s++;
		else
		{
			if(s>0)s--;
			else t++;
		}
	}
	cout<<s+t<<endl;
	return 0;
}

Measured memory_bytes: 640
num = int(input())
data = list(map(int, input().split()))
for i in range(num):
    for j in range(i, 0, -1):
        if data[j] < data[j-1]:
            data[j-1], data[j] = data[j], data[j-1]
    print(' '.join(map(str, data)))


Measured memory_bytes: 5600
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

using T = tuple<int, int, int>;

signed main(){
	int N;
	cin >> N;
	auto ctoi = [](char c) -> int{
		if(c == 'D') return 0;
		if(c == 'L') return 1;
		if(c == 'U') return 2;
		if(c == 'R') return 3;
	};
	vector<vector<pair<int,int>>>v(4);
	REP(i, N) {
		int x, y;char u;
		cin >> x >> y >> u;
		v[ctoi(u)].emplace_back(y, x);
	}

	int ans = INF;

	vector<vector<int>>us(200020);
	for(auto[y, x]: v[0]) {
		us[x].emplace_back(y);
	}
	REP(i, 200020) sort(ALL(us[i]));
	REP(i, v[2].size()) {
		auto[y, x] = v[2][i];
		auto itr = lower_bound(ALL(us[x]), y);
		if(itr == us[x].end()) continue;
		CHMIN(ans, abs(y - *itr) * 5);
	}
	//out(ans);

	vector<vector<int>>ls(200020);
	for(auto[y, x]: v[1]) {
		ls[y].emplace_back(x);
	}
	REP(i, 200020) sort(ALL(ls[i]));
	REP(i, v[3].size()) {
		auto[y, x] = v[3][i];
		auto itr = lower_bound(ALL(ls[y]), x);
		if(itr == ls[y].end()) continue;
		CHMIN(ans, abs(x- *itr) * 5);
	}
	//out(ans);

	REP(turn, 4) {

		vector<vector<pair<int,int>>>g(400040);
		for(auto[y, x]: v[0]) {
			g[x + y].emplace_back(y - x, 1);
		}
		for(auto[y, x]: v[1]) {
			g[x + y].emplace_back(y - x, 0);
		}
		REP(i, 400040) {
			sort(ALL(g[i]));
			REP(j, g[i].size() - 1) {
				if(g[i][j].second == 0 && g[i][j + 1].second == 1) {
					CHMIN(ans, 5*(g[i][j + 1].first - g[i][j].first));
				}
			}
		}

		vector<vector<pair<int,int>>>nv(4);
		REP(i, 4) for(auto&&[y, x]: v[i]) {
			nv[(i + 1) % 4].emplace_back(200000 - x, y);
		}
		v = nv;
		//out(ans);
	}
	ans == INF ? out("SAFE") : out(ans);
}

Measured memory_bytes: 48688
N = int(input())
A = list(map(int,input().split()))

A.sort()

ai = A[-1]

M = min(ai-A[0], A[0])
aj = A[0]

for i in range(N):
    m = min(ai-A[i], A[i])
    if M < m:
        aj = A[i]
        M = m

print(ai,aj)

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

int main() {
  int N;
  cin >> N;
  
  int ans = 100000000;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    
    int count = 0;
    
    if (x % 2 != 0)
      ans = 0;
    
    while (x % 2 == 0) {
      x /= 2;
      count++;
    }
    ans = min (ans,count);
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 3620
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int [][]po=new int[n][2];
        int index=0;
        int []hh=new int[n];
        for(int i=0;i<n;i++){
            po[i][0]=sc.nextInt();
            po[i][1]=sc.nextInt();
            if((hh[i]=sc.nextInt())>0)index=i;
        }
    
        int x=0,y=0,h=0;
        Po:for(x=0;x<=100;x++){
            for(y=0;y<=100;y++){
                boolean b=true;
                h=hh[index]+Math.abs(x-po[index][0])+Math.abs(y-po[index][1]);
                for(int i=0;i<n;i++){
                    if(Math.max(0,h-(Math.abs(x-po[i][0])+Math.abs(y-po[i][1])))!=hh[i]){
                        b=false;
                        break;
                    }
                }
                if(b)break Po;
            }
        }
        System.out.println(x+" "+y+" "+h);
    }
}

Measured memory_bytes: 27748
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define INF 0x3f3f3f3f

typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<double,double> pdd;
ll a,b;
int main()
{
    while(cin>>a>>b)
    {
        if(a>=10||b>=10) cout<<-1<<"\n";
        else cout<<a*b<<"\n";
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
int k;
cin >> k;
queue<ll>q;
for(int i=1;i<=9;i++) q.push(i);
while(1){
    if(k<=q.size()){
        rep(i,k-1) q.pop();
        cout << q.front() <<endl;
        return 0;
    }
    int len=q.size();
    rep(i,len){
        ll hd=q.front();q.pop();
        for(int j=-1;j<=1;j++){
            ll r=hd%10+j;
            if(r<0||r>9) continue;
            q.push(hd*10+r);
        }
    }
    k-=len;
}
return 0;
}



Measured memory_bytes: 1280
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int n,m;
int s[100000];

bool defeatable(int x,int l,int s){
    return s<x+l;
}

bool check(int x){
    int cnt=0;
    int l=1;
    while(!defeatable(x,l,s[n-1])){
        int i=lower_bound(s,s+n,l)-s;
        if(!defeatable(x,l,s[i]))i--;
        if(i>0&&abs(l-s[i])>abs(l-s[i-1]))i--;
        if(i<0)return false;
        cnt++;
        l+=max(1,x-abs(l-s[i]));
    }
    cnt++;
    return cnt>=m;
}

void run(){
    cin>>n>>m;
    if(!n)return;
    MEMSET(s);
    rep(i,n)cin>>s[i];
    int ok=s[0],ng=1e8;
    while(ng-ok>1){
        int mid=(ok+ng)/2;
        if(check(mid))ok=mid;
        else ng=mid;
    }
    if(check(ok))cout<<ok<<endl;
    else cout<<-1<<endl;
    run();
}


Measured memory_bytes: 3532
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007

ll buc[50]={0};
ll dp[100]={0};


int main(){
  ll a,b,c,n,h,w;
  cin >> a >> b;
  cout << (a>b?a-1:a) << endl;
}


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

int main () {
  int H, N;
  cin >> H >> N;
  
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  for (int i = 0; i < N; i++) {
    H -= A.at(i);
  }
  
  if (H > 0) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 100001
#define INF (1<<29)
typedef pair<int,int> pii;
 
int field[MAX],N,dist[MAX];
 
bool inField(int x){
    return 0 <= x && x < N;
}
 
int dijkstra(int s){
    priority_queue<pii,vector<pii>,greater<pii> > Q;
    Q.push(pii(dist[s],s));
    while(!Q.empty()){
	pii p = Q.top(); Q.pop();
	int v = p.second;
	if(dist[v] < p.first) continue;
	if(field[v] == 0){
	    for(int i = 0 ; i < 6 ; i++){
		int next = v+i+1;
		if(!inField(next)) continue;
		if(dist[v] + 1 < dist[next]){
		    dist[next] = dist[v] + 1;
		    Q.push(pii(dist[next],next));
		}
	    }
	}else{
	    int next = v + field[v];
	    if(!inField(next)) continue;
	    if(dist[v] < dist[next]){
		dist[next] = dist[v];
		Q.push(pii(dist[next],next));
	    }
	}
    }
    return dist[N-1];
}
 
int main(){
    cin >> N;
    for(int i = 0 ; i < N ; i++){
	cin >> field[i];
    }
    fill(dist,dist+MAX,INF);
    dist[0] = 0;
    cout << dijkstra(0) << endl;
    return 0;
}

Measured memory_bytes: 3876
A, B, C, X = 4.times.map{gets.to_i}
a, count = 0, 0
while a <= A do
  n = X - 500 * a
  b = 0
  while b <= B && n >= 0 do
    m = n - 100 * b
    count += 1 if m % 50 == 0 && m <= 50 * C && m >= 0
    b += 1
  end
  a += 1
end
print count

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,k,ans,j,l;
int sum1=1,sum2=1;
int main()
{
    cin>>n>>k;
    j=k-1;
    sum1*=k;
    n--;
    while(n>0)
    {
        n--;
        sum1=sum1*j;
    }
    cout<<sum1<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
n,m = map(int,input().split())

d = defaultdict(list)

if m==0:
    print(1)
    exit()

visited = [-1] + [False]*n
for i in range(m):
    a,b = map(int,input().split())
    d[a].append(b)
    d[b].append(a)
maxi = 1
for i in range(1,n+1):
    if visited[i]:
        continue
    cnt = 0
    que = deque([i])
    while que:
        v = que.pop()
        if not visited[v]:
            visited[v] = True
            cnt += 1
        for j in d[v]:
            if not visited[j]:
                que.append(j)
    maxi = max(maxi,cnt)
print(maxi)

Measured memory_bytes: 133748
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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;
}

#define rep(i, e) for(int i = 0; i < e; i++)
#define repp(i, s, e) for(int i = s; i < e; i++)
#define MAX_N 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define NIL -1
typedef pair<ll, ll> P;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

void print(vector<ll> &v) {
    rep(i, v.size()) {
        if(i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}

int main() {
    int W, H, w, h, cnt = 0;
    cin >> W >> H >> w >> h;

    rep(i, W) {
        rep(j, H) {
            if(i > w - 1 && j > h - 1) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
// Problem : B - ... (Triple Dots)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define sqr(x) (x) * (x)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define rALL(a) a.rbegin(), a.rend()
#define SORT(a) sort(ALL(a))
#define sc scanf
#define pr printf
#define xatop(a) cerr << #a << " = " << a << endl;
#define jsatr xatop(__LINE__)
#define INF 1000000000
#define mod 1000000007

int main() {
	int k;
	string s;

	cin >> k >> s;

	if (s.size() <= k)
		cout << s << endl;
	else
		cout << (s.substr(0, k)) << "..." << endl;

	return 0;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int C[26][2]{};

int main() {
  int N;
  string S;
  cin >> N >> S;
  for (int i = 0; i < 26; ++i) {
    C[i][0] = -1;
    C[i][1] = -1;
  }
  for (int i = 0; i < N; ++i) {
    int c = S[i] - 'a';
    if (C[c][0] == -1) {
      C[c][0] = i;
    } else {
      C[c][1] = i;
    }
  }
  int res = 0;
  for (int i = 0; i < N - 1; ++i) {
    int cnt = 0;
    for (int j = 0; j < 26; ++j) {
      if (C[j][0] <= i && i < C[j][1]) {
        ++cnt;
      }
    }
    res = max(res, cnt);
  }
  printf("%d\n", res);
}

Measured memory_bytes: 3228
#include<iostream>
#include<cmath>
#include<vector>
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 s1,s2,min=100000;
  for(int t=0;t<n;t++){
    s1=0;
    s2=0;
    for(int i=0;i<n;i++){
      if(i<=t) s1+=a.at(i);
      else s2+=a.at(i);
    }
    if(min>fabs(s1-s2)) min=fabs(s1-s2);
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#72 ミンコフスキー距離

n = int(input())
x = map(int, input().split())
y = map(int, input().split())

x_y = [abs(xi - yi) for xi, yi in zip(x, y)]
p1 = sum(x_y)
p2 = sum(i ** 2 for i in x_y) ** (1/2)
p3 = sum(i ** 3 for i in x_y) ** (1/3)
p_inf = max(x_y)

print(p1)
print(p2)
print(p3)
print(p_inf)


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

using namespace std;

typedef long long ll;
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}


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

    string m,s;
    cin >> m;
    for ( int i = 0; i < 19; i++ )
    {
        if ( i != 5 && i != 13 ) s += m[i];
        else s+= " ";
    }

    cout <<s;
    // 274751WM
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1000000007
#define loop(x) for(int i = 0; i < x; i++)
using namespace std;

long long swapCount = 0;
void swap(vector<int> &arr, int i, int j) {
    if(i == j) {
        return;
    }

    int temp = arr[i];
    arr[i] = arr[j];
    arr[j] = temp;
    swapCount++;
}

long long f(long long W, vector<long long> vls, vector<long long> wts) {
    vector<vector<long long>> dp(W + 1, vector<long long>(vls.size() + 1, 0));
    for(int i = 1; i <= W; i++) {
        for(int j = 1; j <= wts.size(); j++) {
            if(wts[j - 1] <= i) {
                dp[i][j] = max(dp[i][j - 1], dp[i - wts[j - 1]][j - 1] + vls[j - 1]);
                //cout<<"^ ";
            } else {
                dp[i][j] = dp[i][j - 1];
                //cout<<"<-";
            }
            //cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }
    return dp[W][vls.size()];
}

int main() { 
   //code
   ios::sync_with_stdio(false);
   int t = 1;
    //cin>>t;
    //cin.ignore();
   while(t--) {
        int row, col;
        ////////////////FOR ARRAY
        // cin>>col;
        // vector<int> arr;
        // for(long long i = 0; i < col; i++) {
        //     int x;
        //     cin>>x;
        //     arr.push_back(x);
        // }
        // f(arr);

        //////////////FOR MATIX
        // vector<int> arr;
        // for(int i = 0; i < row; i++) {
        //     arr.push_back(vector<int>(col, 0));
        //     for(int j = 0; j < col; j++) {
        //         int x;
        //         cin>>x;
        //         arr[i].push_back(x);
        //     }
        // }
        // f(arr);

        ////////////FOR STRING
        // string s;
        // cin>>s;
        // cout<<f(s)<<endl;
        cin>>col;
        long long W;
        cin>>W;
        vector<long long> wts(col, 0);
        vector<long long> vls(col, 0);
        for(long long i = 0; i < col; i++) {
            int wt, vl;
            cin>>wt;
            cin>>vl;
            wts[i] = wt;
            vls[i] = vl;
        }
        cout<<f(W, vls, wts)<<endl;
        
    }
    return 0; 
}

Measured memory_bytes: 82304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 2929000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;

    ll n,m;
    cin>>n>>m;
    ll L=-1,R=n+1;
    for(i=0;i<m;i++){
        ll l,r;
        cin>>l>>r;
        L=max(L,l);
        R=min(R,r);
    }
    cout<<max(0ll,R-L+1)<<endl;
    
    return 0;
}

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

int main(){
    int N,M,town;
    cin >> N >> M ;

    vector<int> roads(N);

    for(int i=0;i<2*M;i++){
        cin >> town;
        roads.at(town-1)++;
    }

    for(int i=0;i<N;i++){
        cout << roads.at(i) << endl;
    }
}

Measured memory_bytes: 256
class DisjointSet
  def initialize(size = nil)
    @rank = Array.new(size){0}
    @parent = []
    if size
      size.times do |i|
        @parent[i] = i
      end
    end
  end

  def same(x, y)
    return find(x) == find(y)
  end

  def unite(x, y)
    x = find(x)
    y = find(y)
    if @rank[x] > @rank[y]
      @parent[y] = x
    else
      @parent[x] = y
      @rank[y] += 1 if @rank[x] == @rank[y]
    end
  end

  def find(x)
    @parent[x] = find(@parent[x]) unless x == @parent[x] 
    return @parent[x]
  end
end

n = gets.to_i
tree = DisjointSet.new(n)

sides = {}
n.times{|i|
  arr = gets.split.map(&:to_i)
  arr.each_with_index{|val, j|
    if i > j && val > -1
      sides["#{i} #{j}"] = val
    end
  }
}

sides = sides.sort_by {|k, v| v}
sum = 0
sides.each{|side|
  r, l = side[0].split.map(&:to_i)
  unless tree.same(r, l) then
    sum += side[1]
    tree.unite(r, l)
  end
}
puts sum

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

using namespace std;

int main()
{
    string s , s1 ;
    cin>>s>>s1 ;
    string s2 = s ;
    bool t = true ;
    for(int i = 0 ; ; ++i)
    {
        if(s2 == s && i != 0)
            return cout<<"No" , 0 ;
        char c = s[s.size()-1];
        string s3 = "";
        s3 += c ;
        for(int j = 0 ; j < s.size()-1 ; ++j)
            s3 += s[j] ;
        s = s3 ;
        if(s == s1)
            return cout<<"Yes" , 0 ;
    }
    return 0 ;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = 0
sign = 1
for i in range(N):
  S += sign * A[i]
  sign *= -1
for i in range(N):
  print(S, end = ' '*(i<N-1))
  S *= -1
  S += 2*A[i]
print()

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

using namespace std;

long long inf=1000000007;

long long modpow(long long n,long long p,long long mod);

int main(){
	long long n,m;
	cin>>n>>m;
	while(n!=0 && m!=0){
		vector<long long> c(m),x(n);
		for(long long i=0;i<m;i++) cin>>c.at(i);
		for(long long i=0;i<n;i++) cin>>x.at(i);

		vector<vector<long long>> dp(n+1,vector<long long>(256,inf));
		dp.at(0).at(128)=0;
		long long ans=inf;

		for(long long i=0;i<n;i++){
			for(long long j=0;j<=255;j++){
				for(auto book:c){
					long long next=j+book;
					if(next>255) next=255;
					if(next<0) next=0;

					dp.at(i+1).at(next)=min(dp.at(i+1).at(next),dp.at(i).at(j)+(next-x.at(i))*(next-x.at(i)));

					if(i==n-1) ans=min(ans,dp.at(i+1).at(next));
				}
			}
		}

		cout<<ans<<endl;
		cin>>n>>m;
	}

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0) return (modpow(n,p/2,mod)*modpow(n,p/2,mod))%mod;
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}



Measured memory_bytes: 43712
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int mod=1e9+7;
struct Combin{
	#define N 4000005
	int fac[N],rv[N],facrv[N];
	Combin(){
		fac[0]=rv[1]=facrv[0]=1;
		for(int i=2;i<N;i++) rv[i]=((-(LL)(mod/i)*rv[mod%i]%mod)+mod)%mod;
		for(int i=1;i<N;i++) fac[i]=(LL)fac[i-1]*i%mod;
		for(int i=1;i<N;i++) facrv[i]=(LL)facrv[i-1]*rv[i]%mod;
	}
	int C(int r1,int n1){
		if(r1>n1) return 0;
		return fac[n1]*(LL)facrv[r1]%mod*facrv[n1-r1]%mod;
	}
	#undef N
}C;
int n,k;
int dp[2][2005];
int main(){
	scanf("%d%d",&n,&k);
	if(k==1) return puts("1"),0;
	int now=0;
	for(int i=0;i<=n;i++){
		memset(dp[now],0,sizeof(dp[0]));
		for(int j=i;j<=n;j++){
			if(j==i) dp[now][j]=i==0? 1:dp[now^1][j];
			else dp[now][j]=(dp[now^1][j] + dp[now][j-1]*1LL*C.C(k-2,k-2+i*k+(j-i-1)*(k-1)))%mod;
		}
		now^=1;
	}
	cout<<dp[now^1][n]*1LL*C.fac[n]%mod<<endl;
	return 0;
}

Measured memory_bytes: 47104
// Ryo Kamoi
// #define DEBUG

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>

using namespace std;

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

typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int INF = 1000000000;

int n;
ll a[100010];
int main(){
  cin >> n;
  REP(i, n) {
    cin >> a[i];
  }

  ll sum_all = 0;
  ll sum_odd = 0;
  REP(i, n) {
    sum_all += a[i];
    if (i%2 == 0 && i<n-1) sum_odd += a[i];
  }
  sum_all /= 2;

  ll last = sum_all - sum_odd;
#ifdef DEBUG
  cout << last << endl;
#endif
  ll prev = a[n-1] - last;
  cout << prev*2 << " ";
  REP(i, n-1) {
    cout << (a[i] - prev) * 2;
    prev = a[i] - prev;
    if (i<n-2) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
}


Measured memory_bytes: 2048
#include<stdio.h>
#include<math.h>
#define M_PI 3.14159265354979 
int main(){
	
	double ans,s1,s2,a,b,x;
	scanf("%lf %lf %lf",&a,&b,&x);
	
	if(x>a*a*b/2){
		s1=2*(a*a*b-x)/(a*a);
		ans=180*atan(s1/a)/M_PI;
	}else {
		s2=2*x/(a*b);
		ans=90-180*atan(s2/b)/M_PI;
	}
	
	printf("%lf",ans);
	
	return 0;
	
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int dp[MAXN][3];
int main()
{
    int n; scanf("%d", &n);
    for (int i = 1, c[3]; i <= n; i++)
    {
        for (int j = 0; j <= 2; j++) 
        {
            scanf("%d", &c[j]);
            for (int k = 0; k <= 2; k++) if (j != k)
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + c[j]);
        }
    }
    printf("%d\n", max(dp[n][0], max(dp[n][1], dp[n][2])));
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <cmath>

int main(){
    int N, D, n, d;
    scanf("%d", &N);
    scanf("%d", &D);

    int x[N][D];

    int i, j ;

    double dist;
    int k, cnt = 0;
    for(n=0;n<N;n++){
        for(d=0;d<D;d++){
            scanf("%d", &x[n][d]);
        }
        if(n != 0){
            j = n;
            float tmp;
            for(i=0;i<j;i++){
                tmp = 0;
                for(k=0;k<D;k++){
                    tmp += std::pow(x[i][k] - x[j][k], 2);
                }
                dist = sqrt(tmp);
                if((dist - (float)(int)dist) == 0.0F) cnt++;
            }
        }
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
import itertools
n,a,b,c = map(int, input().split())
l = [int(input()) for _ in range(n)]

ans = 10**100
for x in itertools.product([0,1,2,3], repeat=n):
    if not 0 in x or not 1 in x or not 2 in x: continue
    bum = [0,0,0]
    res = 0
    for i,j in enumerate(x):
        if j<3:
            if bum[j]!=0:
                res+=10
            bum[j]+=l[i]
    res += abs(a-bum[0])+abs(b-bum[1])+abs(c-bum[2])
    ans = min(ans, res)
print(ans)

Measured memory_bytes: 3064
#include<cstdio>

class dice{
private:
	int a,b,c,d,e,f;
public:
	void setnumber(void);
	void E(void);
	void W(void);
	void S(void);
	void N(void);
	void front(int x);
	void side(int y);
	int puta(void);
};

void dice::setnumber(void){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
}


void dice::E(void){
int a1=a,c1=c,d1=d,f1=f;
a=d1;
c=a1;
d=f1;
f=c1;
}

void dice::W(void){
int a1=a,c1=c,d1=d,f1=f;
a=c1;
c=f1;
d=a1;
f=d1;
}

void dice::S(void){
int a1=a,b1=b,e1=e,f1=f;
a=e1;
b=a1;
e=f1;
f=b1;
}

void dice::N(void){
int a1=a,b1=b,e1=e,f1=f;
a=b1;
b=f1;
e=a1;
f=e1;
}

void dice::front(int x){
int i=0,a1,b1,c1,d1,e1,f1;
while (b!=x){
	a1=a;
	b1=b;
	c1=c;
	d1=d;
	e1=e;
	f1=f;
	a=b1;
	b=c1;
	c=a1;
	d=f1;
	e=d1;
	f=e1;
	i++;
	if(i==4)break;
}

if (b!=x){
	a=e1;
	b=f1;
	c=d1;
	d=c1;
	e=a1;
	f=b1;
}
//printf("%d %d %d %d %d %d\n",a,b,c,d,e,f);
while (b!=x){
	a1=a;
	b1=b;
	c1=c;
	d1=d;
	e1=e;
	f1=f;
	a=b1;
	b=c1;
	c=a1;
	d=f1;
	e=d1;
	f=e1;
}
//printf("front\n");
}

void dice::side(int y){
int a1,c1,d1,f1;
while(c!=y){
	a1=a;
	c1=c;
	d1=d;
	f1=f;
	a=d1;
	c=a1;
	d=f1;
	f=c1;
}
}

int dice::puta(void){
return a;
}

int main(void){
dice koro;
int q,b[24],c[24],a[24];
char ch[101];
int i=0;
koro.setnumber();
scanf("%d",&q);
for(i=0;i<q;i++){
	scanf("%d%d",&b[i],&c[i]);
	koro.front(b[i]);
	koro.side(c[i]);
	a[i]=koro.puta();
}

for(i=0;i<q;i++){
	printf("%d\n",a[i]);
}
return 0;
}

		

Measured memory_bytes: 2756
n = int(input())
s = list(map(int,input().split()))

temp = 0
cand1 = 0
for i in range(n):
    temp += s[i]
    if i%2 == 0:#正になってほしい
        if temp <= 0:
            cand1 += abs(temp-1)
            temp = 1
    else:#負になって欲しい
        if temp >= 0:
            cand1 += abs(temp+1)
            temp = -1

temp = 0
cand2 = 0
for i in range(n):
    temp += s[i]
    if i%2 == 0:
        if temp >= 0:
            cand2 += abs(temp+1)
            temp = -1
    else:
        if temp <= 0:
            cand2 += abs(temp-1)
            temp = 1

print(min(cand2,cand1))


Measured memory_bytes: 14468
#include <iostream>
using namespace std;int main(){long long x;cin>>x;for(int i=0;i<=1000;i++){for(int j=-1000;j<=i;j++){if((long long)i*i*i*i*i-(long long)j*j*j*j*j==x){cout<<i<<" "<<j<<endl;return 0;}}}}

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

using namespace std;

int main(void) {
	int H, W;
	cin >> H >> W;
	string A;
	for(int i = 0; i < H; ++i) {
		string line;
		cin >> line;
		A += line;
	}
	vector<int> v(26, 0);
	for(int i = 0; i < A.length(); ++i) {
		++v[A[i] - 'a'];
	}
	for(int i = 0; i < (H / 2) * (W / 2); ++i) {
		for(int j = 0; j < 26; ++j) {
			if(v[j] >= 4) {
				v[j] -= 4;
				break;
			}
			if(j == 25) {
				cout << "No\n";
				return 0;
			}
		}
	}
	if(H % 2 == 1) {
		for(int i = 0; i < W / 2; ++i) {
			for(int j = 0; j < 26; ++j) {
				if(v[j] >= 2) {
					v[j] -= 2;
					break;
				}
				if(j == 25) {
					cout << "No\n";
					return 0;
				}
			}
		}
	}
	if(W % 2 == 1) {
		for(int i = 0; i < H / 2; ++i) {
			for(int j = 0; j < 26; ++j) {
				if(v[j] >= 2) {
					v[j] -= 2;
					break;
				}
				if(j == 25) {
					cout << "No\n";
					return 0;
				}
			}
		}
	}
	cout << "Yes\n";
	return 0;
}



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

int main() {
  string o, e;
  cin >> o >> e;
  for(int i=0;i<o.size()+e.size();i++) {
    if(i % 2 == 0) {
      cout << o[i/2];
    } else {
      cout << e[i/2];
    }
  }

  cout << endl;
}

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

int main() {
  vector<int> a(3);
  rep(i, 3) cin>>a[i];
  sort(a.begin(), a.end());
  cout<<abs(a[0]-a[1])+abs(a[1]-a[2])<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		String P = sc.nextLine();
		S = S+S;
		if (S.contains(P)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26328
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    for(int j = 0; j < s.size(); j++){
      if(i != j && s.at(i) == s.at(j)){
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int product[2001];
int modinverse(int a, int m) 
{ 
    int m0 = m; 
    int y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        int q = a / m; 
        int t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x%mod; 
} 
int ncr(int n,int r)
{
    if(n<r)
    return 0;
    int numerator,denominator;
    numerator = product[n];
    denominator = (product[r]*product[n-r])%mod;
    int ans=(numerator*modinverse(denominator,mod))%mod;
    return ans;
}
signed main()
{
    int n,k,i;
    cin>>n>>k;
    int blue=k,red=n-k;
    product[0]=1;
    for(i=1;i<=2000;i++)
    {
        product[i]=product[i-1]*i;
        product[i]%=mod;
    }
    for(i=1;i<=k;i++)
    {
        int red_balls=red-(i-1),blue_balls=blue-i;
        int red_boxes=i+1,blue_boxes=i;
        int ans1=ncr(red_balls+red_boxes-1,red_boxes-1);
        int ans2=ncr(blue_balls+blue_boxes-1,blue_boxes-1);
        int ans=(ans1*ans2)%mod;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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


const int MAX = 1000000;
bool is_prime[MAX + 10];
int key(int n)
{
	vector<int> p;
	for (int i = 2; i <= n; ++i)
		if (is_prime[i] && n % i == 0)
			p.push_back(i);
	return 2 * p.back() - accumulate(all(p), 0);
}
int main()
{
	fill_n(is_prime, MAX, true);
	for (int i = 2; i*i <= MAX; ++i)
		if (is_prime[i])
			for (int j = 2*i; j <= MAX; j += i)
				is_prime[j] = false;

	int a, b;
	while (scanf("%d%d", &a, &b), a | b)
		puts(key(a) > key(b) ? "a" : "b");
}

Measured memory_bytes: 1864
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
ll mod = 1e9 + 7;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i, n)cin >> a[i];
	sort(ALL(a));
	vector<pair<ll, int>> p(m);
	rep(i, m)
	{
		int b;ll c;
		cin >> b >> c;
		p[i] = make_pair(c, b);
	}
	sort(ALL(p),greater<pair<ll,int>>());
	vector<ll>d(n, 0);
	int k = 0;
	int l = 0;
	while (k < n && l < m)
	{
		int end = min(k + p[l].second, n);
		for (int i = k; i < end; i++)
		{
			d[i] = p[l].first;
		}
		k = end;
		l++;
	}
	rep(i, n)
	{
		if (d[i]-a[i]>0) a[i] = d[i];
		else break;
	}
	ll ans = 0;
	rep(i, n)ans += a[i];
	co(ans);
	return 0;
}


Measured memory_bytes: 3328
import java.util.*;
// warm-up
// Awesome twist
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		String tok = sc.next();
		int k=0;
		for (int i=0; i<tok.length()-1; i++) {
			if (tok.substring(i, i+2).equals("WB")) { k++; i++; }
		}
		for (int i=0; i<tok.length()-1; i++) {
			if (tok.substring(i, i+2).equals("BW")) { k++; i++; }
		}
		System.out.println(k);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 48476
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    int in;
    vector<int> v;
    cin>>in;
    v.push_back(in);
    cin>>in;
    v.push_back(in);
    cin>>in;
    v.push_back(in);
    sort(v.begin(),v.end());
    cout<<((v[0]==5&&v[1]==5&&v[2]==7)?"YES":"NO");

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
    int a,b;
    string op;
    
    while(1){
    cin >> a >> op >> b;
        if(op == "+"){
            cout << a + b << endl;
        }else if(op=="-"){
            cout << a - b << endl;
        }else if(op=="*"){
            cout << a * b << endl;
        }else if(op=="/"){
            cout << a / b << endl;
        }
        if( op == "?"){
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcases int t;cin>>t;while(t--)
#define int ll
#define pb push_back
#define mod 1000000007
#define for0 for(int i=0;i<n;i++)
#define for1 for(int i=1;i<n;i++)
#define inp0(arr) for(int i=0;i<n;i++)cin>>arr[i];
#define inp1(arr) for(int i=1;i<=n;i++)cin>>arr[i];
#define disp0(arr) for(int i=0;i<n;i++)cout<<arr[i]<<" ";
#define disp1(arr) for(int i=1;i<=n;i++)cout<<arr[i]<<" ";
int binaryexp(int a,int b){int ans=1;
    while(b>0){
        int last_bit=(b&1);if(last_bit)ans*=a;a*=a;b=b>>1;}
    return ans;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
void start()
{
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}
int highestPowerOf2(int n) {return (n & (~(n - 1)));}
int leftMostSetBit(int n) {int k = (int)(log2(n));return k;}
void solve()
{
	string s,t;
	cin>>s>>t;
	int n=s.size();
	int i,ans=0;
	for(i=0;i<n;i++)
	{
		if(s[i]!=t[i])
			ans++;
	}
	cout<<ans<<"\n";
}
signed main()
{
	start();
	int t=1;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3808