akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 2e5+1;
int fact[N], invf[N], inv[N];

int mul(int a, int b) { return 1ll*a*b % mod; }

int ncr(int n, int r) {
    return mul(fact[n], mul(invf[r], invf[n-r]));
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    fact[0] = invf[0] = 1;
    fact[1] = invf[1] = inv[1] = 1;
    forn(i, 2, N) {
        fact[i] = mul(fact[i-1], i);
        inv[i] = mod - ll(mod/i) * inv[mod%i] % mod;
        invf[i] = mul(invf[i-1], inv[i]);
    }
    
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    
    int ans = ncr(n+m-2, m-1);
    
    int i = n-a-1;
    forn(j, 0, b) {
        int tot = mul(ncr(i+j, j), ncr(a+m-j-2, m-j-1));
        ans = (ans-tot+mod) % mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5960
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, x; cin >> n >> x;
    int a[2010];
    rep(i,0,n) cin >> a[i];

    // 魔法i回でスライムを色jにするために必要な最小秒数
    int dp[2010][2010];
    rep(i,0,n) {
        rep(j,0,n) {
            if(i == 0) dp[i][j] = a[j];
            else {
                dp[i][j] = min(a[(j-i+n) % n], dp[i-1][j]);
            }
        }
    }

    int ans = LONG_MAX;
    rep(i,0,n) {
        int temp = x * i;
        rep(j,0,n) {
            // printf("%lld ", dp[i][j]);
            temp += dp[i][j];
        }
        // cout << endl;
        ans = min(ans, temp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#include <cstring>
#include <map>
#include <set>
#define int long long int
using namespace std;

signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    
    int n, d;
    cin>>n>>d;
    cout<<ceil((double)n/(2*d+1))<<endl;
    
}

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

using namespace std;

int solve(){
	int n, q, cnt = 0;
	cin >> n;
	vector<int> S(n);
	for (int i = 0; i < n; i++) cin >> S[i];
	cin >> q;
	vector<int> T(q);
	for (int i = 0; i < q; i++) cin >> T[i];
	for (int i = 0; i < q; i++) {
		if (binary_search(S.begin(), S.end(), T[i])) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

signed main(){
	solve();
}

Measured memory_bytes: 3248
//

fun main() {
    apc001c()
}

fun apc001c() {
    val n = readLine()!!.toInt()
    val vacant = "Vacant"
    val male = "Male"
    val female = "Female"
    println(0)
    var searchTarget = readLine()!!
    if (searchTarget == vacant) {
        return
    }
    val leftSex = searchTarget
    // 0とn-1は必ず不一致
    println(n - 1)
    searchTarget = readLine()!!
    if (searchTarget == vacant) {
        return
    }
    val rightSex = searchTarget
    var left = 0
    var right = n - 1
    while (searchTarget != vacant || left + 1 < right) {
        val t = (left + right) / 2
        println(t)
        searchTarget = readLine()!!
        if (t % 2 == 0) {
            // tの性別をそのまま使う
            if (searchTarget == leftSex) {
                left = t
            } else {
                right = t
            }
        } else {
            // ベースが偶数なので奇数を調べるときは逆転させる
            val rev = if (searchTarget == male) female else male
            if (rev == leftSex) {
                left = t
            } else {
                right = t
            }
        }
    }
}

Measured memory_bytes: 34608
#include<stdio.h>

void keybord(char s[]){
    char k[11];
    int i;
    int j = 0;

    for(i = 0; s[i]; i++){
        if(s[i] == '0'){
            k[j] = s[i];
            j++;
        }

        if(s[i] == '1'){
            k[j] = s[i];
            j++;
        }

        if(s[i] == 'B' && j > 0){
            j--;
            k[j] = '\0';
        }
    }
    k[j] = '\0';

    printf("%s", k);
}

int main(void){
    char s[11];

    scanf("%s", s);

    keybord(s);

    return 0;
}

Measured memory_bytes: 128
import math
S=list(input())
K=int(input())
count = 0
ans = 0
flag = False
firstCount = 0
firstChart = ""
for i in range(1,len(S)):
  if S[i-1] == S[i]:
    count += 1
  else:
    if flag == False:
      firstCount = count
      firstChart = S[i-1]
    else:
      ans += math.ceil(count/2)*K
    flag = True
    count = 0

if flag:
  if firstChart == S[len(S)-1]:
    ans += (firstCount + count + 2) // 2 * (K-1)
    ans += math.ceil(count/2)
    ans += math.ceil(firstCount/2)
  else:
    ans += math.ceil(count/2)*K
    ans += math.ceil(firstCount/2)*K
else:
  ans += (count+1)*K//2
if len(S) == 1:
  if K == 1:
    print("0")
  else:
    print(math.ceil(K//2))
else:
  print(ans)

Measured memory_bytes: 3064
mod = 1000000007
eps = 10**-9
inf = 10**20


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    if N == 2 or N == 3:
        print(max(A))
        exit()

    if N%2 == 0:
        dp = [[-inf] * 2 for _ in range(N+1)]
        dp[-1][0] = 0
        dp[0][1] = 0
        for i in range(N):
            dp[i+1][0] = dp[i-1][0] + A[i]
            dp[i+1][1] = max(dp[i-1][1], dp[i-2][0]) + A[i]
        print(max(dp[-1][1], dp[-2][0]))
        #print(dp)
    else:
        dp = [[-inf] * 3 for _ in range(N + 1)]
        dp[-1][0] = 0
        dp[0][1] = 0
        dp[1][2] = 0
        #print(dp)
        for i in range(N):
            dp[i + 1][0] = max(dp[i+1][0], dp[i - 1][0] + A[i])
            dp[i + 1][1] = max(dp[i+1][1], dp[i - 1][1]+A[i], dp[i - 2][0]+A[i])
            dp[i+1][2] = max(dp[i+1][2], dp[i-1][2]+A[i], dp[i-2][1]+A[i], dp[i-3][0]+A[i])
            dp[-1][0] = 0
            dp[0][1] = 0
            dp[1][2] = 0
            #print(dp)
        print(max(dp[-1][2], dp[-2][1], dp[-3][0]))
        #print(dp)


if __name__ == '__main__':
    main()


Measured memory_bytes: 139084
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  vector<vector<int>> g(N,vector<int>(0));

  for(int i = 0;i < N-1;i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> color(N,0),seen(N,0);
  queue<int> Q;
  Q.push(0);
  seen[0] = 1;
  int w = 0,b = 0;
  w++;
  while(!Q.empty()) {
    int q = Q.front(); Q.pop();
    for(auto nv :g[q]) {
      if(seen[nv]) continue;
      Q.push(nv);
      seen[nv] = 1;
      if(color[q]) {
        color[nv] = 0;
        w++;
      }else {
        color[nv] = 1;
        b++;
      }
    }
  }

  int on = 1,tw = 2,th = 3;
  vector<int> ans(N,0);
  if(w > N/3 && b > N/3) {
    for(int i = 0;i < N;i++) {
      if(color[i]) {
        if(on <= N) {
          ans[i] = on;
          on += 3;
        }
      }else {
        if(tw <= N) {
          ans[i] = tw;
          tw += 3;
        }
      }
    }
  }else if(b <= N/3){
    for(int i = 0;i < N;i++) {
      if(color[i]) {
        ans[i] = th;
        th += 3;
      }
    }
  }else if(w <= N/3) {
    for(int i = 0;i < N;i++) {
      if(!color[i]) {
        ans[i] = th;
        th += 3;
      }
    }
  }

  set<int> S;
  for(int i = 1;i <= N;i++) S.insert(i);
  for(int i = 0;i < N;i++) S.erase(ans[i]);
  for(int i = 0;i < N;i++) {
    if(!ans[i]) {
      ans[i] = *S.begin();
      S.erase(S.begin());
    }
  }

  for(int i = 0;i < N;i++) cout << ans[i] << " ";
 
  cout << endl;
  

}


Measured memory_bytes: 24692
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int M=100000;
		boolean prime[]=new boolean[M+1];
		Arrays.fill(prime,true);
		prime[0]=prime[1]=false;
		for(int i=2;i*i<=M;i++)
		{
			if(!prime[i])
				continue;
			for(int j=i*2;j<=M;j+=i)
				prime[j]=false;
		}
		while(in.hasNext())
		{
			int n=in.nextInt();
			int ans1=-1,ans2=-1;
			int up=n,down=n;
			while(ans1==-1||ans2==-1)
			{
				if(ans1==-1&&prime[--down])
					ans1=down;
				if(ans2==-1&&prime[++up])
					ans2=up;
			}
			System.out.println(down+" "+up);
		}
	}
}

Measured memory_bytes: 20024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  a *= b;
  if(a % 2 == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main() {
    int n = 0, k = 0;
    cin >> n >> k;
    vector<int> h(n);
    for (int i=0; i<n; i++) {
        cin >> h.at(i);
    }
    int res = 0;
    for (int x : h) {
        if (x >= k) res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <map>
#include <cstring>
#include <cstdio>
using namespace std;

struct BSTNode {
	int key;
	BSTNode *lchild, *rchild, *parent;
	BSTNode(int k, BSTNode *p = nullptr, BSTNode *l = nullptr, BSTNode *r = nullptr) : key(k), lchild(l), rchild(r), parent(p)
	{}
};
typedef BSTNode* BSTree;

BSTree insert(BSTree& Root, int key)
{
	BSTree parent = nullptr;
	BSTree child = Root;
	while (child)
	{
		parent = child;
		if (key > child->key)
			child = child->rchild;
		else
			child = child->lchild;
	}
	child = new BSTNode(key, parent);
	if (!parent)
		Root = child;
	else if (parent->key > key)
		parent->lchild = child;
	else
		parent->rchild = child;
	return child;
}
void pre_order(BSTree T)
{
	if (!T)
		return;
	printf(" %d", T->key);
	pre_order(T->lchild);
	pre_order(T->rchild);
}
void in_order(BSTree T)
{
	if (!T)
		return;
	in_order(T->lchild);
	printf(" %d", T->key);
	in_order(T->rchild);
}

BSTree find(BSTree T, int key)
{
	while (T)
	{
		if (T->key > key)
			T = T->lchild;
		else if (T->key < key)
			T = T->rchild;
		else
			break;
	}
	return T;
}
int main(void)
{
	char buf[10];
	int key, n;
	scanf("%d", &n);
	BSTree T = nullptr;
	while (n--)
	{
		scanf("%s", buf);
		if (*buf == 'i')
		{
			scanf("%d", &key);
			insert(T, key);
		}
		else if (*buf == 'f')
		{
			scanf("%d", &key);
			if (find(T, key))
				printf("yes\n");
			else
				printf("no\n");
		}
		else
		{
			in_order(T);
			putchar('\n');
			pre_order(T);
			putchar('\n');
		}
	}
	return 0;
}

Measured memory_bytes: 21936
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 

int main(){
    ll n,k,q;
    cin>>n>>k>>q;
    ll a[q],b[n];
    pan(i,n) b[i]=k;
    pan(i,q) {
        cin>>a[i];
    }
    pan(i,q){
        b[a[i]-1]++;
        // cout<<b[a[i]]<<"*";
    }
    pan(i,n) {
        b[i]-=q;
        // cout<<b[i];
    }
    pan(i,n){
        if(b[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    } 
}

Measured memory_bytes: 2176
#include <iostream>

int main(int argc, char** argv){
    int N, Y;
    // std::cin >> N >> Y;
    std::cin >> N >> Y;
    bool flag = false;
    int ans_x = 0;
    int ans_y = 0;
    int ans_z = 0;

    for(int x=0; x<=2000; x++){
        for(int y=0; y<=2000; y++){
            int z = N - x - y;
            if(z < 0) continue;
            if(10000*x+5000*y+1000*z == Y){
                flag = true;
                ans_x = x;
                ans_y = y;
                ans_z = z;
                break;
            }
        }
    }

    if(flag) std::cout << ans_x << " " << ans_y << " " << ans_z << std::endl;
    else std::cout << "-1 -1 -1" << std::endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main()
{
	int N;
	int d[100];
	set<int> unique;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> d[i];
		unique.insert(d[i]);
	}


	cout << unique.size();
    return 0;
}


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

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var a = cin.ArrayInt(3);
            Console.WriteLine(a.Distinct().Count());
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI=3.14159265358979323846; 

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    cout << 2*PI*N <<endl;

 

 

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define repl(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n,a,b,c,d;
    string s;
    cin >> n >> a >> b >> c >> d >> s;
    if(c < d){
        repl(i,a,max(c,d))if(s[i] == s[i+1] && s[i] == '#'){
            cout << "No\n";
            return 0;
        }
        cout << "Yes\n";
    }else{
        repl(i,a,max(c,d))if(s[i] == s[i+1] && s[i] == '#'){
            cout << "No\n";
            return 0;
        }
        repl(i,b-1,d)if(s[i-1] == s[i] && s[i] == s[i+1] && s[i] == '.'){
            cout << "Yes\n";
            return 0;
        }
        cout << "No\n";
    }
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;

void Main(){
	int a, b;
	cin >> a >> b;
	cout << a*b << " " << (a+b)*2 << endl;
	return;
}

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



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
	int N;
	cin >> N;
	int maxA = 0;
	int minB = 2000000000;
	for(int i = 0; i < N; i++){
		int A, B;
		cin >> A >> B;
		maxA = max(maxA, A);
		minB = min(minB, B);
	}
	cout << maxA + minB << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, m, k;
  in2(n, m);
  string s, t, u;
  in(t);
  s = "";
  rep(i, n + 1){
    u = t[n - i];
    s += u;
  }
  vector<ll> c;
  k = 0;
  while(k < n){
    if(k + m >= n){
      c.pb(n - k);
      k = n;
    }
    else{
      rep(i, m){
        if(s[k + m - i] == '0'){
          k = k + m - i;
          c.pb(m - i);
          break;
        }
        if(i == m - 1){
          out(-1);
          memi;
          return 0;
        }
      }
    }
  }
  rep(i, c.size()){
    out(c[c.size() - i - 1]);
    hina;
  }
  memi;
}


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

using namespace std;

int main()
{
    int n;
    long long sum = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        if (i % 3 && i % 5)
            sum+=i;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3636
def c_streamline():
    N, M = [int(i) for i in input().split()]
    X = sorted([int(i) for i in input().split()])

    interval = sorted([X[i + 1] - X[i] for i in range(M - 1)], reverse=True)
    return sum(interval[N - 1:])  # コマ N 個によって、距離が大きな区間 N-1 箇所を動かさずに済む

print(c_streamline())

Measured memory_bytes: 13840
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main()
{
  int q;
  while (cin >> q, q != -1){
    double x = q / 2.0;
    while (fabs(pow(x, 3) - q) >= 0.00001 * q){
      x = x - (pow(x, 3) - q) / (3 * x * x);
    }
    printf("%f\n", x);
  }
  return (0);
}

Measured memory_bytes: 1184
#include<iostream>

using namespace std;

int main()
{
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	
	//int h22;
	int mint;
	
	if (m2 < m1)
	{
		h2 = h2 - 1;
		m2 = m2 + 60;	
	}
	
	mint = (h2 - h1) * 60 + m2 - m1 - k;
	
	cout << mint << endl;
	
	return 0;
} 


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

int main(){
    int i, len;
    char S[100000];

    scanf("%s", S);
    len = strlen(S);

    for(i=0; i<len; i+=2){
        printf("%c", S[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second.first
#define T4 second.second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

int main(){
	int w,n;
	cin>>w>>n;
	VI ans(w,0);
	REP(i,w)ans[i]=i+1;
	REP(i,n){
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ans[a-1], ans[b-1]);
	}
	REP(i,w)cout<<ans[i]<<endl;
	return 0;
}

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

int main()
{
	char a = 0, b = 0, ca = 0, cb = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 4; i++)
	{
		if (s[i] == a)
			ca++;
		else if (s[i] == b)
			cb++;
		else if (a == 0 && b == 0)
		{
			a = s[i];
			ca++;
		}
		else if (b == 0)
		{
			b = s[i];
			cb++;
		}
	}
	if (ca == 2 && cb == 2)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


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

long long gcd(long long a, long long b) {
  if (b == 0) return a;
  else return gcd(b, a%b);
}

int main() {
  long long N, X;
  cin >> N >> X;
  vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    cin >> x.at(i);
    x.at(i) -= X;
  }
  long long g = abs(x.at(0));
  for (int i = 0; i < N; i++) g = gcd(g, abs(x.at(i)));
  cout << g << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 2e5 + 5;

int n;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n, greater<int>());
	ll res = a[0];
	int c = 1;
	for (int i = 2; i < n; i++) {
		res += a[c];
		if (i & 1)
			c++;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4412
import kotlin.math.min

fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main() {
    data class Magic(val damage: Int, val cost: Int)
    val (h, n) = intList()
    val magic = 0.until(n).map{
        val (a, b) = intList()
        Magic(a, b)
    }
    val costs = Array(h + 1) { 1e9.toInt() }
    costs[0] = 0
    0.until(h + 1).forEach { i ->
        magic.forEach { m ->
            val d = min(m.damage + i, h)
            costs[d] = min(costs[d], m.cost + costs[i])
        }
    }
    println(costs[h].toString())
}

Measured memory_bytes: 54616
n,w=map(int,input().split())
INF = 10**12 + 5
cost=[[INF for i in range(100001)] for j in range(n+1)]
value=[list(map(int,input().split())) for i in range(n)]

for i in range(1,n+1):
  for j in range(100001)[::-1]:
    weight_=value[i-1][0]
    value_=value[i-1][1]
    if j < value_:
      cost[i][j]=min(cost[i-1][j],weight_)
    else:
      cost[i][j]=min(cost[i-1][j-value_]+weight_,cost[i-1][j])
for i in range(100001)[::-1]:
    if cost[-1][i]<=w:print(i+1);exit()

Measured memory_bytes: 173296
#include <iostream>
using namespace std;
void ABC110(void);
void ABC111(void);
void ABC112(void);
void ABC113(void);
void ABC114(void);
void ABC115(void);
void ABC116(void);
void ABC117(void);
void ABC118(void);
void ABC119(void);

int main(void){
    ABC117();
}

void ABC117(){
    int t,x;
    double a;
    cin>>t>>x;
    a=(double)t/x;
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

bool ans[100010];

int main() {
  ll n, m; cin >> n >> m;
  Vl x(m), y(m);
  rep(i, 0, m){
    cin >> x[i] >> y[i];
  }

  Vl cnt(n+1, 1);
  ans[1] = true;

  rep(i, 0, m){
    cnt[x[i]]--;
    cnt[y[i]]++;
    if(ans[x[i]]) ans[y[i]] = true;
    if(cnt[x[i]] == 0) ans[x[i]] = false;
  }


  ll sum = 0;
  Rep(i, 1, n) if(ans[i]) sum++;
  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#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()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  ll ans = 1;
  cin >> n >> k;
  ans = k;
  REP(i,n-1)ans*=(k-1);
  cout << ans << endl;
}


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 62;

int main()
{
  int N, A[100000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }

  // 奇数が奇数個のときやばくて

  int sum = 0;
  for(int i = 0; i < N; i++) {
    sum ^= A[i] & 1;
  }

  if(sum == 1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;

const int MAX_N = 100000, MAX_K = 1000;
int N, K;
int x[MAX_N], y[MAX_N];
char c[MAX_N];
int field[MAX_K+1][2*MAX_K+1];


// nを初期化するのを忘れずに
int BIT[2*MAX_K+1], n;

int sum(int i) {
  int res = 0;
  while (i > 0) {
    res += BIT[i];
    i -= i & (-i);
  }
  return res;
}


void add(int i, int x) {
  while (i <= n) {
    BIT[i] += x;
    i += i & (-i);
  }
}

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

  cin >> N >> K;
  rep(i, N) cin >> x[i] >> y[i] >> c[i];
  n = 2*K;
  
  for (int i = 0; i < N; ++i) {
    if (((x[i]/K)+(y[i]/K)+(c[i] == 'W' ? 0 : 1))%2 == 0) {
      x[i] = x[i]%K; y[i] = y[i]%K;
    } else {
      x[i] = x[i]%K+K; y[i] = y[i]%K;
    }
  }


  for (int i = 0; i < N; ++i) {
    if (x[i] < K) {
      field[0][0]++;
      field[0][x[i]+1]--;
      field[0][x[i]+K+1]++;
      field[y[i]+1][0]--;
      field[y[i]+1][x[i]+1] += 2;
      field[y[i]+1][x[i]+K+1] -= 2;
    } else {
      field[0][x[i]-K+1]++;
      field[0][x[i]+1]--;
      field[y[i]+1][0]++;
      field[y[i]+1][x[i]-K+1] -= 2;
      field[y[i]+1][x[i]+1] += 2;
    }
  }

 int ans = 0;
 for (int k = 0; k < K; ++k) {
   for (int i = 0; i < 2*K; ++i) {
     add(i+1, field[k][i]);
     ans = max(ans, sum(i+1));
   }
 }

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


Measured memory_bytes: 8960
import math
n = int(input())

prime = []
MAX = 55555
for i in range(2,MAX):
    flag = True
    bound = int(math.sqrt(i))+1
    for j in prime:
        if j >= bound:
            break
        if i%j == 0:
            flag = False
            break
    if flag:
        prime.append(i)
res = []
for p in prime:
    if p%10 == 1:
        res.append(p)
    if len(res) == n:
        break
for p in res:
    print(p,end=" ")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)
typedef long long ll;
bool iskaibun(string s){
  string rev = s; reverse(rev.begin(), rev.end());
  return rev==s;
}
int main(){
  string s; cin >> s;
  ll n = s.length();

    if(!iskaibun(s)){
      cout << "No"; return 0;
    }
  string s1;
  for(ll i=0; i<(n-1)/2; i++){
    s1+=s[i];
  }
      if(!iskaibun(s1)){
      cout << "No"; return 0;
    }
  string s2;
  for(ll i=(n+1)/2; i<n; i++){
    s2+=s[i];
  }
        if(!iskaibun(s2)){
      cout << "No"; return 0;
    }
  cout << "Yes";

}

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

int main(){
  int k,i;
  int size;
  char str[101];
  
  scanf("%d",&k);
  scanf("%s",str);
  
  size = strlen(str);

  if(size <= k)
    printf("%s",str);
  else{
    for(i = 0; i < k ; i++){
      printf("%c",str[i]);
    }
    printf("...");
  }
    
  return 0;
  
}

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

int main() {
	int x, y;
	cin >> x >> y;
	cout << x+y/2 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <time.h> //for clock
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using ll = long long;

int main(){
    int n, v, c;
    vector<int> a;

    cin >> n;

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

    int sum = 0;
    for(i = 0; i < n; i++){
        cin >> c;
        if(a[i] - c > 0){
            sum += a[i] - c;
        }
    }

    cout << sum << endl;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  int coin = 0;
  
  for(int i = 0; i < 2; i++){
    coin += max(A, B);
    if(A > B) A--;
    else B--;
  }
  cout << coin << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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++)

int main()
{
  int d[4],n,r;
  while(cin >> d[0] >> d[1] >> d[2] , d[0]){
    cin >> n;
    sort(d, d + 3);
    int ans = d[0] * d[0] + d[1] * d[1];
    while(n--){
      cin >> r;
      cout << (r * r * 4 > ans ? "OK" : "NA") << endl;
    }
  }
}

Measured memory_bytes: 1168
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<stdio.h>
#include<string.h>

#define ll long long 
#define ull unsigned long long
#define ld long double
#define all(vec) (vec).begin(),(vec).end()
#define allr(vec) (vec).rbegin(),(vec).rend()
#define viewVec(vec) for(auto i:(vec))cout << i << " ";cout << endl
using namespace std;

ll  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;
ll ans = 0, sum = 0, mn = 1e18, mx = 0, cnt = 0;
const ll M = 1000000007;

map<char, int>mp;
vector<int>vec;
vector<int>vec2;
//vector<int>res;
//                                                   gcd/lcm--f***ing--long long


ll gcd(ll a, ll b) { if (b == 0)return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a*b) / gcd(a, b); }


/*(constructive)*/



int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		vec.push_back(x);
		sum += x;
	}
	double avr = sum / (double)n;
	l = sum / n;
	h = ceil(sum / (double)n);

	for (int i = 0; i < n; i++)
		cnt += pow(abs(l - vec[i]), 2);

	ans = cnt;
	cnt = 0;

	for (int i = 0; i < n; i++)
		cnt += pow(abs(h - vec[i]), 2);

	ans = min(ans, cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main {
  def main(args:Array[String]) = {
    var s = ""
    while( {s = readLine;s} != "-1 -1 -1") {
      val n = s.split(" ").map(_.toInt)
      val sec = n(0)*3600 + n(1)*60 + n(2)
      val sd = 120*60 - sec
      val sd3 = sd*3
      printf("%02d:%02d:%02d\n", sd/3600, (sd/60) % 60, sd % 60)
      printf("%02d:%02d:%02d\n", sd3/3600, (sd3/60) % 60, sd3 % 60)
    }
  }
}

Measured memory_bytes: 44020
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/


ll N;

int main(){
    cin >> N;

    for(ll h=1;h<=3500;h++){
        for(ll n=1;n<=3500;n++){
            ll t = 4 * h * n - N * n - N * h;
            ll s = N * n * h;
            if(t==0) continue;
            if(s%t==0){
                ll w = s/t;
                if(w<0) continue;
                if(w==0) continue;
                cout << h << " " << n << " " << w <<endl;
                return 0;
            }
        }
    }
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 200010;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1000000007;

int a[maxN];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		int d;
		scanf("%d",&d);
		for(int j=1;j<=d;j++)
		{
			int x;
			scanf("%d",&x);
			a[x]++;
		}
	}
	int cnt = 0;
	for(int i=1;i<=n;i++)
	{
		if(a[i] == 0)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3764
/*
 * Author - Abhas Jain
 * Code is inside the solve function
 */
 
#include <bits/stdc++.h>
 
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;
 
void solve() 
{
	int x, y;
	cin >> x >> y;
	for (int i = 0; i <= x; ++i) {
		if (2 * i + 4 * (x - i) == y) {
			cout << "Yes";
			exit(0);
		}
	}
	cout << "No";
}
 
int main( )
{   
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
const ll MAX=510000;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};
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; }

int main(){
    ll N;
    cin>>N;
    vector<ll> ans(N+5,0);
    for(ll i=0;i<N-1;i++){
        ll a;
        cin>>a;
        ans[a]++;
    }
    
    for(ll i=1;i<=N;i++){
        cout<<ans[i]<<endl;
    }
}

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

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

#define MAX 200000

int main(int argc, char *argv[])
{
    int n, a[MAX];
    int i;
    int minv = 0, maxv = -2000000000;
  
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);

      minv = a[0];
      for (i = 1; i < n; i++) {
          maxv = max(a[i] - minv, maxv);
          minv = min(a[i], minv);
      }
      
      printf("%d\n", maxv);
      
      return 0;
}


Measured memory_bytes: 2544
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define flash ios_base::sync_with_stdio(false);     cin.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define f first
#define s second



using namespace std;

int main()
{
  flash

  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  int i=1;


  while(true){

    if(i%2!=0){
        c-=b;
        if(c<=0){
          cout<<"Yes\n";
          break;
        }

      }
    else{
      a-=d;
      if(a<=0){
        cout<<"No\n";
        break;
      }
    }
    i++;
  }

}


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

int main() {
    string w;
    cin >> w;
    int cnt[26] = {0};
    bool ans = true;
    
    rep(i, w.length()) {
        cnt[w[i] - 'a']++;
    }
    
    rep(i, 26) {
        if (cnt[i] & 1) {
            ans = false;
            break;
        }
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000003;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){
        a=b;
        return true;
    }
    return false;
}

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    vector<bool> decide(K+1,false);
    rep(i,K+1){
        if (!decide[i]){
            rep(j,N){
                if (i+a[j]>K) continue;
                decide[i+a[j]]=true;
            }
        }
    }
    if (decide[K]) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  cout << divceil(N, 2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
/*!* [modint] *!*/
/*+* 剰余環整数と剰余階乗 *+*/
struct int_m;
int_m invmod(int_m);
int_m powmod(int_m, i64);
struct int_m {
    static i64 m;
    i64 v;
    int_m() {}
    int_m(i64 x) : v(x) {}
    int_m operator+(const int_m &y) const { return (v + y.v) % m; }
    int_m operator-(const int_m &y) const { return (v - y.v + m) % m; }
    int_m operator*(const int_m &y) const { return (v * y.v) % m; }
    int_m operator/(const int_m &y) const { return *this * invmod(y); }
    int_m operator^(const i64   &y) const { return powmod(*this, y); }
    void operator+=(const int_m &y) { *this = *this + y; }
    void operator-=(const int_m &y) { *this = *this - y; }
    void operator*=(const int_m &y) { *this = *this * y; }
    void operator/=(const int_m &y) { *this = *this / y; }
    void operator^=(const i64   &y) { *this = *this ^ y; }
    bool operator==(const int_m &y) const { return v == y.v; }
    bool operator!=(const int_m &y) const { return v != y.v; }
    friend istream &operator>>(istream &ist, int_m m) { ist >> m.v; return ist; }
    friend ostream &operator<<(ostream &ost, int_m m) { ost << m.v; return ost; }
};
i64 int_m::m;
// O(log a)
int_m powmod(int_m a, i64 p) {
    int_m v = 1;
    for(int_m b = a; p > 0; p >>= 1, b *= b ) if(p & 1) v *= b;
    return v;
}
int_m invmod(int_m x) {
    return powmod(x, x.m - 2);
}

int main() {
    int_m::m = 998244353;
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    for(int &a : A) cin >> a;
    vector<int_m> cur(S + 1);
    vector<int_m> prev(S + 1);
    prev[0] = 1;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= S; j++) {
            cur[j] += prev[j];
            if(j + A[i] > S) continue;
            int_m tmp = prev[j];
            if(j == 0) tmp *= i + 1;
            if(j + A[i] == S) tmp *= N - i;
            cur[j + A[i]] += tmp;
        }
        for(int_m &x : prev) x = 0;
        swap(prev, cur);
    }
    cout << prev[S] << endl;
    return 0;
}



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

#include <vector>
using namespace std;


int main(int argc, char const *argv[])
{
	char n[11];
	vector<string> str;
	scanf("%s",n);
	
	for(unsigned int i = 0; i< strlen(n);i++){
		if(n[i] =='1'){
			str.push_back("1");
		}else if(n[i] == '0'){
			str.push_back("0");
		}else if(n[i] =='B' && str.size() != (unsigned int)0){
			str.pop_back();
			}
					
	}
	
	for(unsigned int index = 0; index  < str.size() ;index++){
			cout << str[index];
	}
		
	return 0;
}


Measured memory_bytes: 256