akhauriyash/Code-Regression huggingface dataset:
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

struct point {
	double	x, y;
};

struct triangle {
	struct point	vertices[3];
};

static inline double
distance(const struct point *p, const struct point *q)
{
	return hypot(p->x - q->x, p->y - q->y);
}

static inline void
decompose(size_t size, double **a)
{
	size_t	i, j, p;
	size_t	i_max;
	double	a_max, a_cur;

	for (p = 0; p < size - 1; p ++) {
		i_max = p;
		a_max = fabs(a[p][p]);
		for (i = p + 1; i < size; i ++) {
			a_cur = fabs(a[i][p]);
			if (a_cur > a_max) {
				i_max = i;
				a_max = a_cur;
			}
		}
		{
			double	*tmp = a[p];
			a[p] = a[i_max];
			a[i_max] = tmp;
		}
		for (i = p + 1; i < size; i ++) {
			a[i][p] /= a[p][p];
			for (j = p + 1; j < size; j ++) {
				a[i][j] -= a[i][p] * a[p][j];
			}
		}
	}
	for (i = 0; i < size; i ++) {
		for (p = 0; p < i; p ++) {
			a[i][size] -= a[p][size] * a[i][p];
		}
	}
	for (i = size; i > 0; ) {
		i --;
		for (p = i + 1; p < size; p ++) {
			a[i][size] -= a[p][size] * a[i][p];
		}
		a[i][size] /= a[i][i];
	}
}

double *
malfatti_radii(const struct triangle *tri, double mradii[])
{
	double	a, b, c, s, sa, sb, sc, ir;
	double	l, m, n;
	double	x, y, z;
	double	lx, my, nz;
	double	sqrt_x, sqrt_y, sqrt_z;
	double	f, g, h;
	double	norm_prev, norm_cur;

	a = distance(&tri->vertices[1], &tri->vertices[2]);
	b = distance(&tri->vertices[2], &tri->vertices[0]);
	c = distance(&tri->vertices[0], &tri->vertices[1]);
	s = (a + b + c) / 2;
	sa = s - a;
	sb = s - b;
	sc = s - c;
	ir = sqrt(sa * sb * sc / s);
	l = sa / ir;
	m = sb / ir;
	n = sc / ir;
	x = 1;
	y = 1;
	z = 1;
	norm_cur = HUGE_VAL;
	while (lx = l * x, my = m * y, nz = n * z,
	       sqrt_x = sqrt(x), sqrt_y = sqrt(y), sqrt_z = sqrt(z),
	       f = my + nz + 2 * sqrt_y * sqrt_z - (m + n),
	       g = lx + nz + 2 * sqrt_x * sqrt_z - (l + n),
	       h = lx + my + 2 * sqrt_x * sqrt_y - (l + m),
	       norm_prev = norm_cur,
	       (norm_cur = fabs(f) + fabs(g) + fabs(h)) < norm_prev) {
		double	table_base[3][4] = {
			{0, m + sqrt_z / sqrt_y, n + sqrt_y / sqrt_z, f},
			{l + sqrt_z / sqrt_x, 0, n + sqrt_x / sqrt_z, g},
			{l + sqrt_y / sqrt_x, m + sqrt_x / sqrt_y, 0, h},
		};
		double	*table[3] = {
			table_base[0], table_base[1], table_base[2]
		};
		decompose(3, table);
		x -= table[0][3];
		y -= table[1][3];
		z -= table[2][3];
	}
	mradii[0] = x * ir;
	mradii[1] = y * ir;
	mradii[2] = z * ir;
	return mradii;
}

int
main(int argc, char *argv[])
{
	double	x0, y0, x1, y1, x2, y2;
	struct triangle	t;
	double	r[3];

	while (scanf("%lf%lf%lf%lf%lf%lf", &x0, &y0, &x1, &y1, &x2, &y2) == 6 &&
	       !(x0 == 0 && y0 == 0 && x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0)) {
		t.vertices[0].x = x0;
		t.vertices[0].y = y0;
		t.vertices[1].x = x1;
		t.vertices[1].y = y1;
		t.vertices[2].x = x2;
		t.vertices[2].y = y2;
		malfatti_radii(&t, r);
		printf("%.6f %.6f %.6f\n", r[0], r[1], r[2]);
	}
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();


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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    cin>>a>>b;
    c=((a-1)+a);
    d=((b-1)+b);
    e=(a+b);
    f=max(c,d);
    cout<<max(f,e);

 return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline #文字列をsplit()しない場合s=s[:-2]が必要

    n=int(input())
    A=[int(_) for _ in input().split()]
    sum_a=sum(A)
    B=[int(_) for _ in input().split()]
    for i in range(n):
        s=max(B[i]-A[i],0)
        A[i]-=min(A[i],B[i])
        A[i+1]-=min(A[i+1],s)
    print(sum_a-sum(A))

if __name__=='__main__':
    main()

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

int main()
{
   int n,m;
   cin>>n>>m;
   
   vector<int>to[100005];
  
  rep(i,m){
     int a,b;
     cin>>a>>b;
    
     a--; b--;
     to[a].push_back(b);
     to[b].push_back(a);
  }
  
  queue<int>q;
  vector<int>dist(n,INF);
  vector<int>pre(n,-1);

  dist[0] = 0;
  q.push(0);
  while(!q.empty())
  {
      int v = q.front();
      q.pop();
    
      for(int u:to[v])
      {
         if(dist[u]!=INF)continue;
        
         dist[u] = dist[v]+1;
         pre[u] = v;
         q.push(u);
      
      } 
  }
 
 cout<<"Yes"<<endl;
  
  rep(i,n)
  {
      if(i==0)continue;
   
      int ans = pre[i];
       ans++;
      cout<<ans<<endl;
  
  }
  
}


Measured memory_bytes: 10684
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
int sum[2001][2001];
ll f(int x1,int y1,int x2,int y2){
    return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    map<int,int> mp;
    int n;cin>>n;
    int r=0;
    rep(i,0,n){
        int a;cin>>a;
        if(mp[a]==0)mp[a]++;
        else{
            r=1;
        }
    }
    if(r)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


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

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

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

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

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

/*


*/

vi dp(N,0);
void solve(){
    in2(n,k);
    vi a(n); lelo(a);
    for(i=1;i<=k;i++){
    	for(j=0;j<n;j++){
    		if(i-a[j]>=0 and dp[i-a[j]]==0){
    			dp[i]=1;
    		}
    	}
    }
    if(dp[k]){
    	ce("First");
    	re;
    }
    ce("Second");
}

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

/*


*/

  

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

int main()
{
    int n, a[100010] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

    int sum = 0;
    for (int i = 1; i < n + 2; i++) sum += abs(a[i] - a[i - 1]);

    for (int i = 1; i <= n; i++) {
        int t = sum - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1]);
        printf("%d\n", t);
    }

    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
	string X;
	cin >> X;
	int num_S = 0, num_T = 0;
	int cnt = 0;
	for(int i = 0; i < X.length(); i++){
		if(X[i] == 'S') num_S++;
		if(X[i] == 'T'){
			num_T++;
			if(num_S >= 1){
				num_T--;
				num_S--;
				cnt++;
			}
		}
	}
	cout << X.length() - cnt * 2 << endl;
	return 0;
}



Measured memory_bytes: 644
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define mp make_pair

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> pii;
///-------------------------


int main()
{
    Phuong_; /// <3
    string s;
    cin >> s;
    bool ans=false;
    for(int i=0;i<3; ++i)
        if (s[i]=='7') ans=true;
    if (ans) cout << "Yes"; else cout << "No";
    return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int H, A;
    cin >> H >> A;
    int ans = 0;
    while(H > 0) {
        ans++;
        H -= A;
    }
cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
int n;
int arr[N];
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
int ans=0;
arr[0]=1;
for(int i=0;i<n;i++)
{
	int x;
	cin>>x;
	if(arr[x-1]){

	arr[x]=1;
	ans=max(ans,x);}
}
if(ans==0)
cout<<"-1";
else
cout<<n-ans;


}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define INF 1<<30
#define LINF 1LL<<60
#define MAX_C 105
#define Min 10010
ll dp[MAX_C][Min];
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, C; cin >> N >> C;
	vector<ll> a(N), b(N), c(N);
	for (int i = 0; i < N;i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 0; i < MAX_C;i++) {
		for (int j = 0; j < Min;j++) {
			dp[i][j] = -INF;
		}
	}

	dp[0][0] = 0;
	for (int i = 0; i < N;i++) {
		for (int j = MAX_C - 1; j >= 0; j--) {
			for (int k = Min - 1; k >= 0;k--) {
				if (dp[j][k] == -INF)continue;
				if (j + c[i] > C)continue;
				ll x = min(k + a[i], dp[j][k] + b[i]);
				ll y = max(k + a[i], dp[j][k] + b[i]);
				dp[j + c[i]][x] = max(dp[j + c[i]][x], y);

				x = min(k + b[i], dp[j][k] + a[i]);
				y = max(k + b[i], dp[j][k] + a[i]);
				dp[j + c[i]][x] = max(dp[j + c[i]][x], y);
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < MAX_C;i++) {
		for (int j = Min - 1; j >= 0;j--) {
			if (dp[i][j] == -INF) continue;
			ans = max(ans, (ll)j);
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11372
/*
Main AC Solution
*/

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

//#include "../maker/common.h"

const int MN = 100;

V<int> input() {
    int n;
    assert(scanf("%d", &n));
    assert(2 <= n && n <= MN);
    V<int> v(n);
    for (int i = 0; i < n; i++) assert(scanf("%d", &(v[i])));
    return v;
}

mt19937 gen;
void reseed(ll seed) {
    gen = mt19937(seed);
    for (int i = 0; i < 10000; i++) {
        gen(); // skip
    }
}

ll rand_int(ll l, ll r) { //[l, r]
    using D = uniform_int_distribution<ll>;
    assert(l <= r);
    return D(l, r)(gen);
}


int main() {
    V<int> v = input();
    int n = int(v.size());
    int ans = 0;
    int l = 0;
    while (l < n) {
        int r = l;
        while (r < n && v[l] == v[r]) r++;
        ans += (r-l) / 2;
        l = r;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,m;

int main()
{	cin>>n>>k;
    m=n*(n-1)/2-k;
    if(m<n-1) 
		m=-1;
    cout<<m<<endl;
    if(m!=-1)
	{
        int cnt=n-1;
        while(m>0)
		{
            for(int i=n-cnt+1;i<=min(n,n-cnt+m);++i) 
				cout<<n-cnt<<" "<<i<<endl;
            m-=cnt--;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
int main() {
	long long n;
    std::cin >> n;
    std::unordered_map< long long, long long > mmap;
    std::vector<long long> a(n,0);
    for(long long i = 0; i < n; ++i) {
        long long x;
        std::cin >> x;
        a[i] = x;
        if (i != 0) a[i] += a[i - 1];
        if (mmap.find(a[i]) == mmap.end()) {
            mmap.insert(std::pair < long long, long long > (a[i], 1));
        } else {
            mmap[a[i]] += 1;
            
        }
        //std::cout << a[i] << '\n';
    }
    long long count = 0;
    for (std::unordered_map< long long, long long >::iterator it = mmap.begin(); it!= mmap.end(); ++it) {
        long long x = it->first;
        if (x == 0) {
            count += (it->second);
        }
        count += (mmap[x]) * (mmap[x] - 1) / 2;
    }
    std::cout << count << '\n';
}

Measured memory_bytes: 10056
import java.math.*;
import java.util.*;
import java.util.function.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] H = new int[N];
    for (int i = 0; i < N; i++) H[i] = sc.nextInt();
    sc.close();

    BigInteger ans = BigInteger.ZERO;
    Arrays.sort(H);
    for (int i = H.length - 1 - K; -1 < i; i--) {
      ans = ans.add(BigInteger.valueOf(H[i]));
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 81408
#include <iostream>
#include <stdio.h>

using namespace std;
int main(){
    int  n;
    cin >> n;
    int b,f,r,v;
    int a[4][3][10] = {};
    for(int i=0; i<n; i++){
        cin >> b >> f >> r >> v;
        a[b-1][f-1][r-1] += v;
    }
    
    for(int i = 0; i < 4 ; i++){
        for(int j = 0; j<3; j++){
            for(int k = 0; k < 10; k++){
                cout << " " << a[i][j][k];
                
            }
            cout << endl;
        }
        if(i != 3){
            cout << "####################" << endl;
    
            
        }
    }
    
}


Measured memory_bytes: 3092
program tenquestionfive
 implicit none
 integer N, A, B, i, sum, res
 integer x1, x2, x3, x4, x5
 read(*,*) N, A, B
 res=0
 do i=1,N
 x1=int(i/10**4)
 x2=int(i/10**3)-x1*10**1
 x3=int(i/10**2)-x1*10**2-x2*10**1
 x4=int(i/10**1)-x1*10**3-x2*10**2-x3*10**1
 x5=int(i/10**0)-x1*10**4-x2*10**3-x3*10**2-x4*10**1
 sum=x1+x2+x3+x4+x5
 if ((sum.ge.A).and.(sum.le.B)) res=res+i
 end do
 write(*,*) res
end program

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    ll a_c = 0;
    ll b_c = 0;
    rep(i, N) {
        ll a = A[i];
        ll b = B[i];
        if (a == b) continue;
        ll tmp = abs(a - b);
        if (a > b) {
            b_c += tmp;
        } else {
            if (tmp % 2) {
                a_c += (tmp + 1) / 2;
                b_c++;
            } else {
                a_c += tmp / 2;
            }
        }
    }

    if (a_c >= b_c) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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



int main() 
{
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    int ans = 0;
    rep(i,n)
    {
        rep(j,n)
        {
            if(i!=j)
            {
                ans += d[i]*d[j];
            }
        }
    }

    cout << ans/2 << endl;




    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;


int main() {
    long n, l;
    cin >> n >> l;
    vector<long> a (n);
    for (long i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    // Can be approached from behind: can a rope be fully tied from fully untied state?
    // Let's try completely optimizing it: if one 1st tie is possible, then you can tie it fully 
    // from that position without checking anything anymore, because it will always be > l
    
    long lastKnot = 1000000;
    for (long i = 0; i < n - 1; i++) {
        if(a[i] + a[i+1] >= l) {
            lastKnot = i + 1;
            break;
        }
    }
    
    if (lastKnot != 1000000) {
        ostringstream ss;
        for (int i = 1; i < lastKnot; i++) ss << i << endl;
        for (int i = n-1; i >= lastKnot; i--) ss << i << endl;
        cout << "Possible" << endl << ss.str();
    } else {
        cout << "Impossible";
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int& h : H) cin >> h;
  vector<int> dp(N, 0);
  for (int i = 1; i <= N; i++) {
    for (int k = 1; k <= K; k++) {
      if (i - k < 0) break;
      int tmp = abs(H[i] - H[i-k]);
      if (k == 1) dp[i] = tmp + dp[i-k];
      else dp[i] = min(dp[i], tmp + dp[i-k]);
    }
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int K, S;
	cin >> K >> S;
	
	int ans = 0;
	for (int i = 0; i <= K; i++)
	{
		for (int j = 0; j <= K; j++)
		{
			int k = S - (i+j);
			if (0 <= k && k <= K)
				ans++;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
n=int(input())
a=list(int(input()) for _ in range(n))
a.sort()
cnt=1
ans=0
for i in range(n-1):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        if cnt%2==0:
            cnt=1
        else:
            ans+=1
            cnt=1
if a[-2]==a[-1]:
    if cnt%2==1:
        ans+=1
else:
    ans+=1
print(ans)


Measured memory_bytes: 7400
s = input()
bigin = len(s)
for i in range(len(s)):
    if s[i] == "A":
        bigin = i
        break
for j in range(len(s) - 1,-1,-1):
    if s[j] == "Z":
        end = j
        break
ans = end - bigin + 1
print(ans)

Measured memory_bytes: 3516
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <cstring>

#define test(t) while(t--)
#define fo(i,k,n) for(int i=k;i<n;i++)
#define refl(a,x) for(auto& a:x)
#define MIN(a,b)  (a>b?b:a)
#define ll  long long int
#define MOD 1e9 + 7
#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "
#define fi first
#define se second
#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
//typedef pair<int,int> pai;
//typedef pair<char,int> pac;



/*bool f(int x,int y){

return x>y;
}*/


using namespace std;


void solve(){ll x,y;
             in x>>y;
             //if(x>y)
             out min((x%y),y-(x%y))<<en;
             //else
                //out x<<en;
}


int main(){ fast()
             //freopen("input.txt","r",stdin);
	         //freopen("output.txt","w",stdout);
             ll t=1;
            //cin>>t;
            test(t){
            solve();
            }

return 0;}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	int n;
	cin >> n;
	int dp[100050] = {};
	vector<int> s;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		s.push_back(a);
	}
	dp[0] = 0;
	dp[1] = dp[0] + abs(s[0]-s[1]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 2] + abs(s[i - 2] - s[i]), dp[i-1]+abs(s[i-1]-s[i]));
	}
	int c = n - 1;
	cout << dp[c];
}

Measured memory_bytes: 1276
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}

const int N=1000010;
VI p[N];
int mp[N];
void main() {
    for ( int i=2; i<N; i++ ) {
        if ( SZ(p[i]) ) continue;
        for ( int j=i; j<N; j+=i ) {
            p[j].PB(i);
        }
    }
    
    int n;
    R(n);
    VI a(n);
    REP(i,n) R(a[i]);
    REP(i,n) {
        for ( int j:p[a[i]] ) mp[j]++;
    }
    int ok=1,ok2=1;
    for ( int i=2; i<N; i++ ) {
        if ( mp[i]>1 ) ok=0;
        if ( mp[i]==n ) ok2=0;
    }
    if ( ok ) {
        W("pairwise coprime");
    } else if ( ok2 ) {
        W("setwise coprime");
    } else {
        W("not coprime"); 
    }
}

}} // {{{ main
int main() { unolight::main(); return 0; }
// }}}


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

int main() {
    int n;
    string st;
    cin >> n;
    cin >> st;
    int l = 0;
    int r = n - 1;
    int cnt = 0;
    while (l < r) {
        while (l < r && st[l] == 'R') {
            l += 1;
        }

        while (r > l && st[r] == 'W') {
            r -= 1;
        }

        if (l < r) {
            swap(st[l], st[r]);
            cnt += 1;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3704
import itertools

n = int(input())
l = list(map(int, input().split()))

comb = list(itertools.combinations(l, 3))

# print(comb)

count = 0

for c in comb:
    if c[0] + c[1] > c[2] and c[1] + c[2] > c[0] and c[0] + c[2] > c[1]\
            and c[0]!=c[1] and c[0]!=c[2] and c[1]!=c[2]:
        # print(c)
        count += 1

print(count)

Measured memory_bytes: 20636
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    n=int(input())
    X,Y,XY=[],[],[]
    for i in range(n):
      x,y=map(int,input().split())
      X.append(x+y)
      Y.append(x-y)
      XY.append((x+y,x-y))
    X.sort()
    Y.sort()
    ans=0
    for x,y in XY:
      ans=max(ans,max(x-X[0],X[-1]-x,y-Y[0],Y[-1]-y))
    print(ans)


if __name__ == '__main__':
    resolve()

Measured memory_bytes: 52896
n, x, y = map(int, input().split())

def dis(a, b):
    ret = abs(a - b)
    ret = min(ret, abs(a - x) + 1 + abs(b - y))
    ret = min(ret, abs(a - y) + 1 + abs(b - x))
    return ret

ans = [0] * (n-1)
for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans[dis(i, j)-1] += 1

for x in ans:
    print(x)

Measured memory_bytes: 50908
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    char c;
    string s="";
    while(n--){
        cin >> c;
        s+=c;
    }
    for(int i=0; i<=1997; i++){//4桁は997個だけ1997より小さい
        if(s.find(to_string(i))==string::npos){//nposとは部分列が入っていないのをさす
            cout << i << "\n";
            break;
        }
    }
    
}



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

int main() {
    int n, m; cin >> n >> m;
    vector<int> v(m+1, 0);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int k; cin >> k;
        for (int j = 0; j < k; j++) {
            int p; cin >> p;
            v[p]++;
        }
    }
    for (int i = 0; i <= m; i++) {
        if (v[i] == n) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

#define MAX_H 7
#define MAX_W 7

int w, h;
int gy, gx;
int F[MAX_H][MAX_W];

struct P {
    int wx, wy;
    int cx, cy;
    int t;
};

const int dy[] = {0, 1, 0, -1};
const int dx[] = {1, 0, -1, 0};
bool used[MAX_H][MAX_W][MAX_H][MAX_W]; // 荷物の座標, ミスターの座標

bool v[MAX_H][MAX_W];
bool can_move_to(int fy, int fx, int ty, int tx) {
    if (ty == fy && tx == fx) return true;
    if (F[ty][tx] == 1) return false;
    if (F[fy][fx] == 1) return false;
    for (int i = 0; i < 4; i++) {
        int ny = fy + dy[i];
        int nx = fx + dx[i];
        if (0 <= ny && ny < h && 0 <= nx && nx < w && !v[ny][nx]) {
            v[fy][fx] = true;
            if (can_move_to(ny, nx, ty, tx)) 
                return true;
        }
    }
    return false;
}

int bfs(P cur) {
    queue<P> q;
    q.push(cur);
    memset(used, 0, sizeof(used));
    while (!q.empty()) {
        P p = q.front(); q.pop();
        if (p.cy == gy && p.cx == gx) 
            return p.t;
        for (int i = 0; i < 4; i++) {
            int ny = p.cy + dy[i];
            int nx = p.cx + dx[i];
            int py = p.cy - dy[i];
            int px = p.cx - dx[i];
            P next;
            next.wy = p.cy;
            next.wx = p.cx;
            next.cy = ny;
            next.cx = nx; 
            next.t = p.t + 1;
            if (0 <= ny && ny < h && 0 <= nx && nx < w && 
                    0 <= py && py < h && 0 <= px && px < w && F[ny][nx] != 1 && !used[next.cy][next.cx][next.wy][next.wx]) {
                memset(v, 0, sizeof(v));
                F[p.cy][p.cx] = 1;
                if (can_move_to(p.wy, p.wx, py, px)) {
                    used[next.cy][next.cx][next.wy][next.wx] = true;
                    q.push(next);
                }
                F[p.cy][p.cx] = 0;
            }
        }
    }
    return -1;
}

int main() {
    while (cin >> w >> h, w || h) {
        P cur;
        cur.t = 0;
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++) {
                cin >> F[i][j];
                if (F[i][j] == 4) {
                    cur.wy = i;
                    cur.wx = j;
                    F[i][j] = 0;
                } else if (F[i][j] == 2) {
                    cur.cy = i;
                    cur.cx = j;
                    F[i][j] = 0;
                } else if (F[i][j] == 3) {
                    gy = i;
                    gx = j;
                    F[i][j] = 0;
                }
            }
        cout << bfs(cur) << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
// #define multicase
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 15;

int freq[N], a[N];

void solve() {
    int T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    for(int tc = 1; tc <= T; tc++) {
        for(int i = 1; i <= 3; i++) {
            cin >> a[i];
            freq[a[i]]++;
        }
        cout << (freq[5] == 2 && freq[7] == 1 ? "YES\n" : "NO\n"); 
    }
}

int main() {

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

    solve();
    
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

    int n;
    cin >> n;
    lol a[n + 5], b[n + 5], ans = 0;
    reps(i, n){
      cin >> a[i] >> b[i];
    }
    for(int i = n;i > 0;i --){
      if((a[i] + ans) % b[i] != 0){
	ans += b[i] - (a[i] + ans) % b[i];
      }
    }
    cout << ans << '\n';
    return 0;
} 


Measured memory_bytes: 1792
from collections import defaultdict
H, W, M = map(int, input().split())
d = defaultdict(int)
tate = [0 for i in range(H+1)]
yoko = [0 for i in range(W+1)]
for i in range(M):
    x, y = map(int, input().split())
    d[(x, y)] = 1
    tate[x] += 1
    yoko[y] += 1

ans = 0
T = []
Y = []
for i, v in enumerate(tate):
    T.append((v, i))
for i, v in enumerate(yoko):
    Y.append((v, i))
T.sort(reverse=True)
Y.sort(reverse=True)

value_t = T[0][0]
value_y = Y[0][0]
cnt_t = 0
cnt_y = 0
for value, index in T:
    if value == value_t:
        cnt_t += 1

for Value, Index in Y:
    if Value == value_y:
        cnt_y += 1
if cnt_t*cnt_y > M:
    print(value_t+value_y)

else:
    M = T[0][0]+Y[0][0] - 1
    value_t = T[0][0]
    value_y = Y[0][0]
    for value, index in T:
        if value < value_t:
            break
        for Value, Index in Y:
            if Value < value_y:
                break
            if (index, Index) in d.keys():
                ans = max(ans, value+Value-1)
            else:
                ans = max(ans, value+Value)
    print(ans)

Measured memory_bytes: 194764
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
 <url:https://github.com/kei1107/algorithm/blob/master/template/template_for_problems.cpp>
 ?????????============================================================
 n????????´??°a1, a2, ???, an??¨n????????´??°p1, p2, ???, pn?????´??°m?????????????????????
 k???????????´??°ak???pk[%]????¢??????§?????¶?????¨??????????????????k(1 ??? k ??? n)?????????????????????
 0?????\???n?????\????????´??°??????????????????1??\???m??\????????´??°????????§???
 ?????°????????´??°????°?????????¨???1?????§?????????????????????????????°????????????????±??????????
 =================================================================
 ?§£??¬=============================================================
 ????????????( := ????????????????????????)
 ================================================================
 
 
 <reference:http://d.hatena.ne.jp/simezi_tan/20130522/1369203086>
 
 ???????????????????????????????????? < rep(j, 0, n) if(j & (1 << i)) f[j] -= f[j ^ (1 << i)]; >
 ????????????????????????????????? <rep(j, 0, n) if(j & (1 << i)) f[j] += f[j ^ (1 << i)];>
 */

inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    vector<ll> a(n);
    vector<long double> p(n);
    for(auto &x:a) cin >> x;
    for(auto &x:p) {
        cin >> x;
        x/=100;
    }
    
    // Preprocessing
    // probability
    // ??????????±???????????????????????????£??????????????????
    vector<long double> dp1((1<<n),1.0);
    for(int i = 0; i < n;i ++){
        for(int j = 0; j < (1<<n);j++){
            if((j>>i)&1){
                dp1[j] *= p[i];
            }else{
                dp1[j] *= (1-p[i]);
            }
        }
    }
    
    // ????????????????????????
    /* ?????????????????? +=??¨?????? -=???????????°??????*/
    vector<ll> dp2((1<<n),0);
    for(int i = 0; i <(1<<n);i++){
        ll LCM = 1;
        for(int j = 0; j < n;j++){
            if(LCM > m) break;
            if((i>>j)&1){
                ll tmp = a[j] / gcd(LCM,a[j]);
                if(1.0 * tmp * LCM < 1.5e18) LCM*=tmp;
                else LCM = m+1;
            }
        }
        dp2[i] = m/LCM;
    }
    for(int i = 0; i < n;i++){
        for(int j = 0;j < (1<<n);j++){
            if((j>>i)&1){
                dp2[j] -= dp2[j^1 << i];
            }
        }
    }
    
    long double res = 0;
    for(int i = 0; i < (1<<n);i++){
        res += dp1[i] * (m - abs(dp2[i])); // ??¶???????????¨???
    }
    cout << fixed << setprecision(10) << res << endl;
    return 0;
}

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

int main() {
  
  int a, b;
  cin >> a >> b;
  
  cout << ((a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) ? "Possible" : "Impossible") << endl;
}

Measured memory_bytes: 256
END { load __FILE__ unless $stdin.eof? }

m = 10**9 + 7
n = gets.to_i
fish = Array.new(n) do
  a, b = gets.split.map!(&:to_i)
  c = a.gcd(b)
  c = -c if b < 0 || b == 0 && a < 0
  c == 0 ? [a, b] : [a / c, b / c]
end.tally

fish_p, fish_m = fish.partition { |(a, b), num| a > 0 }.map!(&:to_h)
zero = fish_m.delete([0, 0]) || 0

prod = 1
solo = 0
fish_p.each do |(a, b), x|
  if (y = fish_m.delete([-b, a]))
    prod *= (1 << x) + (1 << y) - 1
    prod %= m
  else
    solo += x
  end
end
solo += fish_m.values.sum

puts (prod * 2.pow(solo, m) - 1 + zero) % m


Measured memory_bytes: 50656
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, sum = 0;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N - 1; i++) {
        sum += abs(A.at(i) - A.at(i + 1));
    }
    sum += abs(A.at(0));
    sum += abs(A.at(N - 1));
    cout << sum - abs(A.at(0)) - abs(A.at(1) - A.at(0)) + abs(A.at(1)) << endl;
    for (int i = 1; i < N - 1; i++) {
        cout << sum - abs(A.at(i) - A.at(i - 1)) - abs(A.at(i + 1) - A.at(i)) + abs(A.at(i + 1) - A.at(i - 1)) << endl;
    }
    cout << sum - abs(A.at(N - 1) - A.at(N - 2)) - abs(A.at(N - 1)) + abs(A.at(N - 2)) << endl;

}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<bool> s(4, false);
  rep(i, n) {
    char a;
    cin >> a;
    if (a == 'P')
      s[0] = true;
    else if (a == 'W')
      s[1] = true;
    else if (a == 'G')
      s[2] = true;
    else
      s[3] = true;
  }
  int count = 0;
  rep(i, 4) {
    if (s[i] == true) count++;
  }
  if (count == 3) {
    cout << "Three" << endl;
  } else
    cout << "Four" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
  string input;
  cin >> input;
  if (input == "SUN")
  {
    cout << 7 << endl;
  }
  else if (input == "MON")
  {
    cout << 6 << endl;
  }
  else if (input == "TUE")
  {
    cout << 5 << endl;
  }
  else if (input == "WED")
  {
    cout << 4 << endl;
  }
  else if (input == "THU")
  {
    cout << 3 << endl;
  }
  else if (input == "FRI")
  {
    cout << 2 << endl;
  }
  else if (input == "SAT")
  {
    cout << 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int X;
  cin>>X;
  if(X<0)X=-X;
  int x=0;
  REP(i,X+1){
    x+=i;
    if(x>=X){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<algorithm>
using std::cout;
using std::cin;
using std::endl;
const int INF=100000;
int H,W;
int cost[10][10];
int mincost[10][10]={};

void input(void){
    cin>>H>>W;
    for(int i=0;i<=9;i++){
        for(int j=0;j<=9;j++){
            scanf("%d",&cost[i][j]);
        }
    }
}

void floyd(void){
    //initialize
    for(int i=0;i<=9;i++){
        for(int j=0;j<=9;j++){
            mincost[i][j]=cost[i][j];
        }
    }
    for(int k=0;k<=9;k++){
        for(int i=0;i<=9;i++){
            for(int j=0;j<=9;j++){
                mincost[i][j]=std::min(mincost[i][j],mincost[i][k]+mincost[k][j]);
            }
        }
    }
}
int solve(void){
    int answer=0;
    int m;
    for(int i=0;i<H*W;i++){
        scanf("%d",&m);
        if(m!=-1){
            //cout<<mincost[m][1]<<endl;
            answer+=mincost[m][1];
        }
    }
    return answer;
}

int main(void){
    input();
    floyd();
    cout<<solve()<<endl;
	
    return 0;
}


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

int main(){
  int N,K;
  string s;
  cin>>N>>K;
  cin>>s;
  //最後にN=1を考慮を
  if (N==1){
    cout<<1<<endl;
    return 0;
  }
  
  int sz=1;
  for(int i=0;i<N-1;i++){
    if (s[i]!=s[i+1]){
      sz++;
    }
  }
  if (s[0]==48)
    sz++;
  if (s[N-1]==48)
    sz++;
  if (sz==1){
    cout<<N<<endl;
    return 0;
  }
  
  //szは箱の数
  //箱の長さを計算
  int ms=49;
  int count=0;
  int idx=0;
  vector<int> x(sz,0);
  for(int i=0;i<N;i++){
    if (s[i]!=ms){
      x[idx]=count;
      count=0;
      idx++;
      ms=s[i];
    }
    count++;
  }
  x[idx]=count;
  
  
  
  int k=K*2+1;//取れる箱の最大数
  if (k>sz)
    k=sz;
  //最初のk個の連続した箱の長さを計算
  int gk=0,maxgk=0;
  for(int i=0;i<k;i++){
    gk+=x[i];
  }
  maxgk=gk;
  //そこから2箱ずつずらして長さの最大値を計算
  for(int i=k;i<sz;){
    gk+=x[i];//3
    gk+=x[i+1];//4
    gk-=x[i-k];//0
    gk-=x[i-k+1];//1
    i+=2;
    if (maxgk<gk)
      maxgk=gk;
  }
  
  cout<<maxgk<<endl;
  return 0;
}

Measured memory_bytes: 896
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(*args):
    print(*args,file=sys.stderr)

def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
     
#input

def resolve():
    A,B=pin()
    ans=-1
    for i in range(1,2001):
        if int(i*(0.08))==A and int(i*(0.1))==B:
            ans=i
            break

    print(ans)
    #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()

"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2 2"""
        output = """25"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """8 10"""
        output = """100"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """19 99"""
        output = """-1"""
        self.assertIO(input, output)
if __name__=="__main__":resolve()

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it++)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <ll> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



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

    int T=1;
    //cin >> T;
    while(T--){
        ll a,b,c,k;
        cin>>a>>b>>c>>k;
        ll ans=0;
        ans=min(k,a);
        k-=a;
        k-=b;
        if(k>0){
            ans-=k;
        }
        cout<<ans<<el;
    }

    return 0;
}

Measured memory_bytes: 3688
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 10 11:58:51 2020

@author: liang
"""

S = input()

r_index = -1
l_index = -1
r_count = 0
l_count = 0
ans = [0]*len(S)
for i in range(len(S)):
    #print(r_index, l_index)
    if S[i] == 'R':
        if l_index != -1:
            #ansの処理
            ans[r_index] = (r_count+1)//2 + l_count//2
            ans[l_index] = (l_count+1)//2 + r_count//2
            l_index = -1
            r_count = 0
            l_count = 0
        r_index = i
        r_count += 1
    else:
        if l_index == -1:
            l_index = i
        l_count += 1

#ansの処理        
ans[r_index] = (r_count+1)//2 + l_count//2
ans[l_index] = (l_count+1)//2 + r_count//2            

print(' '.join([str(i) for i in ans]))

Measured memory_bytes: 17112
INF = 1 << 60

n, k, c = map(int, input().split())
s = input()

left = []
b = -INF
cnt1 = 0
for i in range(n):
    if cnt1 == k:
        break
    if s[i] == "x":
        continue
    if b + c < i:
        b = i
        cnt1 += 1
        left.append(i)

right = []
b2 = INF
cnt2 = 0
for i in reversed(range(n)):
    if cnt2 == k:
        break
    if s[i] == "x":
        continue   
    if b2 - c > i:
        b2 = i
        cnt2 += 1
        right.append(i)

right = right[::-1]

# print("right =", right)
# print("left =", left)
m = len(left)
ans = []
for i in range(m):
    if right[i] == left[i]:
        ans.append(right[i])
for i in ans:
    print(i + 1)

Measured memory_bytes: 101344
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int64_t solve(int64_t x) {
	x++;
	if (x % 2 == 0) {
		if ((x / 2) % 2 == 1) return 1;
		else return 0;
	}
	else {
		if ((x / 2) % 2 == 1) return x;
		else return --x;
	}
}

int main() {
	int64_t A, B;
	cin >> A >> B;

	int64_t a, b;
	a = solve(A - 1);
	b = solve(B);
	//cout << a << ' ' << b << endl;

	cout << (a ^ b) << endl;
}

Measured memory_bytes: 3592