akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace MyProgram{
    class AtCoder{
        static void Main(){
            long[] input = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            long X = input[0];
            long Y = input[1];
            for(var i=0;;i++){
                X = X*2;
                if(Y < X){
                    Console.WriteLine(i+1);
                    return;
                }
            }

        }
    } 
}

Measured memory_bytes: 13140
#include<iostream>
#include<vector>
using namespace std;
long int traverse(vector<long int> g[],long int dp[],long int n,long int start)
{
    if(g[start].size()==0)
    {
        return 0;
    }
    long int mx=0;
    for(int i=0;i<(int)g[start].size();i++)
    {
        if(!dp[g[start][i]])
            dp[g[start][i]]=traverse(g,dp,n,g[start][i]);
        mx=max(mx,1+dp[g[start][i]]);
    }
    return mx;
}

int provoke(vector<long int> g[],long int dp[],long int n)
{
    long int mx=0;
    for(int i=1;i<=n;i++)
    {
        if(!dp[i])
            dp[i]=traverse(g,dp,n,i);
        mx=max(mx,dp[i]);
    }
    return mx;
}

int main()
{
    long int n,m,x,y;
    cin>>n>>m;
    long int dp[n+1]={0};
    vector<long int> g[n+1];
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        g[x].push_back(y);
    }
    cout<<provoke(g,dp,n);
}


Measured memory_bytes: 9856
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };


/******************************************************************************************/


struct Combination {

	vector<ll> fact, rfact;

	Combination(ll sz) : fact(sz + 1), rfact(sz + 1) {

		fact[0] = 1;
		for (ll i = 1; i < fact.size(); i++) {
			fact[i] = fact[i - 1]%MOD * i % MOD;
		}
		//逆元
		rfact[sz] = inv(fact[sz]);
		for (ll i = sz - 1; i >= 0; i--) {
			rfact[i] = rfact[i + 1] %MOD * (i + 1) % MOD;
		}
	}

	ll inv(ll x) {
		return pow(x, MOD - 2);
	}
	ll pow(ll x, ll n) {
		ll ret = 1;
		while (n > 0) {
			if (n & 1) (ret *= x) %= MOD;
			(x *= x) %= MOD;
			n >>= 1;
		}
		return (ret);
	}
	ll P(ll n, ll r) {
		if (r < 0 || n < r) return (0);
		return (fact[n] * rfact[n - r] % MOD);
	}

	ll C(ll p, ll q) {
		if (q < 0 || p < q) return (0LL);
		return (fact[p]%MOD * rfact[q] % MOD * rfact[p - q] % MOD);
	}

	ll H(ll n, ll r) {
		if (n < 0 || r < 0) return (0);
		return (r == 0 ? 1 : C(n + r - 1, r));
	}
};



int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	
	ll a, b, k;
	cin >> a >> b >> k;

	ll hoge = a;
	a -= k;
	k -= hoge;
	if (k > 0) {
		b -= k;
	}
	cout << max(a, 0LL) << " " << max(b, 0LL) << endl;



	return 0;
}



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

int main(void){
	char str[20];
	int n,i,temp;

	scanf("%s",&str);

	n = strlen(str);

	for(i = 0;i < n/2;i++){
		temp = str[i];
		str[i] = str[n-1-i];
		str[n-1-i] = temp; 
	}

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

	return 0;
}

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

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

  int min = N, m = N;
  int sum = 0;
  for (int i = 1; i < (N / 2) + 1; i++) {
    m = N - i;
    sum = 0;
    ti = i;

    for (int j = 0; j < 5; j++) {
      sum += m % 10;
      m /= 10;
      sum += ti % 10;
      ti /= 10;
      // cout << ti << sum << m << endl;
    }
    if (sum < min) {
      min = sum;
    }
  }
  cout << min << endl;
  return 0;
}


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

typedef long long LL;
typedef double DL;

const int INF = 2147483647;

int a,b;

inline int getint()
{
    int ret = 0,f = 1;
    char c = getchar();
    while (c < '0' || c > '9') 
    {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
        ret = ret * 10 + c - '0',c = getchar();
    return ret * f;
}

int main()
{
    #ifdef AMC
        freopen("AMC1.txt","r",stdin);
//        freopen("AMC2.txt","w",stdout);
    #endif
    a = getint(); b = getint();
    if (a >= 9)
    {
    	printf(":(");
    	return 0;
	}
	if (b >= 9)
    {
    	printf(":(");
    	return 0;
	}
	printf("Yay!");
	return 0;
}

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

using namespace std;

#define int long long

struct Dijkstra {
	struct E {
		int t; // to
		int c; // cost
		E(int t_, int c_) : t(t_), c(c_) {}
//		E(void) : t(0), c(0) {}
		inline bool operator<(const E a) const {
			return c < a.c;
		}
		inline bool operator>(const E a) const {
			return a < (*this);
		}
	};
	int n; // num of vertex
	vector<vector<E>> es; // edges list
	Dijkstra(int sz) : n(sz), es(sz) {}
	void add_edge(int s, int t, int cost) {
		es[s].push_back(E(t, cost));
	}
	// s : start, inf : infinity
	auto calc(int s, int inf) {
		vector<int> res(es.size(), inf);
		// res[i] : cost of position i
		priority_queue<E, vector<E>, greater<E>> q;
		q.emplace(s, 0);
		while (!q.empty()) {
			auto a = q.top();
			q.pop();
			// a.t : now position
			// a.c : now position's cost
			if (a.c >= res[a.t]) continue;
			res[a.t] = a.c;
			for (auto& p : es[a.t]) {
				if (a.c + p.c < res[p.t]) q.emplace(p.t, a.c + p.c);
			}
		}
		return res;
	}
};

signed main()
{
	int n, m, S, T;
	cin >> n >> m >> S >> T;
	S--, T--;
	Dijkstra EN(n), SN(n);
	for (int i = 0; i < m; i++) {
		int v, u, x, y;
		cin >> v >> u >> x >> y;
		v--, u--;
		EN.add_edge(u, v, x);
		EN.add_edge(v, u, x);
		SN.add_edge(u, v, y);
		SN.add_edge(v, u, y);
	}
	auto en = EN.calc(S, LLONG_MAX);
	auto sn = SN.calc(T, LLONG_MAX);
	vector<int> res(n);
	for (int i = 0; i < n; i++) res[i] = en[i] + sn[i];
	for (int i = n - 2; i >= 0; i--) res[i] = min(res[i], res[i + 1]);
	for (int i = 0; i < n; i++) cout << (int)1e15 - res[i] << endl;
}
/*
	verified on 2018/5/13
	https://atcoder.jp/contests/soundhound2018-summer-qual/tasks/soundhound2018_summer_qual_d
*/

Measured memory_bytes: 19000
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> //tuple<ll,ll,ll>
#define pr(x) cout << x << endl;
using namespace std;
 
int main(){
  int n; cin >> n;
  ll s[n][2];
  rep(i,n) cin >> s[i][0] >> s[i][1];
  ll a,b;
  a=s[0][0];
  b=s[0][1];
  rep(i,n-1){
    ll na,nb;
    na=s[i+1][0];
    nb=s[i+1][1];
    if(na>=a && nb>=b){
      a=na;
      b=nb;
      continue;
    }
    ll f=max((a+na-1)/na,(b+nb-1)/nb);
    //f++;
    a=na*f;
    b=nb*f;
    //cout << a << b << endl;
  }
  cout << a+b << endl;
return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;cin>>n;
  int a;cin>>a;
  int ans = 0;
  for(int i = 0; n > i; i++){
    int tmp;cin>>tmp;
    ans += min(tmp,a-tmp)*2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,en;
    cin>>n;
    int x[n],y[n],h[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]!=0){
            en=i;
        }
    }
 
    int ansx=0,ansy=0;
    int HH;
   
    for(int i=0;i<=100;i++){
        int flag=0;
        for(int j=0;j<=100;j++){
            HH=h[en]+abs(x[en]-i)+abs(y[en]-j);
            for(int u=0;u<n;u++){
                int hh=HH-abs(x[u]-i)-abs(y[u]-j);
                if(max(hh,0)!=h[u]){
                    break;
                }
                if(u==n-1){
                    int ansh=h[en]+abs(x[en]-i)+abs(y[en]-j);
                    cout<<i<<" "<<j<<" "<<ansh<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
struct Card
{
    char name;
    int number;
};
Card a[100005],b[100005],tmp[100005];
int n;
void merge(Card a[],int l,int m,int r,Card tmp[])
{
    int p1=l,p2=m+1,p3=0;
    while(p1<=m&&p2<=r)
    {
        if(a[p1].number<=a[p2].number) tmp[p3++]=a[p1++]; //注意这里必须是<=，如果是<的话，结果就不稳定了
        else tmp[p3++]=a[p2++];
    }
    while(p1<=m) tmp[p3++]=a[p1++];
    while(p2<=r) tmp[p3++]=a[p2++];
    for(int i=0;i<=r-l;i++) a[i+l]=tmp[i];
}
void mergesort(Card a[],int l,int r,Card tmp[])
{
    if(l<r)
    {
        int m=l+(r-l)/2;
        mergesort(a,l,m,tmp);
        mergesort(a,m+1,r,tmp);
        merge(a,l,m,r,tmp);
    }
}
int partition(Card a[],int p,int r)
{
    Card x=a[r],t;
    int i=p-1;
    for(int j=p;j<r;j++)
    {
        if(a[j].number<=x.number)
        {
            i++;
            t=a[j];a[j]=a[i];a[i]=t;
        }
    }
    t=a[i+1];a[i+1]=a[r];a[r]=t;
    return i+1;
}
void quicksort(Card a[],int p,int r)
{
    if(p<r)
    {
        int q=partition(a,p,r);
        quicksort(a,p,q-1);
        quicksort(a,q+1,r);
    }
}
int main()
{
    int i,stable=1;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i].name>>a[i].number;
        b[i].name=a[i].name;
        b[i].number=a[i].number;
    }
    mergesort(b,0,n-1,tmp);
    quicksort(a,0,n-1);
    for(i=0;i<n;i++)
    {
        if(a[i].name!=b[i].name)
        {
            stable=0;
            break;
        }
    }
    if(stable==1) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    for(i=0;i<n;i++)
    {
        cout<<a[i].name<<" "<<a[i].number<<endl;
    }
    return 0;
}


Measured memory_bytes: 5424
#include <stdio.h>
#include <string.h>
#include <queue>

using namespace std;

int main(void){
	int t, n, i, j, field[151][151], ix, iy, count;
	const int standard = 75, dx[6] = {1,1,0,-1,-1,0}, dy[6] = {1,0,-1,-1,0,1};
	queue<int> x, y;
	while(1){
		scanf("%d%d",&t,&n);
		if(t == 0 && n == 0)
			break;
		memset(field,-1,sizeof(field));
		for(i = 0;i < n;i++){
			scanf("%d%d",&ix,&iy);
			field[iy + standard][ix + standard] = 0;
		}
		scanf("%d%d",&ix,&iy);
		x.push(standard + ix),y.push(standard + iy);
		field[standard + iy][standard + ix] = 0;
		while(x.size()){
			for(i = 0;i < 6;i++){
				if(field[y.front() + dy[i]][x.front() + dx[i]] == -1 && field[y.front()][x.front()] < t){
					x.push(x.front() + dx[i]),y.push(y.front() + dy[i]);
					field[y.front() + dy[i]][x.front() + dx[i]] = field[y.front()][x.front()] + 1;
				}
			}
			x.pop(), y.pop();
		}
		count = 1;
		for(i = 0;i < 151;i++){
			for(j = 0;j < 151;j++){
				if(field[i][j] > 0)
					count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void) {
    string n;
    cin>>n;
    int t=n.size();
    int ans=0;
    if(t%2==0){
        for(int i=1;i<=t;i+=2){
            ans+=(9*pow(10,i-1));
        }
        cout<<ans<<endl;
    }
    else{
        for(int i=1;i<=t-2;i+=2){
            ans+=(9*pow(10,i-1));
        }
        int nn=stoi(n);
        ans+=(nn-pow(10,t-1)+1);
        cout<<ans<<endl;
    }
    
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if (N <= 3) {
			System.out.println("No");
			return;
		}
		boolean found = false;
		int xMax = N / 4;
		int yMax = N / 7;
		for (int x = 0; x <= xMax; x++) {
			for (int y = 0; y <= yMax; y++) {
				if ((4 * x) + (7 * y) == N) {
					found = true;
					break;
				}
			}
			if (found) {
				break;
			}
		}
		System.out.println(found ? "Yes" : "No");
	}
}

Measured memory_bytes: 22732
using System;
using System.Linq;

namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
      
      string S=Console.ReadLine();
      string[] arr=new string[S.Length];
      
      for(int i=0;i<S.Length;i++){
        arr[i]=S.Substring(i,1);
 
      }
    string[] dis=arr.Distinct().ToArray();
      if(dis.Length!=arr.Length){
        Console.WriteLine("no");
      }else{
        Console.WriteLine("yes");
      }
    }
    
  }

}



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

using namespace std;

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

int bins[100];

int main() {
    int n, w;
    while(cin>>n>>w, n+w) {
        int max_v = 0;
        memset(bins, 0, 100);
        rep(i, n) {
            int v; cin >> v;
            bins[v/w]++;
            max_v = max(max_v, v);
        }
        int n_bins = 1 + max_v / w;
        int max_bin = 0;
        rep(i, n_bins) {
            max_bin = max(max_bin, bins[i]);
        }
        double ans = 0.01;
        rep(i, n_bins) {
            ans += (double)(n_bins-i-1)*bins[i]/(double)((n_bins-1)*max_bin); 
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3248
#include<stdio.h>
#include<math.h>

int main(){

  int i,c=0,N,f=0,a;
  //load number
  scanf("%d",&N);
  //N>0 ->roop
  while(N-->0){
    //road number
    scanf("%d",&a);
    if(a==1)continue;
    //judge number
    for(i=2;i<=sqrt((double)a);i++){
      //if a%j=0 flag=1
      if(a%i==0) f=1;
    }
    if(f==1)f=0;
    //else count prime number
    else c++;
  }
  //print counter
  printf("%d\n",c);



  return 0;

}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

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



Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
ll lcm(int a, int b){
  int c=__gcd(a,b);
  c=a/c*b;
  return c;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n;	
long long  step,ans;
char s;
int main(){
	scanf("%lld",&n);
	for(int i=0;i<n;i++){
		cin>>s;
		if(s=='I'){
			step++;
		}
		else if(s=='D'){
			step--;
		}
		ans=max(step,ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from itertools import groupby

def f(x):
  groups = []
  for _, g in groupby(x):
    groups += [list(g)]
 
  ans = 0
  flag = False
  for group in groups:
    n = len(group)
    if flag:
      n -= 1
      flag = False
    if n == 0:
      print(group, file=sys.stderr)
      continue
    c = (n-1)//3 * 2
    o = n%3
    if o == 0:
      d = 2
    elif o == 1:
      d = 1
    elif o == 2:
      d = 2
      flag = True
    print(group, c, d, file=sys.stderr)
    ans += c + d
  if flag:
    ans -= 1
  print(ans, file=sys.stderr)
  return ans

def solve():
  s = input()
  print(f(s))


if __name__ == '__main__':
  solve()

Measured memory_bytes: 38424
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int age;
  cin >> age;
  if(age == 3||age == 5||age == 7){
	cout << "YES\n";
  }
  else{
	cout << "NO\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans=0;
    for(int x=0;x<n-2;x++)
    {
        if(s[x]=='A' && s[x+1]=='B' && s[x+2]=='C')
            ++ans;

    }
    cout<<ans;
}


Measured memory_bytes: 256
X = int(input())
#print(X)
n = X
div = []
for i in range(1, int(n**0.5)+1):
  if n % i == 0:
    div.append(i)
    if i != n // i:
      div.append(n//i)
#print(div)

for i in div:
  for a in range(0, 1001): 
    b = a - i
    #print(a, b)
    if a**5 - b**5 == X:
      print(a, b)
      break
  else:
    continue
  break

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    double l;
    cin >> l;
    l /= 3;
    print(fixed << setprecision(8) << l*l*l);
    return 0;
}

Measured memory_bytes: 256
X,Y=map(int,input().split())

def comb(n,r,mod):
  def framod(n,mod,a=1):
    for i in range(1,n+1):
      a=a*i % mod
    return a
  
  def pow(n,r,mod):
    if r==0:
      return 1
    if r%2==0:
      return pow(n*n % mod, r//2, mod) % mod
    if r%2==1:
      return n*pow(n, r-1, mod) % mod
  
  a=framod(n,mod)
  b=framod(r,mod)
  c=framod(n-r,mod)
  return (a*pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod

ans=0
mod=10**9+7
if (X+Y)%3!=0:
  print(ans)
else:
  n=Y-(X+Y)//3
  m=X-(X+Y)//3
  if n<0 or m<0:
    print(ans)
  else:
    print(comb(n+m,n,mod))

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <queue>

using namespace std;


void make_graph(vector<pair<int, int> >& edgeList, vector<vector<int> >& graph, vector<int>& indegree){

    for(int i = 0; i < edgeList.size(); i++){
      graph[edgeList[i].first].push_back(edgeList[i].second);
      indegree[edgeList[i].second]++;
    }
}

void topologicalSortLongestDistance(vector<vector<int> >& graph, vector<int>& indegree, vector<int>& dist){

    queue<int> zeros;
    int count = 0;
    for(int i = 0; i < indegree.size(); i++){
        if(indegree[i] == 0)zeros.push(i);
    }

    while(!zeros.empty()){
        auto node = zeros.front();
        zeros.pop();
        for(auto ng : graph[node]){
            dist[ng] = max(dist[ng], dist[node] + 1);
            indegree[ng]--;
            if(indegree[ng] == 0)zeros.push(ng);
        }
    }

}


int main(){

  int n,m;
  cin >> n >> m;
  vector<pair<int, int>> edgeList;
  int a, b;
  for(int i = 0; i < m; i++){
  	cin >> a >> b;
    edgeList.push_back(make_pair(a, b));
  }
 
  vector<vector<int> > graph(n+1);
  vector<int> indegree(n+1, 0);

  make_graph(edgeList, graph, indegree);

 

  vector<int> dist(n+1, 0);
  topologicalSortLongestDistance(graph, indegree, dist);
  int res = 0;
  for(int i = 0; i <= n; i++){
      res = max(res, dist[i]);
  }
  cout << res << endl;



  
}


Measured memory_bytes: 7284
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define WHITE 0
#define BRACK 1

int **matrix;
int *d;
int *parent;
int *color;

void dijkstra(int);

int main(){
  int n,i,j,k,u,v;
  scanf("%d",&n);

  color =  malloc(n * sizeof(int ));
  d =  malloc(n * sizeof(int ));
  parent = malloc(n * sizeof(int));

  matrix = malloc(n * sizeof(int *));
  for(i=0;i<n;i++)
    matrix[i] = malloc(n * sizeof(int));

  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      matrix[i][j] = -1;
  
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      scanf("%d",&matrix[u][v]);
    }
  }

  dijkstra(n);

  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);

  free(d);
  free(color);
  free(parent);
  for(i=0;i<n;i++) free(matrix[i]);
  free(matrix);

  return 0;
  
}


void dijkstra(int n){
  int mincost;
  int i,j,u;

  for(i=0;i<n;i++){
    d[i] = INT_MAX;
    parent[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    mincost = INT_MAX;

    for(i=0;i<n;i++){
      if(color[i] != BRACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }

    if(mincost == INT_MAX) break;

    color[u] = BRACK;

    for(i=0;i<n;i++){
      if(color[i] != BRACK && matrix[u][i] != -1 && matrix[u][i] + d[u] < d[i]){
	d[i] = matrix[u][i] + d[u];
	parent[i] = u;
      }
    }
  }
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define mod 1000000007
#define inf 1e15
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y)* mod_pow(kai(y, y), mod - 2, mod) % mod;
}
struct edge { int to, cost; };
signed main() {
	int a, b;
	cin >> a >> b;
	rep(i, 3) {
		if (i + 1 != a && i + 1 != b) {
			cout << i + 1 << endl;
			ggr
		}
	}
	ggr
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    
    ll l,r,d;
    cin>>l>>r>>d;
    
    ll count=0;
    for(ll i=l;i<=r;i++)
    {
        if(i%d==0)
        count++;
    }
    
    cout<<count<<endl;
}

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

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

int main() {
    int r,g,b,n;cin>>r>>g>>b>>n;
    ll ans = 0;
    rep(i,n)rep(j,n){
        int tmp = n  - r*i - g*j;
        if(tmp%b==0 && tmp>=0)++ans;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt(), K = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			sum += Math.min(2 * a, (K - a) * 2);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <queue>
#define pii pair<int, int>
using ll = long long int;
using namespace std;
long long d, s, t;
void inp()
{
    cin >> d >> t >> s;
}
void process()
{
    long long k = (d/s)+(d%s != 0);
    if (k <= t) cout <<"Yes";
    else cout <<"No";
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("test.inp","r", stdin);
    inp();
    process();
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N, T, A;
  cin >> N >> T >> A;
  vector <int> H(N);
  rep(i,N) cin >> H[i];

  int ans = 0;
  double tmp = 100000.0;  //温度差の最小値を格納
  rep(i,N){
    double diff = abs(T - H[i] * 0.006 - A);  //A度との差
    if (diff == min(diff, tmp)) ans = i;  //温度差の最小値を更新したときansにiを代入
    tmp = min(diff, tmp);
  }
  cout << ans + 1 << endl;
}


Measured memory_bytes: 3628
def main():
    n = int(input())
    print(solve(n))

def digit_sum(n):
    s = 0
    while n != 0:
        s += n % 10
        n //= 10
    return s

def digit_sums_up(n):
    s = digit_sum(n)
    yield s

    while True:
        n += 1
        s += 1
        x = 10
        while n % x == 0:
            s -= 9
            x *= 10
        yield s

def digit_sums_down(n):
    s = digit_sum(n)
    yield s

    while True:
        x = 10
        while n % x == 0:
            s += 9
            x *= 10
        s -= 1
        n -= 1
        yield s

def solve(n):
    m = float('inf')
    for i, a, b in zip(range(n - 1), digit_sums_up(1), digit_sums_down(n - 1)):
        m = min(m, a + b)
    return m


main()

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n;
    double res=0;
    double x[10],y[10];
	cin >> n;
	for(int i=0;i<n;i++) cin>>x[i]>>y[i];
	for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            res += sqrt( (x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]) );
	res = res/((double)(n)*0.5);
	cout << fixed << res << endl;
}


Measured memory_bytes: 256
from itertools import combinations_with_replacement

n,m,q=map(int,input().split())
A=list(range(1,m+1))
s=(list(combinations_with_replacement(A,n)))
a=[0]*q
b=[0]*q
c=[0]*q
d=[0]*q

ans=0
for i in range(q):
    a[i],b[i],c[i],d[i]=map(int,input().split())

for i in s:
    total=0
    for j in range(q):
        if i[b[j]-1]-i[a[j]-1]==c[j]:
            total+=d[j]
    ans=max(ans,total)
print(ans)

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// 結果を入れたmapを返します
map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i <= sqrt(n); i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  // 2以上で割り切れなかったら
  if (n != 1) ret[n] = 1;
  return ret;
}

// ====================================================================

int main() {
  ll n;
  cin >> n;
  map<ll, int> mp = prime_factor(n);
  ll ans = 0;
  for (auto x : mp) {
    int count = 1;
    while (count <= x.second) {
      x.second -= count;
      count++;
      ans++;
    }
  }
  cout << ans << endl;
}


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

typedef long long int ll;
#define size 100002
ll a[size][3];
ll dp[size][3];
ll n;

ll func(ll i,ll j)
{
	if(i==n)
	{
		dp[i][j]=a[i][j];
		return dp[i][j];
	}
	if(dp[i][j]!=-1)
		return dp[i][j];
	dp[i][j] = max(func(i+1,(j+1)%3),func(i+1,(j+2)%3))+a[i][j];
	return dp[i][j];
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	ll i,j;
	for(i=1;i<=n;i++)
	{
		cin >> a[i][0] >> a[i][1] >> a[i][2];
		dp[i][0]=dp[i][1]=dp[i][2]=-1;
	}
	ll ans = max(func(1,0),func(1,1));
	ans = max(ans,func(1,2));
	cout << ans << "\n";
	return 0;
}

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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC   
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

const ll MOD = (ll)1e9+7; //change it for other mods

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve(ll testnum)
{
    ll n,m,x;
    cin >> n >> m >> x;
    vll c(n), a[n];
    for(ll i=0;i<n;i++) {
    	cin >> c[i];
    	for(ll j=0;j<m;j++) {
    		ll temp;
    		cin >> temp;
    		a[i].pb(temp);
    	}
    }
    ll temp = (1 << n);
    ll cst = (ll)1e15;
    for(ll i=0;i<temp;i++) {
    	vll b(m, 0);
    	ll cost = 0;
    	for(ll j=0;j<n;j++) {
    		if((i & (1 << j)) > 0) {
    			// cout << i << " " << j << " " << (i & (1 << j)) << "\n"; 
    			cost += c[j];
    			for(ll k=0;k<m;k++) {
    				b[k] += a[j][k];
    			}
    		}
    	}
    	ll tt = 0;
    	for(ll k = 0; k < m; k++) {
    		if(b[k] < x) {
    			tt = 1;
    			break;
    		}
    	}
    	if(tt == 0) {
    		cst = min(cst, cost);
    	}
    }
    if(cst == (ll)1e15) {
    	cout << "-1\n";
    } else {
    	cout << cst << "\n";
    }
}

int main()
{
    FAST_IO;
    #ifdef STIO 
      freopen("input.txt" , "r", stdin);
      freopen("output.txt" , "w", stdout);
    #endif
    ll t = 1;
    // cin >> t;
    for (ll i = 1; i <= t; i++) {
        solve(i);
    }
}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;

string res;

int main()
{
    ll a, b;
    string s;
    cin >> a >> b >> s;

    res = "Yes";
    for (int i = 0; i < s.length(); i++)
    {
        if (i == a)
        {
            if (s[i] != '-')
            {        
                res = "No";
            }
        }
        else
        {
            if (!('0' <= s[i] && s[i] <= '9'))
            {
                res = "No";
            }
        }
    }
    println(res);
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while (true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
}

int main(){
    vector<char> str(3);
    foreach(i,str)cin>>i;
    sort(all(str));
    str.erase(unique(all(str)),str.end());
    if(str.size()==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        //
		int X = Integer.parseInt(br.readLine());
		int t = 0;
		int sum = 0;
		
		while (true) {
			sum += ++t;
        	if (sum >= X) { System.out.println(t); return; }
		}

    }

}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >>s;
  for(int i=0;i<s.size();i++) cout<<'x';
  cout <<'\n';
  return (0);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int main(){
  int i;
  string in;

  cin >> in;

  rep(i,in.length()){
    if(in[i] - 3 < 'A') printf("%c",in[i] - 3 + 26);
    else printf("%c",in[i] - 3);
  }
  puts("");

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
//const ll MOD=100000;
const ll MAX=1e7;
const ll INF=(1ll<<60);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
struct Union_Find{
    ll N;
    vi par;
    vi siz;
    Union_Find(int n):N(n){
        par.resize(N);
        siz.resize(N,1);
        rep(i,0,N) par[i]=i;
    }
    ll root(ll X){
        if(par[X]==X) return X;
        return par[X]=root(par[X]);
    }
    bool same(ll X,ll Y){
        return root(X)==root(Y);
    }
    void unite(ll X,ll Y){
        X=root(X);
        Y=root(Y);
        if(X==Y) return;
        par[X]=Y;
        siz[Y]+=siz[X];
        siz[X]=0;
    }
    ll size(ll X){
        return siz[root(X)];
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r];
}
signed main(){
    ll N; cin>>N;
    vi A(N);
    ll cnt=0;
    rep(i,0,N){
        cin>>A[i];
        if(A[i]%2==1) cnt++;
    }
    string ans="YES";
    if(cnt%2==1) ans="NO";
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    int A_count=0;
    int B_count=0;
    rep(i,S.size()){
        if(S[i]=='A'){
            A_count++;
        }
        if(S[i]=='B'){
            B_count++;
        }
    }
    if(A_count==0 || B_count==0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
import math
H,W = input().split()
Hnum = int(H)
Wnum = int(W)
counter = 0
tmp = 0
if Hnum == 1 or Wnum == 1:
    counter =1
elif Hnum%2 == 0:
    counter = int(Hnum/2 * Wnum)
else:
    tmp = math.ceil(Wnum/2)
    Hnum -=1        
    counter = int((Hnum/2 * Wnum) +tmp)
print(counter)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;

  if (a % 2 != 0 && b % 2 != 0) {
    cout << "Odd" << endl;
  }
  
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int dp[3300][3300];

int main(){
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            if(i == 0 || j == 0) dp[i][j] = 0;
            else {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
                if(s[i-1] == t[j-1])
                    dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
            }
        }
    }

    string ans = "";
    while(n > 0 && m > 0){
        if(dp[n][m] == dp[n-1][m]) n--;
        else if(dp[n][m] == dp[n][m-1]) m--;
        else {
            ans += s[n-1];
            n--;
            m--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

Measured memory_bytes: 39168
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ass 1e18
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x,y) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<< endl;
#define debug3(x,y,z) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<<" "<<#z<<" : "<<z<< endl;
using namespace std;
typedef long long int ll;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll arr[200005],dp[200005];
vector<ll>v[200005];

void dfs(ll x,ll parent,ll sum)
{
	dp[x]=sum+arr[x];
	for(ll i=0;i<v[x].size();i++)
	{
		if(v[x][i]!=parent)
			dfs(v[x][i],x,sum+arr[x]);
	}
}

int main()
{
	boost
	ll n,q,a,b,i;
	cin>>n>>q;
	for(i=1;i<n;i++)
	{
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	while(q--)
	{
		cin>>a>>b;
		arr[a]+=b;
	}
	dfs(1,-1,0);
	for(i=1;i<=n;i++)
		cout<<dp[i]<<" ";
	return 0;
}

Measured memory_bytes: 28800
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#define rep(i,N) for(int i=0; i<N;i++)
using namespace std;

int main(){
    long int N,ans1,ans2;
    cin >>N;
    for(long int j=(long int)sqrt(N);j>0;j--){
        if(N%j==0){
            ans1=N/j;
            ans2=j;
            break;
        }
    }
    cout <<ans1+ans2-2<<endl;
    return 0;
}

Measured memory_bytes: 3680
#include <stdio.h>
 
int main(void){
    int a,b,answer,br=0;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
         
        switch(op){
        case '+':
            answer = a + b;
            break;
        case '-':
            answer = a - b;
            break;
        case '*':
            answer = a * b;
            break;
        case '/':
            answer = a / b;
            break;
        case '?':
            br = 1;
            break;
        }
         
        if(br != 1){
            printf("%d\n",answer);
        }else{
            break;
        }
    }
     
    return 0;
}

Measured memory_bytes: 600
import sys
from operator import itemgetter
from collections import deque, Counter
from itertools import permutations, combinations
from heapq import heapify, heappop, heappush
from bisect import bisect, bisect_left

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    dig = 0
    while N > 0:
        N //= K
        dig += 1
    print(dig)

    return 0

if __name__ == "__main__":
    solve()

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

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

typedef int64_t ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int K, X;
  cin >> K >> X;
  for(int i = X - K + 1; i <= X + K - 1; ++i) {
    if(i != X - K + 1) cout << " ";
    cout << i;
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    char a;
    cin>>a;
    if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
    {
        cout<<"vowel"<<endl;
    }
    else cout<<"consonant"<<endl;
    return 0;
}

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

/**
 * @brief プログラムのエントリーポイントです
 * 
 * @return int 終了後、0を返却しなければなりません。
 */
int main()
{
    // 入力
    int A, B;
    cin >> A >> B;

    int anser = (1 + 2 + 3) - ( A + B );

    // 出力
    cout << anser << endl;

    return 0;
}


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

int main(){
  long long n;
  cin>>n;
  long long a[n];
  for(long long i=0;i<n;i++){
    cin>>a[i];
  }
  vector<long long> v;
  v.push_back(0);
  v.push_back(abs(a[1]-a[0]));
  for(long long i=2;i<n;i++){
    v.push_back(min(abs(a[i]-a[i-1])+v[i-1],abs(a[i]-a[i-2])+v[i-2]));
  }
  cout<<v[v.size()-1];
  return 0;
}

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

int main()
{
    size_t N, Q;
    cin >> N >> Q;

    vector<vector<size_t>> s(2, vector<size_t>(N, N - 1));
    vector<size_t> hw(2, N - 1);

    size_t ans = (N - 2) * (N - 2);
    for (size_t q = 0; q < Q; q++)
    {
        size_t i;
        size_t x;
        cin >> i >> x;
        i--;
        x--;
        size_t j = (i + 1) % 2;

        if (x < hw[i])
        {
            for (size_t k = x; k <= hw[i]; k++)
            {
                s[i][k] = hw[j];
            }
            hw[i] = x;
        }
        ans -= s[i][x] - 1;
    }
    cout << ans << endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    string W;
    cin >> W;

    map<char, int> freq;
    for (auto c : W) {
        freq[c]++;
    }

    for (int i=0; i<26; i++) {
        if (freq[i+'a']%2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}



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

int main() {
string A; cin>>A;
  string B; cin>>B;
  int L=0;
  for(int i=0; i<A.size(); i++){
if(A.at(i)==B.at(i))
  L++;
    else continue;
  }
  if(L==A.size())
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
  


Measured memory_bytes: 3632