akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int N;
    cin >> N;
    double ans;
    
    rep(i, N) {
        double a;
        cin >> a;
        ans += 1.0 / a;
    }

    ans = 1.0 / ans;
    cout << fixed << setprecision(5) << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

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

  ll x, k, d;
  cin >> x >> k >> d;

  x = abs(x);

  ll r = x % d;
  ll cnt = (x - r) / d;
  if (cnt >= k) {
    cout << x - k * d << endl;
    return 0;
  }
  k -= cnt;
  if (k % 2 == 0) {
    cout << r << endl;
  } else {
    cout << abs(r - d) << endl;
  }
  return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

/*
    (1,0) => (1,1)
    (0,1) => (-1,1)
    (x,y) => (x-y,x+y)
*/

pair<int,int> rotate45(int y,int x){
    return make_pair(y+x,-y+x);
}

void solve(){
    int H,W,d;
    cin >> H >> W >> d;

    vector<int> ys,xs;
    rep(i,0,H) rep(j,0,W){
        int i_=rotate45(i,j).first,j_=rotate45(i,j).second;
        ys.push_back(i_);
        xs.push_back(j_);
    }

    sort(ys.begin(),ys.end());
    sort(xs.begin(),xs.end());

    ys.erase(unique(ys.begin(),ys.end()),ys.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());

    map<int,int> y_to_order,x_to_order;
    rep(i,0,ys.size()) y_to_order[ys[i]]=i;
    rep(i,0,xs.size()) x_to_order[xs[i]]=i;

    vector<int> color(H*W);
    rep(i,0,H){
        rep(j,0,W){
            int i_=rotate45(i,j).first,j_=rotate45(i,j).second;
            color[i*W+j]=(y_to_order[i_]/d+x_to_order[j_]/d*2+2000)%4;
        }
    }

    rep(i,0,H){
        rep(j,0,W){
            if(color[i*W+j]==0) cout << "R";
            else if(color[i*W+j]==1) cout << "Y";
            else if(color[i*W+j]==2) cout << "G";
            else cout << "B";
        }
        cout << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

ll gcd(ll x, ll y) { return y ? gcd(y, x%y) : x;}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y;}

int main() {
  ll n, m; cin >> n >> m;
  vector<int> a(n); rep(i, n) cin >> a[i];
  ll G = 1;
  rep(i, n) G = lcm(G, a[i]);
  rep(i, n) {
    if (G / 2 % a[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  cout << (m * 2 / G + 1) / 2 << endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
using namespace std;
int main()
{
    int h,w,n;
    cin>>h>>w>>n;
    int temp=max(h,w);
    cout<<ceil(n*1.0/temp);
    return 0;
}

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

using namespace std;

vector<int> AdjList[300050];

const int modemul = 100005;

int dist[300050];

int main(){
	int N, M;
	scanf("%d%d", &N, &M);
	
	for(int i = 0; i < M; i ++){
		int a, b;
		scanf("%d%d", &a, &b);
		AdjList[a].push_back(b+modemul);
		AdjList[a+modemul].push_back(b+modemul*2);
		AdjList[a+modemul*2].push_back(b);
	}
	
	int S, T;
	scanf("%d%d", &S, &T);
	
	for(int i = 0; i < 300049; i ++){
		dist[i] = -3;
	}
	queue<int> q;
	q.push(S);
	dist[S] = 0;
	
	while(!q.empty()){
		int u = q.front(); q.pop();
		for(int v: AdjList[u]){
			if(dist[v] == -3){
				dist[v] = dist[u]+1;
				q.push(v);
			}
		}
	}
	printf("%d", dist[T]/3);
}


Measured memory_bytes: 17792
//                                               KEEP GRINDING
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>   new_data_set;

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

#define int long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define precise(i) fixed << setprecision(10) << i
#define f(i,a,b) for(int i=a;i<b;++i)

#define endl '\n'
#define debug cout<<"\n========================================\n"<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;

#define all(a) a.begin(),a.end()
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define mx(a) *max_element(a)
#define mn(a) *min_element(a) 
#define LB lower_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS >= OUR VALUE 
#define UB upper_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS > OUR VALUE 

#define fr first
#define sc second

#define MAXN 500000
#define INF 9223372036854775807
signed main(){
    fastio
    int x,n;
    cin >> x >> n;
    set<int> s;
    f(i,0,n){
    	int t;
    	cin >> t;
    	s.insert(t);
	}
	for(int i=0;;i++){
		if( s.count( x-i )==0 ){
			cout<<x-i;
			return 0;
		}
		if( s.count( x+i )==0 ){
			cout<<x+i;
			return 0;
		}
	}
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e6+1;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, x;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		if ((x % 2) || (x%2 == 0 && (x%3 == 0 || x%5 == 0)))
			continue;
		else
			return cout << "DENIED", 0;
	}
	cout << "APPROVED";
  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int q;
int main(){
	cin>>q;
	rep(w,q){
		ll a,b,c,d;
		cin>>a>>b>>c>>d;
		ll k = (a+b)/(min(a,b)+1);
		ll lb=-1LL,ub=a+1;
		while(ub-lb > 1){
			ll mid = (lb+ub)/2;
			ll bb = max(0ll,(mid-1)/k);
			ll zana = a-mid,zanb = b-bb;
			if(zanb <= (zana+1)*k){
				lb = mid;
			}
			else{
				ub = mid;
			}
		}
		bool ok = 0;
		for(ll x=max(0LL,lb);x<=min(a,lb);x++){
			ll acnt = x;
			ll bcnt = max(0ll,(x-1)/k);
			ll sum = acnt+bcnt;
			acnt += (a+b-sum)/(k+1);
			bcnt += (a+b-sum)-((a+b-sum)/(k+1));
			if(acnt != a || bcnt != b) continue;
			for(ll i=c;i<=d;i++){
				if(i<=sum){
					if(i%(k+1) == 0) printf("B");
					else printf("A");
				}
				else{
					ll j = a+b+1-i;
					if(j%(k+1) == 0) printf("A");
					else printf("B");
				}
			}
			ok = 1;
			puts("");
			break;
		}
		assert(ok);
	}
}

Measured memory_bytes: 384
a, b = map(int, input().split())
if a == 0:
    print("Zero")
elif a > 0:
    print("Positive")
elif a < 0:
    if b == 0:
        print("Zero")
    elif b > 0:
        print("Zero")
    else:
        temp = b - a + 1
        if temp % 2 == 0:
            print("Positive")
        else:
            print("Negative")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << max(C - (A - B), 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    ll rem = 0;
    for(ll i = 1; i <= 1e7; i++) {
        rem = rem * 10 + 7;
        rem %= K;
        if(rem == 0) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] permutaion = new int[n];
            for (int i = 0; i <n ; i++) {
                permutaion[i]=in.nextInt();
            }
            int min = permutaion[0];
            int ans = 0;
            for (int i = 0; i <n; i++) {
                if (permutaion[i] <= min){ans++;min=permutaion[i];}
            }
            System.out.println(ans);
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt(){return  Integer.parseInt(next());}
        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


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

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9+7;
const ll INF = 1<<30;

int main(){
	int n, k;
	double p;
	vector<double> arr;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>p;
		arr.pb((p+1)/2);
		//cout<<arr[i]<<"\n";
	}
	int l = 0, r = 0;
	double curr_sum = 0;
	double ans = 0;
	while(r<n){
		curr_sum += arr[r];
		if(r-l+1 == k){
			ans = max(ans, curr_sum);
			curr_sum -= arr[l++];
		}
		r++;
	}
	cout<<setprecision(12)<<fixed<<ans<<"\n";
	return 0;
}

/*
1 2 2 4 5

1: 1
2: 1.5
4: 2.5
5: 3
6: 3.5

10: 5.5
13: 6
17: 8
20: 10.5

*/

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

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int k,n=0,arr[5],i,x;
  vector <int> v1;
  for(i=0;i<5;i++)
   {cin>>x;
   v1.push_back(x);}
  cin>>k;
  if((*max_element(v1.begin(),v1.end())-*min_element(v1.begin(),v1.end())>k))
    cout<<":(";
  else
    cout<<"Yay!";
   return 0;
}


Measured memory_bytes: 384
n = int(input())
t = [0] * n
x = [0] * n
for i in range(n):
    t[i], x[i] = map(int, input().split())
a=0
for j in range(n-2):
    if t[j]==x[j]and t[j+1]==x[j+1] and t[j+2]==x[j+2]:
        a+=1
    else:
        a+=0
if a==0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9204
//In The Name Of GOD

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;
typedef long double ld ;

const ll mod = 998244353;
const ll inf = 2000000000;
const ll infll = (ll)2*1000*1000*1000*1000*1000*1000;
const ll maxn = 2*1001+1;

#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);

int main(){
	int a[3],ans=0;
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	a[0]+=a[2]-a[1];
	ans+=a[2]-a[1];
	a[1]=a[2];
	ans+=(a[1]-a[0])/2+((a[1]-a[0])%2)*2;
	cout<<ans;
}

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

int tmp[100];
int koukan(int n,int index,int to)
{
	int ret=0;
	int from=tmp[index];
	int tar=100;
	for(int i=index;i<n;i++)
	{
		if(tmp[i]==to)
		{
			tar=i;
			break;
		}
	}
	//swap
	for(int i=tar;i>index;i--)
	{
		ret++;
		int t=tmp[i];
		tmp[i]=tmp[i-1];
		tmp[i-1]=t;
	}
	return ret;
}
int main()
{
	int n,m;
	cin>>n>>m;
	int bit[100];
	int p[16];
	int rui=0;
	for(int i=0;i<n;i++)
	{
		cin>>bit[i];
	}
	for(int i=0;i<m;i++)
		cin>>p[i];
	copy(bit,bit+100,tmp);
	int ansa=0;
	int index=0;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p[i];j++)
		{
			if(tmp[index]!=(i&1))
				ansa+=koukan(n,index,i&1);
			index++;
		}
	}
	int ansb=0;
	index=0;
	copy(bit,bit+100,tmp);
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p[i];j++)
		{
			if(tmp[index]!=((i+1)&1))
				ansb+=koukan(n,index,(i+1)&1);
			index++;
		}
	}
	//cerr<<ansa<<" "<<ansb<<endl;
	cout<<min(ansa,ansb)<<endl;
}


Measured memory_bytes: 3084
def binSearch(S, x):
    a = -1
    b = len(S)-1

    while(a + 1 < b):
        c = (a+b)//2
        if S[c] >= x:
            a = c
        else:
            b = c

    return b

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    S = []

    for a in A:
        if len(S) == 0 or S[-1] >= a:
            S.append(a)
        else:
            p = binSearch(S, a)
            S[p] = a
    
    print(len(S))


if __name__ == '__main__':
    main()


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

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int N, M, P;
            int[] player = new int[100];
            int sum;
            int result;
            while (true)
            {
                N = this.cin.GetNextToInt();
                M = this.cin.GetNextToInt();
                P = this.cin.GetNextToInt();
                sum = 0;

                if (N == 0 && M == 0 && P == 0)
                    break;

                for (int i = 0; i < N; i++)
                {
                    player[i] = this.cin.GetNextToInt();
                    sum += player[i] * 100;
                }

                if (player[M - 1] > 0)
                    result = (int)(sum * (100 - P) / 100d / player[M - 1]);
                else
                    result = 0;

                Console.WriteLine(result);
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        public string Line { get; set; }
        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public void GetLine()
        {
            this._i = 0;
            do
            {
                this.Line = Console.ReadLine();
            } while (this.Line == "");

            if (this.Line != null)
                this._s = this.Line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);
        }

        public string GetNext()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            this.GetLine();

            return this._s[this._i++];
        }

        public int GetNextToInt()
        {
            return int.Parse(this.GetNext());
        }

        public long GetNextToLong()
        {
            return long.Parse(this.GetNext());
        }

        public double GetNextToDouble()
        {
            return double.Parse(this.GetNext());
        }
    }
}

Measured memory_bytes: 5836
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast ios::sync_with_stdio(0);cin.tie(0);
using namespace std;



int main() {
    fast
    int n;cin>>n;
    long long h[n],l[n],r[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
        l[i]=i+1+h[i];
        r[i]=i+1-h[i];
    }
    sort(r,r+n);
    ll ans=0,lb,ub;
    for(int i=0;i<n;i++)
    {
        lb=lower_bound(r,r+n,l[i])-&r[0];
        ub=upper_bound(r,r+n,l[i])-&r[0];

        ans+=ub-lb;
    }


cout<<ans;
return 0;


}

Measured memory_bytes: 8336
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();

        int even = N/2;
        int odd = N-even;

        println((double)odd/N);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 23764
#include <stdio.h>

int main(void){
    char word[1300];
    int j;
    fgets(word, 1300, stdin);
    j = 0;
    while(1){
        if('a' <= word[j] && word[j] <= 'z')
            word[j] -= 32;
        else if('A' <= word[j] && word[j] <= 'Z')
            word[j] += 32;
        if(word[j] == 10)
            break;
        j++;
    }
    
    printf("%s", word);
    return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<long long,int> pp;

int main() {
    int W,H;
    cin >> W >> H;
    vector<pp> p(W+H);
    for(int i=0; i<W+H; i++) {
        long long tmp;
        cin >> tmp;
        p[i] = pp(tmp,i);
    }
    sort(p.begin(), p.end());
    long long a = W + 1;
    long long b = H + 1;
    long long res = 0;
    for(int index=0; index<p.size(); index++) {
        pp e = p[index];
        if(e.second < W) {
            res += e.first * b;
            a--;
        } else {
            res += e.first * a;
            b--;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
#define N 1000009
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
using namespace std;

int m,n,fac[N],inv[N];
int ksm(int x,int y){
	int z=1; for (; y; y>>=1,x=(ll)x*x%mod) if (y&1) z=(ll)z*x%mod;
	return z;
}
int main(){
	scanf("%d%d",&m,&n); if (m<n) swap(m,n);
	int i,ans=0;
	fac[0]=inv[0]=inv[1]=1;
	for (i=1; i<N; i++) fac[i]=(ll)fac[i-1]*i%mod;
	for (i=2; i<N; i++) inv[i]=mod-(ll)inv[mod%i]*(mod/i)%mod;
	for (i=2; i<N; i++) inv[i]=(ll)inv[i-1]*inv[i]%mod;
	for (i=1; i<=n; i++) ans=(ans+(ll)cbn(i<<1,i)*cbn(m+n-(i<<1),m-i))%mod;
	printf("%lld\n",((ll)ans*ksm(cbn(m+n,m)<<1,mod-2)+m)%mod);
	return 0;
}


Measured memory_bytes: 8192
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())z
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))

n,q=input_list()
s=input()
l=len(s)
left=[0 for _ in range(l)]
for i in range(1,l):
    left[i]=left[i-1]
    if s[i-1]+s[i]=="AC":
        left[i]+=1

for _ in range(q):
    l,r=input_list()
    print(left[r-1]-left[l-1])




Measured memory_bytes: 21876
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
string a,b;cin>>a>>b;
if(a.size()>b.size())cout<<"GREATER"<<endl;
else if(a.size()<b.size())cout<<"LESS"<<endl;
else{
    if(a==b)cout<<"EQUAL"<<endl;
    else if(a>b)cout<<"GREATER"<<endl;
    else cout<<"LESS"<<endl;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
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);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */

int main() {
    int A,B,C,D;cin >>A>>B>>C>>D;
    if(A!=C) cout << 1;
    else cout << 0;
}

Measured memory_bytes: 3604
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))

light=1
count=0
for i in range(N):
    if light==2:
        print(count)
        quit()
    elif count>0 and light==1:
        print(-1)
        quit()
    else:
        light=A[light-1]
        count+=1
print(-1)


Measured memory_bytes: 7084
#include <iostream>
#include <set>
typedef long long ll;
using namespace std;
ll gcd(ll a, ll b) {
    if (a%b == 0) {
        return b;
    } else {
        return gcd(b, a%b);
    }
}
int main() {
    ll a, b;
    cin >> a >> b;
    //a,bの最大公約数を素因数分解し、素因数の種類を数えれば良い
    ll g = gcd(a, b);
    ll i = 2;
    set<ll> st; //同じ素因数は重複して数えなくて良いのでsetを用いる
    st.insert(1);
    //a,b<=10^12より、10^6より大きい因数は2つ以上含まれないため
    //i=10^6で打ち切ればgは「1」か「10^6より大きい素因数」となる
    while (g > 1 && i <= 1000000) {
        if (g%i == 0) {
            g /= i;
            st.insert(i);
        } else {
            i++;
        }
    }
    st.insert(g);
    cout << st.size() << endl;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstdint>
#include <algorithm>

intmax_t lcm(intmax_t n, intmax_t m) {
  intmax_t n_=n, m_=m;
  while (m)
    std::swap(n%=m, m);

  return n_/n*m_;
}

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

  intmax_t T;
  scanf("%jd", &T);

  for (int i=1; i<N; ++i) {
    intmax_t t;
    scanf("%jd", &t);
    T = lcm(T, t);
  }

  printf("%jd\n", T);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<vector>
#include<stack>
#include<string>
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	if (m != n + 1) {
		cout << "No";
		return 0;
	}
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i]) {
			cout << "No";
			return 0;
		}		
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#define MAX 500001

int A[MAX];
int n;

void maxHeapify(int);
void buildMaxHeap(void);
int left(int);
int right(int);

int main(){

  int i;
  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d",&A[i]);
  }
  buildMaxHeap();
  for(i=1; i<=n; i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

void maxHeapify(int i){
  int largest ,tmp, l, r;
  l=left(i);
  r=right(i);

  if((n+1 >l) && (A[l] > A[i])) largest=l;
  else largest=i;
  if((n+1>r) && (A[r]>A[largest])) largest=r;
  if (largest!=i){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxHeapify(largest);
  }
}

void buildMaxHeap(){
  int i;
  for (i=(n/2); i+1>1; i--){
    maxHeapify(i);
  }
}

int left(int i){
  int a;
  a=2*i;
  return a;
}

int right(int i){
  int a;
  a=2*i+1;
  return a;
}

Measured memory_bytes: 2552
using Yorukatsu027.Questions;
using Yorukatsu027.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu027.Questions
{
    /// <summary>
    /// ABC125 D
    /// </summary>
    public class QuestionD : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var a = inputStream.ReadLongArray();

            var minusCount = a.Count(i => i < 0);
            var absSum = a.Sum(i => Math.Abs(i));
            var absMin = a.Min(i => Math.Abs(i));

            if (minusCount % 2 == 0)
            {
                yield return absSum;
            }
            else
            {
                yield return absSum - 2 * absMin;
            }
        }
    }
}


namespace Yorukatsu027
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu027.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu027.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 31196
/*
 * atcoder/abc106/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
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; }

string S;
ll K;
void solve() {
  cin >> S >> K;
  K--;
  ll n = 0;
  char c = '1';
  // 先頭の1がどこまで続くか
  if (S[0] != '1') n = -1;
  else {
    while (S[n] == '1') n++;
    n--;
  }

  // 1が先頭に無い
  if (n < 0) {
    cout << S[0] << endl;
    return;
  }

  // すべて1
  if (n == S.size()-1) {
    cout << 1 << endl;
    return;
  }

  // インデックスKまでは1が続いている
  if (n >= K) {
    cout << 1 << endl;
    return;
  }

  cout << S[n+1] << endl;
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n, a, b;
  int i, j, high, mid, x, y, z;
  int m;
  int max = -1;
  int low = 1;
  int h[100001] = {};
  scanf("%d %d %d", &n, &a, &b);

  for(i=0; i<n; i++)
  {
    scanf("%d", &h[i]);
    if(max < h[i])
    {
      max = h[i];
    }
  }

  high = max / b;

  while(low <= high)
  {
    mid = (low + high) / 2;
    z = 0;
    m = mid;
    for(j=0; j<n; j++)
    {
      x = h[j] - mid * b;
      if(x > 0)
      {
        y = x / (a-b);
        if(x % (a-b) != 0) y++;
        m = m - y++;
          if(m < 0)
          {
            z = 1;
            break;
          }
      }
    }
    if(z == 1)
    {
      low = mid + 1;
    }
    else
    {
      high = mid - 1;
    }
  }

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

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    int N;
    cin >> N;
    vector<double> V(N);
    for(int i = 0; i < N; i++){
        cin >> V[i];
    }
    sort(all(V));
    double ans = (V[0] + V[1]) / 2.0;
    for(int i = 2; i < N; i++){
        ans = (ans + V[i]) / 2.0;
    }
    //cout << ans << endl;
    printf("%0.10lf\n", ans);

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8

N = int(input())
s = input()
R, B = [], []

for i in range(len(s)):
    if s[i] == 'R':
        R.append(s[i])
    else:
        B.append(s[i])
if len(R) > len(B):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
import math

#Input
A,B= map(int, input().split())

#Process
Ans = -1
tmp08_min = math.ceil(A / 0.08)
tmp08_max = tmp08_min + 12
tmp10_min = math.ceil(B / 0.10)
tmp10_max = tmp10_min + 9

tmp_min = min(tmp08_min, tmp10_min)
tmp_max = max(tmp08_max, tmp10_max)

tmp = tmp_min
while tmp <= tmp_max:
    if(A == int(tmp * 0.08) and B == int(tmp * 0.10)):
        Ans = tmp
        break
    tmp += 1

#Output
print(Ans)

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

const int A = 1000010;
int freq[A];

bool issafe(int a) {
  if (freq[a] > 1) {
    return false;
  }

  for (long long int i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      if (freq[i] || freq[a/i]) {
        return false;
      }
    }
  }

  return true;
}

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

  std::vector<int> a(n);
  for (int &ai : a) {
    scanf("%d", &ai);
    freq[ai]++;
  }

  if (freq[1]) {
    puts(freq[1] == 1 ? "1" : "0");
    return 0;
  }

  int ans = 0;

  for (const int &ai : a) {
    ans += issafe(ai);
  }
  
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 7892
#標準入力
N, M, Q = map(int, input().split())
abcd = []
for _ in range(Q):
    tmp = list(map(int, input().split()))
    abcd.append(tmp)

#実装
import itertools as it
A_candidate = list(it.combinations_with_replacement(range(1, M + 1), N))
ans = 0
for i in range(len(A_candidate)):
    tmp = 0
    for j in range(Q):
        if A_candidate[i][abcd[j][1] - 1] - A_candidate[i][abcd[j][0] - 1] == abcd[j][2] :
            tmp += abcd[j][3]
    if ans < tmp:
        ans = tmp
print(ans)
                   

Measured memory_bytes: 21356
ABCD = list(map(int, input().split()))
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]
while True:
	C -= B
	if C <= 0:
		print("Yes")
		break
	A -= D
	if A <= 0:
		print("No")
		break

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

#define X first
#define Y second
#define ll long long
#define MP make_pair
#define PB push_back

using namespace std;

const int MAXN=1e5;
ll MOD=1e9+7;

ll n,m;
char mat[1005][1005];
ll dp[1005][1005];

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

	cin>>n>>m;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin>>mat[i][j];
		}
	}
	for(int i=0; i<n; i++){
		if(mat[i][0]=='#'){
			break;
		}
		else{
			dp[i][0]=1;
		}
	}
	for(int i=0; i<m; i++){
		if(mat[0][i]=='#'){
			break;
		}
		else{
			dp[0][i]=1;
		}
	}
	for(int i=1; i<n; i++){
		for(int j=1; j<m; j++){
			if(mat[i][j]!='#'){
				dp[i][j]=dp[i-1][j]+dp[i][j-1];
				dp[i][j]%=MOD;
			}
//			cout<<dp[i][j];
		}
//		cout<<"\n";
	}
	cout<<dp[n-1][m-1]<<"\n";
	
	return 0;
}

Measured memory_bytes: 12496
#include <iostream>

using namespace std;

int main(){
  int arr[5], k, flg=0;
  cin >> arr[0] >> arr[1] >> arr[2] >> arr[3] >> arr[4] >> k;

  for (int i=1; i<5; i++) {
    if (arr[i]-arr[0]>k) flg++;
  }

  cout << (flg==0 ? "Yay!": ":(") << endl;
  return 0;
}

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

int ssize[200005];
int find(int parent[], int i)  
{  
    if (parent[i] != i)  
        parent[i] = find(parent, parent[i]);
    return parent[i];
}  
  
void Union(int parent[], int x, int y)  
{  
    int xset = find(parent, x);  
    int yset = find(parent, y);  
    if(xset != yset) 
    {  
        parent[xset] = yset;
        ssize[yset] = ssize[yset]+ssize[xset];
    }  
}

int main(){
	#ifndef ONLINE_JUDGE
		freopen ("../input.txt", "r", stdin);
		freopen ("../output.txt", "w", stdout);
	#endif

    ll N, M; cin>>N>>M;
    int *dsu = new int[N * sizeof(int)];
    // memset(dsu, -1, sizeof(int) * N);

    for(int i=0 ; i<N ; i++){
        ssize[i] = 1;
        dsu[i] = i;
    }
    for(int i=0 ; i<M ; i++){
        int x,y; cin>>x>>y;
        Union(dsu, x-1, y-1);
    }
    int ans = 0;
    for(int i=0 ; i<N ; i++){
        ans = max(ans, ssize[i]);
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
main() {
	int a=read(),b=read();
	cout<<max(0,a-2*b);
}


Measured memory_bytes: 256
S = input()
T = input()

len_t = len(T)
G = []

for i in range(len(S)-len_t+1):
  valid = True
  
  for j in range(len_t):
    if S[i+j] != "?" and S[i+j] != T[j]:
      valid = False

  if valid:
    SL = list(S)
    for j in range(len_t):
      SL[i+j] = T[j]
    G.append("".join(SL).replace("?", "a"))

print(min(G, default="UNRESTORABLE"))

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

using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;

  int ma = max(a, max(b, c));

  int nma = 0;
  if(a != ma)nma += a;
  if(b != ma)nma += b;
  if(c != ma)nma += c;

  if(ma == nma){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  ll n,m,ans = 0;
  cin >> n >> m;
  vector<pair<ll,ll>> drink(n);
  rep(i,n) {
    cin >> drink[i].first >> drink[i].second;
  }
  sort(drink.begin(),drink.end());
  rep(i,n) {
    if(m < drink[i].second) {
      ans += drink[i].first*m;
      break;
    }else {
      ans += drink[i].second*drink[i].first;
      m -= drink[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int s, w;
    cin >> s >> w;
    if (s <= w)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;

    return 0;
}

Measured memory_bytes: 3636
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long[] p = new long[n+1];
        long[] ruip = new long[n+1];
        for(int i = 1; i <= n; i++){
            p[i] = sc.nextLong();
            ruip[i] += p[i] + ruip[i-1];  
        }
        long tmp = 0;
        int index = 0;
        for(int i = k; i <= n; i++){
            if(tmp < ruip[i] - ruip[i-k]){
                tmp = ruip[i] - ruip[i-k];
                index = i;
            }
        }
        double ans = 0;
        for(int i = index; i >= index-(k-1); i--){
            ans += calc(p[i]);
        }
        System.out.println(ans);
    }

    public static double calc(long a){
        return 1+(a-1)*0.5;
    }
}

Measured memory_bytes: 85644
N=int(input())
A=list(int(x) for x in input().split())
minus_cnt=0
zero_cnt=0

B=[]
for x in A:
	if x<0:
		minus_cnt+=1
	if x==0:
		zero_cnt+=1
	B.append(max(x,-x))

if (minus_cnt%2==1 and zero_cnt==0):
	print(sum(B)-min(B)*2)
else:
	print(sum(B))

Measured memory_bytes: 14228
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
	int N;
	int a[100001];

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

	int answer = 0;
	for (int i = 1; i <= N; ++i)
	{
		if (a[a[i]] == i)
			++answer;
	}

	cout << answer / 2;

	return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
int main(void){
  int A,B;
  scanf("%d %d",&A,&B);
  if((A+B)%2==0){
  printf("%d",(A+B)/2);
  }
  else{
    printf("IMPOSSIBLE\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
	int N;

	cin >> N;

	int* L = new int[N];

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

	int max = 0;
	int sum = 0;
	int a;

	for (int i = 0; i < N; i++) {
		sum += L[i];

		if (max < L[i]) {
			max = L[i];
			a = i;
		}
	}

	sum -= L[a];

	if (sum > L[a]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main()
{
  int x,y;
  cin >> x >> y;
  int t=0,k=0;
  string ans;
  ans="No";
  
  for (t; t <= x; t++)
  {
    k=x-t;
    if(2*t+4*k==y){
      ans="Yes";
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define N 1000

int lcs(string X,string Y){
	int c[1001][1001];
	int m=X.size();
	int n=Y.size();
	int maxl=0;
	X=' '+X;
	Y=' '+Y;
	for(int i=0;i<=m;i++) c[i][0]=0;
	for(int j=1;j<=n;j++) c[0][j]=0;
	
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if(X[i]==Y[j]){
				c[i][j]=c[i-1][j-1]+1;
			}else{
				c[i][j]=max(c[i-1][j],c[i][j-1]);
			}
			maxl=max(maxl,c[i][j]);
		}
	}
	
	return maxl;
}

int main(){
	string s1,s2;
	int n; cin>>n;
	for(int i=0;i<n;i++){
		cin>>s1>>s2;
		cout<<lcs(s1,s2)<<endl;
	}
	return 0;
}



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

int main(){
    int s;
    cin >> s;
    int answer;
    //100で割ったら1か0になる
    answer = s / 100;
    //あまりは11,10,01,00のどれか
    s = s % 100;
    //10で割ったら1か0になる
    answer = answer + s / 10;
    //あまりは1か0のどちらか
    s = s % 10;
    //1で割ったら1か0になる
    answer = answer + s / 1;
    cout << answer << endl;
}

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

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

    int N;
    cin >> N;

    if (N % 2 == 0){
        cout << (N / 2) << "\n";
    }
    else {
        cout << ((N / 2) + 1) << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C;
    cin >> A >> B >> C;
    if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
        cout << 0 << endl;
    } else {
        cout << min({A * B, B * C, C * A}) << endl;
    }

    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

const int n = 12;
string in;

int calc(){
	int sum = 0;
	rep(i, n - 1){
		int k = 11 - i;
		sum += (in[i] - '0') * (k >= 7 ? k - 5 : k + 1);
	}
	sum %= 11;
	if(sum < 2) sum = 11;
	return in[n - 1] - '0' == 11 - sum;
}

int main(){
	cin >> in;
	vi ans;
	rep(i, n) if(in[i] == '?'){
		rep(j, 10){
			in[i] = '0' + j;
			if(calc()) ans.pb(j);
		}
	}
	if(ans.size() == 1) cout << ans[0] << endl;
	else cout << "MULTIPLE" << endl;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    string ans="No";
    for(int i=1; i<=9; i++){
        for(int j=1; j<=9; j++){
            if(i*j == n) ans="Yes";
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3588
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

const int N=100010,P=1e9+7;

int n,a[N],app[N],l,r,fac[N],inv[N];

inline int C(int x,int y){
  if(x<=0||x<y) return 0;
  if(y<=0) return 1;
  return 1LL*fac[x]*inv[y]%P*inv[x-y]%P;
}

int main(){
  scanf("%d",&n); fac[0]=inv[0]=inv[1]=1;
  for(int i=1;i<=n+5;i++) fac[i]=1LL*fac[i-1]*i%P;
  for(int i=2;i<=n+5;i++) inv[i]=1LL*(P-P/i)*inv[P%i]%P;
  for(int i=1;i<=n+5;i++) inv[i]=1LL*inv[i]*inv[i-1]%P;
  for(int i=1;i<=n+1;i++){
    scanf("%d",&a[i]);
    if(!app[a[i]]) app[a[i]]=i;
    else l=app[a[i]],r=i;
  }
  printf("%d\n",n);
  for(int i=2;i<=n+1;i++)
    printf("%lld\n",(1LL*C(n+1,i)+P-C(n+1-(r-l+1),i-1))%P);
  return 0;
}


Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		final int n = scanner.nextInt();
		final int a = scanner.nextInt();
		final int b = scanner.nextInt();

		int result = ((modpow(2, n) - 1 - comb(n, a)) % PRIME - comb(n, b)) % PRIME;

		while (result < 0) {
			result += PRIME;
		}
		System.out.println(result);

	}

	static int modpow(int n, int p) {//n^p
		long res = 1;
		long a = n;
		for (a %= PRIME; p > 0; a = a * a % PRIME, p >>= 1)
			if ((p & 1) > 0)
				res = res * a % PRIME;
		return (int) res;
	}

	static int tower2(int n) {
		if (n == 1)
			return 2;
		return (int) ((long) tower2(n / 2) * tower2(n - n / 2) % PRIME);
	}

	static int fact(int n) {
		if (n == 1)
			return 1;
		return (int) ((long) n * fact(n - 1) % PRIME);
	}

	static int comb(int n, int k) {
		long numer = 1, denom = 1;
		for (int i = 0; i < k; i++) {
			numer = numer * (n - i) % PRIME;
			denom = denom * (i + 1) % PRIME;
		}

		//		long comb = (long) fact(n) * inverse(fact(k)) % PRIME;
		//		comb = comb * inverse(fact(n - k)) % PRIME;
		return (int) (numer * inverse((int) denom) % PRIME);

	}

	static int inverse(int denom) {
		if (denom == 0)
			return 0;

		int a = PRIME;
		int b = denom;
		int x = 0;
		int y = 1;
		int temp;

		while (a % b != 0) {
			x -= a / b * y;
			temp = x;
			x = y;
			y = temp;
			temp = a % b;
			a = b;
			b = temp;
		}

		//		while (y < 0)
		//			y += PRIME;

		return y;
	}

	static final int PRIME = 1000000007;

}


Measured memory_bytes: 23508
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B, K = map(int, readline().split())
se = set(range(A, A + K)) | set(range(B - K + 1, B + 1))
li = list(se)
li = [x for x in li if A <= x <= B]
li.sort()
print(*li,sep='\n')


Measured memory_bytes: 3064
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n, k = parseMap(split(readline()))
    println(ifelse(n % k == 0, 0, 1))
end
main()

Measured memory_bytes: 112264