akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    int n,a;
    cin>>n>>a;
    n%=500;
    if(n<=a){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }

}


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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> a(N);
    for(auto& it : a) cin >> it;
    sort(a.begin(), a.end(), greater<int>());
    int alice = 0;
    int bob = 0;
    for(int i=0;i<a.size();i++){
        if(i%2==0) alice += a[i];
        else bob += a[i];
    }
    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) {return log(b) / log(a);}

unsigned int randxor()
{
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}



int main() {
	int n, maxW;
	cin >> n >> maxW;
	vector<int> w(n), v(n);
	rep(i, n) {
		cin >> w[i] >> v[i];
	}
	vector<vector<ll>> a(n);
	rep(i, n) {
		a[i].resize(maxW+1);
	}
	ll ans = 0;
	rep(i, n) {
		if (i == 0) {
			if (w[0] <= maxW) {
				a[0][w[0]] = v[0];
			}
			
			continue;
		}
		rep(j, maxW + 1) {
			if (j == 0) {
				a[i][j] = 0;
			}
			else {
				if (j - w[i] >= 0) {
					if (a[i - 1][j] > a[i - 1][j - w[i]] + v[i])
						a[i][j] = a[i - 1][j];
					else
						a[i][j] = a[i - 1][j - w[i]] + v[i];
				}
				else {
					a[i][j] = a[i - 1][j];
				}
			}
		}
	}
	rep(i, n) {
		rep(j, maxW + 1) {
			if (ans < a[i][j]) {
				ans = a[i][j];
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 78592
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> L >> R;
	if (L <= 3)K += (4 - L) * 100000;
	if (R <= 3)K += (4 - R) * 100000;
	if (L == 1 && R == 1)K += 400000;
	cout << K << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pque = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

int main() {
	int x;
	cin >> x;
	cout << 1 - x << '\n';
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n,m,nr,cost[1000001];
set<ll> muchie[1000001];
struct date
{
    ll x,y;
};
bool use[1000001];
date start,finish;
ll val[2001][2001];
ll diri[5]={0,0,-1,1};
ll dirj[5]={-1,1,0,0};
char v[2001][2001];
void dfs(int i,int j)
{
    val[i][j]=nr;
    for(int l=0;l<=3;l++)
    {
        ll lin=i+diri[l];
        ll col=j+dirj[l];
        if(lin>0&&lin<=n&&col>0&&col<=m&&v[lin][col]=='.'&&val[lin][col]==0)
            dfs(lin,col);
    }
}
void bfs(int nod)
{
    use[nod]=1;
    queue<int> coada;
    coada.push(nod);
    while(!coada.empty())
    {
        int node=coada.front();
        for(auto i:muchie[node])
            if(use[i]==0)
            {
                cost[i]=cost[node]+1;
                use[i]=1;
                coada.push(i);
            }
        coada.pop();
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    cin>>start.x>>start.y>>finish.x>>finish.y;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            cin>>v[i][j];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        {
            if(v[i][j]=='.'&&val[i][j]==0)
            {
                nr++;
                dfs(i,j);
            }
            if(v[i][j]=='#')
                val[i][j]=-1;
        }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(val[i][j]!=-1)
        {
            int lin1=max(1,i-2);
            int lin2=min(int(n),i+2);
            int col1=max(1,j-2);
            int col2=min(int(m),j+2);
            for(int l=lin1;l<=lin2;l++)
                for(int c=col1;c<=col2;c++)
                    if(val[l][c]!=-1)
                        muchie[val[i][j]].insert(val[l][c]);
        }
    for(int i=1;i<=nr;i++)
        cost[i]=-1;
    cost[val[start.x][start.y]]=0;
    bfs(val[start.x][start.y]);
    cout<<cost[val[finish.x][finish.y]];
    return 0;
}


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

using namespace std;


void solve(string S)
{
    int ans = 0;
    vector<char> v;
    for (auto &c: S) {
        v.push_back(c);
        if (v.size() >= 2) {
            int n = v.size();
            if (v[n-1] == '0' && v[n-2] == '1') {
                v.pop_back();
                v.pop_back();
                ans += 2;
            } else if (v[n-1] == '1' && v[n-2] == '0') {
                v.pop_back();
                v.pop_back();
                ans += 2;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    solve(S);
    return 0;
}


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

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

  long long n, k; cin >> n >> k;
  if(k % 2 == 1) {
  	long long x = n / k;
  	cout << x * x * x << endl;
  }
  else {
  	long long x = n / k;
  	long long y = ((n + k / 2)) / k;
  	cout << x * x * x + y * y * y << endl;
  }
	return 0;
}	


Measured memory_bytes: 256
gets; a = gets.split.map(&:to_i).sort + [Float::INFINITY]
gets; b = gets.split.map(&:to_i).sort + [Float::INFINITY]

d = []
until a.empty?
  if a[0] < b[0]
    d << a.shift
  elsif a[0] > b[0]
    b.shift
  else
    a.shift
    b.shift
  end
end
d[0..-1].each {|x| p x }


Measured memory_bytes: 61192
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <cctype>
#include <deque>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {

	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";

    return out;

}

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {

	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}

		out << "\n";
	}
		
    return out;

}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int a, b;
	cin >> a >> b;

	cout << max(a - 2 * b, 0) << "\n";

	return 0;

}

Measured memory_bytes: 256
import functools
n = int(input())
a = list(map(int, input().split()))

@functools.lru_cache()
def memo(n):
    ans1 = 0
    ans2 = 0
    now = 0

    for i in range(n):
        now += a[i]
        if i % 2 == 0:
            if now <= 0:
                ans1 += 1 - now
                now = 1
        else:
            if now >= 0:
                ans1 += now + 1
                now = -1

    now = 0

    for i in range(n):
        now += a[i]
        if i % 2 == 1:
            if now <= 0:
                ans2 += 1 - now
                now = 1
        else:
            if now >= 0:
                ans2 += now + 1
                now = -1
    
    return min([ans1,ans2])

print(memo(n))

Measured memory_bytes: 14580
/// @pSaurabh

#include <bits/stdc++.h>

using namespace std;

#define read(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define print(a, n) for(int i = 0; i < n; i++) if(i < n - 1){ cout << a[i] << " "; } else cout << a[i] << "\n";

typedef long long ll;
typedef long double ld;

const ll mod = 1e9 + 7;

void fast(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout .tie(0);
}

int main(){
	// fast();

	int n;
	cin >> n;

	int a[n];
	read(a, n);

	int dp[n + 1];
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);

	for(int i = 2; i < n; ++i){
		dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
	}

	cout << dp[n - 1];

	return 0;
}


Measured memory_bytes: 4316
#include<stdio.h>
#include<string.h>
int main()
{
    char a[4],b[4];
    int i,j,t=0;
    void judge(char[]);
    while(gets(a))
    {
        judge(a);
    }
    return 0;
}
void judge(char a[])
{
    int i,j,t=0;
    char b[4];
    j=strlen(a);
    strcpy(b,a);
    a[0]=b[2];
    a[2]=b[0];
    if(strcmp(a,b)==0)
        printf("Yes\n");
    else
        printf("No\n");
    return;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    if (s[i] == '+') ans++;
    else ans--;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3564
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;
//abc165e

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    set<int> st;
    for(int i=1;i<n;i++){
        st.insert(i);
    }
    int k=1;
    int pr=-1;
    set<int> check;
    while(k<=m){
        int v=*rbegin(st);
        st.erase(v);
        while(pr-v==1||check.count(n-v)||2*v==n){
            v=*rbegin(st);
            st.erase(v);
        }
        pr=v;
        check.insert(v);
        printf("%d %d\n",k,k+v);
        k++;
    }
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Measured memory_bytes: 12036
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
max = a.max
ans = 1e20
mid = max / 2.0
a.each do |d|
  (d+1e-10 - mid).abs
  ans = d if((d+1e-10 - mid).abs < (ans - mid).abs)
end
puts "#{max} #{ans}"

Measured memory_bytes: 9476
n=int(input())
t=0
m=1e18
f=0
for i in range(n):
  a,b=map(int,input().split())
  t+=a
  if a>b:m=min(m,b)
  if a!=b:f=1
if f:
  print(t-m)
else:
  print(0)

Measured memory_bytes: 51928
#include <stdio.h>

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

  int d,flag[10];
  for(int i = 0;i <= 10;i++) flag[i] = 0;
  for(int i = 0;i < K;i++){
    scanf("%d",&d);
    flag[d] = 1;
  }

  for(int i = N;;i++){
    int j = i;
    while(j > 0){
      if(flag[j%10]) break;
      j /= 10;
    }
    if(j <= 0){
      printf("%d\n",i);
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
	static public void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int top=sc.nextInt();
		int front=sc.nextInt();
		int right=sc.nextInt();
		int left=sc.nextInt();
		int back=sc.nextInt();
		int bottom=sc.nextInt();

		String line=sc.next();

		int tmp;
		for(int i=0;i<line.length();i++){
			String order=line.substring(i,i+1);
			if(order.equals("E")){
				tmp=top;
				top=left;
				left=bottom;
				bottom=right;
				right=tmp;
			}else if(order.equals("N")){
				tmp=top;
				top=front;
				front=bottom;
				bottom=back;
				back=tmp;
			}else if(order.equals("S")){
				tmp=top;
				top=back;
				back=bottom;
				bottom=front;
				front=tmp;
			}else if(order.equals("W")){
				tmp=top;
				top=right;
				right=bottom;
				bottom=left;
				left=tmp;
			}
		}

		System.out.println(top);

	}
}


Measured memory_bytes: 26256
#include<cstdio>
#include<vector>
#include<iostream>
#include<memory>

using namespace std;
typedef long long ll;


int main()
{
    int n,m;
    int h[1510]={},w[1510]={};

    while(cin >> n >> m, n)
    {
        vector<int> vx(1500*1000+1,0);
        vector<int> vy(1500*1000+1,0);
        
        for(int i = 0;i < n;i++) cin >> h[i];
        for(int i = 0;i < m;i++) cin >> w[i];

        ll sum;
        for(int i = 0;i < n;i++){
            sum = 0;
            for(int j = i;j < n;j++){
                sum += h[j];
                vy[sum]++;
            }
        }
        for(int i = 0;i < m;i++){
            sum = 0;
            for(int j = i;j < m;j++){
                sum += w[j];
                vx[sum]++;
            }
        }

        int ans = 0;
        for(int i = 0;i < vx.size();i++){
            ans += vx[i]*vy[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 14520
import math
N, D = map(int, input().split())
X = list()
for a in range(N):
    X.append(list(map(int, input().split())))

ans = 0

for a in range(N):
    for b in range(a):
        sq = 0
        for c in range(D):
            s = X[a][c] - X[b][c]
            sq += s*s
        for e in range(sq+1):
            if e*e == sq:
                ans += 1

print(ans)


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	
	static boolean check(ArrayList <Integer> b) {
		if(b.get(0) != 1) {
			return false;
		}
		for(int i = 1; i < b.size(); i++) {
			if(b.get(i-1) != b.get(i)-1) {
				return false;
			}
		}
		return true;
	}
	
	static boolean gap(ArrayList <Integer> b) { 
		for(int i = 0; i < b.size(); i++) {
			if(b.get(i) <= 0) {
				return false;
			}
		}
		return true;
	}
	
	static void removeGap(ArrayList <Integer> b) {
		for(int i = 0; i < b.size(); i++) {
			if(b.get(i) <= 0) {
				b.remove(i);
				i--;
				
				continue;
			}
		}
		b.trimToSize();
	}
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while(true) {
			int N = stdIn.nextInt();
			if(N == 0) {
				break;
			}
			
			
			for(int i = 0; i < N; i++) {
				list.add(stdIn.nextInt());
			}
			int c = 0;
			while(!check(list) && c < 10000) {
				c++;
				if(gap(list)) {
					int size = list.size();
					for(int i = 0; i < list.size(); i++) {
						list.set(i,list.get(i)-1);
					}
					list.add(size);
				}
				removeGap(list);
			}
			System.out.println((check(list))?c:-1);
			list.clear();
			list.trimToSize();
			System.gc();
		}
		
		

	}

}

Measured memory_bytes: 261296
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;
const int BUF = 305;
const long long INF = 1LL<<62;

int nCol, nCut;
int col2height[BUF];

void read() {
    cin >> nCol >> nCut;
    for (int i = 0; i < nCol; ++i) {
        cin >> col2height[i];
    }
}


long long rec(int idx, int remainCut, int heightId, long long dp[BUF][BUF][BUF],
              vector<int> &id2height, map<int, int> &height2id) {
    
    if (idx == nCol) return 0;
    
    long long &ret = dp[idx][remainCut][heightId];
    if (ret != -1) return ret;

    ret = INF;

    // cut
    if (remainCut > 0) {
        ret = min(ret, rec(idx + 1, remainCut - 1, heightId, dp, id2height, height2id));
    }

    // not cut
    ret = min(ret, rec(idx + 1, remainCut, height2id[col2height[idx]], dp, id2height, height2id) +
              + max(0, col2height[idx] - id2height[heightId]));
    
    return ret;
}


void work() {
    vector<int> id2height;
    for (int i = 0; i < nCol; ++i) {
        id2height.push_back(col2height[i]);
    }
    id2height.push_back(0);
    sort(id2height.begin(), id2height.end());
    id2height.erase(unique(id2height.begin(), id2height.end()), id2height.end());

    map<int, int> height2id;
    for (int i = 0; i < id2height.size(); ++i) {
        height2id[id2height[i]] = i;
    }
    
    static long long dp[BUF][BUF][BUF];
    memset(dp, -1, sizeof(dp));

    cout << rec(0, nCut, 0, dp, id2height, height2id) << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 222080
import java.util.*;

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

      int m1 = Integer.parseInt(sc.next());
      int d1 = Integer.parseInt(sc.next());
      int m2 = Integer.parseInt(sc.next());
      int d2 = Integer.parseInt(sc.next());


      if(m1!=m2){
        System.out.println("1");
      }
      else{
        System.out.println("0");
      }

    }
}


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

if x >= y:
    if not (2 * y - x) % 3:  
        ch2 = int((2 * y - x) / 3)
        if ch2 < 0:
            print(0)
            exit()
        ch1 = ch2 + x - y
    else:
        print(0)
        exit()

elif x < y:
    if not (2 * x - y) % 3:  
        ch1 = int((2 * x - y) / 3)
        if ch1 < 0:
            print(0)
            exit()
        ch2 = ch1 + y - x 
    else:
        print(0)
        exit()

def cmb(s, t, r):
    x = 1
    y = 1
    for i in range(t):
        x = (x*(s-i))%r
        y = (y*(i+1))%r
 
    y_inverse = pow(y, r-2, r)
    return (x*y_inverse)%r

mod = 10 ** 9 + 7

print(cmb(ch1+ch2,ch1,mod))

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

int main(){
  ll n,m;cin>>n>>m;
  ll sum = 0;
  if (2*n<=m){
    sum+=n;
    m-=2*n;
    sum+=m/4;
    cout << sum << endl;
  }
  else{
    sum+=m/2;
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 256
while True:
    try:
        Alst = list(map(int, input().split()))
        Blst = list(map(int, input().split()))
        H = 0
        B = 0

        for a, anum in enumerate(Alst):
            for b, bnum in enumerate(Blst):
                if anum == bnum:
                    if a == b:
                        H = H + 1
                    else:
                        B = B + 1

        print(str(H) + ' ' + str(B))


    except EOFError:
        break


Measured memory_bytes: 5596
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

vll graph[200000] = {};
lli score[200000] = {};
lli answer[200000] = {};

void dfs(int i,int s) {

	s += score[i];
	answer[i] = s;

	for(int j = 0;j < graph[i].size(); j++)
		if(answer[graph[i][j]] == -1)
			dfs(graph[i][j],s);

	return;
}

int main(void) {

	lli n, q;
	cin >> n >> q;

	for (int i = 0; i < n -1; i++) {
		lli a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
		answer[i] = -1;
	}
	answer[n - 1] = -1;

	for (int i = 0; i < q; i++) {
		lli p, x;
		cin >> p >> x;
		p--;
		score[p] += x;
	}

	dfs(0,0);

	for (int i = 0; i < n; i++) {
		cout << answer[i] << " ";
	}


	return 0;
}

Measured memory_bytes: 25600
#include<bits/stdc++.h>
#define N 2005
#define ll long long
#define p 1000000007
using namespace std;

int n,m,a[N][N],ans;
vector<int>to[N];
unordered_set<int>g[N];

inline int read()
{
	int ans=0,f=1;char c=getchar();
	while(c>'9'||c<'0') {if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') ans=(ans<<1)+(ans<<3)+(c^48),c=getchar();
	return ans*f;
}

void build(int x,int fa,int a[],int val)
{
	a[x]=val;
	for(auto y:to[x]) if(y!=fa) build(y,x,a,val);
}

bool chk(int x,int y,int z){return a[y][x]!=a[y][z];}

void add(int u,int v)
{
	if (u==v) return;
	for(auto z:g[u]) if(chk(u,z,v)) {add(z,v);return;}
	for(auto z:g[v]) if(chk(u,z,v)) {add(z,u);return;}
	
	g[u].insert(v);
	g[v].insert(u);
	vector<int>f;
	f.clear();
	for (auto z:g[u]) if((z!=v)&&chk(u,v,z)) f.push_back(z);
	for (auto z:f)
		if (g[u].count(z))
		{
			g[u].erase(z);
			g[z].erase(u);
			add(v,z);
		}
	f.clear();
	for(auto z:g[v]) if((z!=u)&&chk(v,u,z)) f.push_back(z);
	for(auto z:f)
		if (g[v].count(z))
		{
			g[v].erase(z);
			g[z].erase(v);
			add(u,z);
		}
}

int work(int x,int fr)
{
	int t=1;
	for(auto y:g[x]) if(chk(fr,x,y))t+=work(y,x);
	return t;
}

int main()
{
	n=read();m=read();
	for(int i=1;i<n;i++)
	{
		int u=read(),v=read();
		to[u].push_back(v);
		to[v].push_back(u);
	}
	for(int i=1;i<=n;i++)
		for(auto y:to[i])
			build(y,i,a[i],y);
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		add(u,v);
	}
	for(int i=1;i<=n;i++) ans+=work(i,0)-1;
	printf("%d\n",ans/2);
	return 0;
}


Measured memory_bytes: 16640
from sys import stdin

MOD = 10**9+7
def modcmb(n, r, mod):
    x = 1
    y = n
    for i in range(2,r+1):
        x *= i
        x %= mod
        y *= n-i+1
        y %= mod
    return y * pow(x, mod-2, mod) % mod

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

DIV = 10**9+7

_n = pow(2, n, MOD)
_a = modcmb(n, a, MOD)
_b = modcmb(n, b, MOD)
ans = _n - _a - _b - 1
print(ans % MOD)


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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1,i,j;
    //cin>>t;
    while(t--)
    {
        int n,m,count=0,sum=0,maxi=0,mini=1e18;
        cin>>n;
        set<string> s;
        while(n--)
        {
            string temp;
            cin>>temp;
            s.insert(temp);
        }
        cout<<s.size();
    }
}

Measured memory_bytes: 19248
#include <stdio.h>

int main(void)
{
	int x;
	int y;
	
	while(1){
		scanf("%d %d", &x, &y);
	if(x == 0 && y == 0){
		break;
		}
	if(x < y){
		printf("%d %d\n", x, y);
		}
	else if(x > y){
		printf("%d %d\n", y, x);
		}
	else {
		printf("%d %d\n", x, y);
		}
	}
	
	return (0);
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, k, x; cin >> k >> x;
	for (int h = x - k + 1; h <= x + k - 1; h++) {
		cout << h << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <queue>
#include <set>

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

  queue<pair<ll, ll>> que;

int main(int argc, char const *argv[])
{
  vector<pair<ll, ll>> neighbor{make_pair(0, 1), make_pair(0, -1), make_pair(1, 0), make_pair(-1, 0)};
  ll res = 0;
  ll h, w;
  cin >> h >> w;
  vector<vector<char>> map = vector<vector<char>>(h, vector<char>(w));
  REP(i, h)
  {
    REP(j, w)
    {
      char cell;
      cin >> cell;
      map[i][j] = cell;
      if (cell == '#')
        que.push(make_pair(i, j));
    }
  }
  que.push(make_pair(-1, -1));

  while (true)
  {
    pair<ll, ll> cell = que.front();
    

    if (cell.first == -1) {
      que.pop();
      if (que.empty()) break;
      res++;

      que.push(make_pair(-1,-1));
      continue;
    }

    for (auto nei : neighbor)
    {
      ll y = cell.first+nei.first;
      ll x = cell.second+nei.second;

      if (y < 0 || y >= h || x < 0 || x >= w) continue;

      if (map[y][x] == '.')
      {
        map[y][x] = '#';
        que.push(make_pair(y, x));
      }
    }
    que.pop();

  }
  cout << res << endl;
  return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
     cin >> x >> y;
     ans = x + y - __gcd(x,y) + 1;
     Cout(ans);
     

       
return 0;
}



Measured memory_bytes: 3252
//Author- Sajal Agrawal
//sajal.agrawal1997@gmail.com
#include <bits/stdc++.h>
using namespace std;
#define  ll long long
int main() {
    ll k,i,j,t1,t2;
    cin>>k;
    //cout<<"k="<<k<<endl;
    ll a[k];
    for(i=0;i<k;i++)cin>>a[i];
    ll l=2,r=2;
    for(i=k-1;i>=0;i--){
        //cout<<"l="<<l<<" r="<<r<<" a[]="<<a[i]<<endl;
        if(l%a[i]==0 or r%a[i]==0 or (l/a[i]!=r/a[i])){
        	if(l%a[i]==0){
            	
            }else{
            	l=(l/a[i] + 1)*a[i];
            	//cout<<"l="<<l<<endl;
            }
            if(r%a[i]==0){
            	r=r+a[i]-1;
            }else{
            	r=(r/a[i])*(a[i])+a[i]-1;
            	//cout<<"r="<<r<<endl;
            }
        }else{
            printf("-1\n");
            return 0;
        }
        //cout<<"l="<<l<<" r="<<r<<endl;
    }
    printf("%lld %lld\n",l,r);
	return 0;
}













Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define all(v) v.begin(),v.end()
#define boost ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
/*
#define bigint __int128
__int128 abss(__int128 x){if(x>0)return x;
    return -x;
    }
*/
void solve() {
        int d,t,s;cin>>d>>t>>s;
  if(s*t>=d){cout<<"Yes\n";}else{cout<<"No\n";}
}
int main()
{boost;
int t;t =1;//cin>>t;
while(t--){solve();}
}


Measured memory_bytes: 3624
#include <stdio.h>

int main() {
    int k, x, pos, n;
    int t = 1;
    scanf("%d %d", &k, &x);
    pos = x-k+1;
    n = k*2-1;
    for (int i=0; i<n; ++i) {
        if (t) {
             printf("%d", pos);
             t = 0;
        } else {
            printf(" %d", ++pos);
        }
    }
    return 0;
}


Measured memory_bytes: 128
// AOJ 2773: Periodic Sequence
// 2017.10.9 bal4u@uu

#include <stdio.h>

int s[200005];
int a[200005];

int main()
{
	int n, i, j;

	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", s+i);
	a[0] = -1, j = -1;
	for (i = 0; i < n; i++) {
		while (j >= 0 && s[i] != s[j]) j = a[j];
		a[i+1] = ++j;
	}
	n = i;
	
	j = n - a[n];
	if (n % j != 0) puts("1");
	else printf("%d\n", n / j);
	return 0;
}

Measured memory_bytes: 3312
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}




main(){
  int n;
  cin>>n;
  vector<P> v(n);
  rep(i,n){
    cin>>v[i].F>>v[i].S;
  }

  bool flag=true;
  int sum=0;
  rep(i,n){
    sum+=v[i].F;
    if(v[i].F!=v[i].S) flag=false;
  }

  if(flag){
    cout<<0<<endl;
  }else{
    int res=INF;
    rep(i,n){
      if(v[i].F>v[i].S){
        res=min(res,v[i].S);
      }
    }

    cout<<sum-res<<endl;
  }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

ll arr[N];
ll dp[N];
int main(){
  int n; ll a,b;
  scanf("%d%lld%lld",&n,&a,&b);
  REP(i,n) scanf("%lld",&arr[i]);
  if(a>b) swap(a,b);
  arr[n]=arr[n-1]+b;
  dp[0]=1;
  dp[1]=1+(arr[1]-arr[0]>=b);
  ll sum=0,cur=0;
  int fl=1;
  REPP(i,2,n+1){
    if(arr[i-1]-arr[i-2]<a) fl=0;
    while(cur<i-2&&arr[i]-arr[cur]>=b&&(cur==0||arr[cur+1]-arr[cur-1]>=a)) sum+=dp[cur++];
    if(arr[i-1]-arr[i-2]<a) sum=0,cur=i-2;
    dp[i]=fl+sum;
    if(arr[i]-arr[i-1]>=b) dp[i]+=dp[i-1];
    if(arr[i]-arr[i-2]>=b){
      if(i-2==0||arr[i-1]-arr[i-3]>=a) dp[i]+=dp[i-2];
    }
    dp[i]%=mod;
  }
  printf("%lld\n",dp[n]);
  return 0;
}

Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (4e18) + 9;
const int MOD = (1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { r, d, l, u };
int dx[] = { 0, 1, 0,-1 };
int dy[] = { 1, 0,-1, 0 };

//enum diR { d, r, u, l , dr, ur, dl, ul };
int dX[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dY[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiou"; //and sometimes "aeiouy"

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
//convert index from 2D matrix to 1D array. (Zero-indexed)
int ord(int r, int c, int nCol) { return (nCol*r) + c + 1; }
//convert index from 1D array to 2D matrix . (One-indexed)
ii rord(int n, int nCol) {
	int r = n%nCol, c = n / nCol;
	if (n%nCol == 0) c--, r = nCol;
	return ii(r, c);
}

ll poww(ll num, ll p, ll md = MOD) {
	num %= md;
	ll ret = 1;
	while (p > 0) {
		if (p & 1) ret = (ret * num) % md;
		num = (num * num) % md;
		p >>= 1;
	}
	return ret;
}

ll nCr(ll n, ll r) {
	if (n < r)
		return 0;
	if (r == 0)
		return 1;
	return n * nCr(n - 1, r - 1) / r;
}

const int N = 3100;
double dp[N][N], p[N];
int n;
double solve(int idx, int cnt) {
	if (idx == n) {
		if (cnt > n / 2) return 1.0;
		else return 0.0;
	}
	double& ret = dp[idx][cnt];
	if (ret == ret) return ret;
	return ret = p[idx] * solve(idx + 1, cnt + 1) + (1.0 - p[idx]) * solve(idx + 1, cnt);
}


int main()
{
#ifndef ONLINE_JUDGE

#else
	//freopen("pyramid.in", "r", stdin);
#endif
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	cin >> n;
	lop(i, n) cin >> p[i];
	mem(dp, -1);
	printf("%0.10f\n", solve(0, 0));



	return 0;
}


Measured memory_bytes: 75520
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

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

  if(b == 1) cout << 0 << endl;
  else {

  if(a >= b) cout << 1 << endl;

  else {

  b -= a;
  if(b % (a-1) == 0){
    cout << b / (a-1) + 1<<endl;
  }
  else cout << b / (a-1) + 2 <<endl;




}
}
  return 0;
}


Measured memory_bytes: 256
X,N=map(int,input().split())
if N>=1:
    p=list(map(int,input().split()))

    SA=10**9
    num=-10**9
    for i in range(102):
        if i not in p:
            if abs(X-i)<SA:
                SA=abs(X-i)
                num=i
    print(num)
else:
    print(X)

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

sum = []

for i in range(N):
  if not sum:
    sum.append(A[i])
  else:
    sum.append(sum[i-1] + A[i])
    
product_sum = 0
    
for i in range(N-1):
  product_sum += A[i] * (sum[N-1] - sum[i])
  
print(product_sum % (10**9 + 7))

Measured memory_bytes: 31444
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    int n,m; cin >> n >> m;
    vector<int> x(m);
    vector<int> sa;
    rep(i,m) cin >> x[i];
    sort(x.begin(), x.end());
    for(int i = 1; i < m; i++) sa.push_back(x[i]-x[i-1]);
    sort(sa.rbegin(), sa.rend());
    int ans = x[m-1] - x[0];
    rep(i,min(n-1,m-1)) ans -= sa[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1404
#include<bits/stdc++.h>
#include<algorithm>
#include<numeric>
#define int long long
#define all(x) x.begin(),x.end()
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
void solve() {
   int k;
   string s;
   cin>>k>>s;
   if(s.length()<=k) cout<<s;
   else cout<<s.substr(0,k)<<"...";
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //cout<<"Hello World"<<"\n";
    //int t;cin>>t;while(t--)
        solve();

}

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

int main(){
    int h,n,k=0;
    int a[100000];
    cin>>h>>n;
    bool x=false;
    for(int i=0;i<n;i++){
        cin>>a[n];
        k+=a[n];
    }
    if(h<=k){
        x=true;
    }
    if(x){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

int n;

int main(){
    cin >> n;
    int output = 1;

    while(1){
        if(n>=output*2){
            output *= 2;
        } else {
            break;
        }
    }
    cout << output << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 1000005
#define pb push_back
#define mp make_pair
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;

bool prime[MAX];
int lowFactor[MAX],vis[MAX];
void SIEVE(void){  /// 10^6 lowest factors stored ; O(Nlog(log(N)))
    for(int i=1;i<MAX;i++){
        prime[i]=true;
        lowFactor[i]=i;
    }
    prime[1]=false;
    for(int i=2;i*i<MAX;i++){
        if(!prime[i]) continue;
        for(int j=i*i;j<MAX;j+=i){
            prime[j]=false;
            if(lowFactor[j]==j) lowFactor[j]=i;
        }
    }
}

vector<int> getFactorization(int a){ /// O(log(n)); n<10^6/10^7
    vector<int> V;
    while(a>1){
        int pre=lowFactor[a];
        int cong=0;
        while(lowFactor[a]==pre){
            pre=lowFactor[a];
            a/=pre;
            cong++;
        }
        if(cong) V.pb(pre);
    }
    return V;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    SIEVE();
    int n,a,gcdd,pw=0;
    cin>>n>>a;
    auto U=getFactorization(a);
    for(auto u:U){
        vis[u]=1;
    }
    gcdd=a;
    for(int i=2;i<=n;i++){
        cin>>a;
        gcdd=__gcd(gcdd,a);
        auto V=getFactorization(a);
        for(auto v:V){
            if(vis[v]){
                pw=1;
            }
            vis[v]=1;
        }
    }
    if(!pw) cout<<"pairwise coprime";
    else if(gcdd==1) cout<<"setwise coprime";
    else cout<<"not coprime";
    return 0;
}


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

using namespace std;

#define fo(i,CApiTaL_N) for(int i=0; i<CApiTaL_N; i++)
#define Fo(i,k,CApiTaL_N) for(int i=k; i<CApiTaL_N; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int t=1;
const int mxN=3e3;
string s1,s2;
vector<vector<pair<int,pii>>>dp(mxN+1,vector<pair<int,pii>>(mxN+1));

void test_case(){
    cin>>s1>>s2;
    int n=s1.size(), m=s2.size();
    Fo(i,1,n+1){
        Fo(j,1,m+1){
            if(s1[i-1]==s2[j-1]){
                dp[i][j]=max({mp(dp[i-1][j-1].first+1,mp(i-1,j-1)), mp(dp[i][j-1].first,mp(i,j-1)), mp(dp[i-1][j].first,mp(i-1,j))});
            }else{
                dp[i][j]=max(mp(dp[i][j-1].first,mp(i,j-1)), mp(dp[i-1][j].first,mp(i-1,j)));
            }
        }
    }
    auto fnl=mp(0,mp(0,0));
    string ans="";
    Fo(i,1,n+1){
        Fo(j,1,m+1){
            if(dp[i][j].first>fnl.first){
                fnl=dp[i][j];
            }
        }
    }
    pii prv=fnl.second,curr=fnl.second;
    if(fnl.first)ans.pb(s1[curr.first]);
    while(prv!=mp(0,0)){
        int l1=curr.first, r1=curr.second, l2=prv.first, r2=prv.second;
        if(l1+1==l2&&r1+1==r2){
            ans.pb(s1[l1]);
        }
        prv=curr;
        curr=dp[l1][r1].second;
    }

    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

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

    // cin>>t;
    while(t--){
        test_case();
    }
    
    return 0;
}

Measured memory_bytes: 109340
#!/usr/bin/env python3

def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    cur = sum(p[0:K])
    max = cur
    for i in range(N - K):
        cur = cur - p[i] + p[i + K]
        if cur > max:
            max = cur

    print((max + K) / 2)


main()


Measured memory_bytes: 25060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	var c string
	fmt.Scanf("%s", &c)
	fmt.Printf("%s", string(c[0] + 1))
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    int count;
    count = 10*a[2]+a[1]+a[0];
    out(count);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int ans;

void upd(int& x, int y) {
    x = max(x, y);
    ans = max(ans, y);
}

const int maxn = 305;

int dp[maxn][maxn][maxn];

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int k;
    string s;
    cin >> s >> k;
    int n = s.length();
    fore(l1, 0, n)
        fore(l2, 0, n - l1 - 1)
            fore(changes, 0, k) {
                //printf("dp = %d l1 = %d l2 = %d changes = %d\n", dp[l1][l2][changes], l1, l2, changes);
                upd(dp[l1 + 1][l2][changes], dp[l1][l2][changes]);
                upd(dp[l1][l2 + 1][changes], dp[l1][l2][changes]);
                int addit = l1 == n - l2 - 1 ? 1 : 2;
                if (s[l1] == s[n - l2 - 1]) {
                    upd(dp[l1 + 1][l2 + 1][changes], dp[l1][l2][changes] + addit);
                } else if (changes < k) {
                    upd(dp[l1 + 1][l2 + 1][changes + 1], dp[l1][l2][changes] + addit);
                }
            }
    printf("%d", ans);
}



Measured memory_bytes: 110848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  int d[N];
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  sort(d,d+N);
  cout << d[N/2]-d[N/2-1]<< endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    string s;
    cin >> s;
    bool f=true;
    for(int i=0;i<s.size();i++){
        for(int j=0;j<i;j++){
            if(s[i]==s[j]){
                f =false;
            }
        }
    }
    if(f==true) cout <<"yes"<<endl;
    else cout<<"no" <<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力値
		int n = sc.nextInt();
		String s = sc.next();
		// 文字列の長さ
		int len = n%2 == 0 ? n/2 : 0;
		// 2度繰り返せばOK
		boolean ret = false;
		if(len>0) {
			String c1 = s.substring(0,len);
			String c2 = s.substring(len,s.length());
			if (c1.equals(c2)) {
				ret = true;
			}
		}
		System.out.println(ret?"Yes":"No");
		sc.close();
	}
}


Measured memory_bytes: 21716