akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
  double v,y,t;
  int n;
  while(cin >> v){
    t = (v/9.8);
    y = 4.9 * (t*t);
    for(int i=1;i<=10000;i++){
      n = 5 * i - 5;
      if((int)y<n){
	cout << i << endl;
	break;
      }
    }
  }
}
 

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

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

        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();

        long c = Math.max(0, k - a);

        System.out.println(Math.max(0, a - k) + " " + Math.max(0, b - c));
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL a,b;
  cin >> a >> b;
  a+=1;
  a/=7;
  a=min(2ll,a);
  cout << a*b/2 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.ArrayList;

public class Main {

  public static void main(String[] args) throws IOException {
	  Scanner in = new Scanner(System.in);
	  int n = in.nextInt();
	  int last = n % 10;
	  String res = "hon";
	  if(last==3) {
		  res = "bon";
	  }else if(last==0 || last==1 || last==6 || last==8) {
		  res = "pon";
	  }
	  System.out.println(res);
      
  }
}

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

int main(){
	int n;
	cin >> n;
	vector<vector<vector<int>>> si(n, vector<vector<int>>(0, vector<int>(0)));
    rep(i, n){
      int sn;
      cin >> sn;
      rep(j, sn){
        int a0, a1;
        cin >> a0 >> a1;
        si.at(i).push_back({a0, a1});
      }
    }
    vector<int> sh(n);
    int max = 0;
    for(int i=0; i<pow(2, n); i++){
      int l = i;
      int a = 0;
      rep(j, n){
        if(l%2 == 1){
          sh.at(j) = 1;
          a++;
          //cout << 1 << ' ';
        }else{
          sh.at(j) = 0;
          //cout << 0 << ' ';
        }
        l /= 2;
      }
//      cout << endl;
      int f = 0;
      rep(j, n){
        if(sh.at(j) == 1){
          for(int k=0; k<si.at(j).size(); k++){
            //cout << sh.at(si.at(j).at(k).at(0)-1) << ' ' << si.at(j).at(k).at(1) << endl;
            if(sh.at(si.at(j).at(k).at(0)-1) != si.at(j).at(k).at(1)) f = 1;
          }
        }
      }
      if(f == 0 && max < a) max = a;
    }
	cout << max << endl;
}

Measured memory_bytes: 256
#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 endl '\n'
#define MAX

typedef long long ll;
typedef pair<int,int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

struct segment_tree{
	
	vector<ll> st;
	
	segment_tree(int n) : st(4 * n){ }
	
	void update(int node, int b, int e, int p, ll v){
		if(b == e)
			st[node] = v;
		else{
			int m = (b + e) >> 1;
			int l = node << 1;
			int r = l | 1;
			if(p <= m)
				update(l, b, m, p, v);
			else
				update(r, m + 1, e, p, v);
			
			st[node] = max(st[l], st[r]);
		}
	}
	
	ll query(int node, int b, int e, int i, int j){
		if(b >= i && e <= j)
			return st[node];
		if(b > j || e < i)
			return 0;
		int m = (b + e) >> 1;
		int l = node << 1;
		int r = l | 1;
		
		ll L = query(l, b, m, i, j);
		ll R = query(r, m + 1, e, i, j);
		
		return max(L, R);
 	}
	
};

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

	int n;
	cin >> n;
	
	vector<int> h(n);
	vector<ll> b(n);
	
	for(int i = 0; i < n; i++)
		cin >> h[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];
	
	int N = n + 10;
	
	segment_tree st(N);
	
	ll ans = 0;
	for(int i = 0; i < n; i++){
		ll mx = st.query(1, 1, N, 1, h[i]);
		mx += b[i];
		ans = max(ans, mx);
		st.update(1, 1, N, h[i], mx);
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main()
{
   char c[3][2];

   for (int i = 0; i < 2; i++)
   {
      for (int j = 0; j < 3; j++)
      {
         cin >> c[j][i];
         // cout << c[j][i];
      }
   }
   int cnt = 0;
   rep(i, 3)
   {
      rep(j, 1)
      {
         if (c[j][i] == c[2 - j][1 - i])
         {
            cnt++;
         }
      }
   }
   if (cnt == 3)
   {
      cout << "YES" << endl;
   }
   else
   {
      cout << "NO" << endl;
   }
   return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long H =  long.Parse(Console.ReadLine());
		long ans = 0;
		long a = 1;
		while(H>=2){
			H /= 2;
			ans += a;
			a *= 2;
		}
		ans += a;
		Console.WriteLine(ans);
	}
}

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

int main()
{
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    sort(v.begin(),v.end());
    cout << v[0] << " " << v[1] << " " << v[2] << endl;

    return 0;
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#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 rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define reps2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n;

#define WHITE 0
#define BLACK 1

int color[100'002];

struct edge {
    int to, cost;
    edge(int to, int cost) : to(to), cost(cost) {}
};
vector<edge> G[100'002];

void solve() {
    vector<int> st;
    st.push_back(0);
    fill(color, color + n, -1);
    color[0] = WHITE;

    while (!st.empty()) {
        int u = st.back();
        st.pop_back();
        for (const auto e : G[u]) {
            if (color[e.to] == -1) {
                color[e.to] = (e.cost % 2 == 0) ? color[u] : 1 - color[u];
                st.push_back(e.to);
            }
        }
    }
}

int main() {
    cin >> n;
    rep(i, n - 1) {
        int u, v, w;
        cin >> u >> v >> w;
        G[u - 1].push_back(edge(v - 1, w));
        G[v - 1].push_back(edge(u - 1, w));
    }
    solve();
    rep(i, n) { cout << color[i] << endl; }
    return 0;
}

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

using namespace std;

int main(int argc, const char * argv[]) {
    long long int n, k, hk, i, cnth, cnt, ans;
    ans = 0;
    hk = 0;
    cnt = 0;
    cnth = 0;
    cin >> n >> k;
    if(k % 2 == 0)hk = k / 2;
    if(k % 2 == 0){
        for(i = 1;i <= n;i++){
            if(i % k == 0)cnt++;
            else if(i % k == hk)cnth++;
        }
    }else{
        for(i = 1;i <= n;i++){
            if(i % k == 0)cnt++;
        }
    }
    ans = cnth * cnth * cnth + cnt * cnt * cnt;
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
mean=sum(a)//n
ans=float('inf')
for i in range(5):
    t=(mean-2)+i
    tmp=0
    for j in range(n):
        tmp+=(a[j]-t)**2
    ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,total;
	cin>>n>>total;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=(n-i);j++){
			for(int k=0;k<=(n-i-j);k++){
				if((i*10000+j*5000+k*1000)==total){
					if((i+j+k)==n){
						cout<<i<<' '<<j<<' '<<k<<endl;
						return 0;
					}
				}
			}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define mod 1000000007
#define size_f 100002
int main()
{
  ll w,h,x,y;
  cin>>w>>h>>x>>y;

  cout<<double(w)*double(h)/2<<" "<<(x+x==w&&y+y==h)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int N, A, B, C, D;  cin >> N >> A >> B >> C >> D;
	A -= 1, B -= 1, C -= 1, D -= 1;
	string s;  cin >> s;

	bool ans = true;
	for(int i = A ; i < max(C, D) ; i++)
		if(s.substr(i, 2) == "##")  ans = false;

	if(D < C){
      	bool flag = false;
		for(int i = B ; i <= D ; i++)
			if(i >= 0 && i< N && s.substr(i-1,3) == "...")  flag = true;
      
        if(!flag)  ans = false;  
	}

	if(ans)  cout << "Yes" << endl;
	else     cout << "No"  << endl;

	return 0;
}


Measured memory_bytes: 592
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
#include <queue>
#include <unordered_map>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
void fnc(string s,int c,vector<int>&v){
    int frnt=-c-2;
    rep(i,s.size()){
        if(s[i]=='x')continue;
        if(i-frnt>c){
            v.push_back(i);
            frnt=i;
        }
    }
}
int main(){
    int n,k,c;cin>>n>>k>>c;
    string s;cin>>s;
    vector<int> vf,vb;
    fnc(s,c,vf);
    reverse(s.begin(),s.end());
    fnc(s,c,vb);
    if(vf.size()>k)return 0;
    rep(i,k){
        if(vf[i]==n-1-vb[k-1-i])cout<<vf[i]+1<<endl;
    }
}

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

using namespace std;

int main(){
string s;
  cin >>s;
  if(s == "Sunny")
    cout<<"Cloudy"<<endl;
  else if(s=="Cloudy")
    cout<<"Rainy"<<endl;
  else
    cout<<"Sunny"<<endl;
  return 0;

}

Measured memory_bytes: 256
M,s=998244353,0
d=[1]+[0]*7**6
e=d[:]
n=input()
for _ in'_'*n:
 a=input();s+=a;i=s
 while~i:d[i]+=d[i-a]*2%M;e[i]+=e[i-a]%M;i-=1
print(3**n+~s%2*e[s//2]*3-3*sum(d[:s//2+1]))%M

Measured memory_bytes: 35308
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

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

  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << ' ' << b << ' ' << c;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CFBB
{
    static class MainClass
    {

        public static void Main(string[] args)
        {


            string[] input1 = Console.ReadLine().Split(' ');
            int N = int.Parse(input1[0]);
            int H = int.Parse(input1[1]);
            int W = int.Parse(input1[2]);



            var AB = new List<int[]>();

            for (int i = 0; i < N; i++)
            {
                int[] ab = new int[2];
                string[] input2 = Console.ReadLine().Split(' ');
                ab[0] = int.Parse(input2[0]);
                ab[1] = int.Parse(input2[1]);
                AB.Add(ab);
            }


            int ans = 0;


            for (int j = 0; j < N;j++){

                if(AB[j][0]>=H && AB[j][1]>=W){
                    ans++;

                }
            }


            Console.WriteLine(ans);

            return;


        }


    }

}






Measured memory_bytes: 13248
#include <iostream>
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#define F first
#define S second
using namespace std;

int Q = 1e6, h1, h2, cut = 10;
int n, s, D, l, r, up, mx, cnt, mxx, xx, a[30], b[400][30], la[400], u[400], ans[400], o[400];
pair<int, int> c[400][30];
bool v[400][30];

int f(int p, int q1, int q2) {
	int sz = q2 - q1 + 1;
	return p * sz * (sz + 1) / 2;
}

int main()
{
	int i, j, k, t, x, t1, t2;
	srand(time(NULL));
	cin >> D;
	for (i = 0; i < 26; i++) {
		scanf ("%d", &a[i]);
	}
	for (i = 1; i <= D; i++) {
		mxx = -2e9;
		for (j = 0; j < 26; j++) {
			scanf ("%d", &b[i][j]);
		}
		for (j = 0; j < 26; j++) {
			cnt = b[i][j];
			for (k = 0; k < 26; k++) {
				if (k == j) continue;
				cnt -= (i - o[k]) * a[k];
			}
			if (cnt > mxx) {
				xx = j;
				mxx = cnt;
			}
		}
		o[xx] = i;
		ans[i] = u[i] = xx;
	}
//	for (i = 1; i <= D; i++) {
//		ans[i] = u[i] = 1;
//	}
//	for(i = 1; i <= D; i++) {
//		printf("%d\n", ans[i] + 1);
//	}

	for (i = 1; i <= D; i++){
//		scanf ("%d", &t);
		t = u[i] - 1;
		s += b[i][t];
		la[t] = i;
		for (j = 0; j < 26; j++) {
			s -= a[j] * (i - la[j]);
		}
		v[i][t] = 1;
	}
//	cout << s << endl;
//	cin >> Q;
	for (i =0; i < 26; i++) {
		v[0][i] = 1;
		v[D + 1][i] = 1;
	}
	mx = s;
	while (Q--) {
//		scanf ("%d %d", &t1, &t2);
		t1 = rand() % D + 1;
		t2 = rand() % 26;
		if (u[t1] == t2) t2 = (t2 + 1) % 26;
		x = u[t1];
		s -= b[t1][x];
		v[t1][x] = 0;
		v[t1][t2] = 1;
		u[t1] = t2;
		s += b[t1][t2];
		for (l = t1 - 1; l >= 0; l--) if (v[l][x]) break;
		for (r = t1 + 1; r <= D + 1; r++) if (v[r][x]) break;
		s += f(a[x], l + 1, t1 - 1);
		s += f(a[x], t1 + 1, r - 1);
		s -= f(a[x], l + 1, r - 1);
		for (l = t1 - 1; l >= 0; l--) if (v[l][t2]) break;
		for (r = t1 + 1; r <= D +1; r++) if (v[r][t2]) break;
		s += f(a[t2], l + 1, r - 1);
		s -= f(a[t2], l + 1, t1 - 1);
		s -= f(a[t2], t1 + 1, r - 1);
		if (s > mx) {
			up = 0;
			for (i = 1; i <= D; i++) {
				ans[i] = u[i];
			}
			mx = s;
		} else up++;
		if (up == cut) {
			up = 0;
			for (i = 1; i <= D; i++) {
				u[i] = ans[i];
			}
			s = mx;
		}
	}
	for (i = 1; i <= D; i++) {
		printf("%d\n", ans[i] + 1);
	}
    return 0;
}


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

int main() {
    string s; cin >> s;
    string ans = "";
    rep(i, s.size()) {
        if (s[i] == 'B') {
            if(ans.size() > 0) ans.pop_back ();
        } else ans.push_back(s[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	private static final String alpha = "abcdefghijklmnopqrstuvwxyz";

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		char[] c = s.toCharArray();
		Arrays.sort(c);
		HashSet<Character> cstr = new HashSet<Character>();
		for(int i=0;i<c.length;i++){
			cstr.add(c[i]);
		}
		char[] alphabet = alpha.toCharArray();
		for(int i=0;i<alphabet.length;i++){
			if(cstr.add(alphabet[i])){
				System.out.println(alphabet[i]);
				return;
			}
		}
		System.out.println("None");
	}

}


Measured memory_bytes: 27660
import Data.List
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Data.Vector.Unboxed as V (drop,take,sum,last,(!),fromList,Vector)
import Control.Monad
import Control.Monad.ST

type DP s = STUArray s (Int,Int) Int

dp_i :: DP s -> Vector Int -> Int -> Int  -> ST s ()
dp_i dparr as i j = do
  sums <- forM [i..j-1] $ \k -> do
    l <- readArray dparr (i,k)
    r <- readArray dparr (k+1,j)
    return $ l+r
  writeArray dparr (i,j) $ (minimum sums) + (V.sum $ V.take (j-i+1) $ V.drop (i-1) as)

solve :: Vector Int -> Int -> ST s Int
solve as n = do
  dparr <- newArray ((1,1),(n,n)) 0
  forM_ [1..n-1] $ \diff ->
    forM_ [1..n-diff] $ \i -> dp_i dparr as i (diff+i)
  readArray dparr (1,n)

main :: IO ()
main = do
  n <- read<$> getLine
  as <- map read.words <$> getLine
  print $ runST $ solve (V.fromList as) n

Measured memory_bytes: 3196
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

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

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;


int main() {
    int x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<ll> p(a), q(b), r(c);
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];
    sort(all(p));
    sort(all(q));
    sort(all(r));

    ll ans = 0;
    ll xy = x+y;
    while (xy>0) {
        ll ai = -1;
        ll bi = -1;
        if (x>0) ai = p.back();
        if (y>0) bi = q.back();
        ll ci = r.back();
        //cout << ai << " " << bi << " " << ci << endl;
        if (ai>bi&&ai>ci&&x>0) {
            ans+=ai;
            p.pop_back();
            --xy;
            --x;
        }
        else if (bi>ai&&bi>ci&&y>0) {
            ans+=bi;
            q.pop_back();
            --xy;
            --y;
        }
        else if (ci>=ai&&ci>=bi) {
            ans+=ci;
            r.pop_back();
            --xy;
        }
        else if (ai==bi&&ci!=ai) {
            if (x>y) {
                ans+=ai;
                p.pop_back();
                --xy;
                --x;
            }
            else {
                ans+=bi;
                q.pop_back();
                --xy;
                --y;
            }
        }
        
    }
    cout << ans << endl;
    return 0;
}































Measured memory_bytes: 2560
s = (input())
l = len(s)
c = 0
ans = [0] * l
answk = [1] * l
cnt = 0
for c in range(l) :
    if s[c] == 'R':
        cnt += 1
    elif s[c] == 'L':
        ans[c-1] += cnt // 2 + cnt % 2
        ans[c] += cnt // 2
        cnt = 0
    

for d in range(l-1,-1,-1) :
    if s[d] == 'L':
        cnt += 1
    elif s[d] == 'R':
        ans[d+1] += cnt // 2 + cnt % 2
        ans[d] += cnt // 2
        cnt = 0

#print(ans)
print(str(ans).replace(',','').replace('[','').replace(']',''))

Measured memory_bytes: 5256
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int i,j,N;
    int s[5];
    int sum = 0;
    int check = 0;
    int loss_time = 0;
    int last = 0;

    N = 5;
    for(i = 0; i < N; i++)
    {
        scanf("%d", &s[i]);
    }
    for(i = 0; i< N; i++)
    {
        if (s[i] % 10 != 0 && 10 - s[i] % 10 > loss_time) {
            loss_time = 10 - s[i] % 10;
            last = i;
        }
    }
    for(i = 0; i < N; i++) {
        if (i != last) {
            if (s[i] % 10 != 0 ) {
                sum = sum + s[i] + 10 - s[i] % 10;
            } else {
                sum = sum + s[i];
            }
        } else {
            sum = sum + s[last];
        }
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int a,b,c,d;

bool flag(int x,int y){
    if(abs(x-y)<=d)return true;
    return false;
}

int main(){

    cin>>a>>b>>c>>d;
    if(flag(a,c)||(flag(a,b)&&flag(b,c))){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
if (len(pos) == 0 and k % 2 == 1) or n == k:
    ans = 1
    a.sort(reverse = True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    from collections import deque
    ans = 1
    neg_new = []
    for i in range(0, len(neg)//2):
        neg_new.append(neg[2*i] * neg[2*i+1])
    neg_new = deque(sorted(neg_new, reverse = True))
    pos = deque(pos)
    if k % 2 == 1:
        k -= 1
        ans = pos.popleft()
    else:
        ans = 1
    while k > 0:
        if len(pos) >= 2 and len(neg_new) >= 1:
            if pos[0] * pos[1] > neg_new[0]:
                ans *= pos.popleft() * pos.popleft()
            else:
                ans *= neg_new.popleft()
        elif len(pos) >= 2:
            ans *= pos.popleft() * pos.popleft()
        else:
            ans *= neg_new.popleft()
        k -= 2
        ans %= mod
    print(ans % mod)

Measured memory_bytes: 116196
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


int main(){
  ll n;
  cin >> n;
  ll a[200010],b[200010];
  vector<pair<ll,ll>> v;
  FOR(i,n){
    cin >> a[i] >> b[i];
    v.push_back(make_pair(b[i],i));
  }
    sort(v.begin(),v.end());
  

    ll cnt=0;
    bool ans=1;
    FOR(i,n){
      cnt+=a[v[i].second];
      if(v[i].first<cnt){
        ans=0;
      }
    }
    if(ans){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  
}

Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  vector<char> cs(0);
  for(int i=0;i<s.size();i++){
    char c=s.at(i);
    for(int j=0;j<cs.size();j++){
      if(c==cs.at(j)){
        cout<<"no"<<endl;
        return 0;
      }
    }
    cs.push_back(c);
  }
  cout<<"yes"<<endl;
}

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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll n;
  cin >> n;
  ll ans = 0;
  for (ll k = 1; k*k <= n; k++) {
    if (n%k == 0 && n/k > k+1)
      ans += n/k-1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
from itertools import groupby
s = input()
k = int(input())
l = [[k, len(list(g))] for k, g in groupby(s)]
ans = 0
ans2 = 0
for i in range(len(l)):
  if l[i][1] > 1:
    ans += l[i][1] // 2
if len(l) > 1:
  if l[0][0] == l[-1][0]:
    if l[0][1] % 2 == 1 and  l[-1][1] % 2 == 1 :
        ans2 = k - 1
if len(s) == 1:
  print(k // 2)
elif len(l) == 1:
  #if l[0][1] % 2 == 1:
  #  print(((l[0][1] // 2) * k + (k - 1)))
  #else:
  print(len(s) * k // 2)
else:
  print(ans * k + ans2)
    



Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
int main(){
    int n,S;
    while(cin >> n >> S, n){
        vector<int> r(n);
        for(int i = 0 ; i < n ; i++){
            cin >> r[i];
        }
        sort(r.begin(),r.end());
        int res = 0;
        for(int i = 0 ; i < n-1 ; i++){
            int L = i+1, R = n;
            while(R - L > 0){
                int mid = (L + R) / 2;
                if(r[mid]+r[i] > S){
                    R = mid;
                }else{
                    L = mid+1;
                }
            }
            res += n-R;
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <stdbool.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <chrono>
using namespace std;

int main(){
    #if 0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    #endif

    int n, k;

    cin >> n >> k;

    if (k == 1) cout << 0 << endl;
    else cout << n-k << endl;

    return 0;
}

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

int main(){
    int N,M;
    cin >> N >> M;
    int a[N];
    int i;
    int sum=0;
    for(i=0;i<N;i++){
        cin >> a[i];
        sum += a[i];
    }
    double vot = (double)sum/(4.0*M);
    int count=0;
    for(i=0;i<N;i++)if(a[i]>=vot)count++;
    if(count>=M)cout << "Yes" << endl;
    else{cout << "No" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>
#include <limits>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)

struct edge{
    int to;
    double cost;
};

using namespace std;

//ダイクストラで多用する型
typedef pair<double, int> P;//(その頂点までの距離,頂点)として使う。

vector<edge> G[1'010];//頂点iから出る辺の配列G[i]の配列。
double dist[1'010];//特定の頂点から各頂点への距離が格納される。
bool used[1'010];//dijkstra実行中に、頂点iまでの距離を確定したかどうかを持つ。

void dijkstra(int v){//vは始点。
    //以下のリンクでpriority_queueの使い方を参照
    //http://shirokurostone.hatenablog.com/entry/20110522/1306052844
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, v));
    while(!que.empty()){
        P top = que.top();
        que.pop();
        int u = top.second;
        double d = top.first;
        //cout << u << ' ' << d << endl;
        if(used[u]) continue;
        dist[u] = d;
        used[u] = true;
        for(int i = 0; i < G[u].size(); i++){
            if(!used[G[u][i].to]){
                que.push(P(d+G[u][i].cost, G[u][i].to));
                //cout << G[u][i].to << ' ' <<  d+G[u][i].cost << endl;
            }
        }
    }
}

int main(){
    double xs,ys,xt,yt;
    cin>>xs>>ys>>xt>>yt;
    int n;
    cin>>n;
    double x[n+2],y[n+2],r[n+2];
    x[0] = xs;
    y[0] = ys;
    r[0] = 0.0;
    REPP(i,n){
      cin>>x[i]>>y[i]>>r[i];
    }
    x[n+1] = xt;
    y[n+1] = yt;
    r[n+1] = 0;
    double temp;
    REP(i,n+2){
      REP(j,n+2){
        if(i==j)continue;
        temp = hypot(x[j]-x[i], y[j]-y[i]) - r[i] - r[j];
        temp = max(temp, 0.0);
        G[i].push_back(edge{j, temp});
      }
    }
    dijkstra(0);
    double ans;
    ans = dist[n+1];
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


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

using namespace std;

int main(){
    int i=0;
    string s;
    cin >> s;
    for(int n=0; n < s.size() ; n++){
        if(s[n] == '1'){
            i++;
        }
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;

// char alphabet[26] = {'a','b','c','d','e','f','g','h','i',
//        'j','k','l','m','n','o','p','q','r','s','t','u','v',
//        'w','x','y','z'};

/* x power y */

int power(int x, unsigned int y) 
{ 
    int res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}

int32_t main(){
 	fastIO;
 	int n;cin>>n;
 	int a[n];for(int i=0;i<n;i++)cin>>a[i];
 	map<int,int> cnt;
 	int ans=0;
 	for(int i=0;i<n;i++){
 		ans+=cnt[i-a[i]];
 		cnt[i+a[i]]++;
 	}
 	cout<<ans<<endl;
} 			



Measured memory_bytes: 27920
//#pragma GCC optimize("03")
//#pragma GCC target("avx2")
 
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sqr(a) (a)*(a)
#define um unordered_map 
#define us unordered_set
using namespace std;
 
hash<string> hfn;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef double dbl;
typedef unsigned int ui;
const int inf = 2e9;
const ll mod = 1e9 + 7;
const ld eps = 1e-7;
const ll biginf = 1e18;
const ld pi = acosl(-1);

void solve()
{
  string s, t;
  cin >> s >> t;
  vector<vector<int> > dp(s.size(), vector<int>(t.size(), 0));
  for(int i = 0; i < s.size(); i++)
  {
    for(int j = 0; j < t.size(); j++)
    {
      if(!i && !j)
      {
        dp[i][j] = s[i] == t[j];
        continue;
      }
      if(!i)
      {
        dp[i][j] = (s[i] == t[j]) || dp[i][j-1];
        continue;
      }
      if(!j)
      {
        dp[i][j] = (s[i] == t[j]) || dp[i-1][j];
        continue;
      }
      dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
      if(s[i] == t[j])
        dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
    }
  }
  string res = "";
  int curx = s.size()-1, cury = t.size()-1;
  int cur = dp.back().back();
  while(curx >= 0 && cury >= 0 && dp[curx][cury] != 0)
  {
    while(curx > 0 && dp[curx][cury] == dp[curx-1][cury])
      curx--;
    while(cury > 0 && dp[curx][cury] == dp[curx][cury-1])
      cury--;
    res.pb(s[curx]);
    curx--, cury--, cur--;
  }
  reverse(all(res));
  cout << res;
}
 
void multisolve()
{
  int t;
  cin >> t;
  while(t--)
    solve();
}
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  //freopen("hull.in", "r", stdin);
  //freopen("hull.out", "w", stdout);
  solve();
  //multisolve();
}

Measured memory_bytes: 35584
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL x;cin>>x;

    LL m = 100;
    int y = 0;

    while(m < x){
        m = m*1.01;
        y++;
    }
    cout<<y<<endl;
	return;
}

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

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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 51;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

int n, a[N], b[N], f[N], g[N][N];

bool chk(cr h) {
	fo(i, 1, n) {
		memcpy(f, g[i], sizeof(f));
		fd(j, h, 1) {
			fo(k, j, a[i]) f[k % j] |= f[k];
		} if(!f[b[i]]) return 0;
	} return 1;
}

int main() {
	n = read();
	fo(i, 1, n) a[i] = read(), g[i][a[i]] = 1;
	fo(i, 1, n) b[i] = read();
	if(!chk(50)) {puts("-1"); return 0;}
	LL ans = 0;
	fd(u, 50, 1) {
		if(!chk(u - 1)) {
			ans |= 1LL << u;
			fo(i, 1, n) fo(j, u, a[i]) g[i][j % u] |= g[i][j];
		}
	} printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    string S;
    cin >> S;
    ll K;
    cin >> K;

    string S2 = S + S;

    ll kaburi = 0;
    bool ok = true;//かぶりなし
    for (int i = 1; i < S.size(); ++i) {
        if (S[0] != S[i]) ok = false;// かぶりあり
    }

    ll a = 0, b = 0;
    for (int i = 0; i < S.size(); ++i){
        if (S[0] == S[i])a++;
        else break;
    }
    for (int i = S.size() - 1; i >= 0; --i){
        if (S[0] == S[i]) b++;
        else break;
    }

    if(S[0]!=S[S.size()-1]) {
        a=0; b=0;
    }

    ll cnt=0;
    for (int i = 0; i < S.size(); ++i) {
        if(S[i]==S[i+1]){
            cnt++; i++;
        }
    }
    if(ok){
        cout<<(S.size()*K)/2<<endl;
    }else{
        cout<<cnt*K-(a/2+b/2-(a+b)/2)*(K-1)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
score_A = 0
score_B = 0
a.sort(reverse=True)
i = 1
for n in a:
  if i % 2 == 1:
    score_A += n
  elif i % 2 == 0:
    score_B += n
  
  i += 1


result = score_A - score_B
print(result)

Measured memory_bytes: 9052
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int arr[105000];
	bool bll[105000];
	int wc=0;
	int ac=0;
	for(int i=1;i<=n;i++){
		arr[i]=0;
		bll[i]=false;
	}
	while(m--){
		int p;
		string s;
		cin>>p>>s;
		if(bll[p])continue;
		if(s=="AC"){
			bll[p]=true;
			ac++;
			wc+=arr[p];
		}else if(s=="WA"){
			arr[p]++;
		}
	}
	cout<<ac<<" "<<wc<<endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
long long kaijou(long long x) {
    if(x==0) return 1;
    return x*kaijou(x-1)%1000000007;
}
int main() {
    int N, M;
    cin >> N >> M;
    if(abs(M-N)==1) cout << kaijou(M) * kaijou(N) % 1000000007 << endl;
    else if(M==N) cout << 2 * kaijou(M) * kaijou(N) % 1000000007 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;



void init();
void work();
int ca=1;
int main(){
//    freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
//    init();
//    int T;cin>>T;
//    while(T--)
    work();
    return 0;
}
void work(){
    int s,w;cin>>s>>w;
    if(w>=s) cout<<"unsafe";
    else cout<<"safe";
}


Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.S;
		var t=sc.S;
		int ans=0;
		for(int i = 0;i<s.Length;i++) {
			if(s[i]!=t[i]){ans++;}
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27456
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc170
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc170B();
            Console.Out.Flush();
        }

        public static void solve_abc170B()
        {
            int[] xy = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int x = xy[0];
            int y = xy[1];
            double a = (double)(y - (2 * x)) / 2;
            double b = x - a; 
            if (y % 2 != 0)
            {
                Console.WriteLine("No");
            }
            else if (a >= 0 && b >= 0 && a + b == x)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        public static void solve_abc170A()
        {
            int[] x = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] == 0)
                {
                    Console.WriteLine(i + 1);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 28476
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long r = Integer.parseInt(in.next());
            long g = Integer.parseInt(in.next());
            long b = Integer.parseInt(in.next());
            long n = Integer.parseInt(in.next());

            long ans = 0;
            for (int i = 0; i <= n / r; i++) {
                for (int j = 0; j <= n / g; j++) {
                    if (r * i + g * j > n) continue;
                    long rem = n - r * i - g * j;
                    if (rem % b != 0) continue;
                    ++ans;
                }
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n; cin >>n;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  int kotae=n/1.08;
  int tasikame=kotae*1.08;
  if(n==tasikame){
    cout<<kotae<<endl;
  }else{
    for(int i=1;i<n;i++){
      kotae++;
      tasikame=kotae*1.08;
      if(tasikame==n){
        cout<<kotae<<endl;
        return 0;
      }else if(tasikame>n){
        cout<<":("<<endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Prac
{
    class Program
    {
        static void Main(string[] args)
        {
            var House = new int[10,3,4];
            for(var i =0;i<10;i++)
                for(var j=0;j<3;j++)
                    for(var k=4;k<4;k++)
                        House[i,j,k] = 0;
            var n = int.Parse(Console.ReadLine());
            var temp = new int[4];
            for(var i = 0;i<n;i++)
            {
                temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                House[temp[2]-1,temp[1]-1,temp[0]-1] += temp[3];
            }
            for (var i = 0; i < 4; i++)
            {
                for (var j = 0; j < 3; j++)
                {
                    for (var k = 0; k < 10; k++)
                    {

                            Console.Write(" " + House[k, j, i]);
                    }
                    Console.WriteLine();
                }
                if(i!=3)
                Console.WriteLine("####################");
            }
        }
    }
}

Measured memory_bytes: 6040
#include "bits/stdc++.h"
using namespace std;

static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
        int n;
        cin >> n;
        vector<int> a(3 * n);
        for (int i = 0; i < 3 * n; i ++) cin >> a[i];
        priority_queue<int, vector<int>, greater<int>> pq;
        vector<long long> suml(n + 1, 0);
        for (int i = 0; i < n; i ++) { 
                suml[0] += a[i];
                pq.push(a[i]);
        }
        for (int i = n; i < 2 * n; i ++) {
                int nv = a[i];
                pq.push(nv);
                int ov = pq.top();
                pq.pop();
                suml[i - n + 1] = suml[i - n] - ov + nv;
        }
        priority_queue<int> pq2;
        vector<long long> sumr(n + 1, 0);
        for (int i = 3 * n - 1; i >= 2 * n; i --) {
                sumr[n] += a[i];
                pq2.push(a[i]);
        }
        for (int i = 2 * n - 1; i >= n; i --) {
                int nv = a[i];
                pq2.push(nv);
                int ov = pq2.top();
                pq2.pop();
                sumr[i - n] = sumr[i - n + 1] - ov + nv;
        }
        long long ans = -INFL;
        for (int i = 0; i <= n; i ++) ans = max(ans, suml[i] - sumr[i]);
        cout << ans << endl;
        return 0;
}


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

bool max_len(string tex, int n, int len) {
  vector<pair<string, int>> vec;
  for (int i = 0; i+len <= n; ++i) {
    if (i < len && n-i < 2*len) continue;
    string tmp = tex.substr(i, len);
    vec.push_back(make_pair(tmp, i));
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < vec.size()-1; ++i) {
    if (vec[i].first == vec[i+1].first) {
      vector<int> buf;
      buf.push_back(vec[i].second);
      while (i < vec.size()-1 && vec[i].first == vec[i+1].first) {
        buf.push_back(vec[i+1].second);
        ++i;
      }
      sort(buf.begin(), buf.end());
      if (buf[buf.size()-1] - buf[0] >= len) return true;
    }
  }
  return false;
}

int main() {
  int n;
  string s;
  cin >> n >> s;
  int up, low;
  up = n/2 + 1; low = 0;
  while (up - low > 1) {
    int mid = (up + low) / 2;
    if (max_len(s, n, mid)) low = mid;
    else up = mid;
  }
  cout << low << endl;
  return 0;
}

Measured memory_bytes: 5928
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
        int n,i;
        long long t,sum = 0;
        long long a[200005];
        scanf("%d%d",&n,&t);
        for(int i = 0;i <= (n-1);i++)
        	scanf("%lld",&a[i]);
        for(int i = 0;i < (n-1);i++){
        	sum += min(a[i+1]-a[i],t);}
          printf("%lld",sum+t);
}

Measured memory_bytes: 1792
using System;

namespace ABC150B
{
	class Program
	{
		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
			string str = Console.ReadLine();
			int A= 0;
			for(int i = 0;i < N - 2; i++)
			{
				if(str[i] == 'A')
				{
					if (str[i + 1] == 'B')
					{
						if (str[i + 2] == 'C') A++;
					}
				}
			}
			Console.WriteLine(A);
		}
	}
}


Measured memory_bytes: 13140
N,K = map(int,input().split())
S = list(map(int,input()))
num = 1
T = []
if S[0] == 0:
    T.append(0)
for i in range(1,N):
    if S[i-1] != S[i]:
        T.append(num)
        num = 0
    num += 1
T.append(num)
if S[N-1] == 0:
    T.append(0)
#index 0,2,4...に1の連続数、1,3,5...に0の連続数
if K >= len(T)//2:
    print(N)
else:
    x = sum(T[0:2*K+1])
    ans = x
    for i in range(1,(len(T)//2)-K+1):
        x = x-(T[2*i-2]+T[2*i-1])+(T[2*i+2*K-1]+T[2*i+2*K])
        ans = max(ans,x)
    print(ans)


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

using namespace std;

int main()
{
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[0]==s[2]&&s[1]==s[2])
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<int>arr(n,-1);
    int ok=1;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        --a;
        if(a>=n)
            continue;
        if(arr[a]==-1 || arr[a]==b)
            arr[a]=b;
        else
            ok=0;
    }
    if(!ok)
        cout<<-1;
    else{
        if(n==1 && arr[0]==-1){
            cout<<0;
            return 0;
        }
        if(arr[0]==-1)
            arr[0]=1;
        for(int i=1;i<n;i++){
            if(arr[i]==-1)
                arr[i]=0;
        }
        if(arr[0]==0 && n>1){
            cout<<-1;
            return 0;
        }
        for(auto i : arr)
            cout<<i;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    char O[51];
    char E[51];
    char P[101] = {'\0'};
    int i, j;

    scanf("%s%s", O, E);

    j = 0;
    for(i = 0; O[i]; i++){
        P[j++] = O[i];
        P[j++] = E[i];
    }

    printf("%s\n", P);

    return 0;
}

Measured memory_bytes: 128