akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define LL long long

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<LL> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        if(a.at(i) == 0){
            cout << "0" << endl;
            return 0;
        }
    }
    
    LL mul =1;
    for(int i=0; i<n; i++){
        if(mul > 1000000000000000000/a.at(i)){
            cout << "-1" << endl;
            return 0;
        }
            mul *= a.at(i);
    }
    cout << mul << endl;  
    return 0;

}

Measured memory_bytes: 4012
#include <iostream>

int main() {

  std::string A;
  std::string B;
  std::string C;

  std::cin >> A >> B >> C;

  if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<math.h>
#include<set>
#include<iomanip>
#include<stdio.h>
#include<deque>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#define M 1000000007
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N,i;
	cin>>N;
	multiset<double> v;
	double o=0;
	for(i=0;i<N;i++)
	{
		double x;
		cin>>x;
		v.insert(x);
	}
	while(v.size()>1)
	{
		auto itr1=v.begin();
		auto itr2=next(itr1,1);
		o=((*itr1)+(*itr2))/2;
		v.insert(o);
		v.erase(itr1);
		v.erase(itr2);
	}
	cout<<o<<endl;
}

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

namespace ABC144
{
	class Program
	{
		static void Main(string[] args)
			
		{
			int a, b, max;
			var word = Console.ReadLine().Split(' ');
			a = int.Parse(word[0]);
			b = int.Parse(word[1]);
			max = a + b;
			if (max < a - b) max = a - b;
			if (max < a * b) max = a * b;
			Console.WriteLine(max);
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 11092
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
    int a,b,c,d,e;
    
    scanf("%d%d%d",&a,&b,&c);
    
    d=max(a,b); e=min(a,b);
    
    if(d>=c && e<=c ){
        printf("Yes\n");
        }else{
            printf("No\n");
        }
        return 0;
    }





Measured memory_bytes: 256
from itertools import product
K = int(input())
ans = []

for l in range(10):
    for s in range(1, 10):
        for pattern in product([0, 1, 2], repeat=l):  # そのまま, １つ上, １つ下
            X = [s]
            for p in pattern:
                if X[-1] == 0 and p == 2:
                    break
                if X[-1] == 9 and p == 1:
                    break

                if p == 0:
                    X.append(X[-1])

                if p == 1:
                    X.append(X[-1] + 1)

                if p == 2:
                    X.append(X[-1] - 1)
            else:
                ans.append(int(''.join(map(str, X))))

ans.sort()
print(ans[K - 1])


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

const int N=101009,p=998244353,inv2=p+1>>1;
char A[N],B[N],C[N],D[N];
int fac[N<<2],inv[N<<2];
int n,m,ans;

inline int qpow(int A,int B){
	int res(1);while(B){
		if(B&1)res=(ll)res*A%p;
		A=(ll)A*A%p,B>>=1;
	}return res;
}

inline int Com(int nn,int mm){return (ll)fac[nn]*inv[mm]%p*inv[nn-mm]%p;}
void prework(int A){
	fac[0]=inv[0]=1;
	for(int i=1;i<=A;++i)fac[i]=(ll)fac[i-1]*i%p;
	inv[A]=qpow(fac[A],p-2);
	for(int i=A-1;i;--i)inv[i]=(ll)inv[i+1]*(i+1)%p;
}

void work(){
	int left=0,right=0,l=0,r=0,pre=1,val;
	for(int i=1;i<=n;++i)left+=A[i]-'0',right+=B[i]-'0';
	for(int i=m;i;--i)r+=C[i]-'0'+D[i]-'0';
	for(int i=1;i<=m;i++){
		l+=C[i]-'0'+D[i]-'0';
		r-=C[i]-'0'+D[i]-'0';
		if(C[i]=='0' and D[i]=='0')continue;
		if(C[i]=='1' and D[i]=='1')pre=2ll*pre%p;
		if(right)val=Com(right+r-1,r);
		else val=(!r);		ans=(ans+(ll)pre*val)%p;
		if(left)val=Com(left+l-1,l);
		else val=(!l);		pre=(pre+val)%p;
	}
}

int main(){
	scanf("%d%d",&n,&m);
	prework(n+m+n+m);
	scanf("%s%s",A+1,B+1);
	scanf("%s%s",C+1,D+1);
	bool died=true;
	for(int i=1;i<=n;++i)
		if(A[i]=='1' or B[i]=='1' or C[i]=='1' or D[i]=='1')
			{died=false;break;}
	if(died){puts("1");return 0;}
	work();
	swap(n,m);swap(A,C);
	swap(B,D);swap(C,D);
	work();
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3712
N = int(input())
A, B = map(int,input().split())
list = [int(x) for x in input().split()]
counta = 0
countb = 0
countc = 0 
for p in list:
    if p <= A:
        counta += 1
    elif B >= p >= A+1:
        countb += 1
    elif p >= B+1:
        countc +=1
print(min(min(counta,countb),countc))

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

const long long MOD = 998244353;

ll powm(ll x, ll y, ll mod = 1e9 + 7)
{
    ll ans = 1;
    while (y > 0) {
        if (y % 2) {
            ans = (ans * x) % mod;
        }
        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r, ll mod = 1e9 + 7)
{
    static ll prev_r = 1e9 + 7;
    static ll x = 1;
    static ll y = 1;

    ll start_i = 0;
    if (prev_r <= r) {
        start_i = prev_r;
    } else {
        x = 1;
        y = 1;
    }
    prev_r = r;
    for (ll i = start_i; i < r; i++) {
        x *= n - i;
        x %= mod;
    }
    for (ll i = start_i; i < r; i++) {
        y *= i + 1;
        y %= mod;
    }

    ll res = x * powm(y, mod - 2, mod);
    return res % mod;
}

void solve(long long N, long long M, long long K)
{
    ll ans = 0;
    for (ll i = 0; i <= K; i++) {
        ll val = M * powm(M - 1, N - i - 1, MOD);
        val %= MOD;
        val *= nCr(N - 1, i, MOD);
        val %= MOD;
        ans += val;
        ans %= MOD;
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    long long K;
    scanf("%lld", &K);
    solve(N, M, K);
    return 0;
}


Measured memory_bytes: 3776
#include<stdio.h>

#define MAX 100000
#define NIL -1


struct Node {
    public:
        int id;
        int parent;
        int left;
        int right;
};

Node N[MAX];

void Preorder(int id) {
    if (id == NIL) return;
    printf(" %d", id);
    Preorder(N[id].left);
    Preorder(N[id].right);
}
void Inorder(int id) {
    if (id == NIL) return;
    Inorder(N[id].left);
    printf(" %d", id);
    Inorder(N[id].right);
}

void Postorder(int id) {
    if (id == NIL) return;
    Postorder(N[id].left);
    Postorder(N[id].right);
    printf(" %d", id);
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        N[i].id = i;
        N[i].parent = NIL;
        N[i].left = NIL;
        N[i].right = NIL;
    }

    for (int i = 0; i < n; ++i) {
        int id, lc, rc;
        scanf("%d %d %d", &id, &lc ,&rc);
        N[id].left = lc;
        N[id].right = rc;

        int deg = 0;
        if (lc != NIL) {
            N[lc].parent = id;
        }
        if (rc != NIL) {
            N[rc].parent = id;
        }
    }

    int root = NIL;
    for (int i = 0; i < n; ++i) {
        if (N[i].parent == NIL) {
            root = i;
            break;
        }
    }

    printf("Preorder\n");
    Preorder(root);
    printf("\n");

    printf("Inorder\n");
    Inorder(root);
    printf("\n");

    printf("Postorder\n");
    Postorder(root);
    printf("\n");

}

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

int main(){
    int l,r;
    cin>>l>>r;
    int b=2019;
    if(r-l>=2019){
        cout<<0<<endl;
    }else{
    for(int i=l;i<r;i++){
        for(int j=i+1;j<r+1;j++){
            b=min(((i%2019)*(j%2019))%2019,b);
        }
    }
    cout<<b<<endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll N;
  cin >> N;
  vll A(N);
  REP(i, 0, N) {
    ll a;
    cin >> a;
    A[i] = a;
  }
  sort(A.begin(), A.end(), greater<>());

  ll a = 0;
  ll b = 0;
  REP(i, 0, N) {
    if (i % 2 == 0) {
      a += A[i];
    } else {
      b += A[i];
    }
  }
  cout << a - b << endl;

  return 0;
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair

#define forn(i,s,n) for(ll i=s;i<n;i++)
#define all(c)  c.begin(),c.end()
#define boost ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(0);srand(time(NULL));
#define tc(t) ll t;cin >> t; while(t--)
/* cout << fixed << setprecision(12) << ans << endl;*/

#define pii pair<long long,long long>
#define vii vector<pii>
#define vvi vector<vector <long long> >

#define ff first
#define ss second

#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vector<int> , greater<int> >

#define deb1(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
#define deba(a,n) for(ll i=0;i<n;++i) {  cout<<a[i]<<" "; };cout<<"\n"

#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

vector<vector<double> > dp(3010,vector<double>(3010,0) );


int main()
{
 boost;
 ll n;
 cin >> n;
 vector<double> p(n+1);
 p[0]=1;
 forn(i,1,n+1)
 cin >> p[i];
 dp[0][0]=1;
 
 forn(c,1,n+1)
 {
 	forn(h,0,n+1)
 	{
 		if(h==0)
		 dp[c][h]=dp[c-1][h] * (1 - p[c] );
		else
		{ 
		  dp[c][h] = dp[c-1][h-1] * p[c] + dp[c-1][h] * (1 - p[c] ); 
		 	
		  } 
	 }
 }
 
  double ans=0.00;
  ll nh=(n+1)/2;
  forn(a,nh,n+1)
  ans+=(dp[n][a]);
  
 cout << fixed << setprecision(10) << ans << endl;
 
 


}






Measured memory_bytes: 71296
import sys
input = sys.stdin.readline

def main():
    n, k = [int(i) for i in input().split()]
    s = input() + "3"
    s0 = []
    s1 = []
    cnt = 0
    start = 1
    for i in range(n+1):
        if start == 1 and s[i] != "1":
            s1.append(cnt)
            cnt = 1
            start = 0
        elif start == 0 and s[i] != "0":
            s0.append(cnt)
            cnt = 1
            start = 1
        else:
            cnt += 1

    #ans = max(s1)
    #for i in range(n // 2 +1):
    #    ans = max(ans, sum(s1[i:i+k+1]) + sum(s0[i:i+k]))

    ans = sum(s1[0:0+k+1]) + sum(s0[0:0+k])
    n_ans = ans

    for i in range(n):
        try:
            n_ans = n_ans + s1[k+1+i] + s0[k+i] - s1[i] - s0[i]
            ans = max(ans, n_ans)
        except:
            try:
                n_ans = n_ans + s0[k+i] - s1[i] - s0[i]
                ans = max(ans, n_ans)
            except:
                pass

    print(ans)
    #print(s1, s0)

main()


Measured memory_bytes: 4356
#include <stdio.h>

int main(void)
{
	long a, b;
	long d, r;
	double f;

	scanf("%ld %ld", &a, &b);

	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	
	printf("%ld %ld %lf\n", d, r, f);

	return 0;
}

Measured memory_bytes: 636
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
const int modn=1e9+7;
ll mulit(ll a,ll b,ll m){
    ll ans=0;
    while(b){
        if(b&1) ans=(ans+a)%m;
        a=(a<<1)%m;
        b>>=1;
    }
    return ans;
}

ll quick_mod(ll a,ll b,ll m){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mulit(ans,a,m);
        }
        a=mulit(a,a,m);
        b>>=1;
    }
    return ans;
}

ll comp(ll a,ll b,ll m){
    if(a<b) return 0;
    if(a==b) return 1;
    if(b>a-b) b=a-b;
    ll ans=1,ca=1,cb=1;
    for(int i=0;i<b;i++){
        ca=ca*(a-i)%m;
        cb=cb*(b-i)%m;
    }
    ans=ca*quick_mod(cb,m-2,m)%m;
    return ans;
}

ll lucas(ll a,ll b,ll m){
    ll ans=1;
    while(a&&b){
        ans=(ans*comp(a%m,b%m,m))%m;
        a/=m;
        b/=m;
    }
    return ans;
}
int main(){
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	ll r=n*1ll*m;
	ll q=lucas(r-2,k-2,modn);
	ll sum=0;
	for(int i=1;i<n;i++){
		sum=(sum+q*i%modn*m%modn*m%modn*(n-i)%modn)%modn;
	}
	for(int i=1;i<m;i++){
		sum=(sum+q*i%modn*n%modn*n%modn*(m-i)%modn)%modn;
	}
	printf("%lld\n",sum);
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1), b(n + 1), c(n);
    for(int i = 1; i <= n; i ++) cin >> a[i];
    for(int i = 1; i <= n; i ++) cin >> b[i];
    for(int i = 1; i < n; i ++) cin >> c[i];

    int res = 0;
    for(int i = 1; i <= n; i ++){
        int x = a[i];
        res += b[x];
        if(i > 1 && a[i - 1] + 1 == a[i]) res += c[a[i - 1]];
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define WHITE 0
#define VISITED 1
#define CANDIDATE 2

void dks(vvpii &g, vi &d, vi &s) {
  priority_queue<pii, vpii, greater<pii>> q;
  q.push(make_pair(d[0], 0));

  while (!q.empty()) {
    auto qt = q.top(); q.pop();
    int u = qt.second, c = qt.first;
    s[u] = VISITED;

    if (d[u] < c) continue;
    
    for (auto cp: g[u]) {
      int v = cp.first, t = d[u] + cp.second;
      if (s[v] != VISITED && t < d[v]) {
        d[v] = t;
        s[v] = CANDIDATE;
        q.push(make_pair(d[v], v)); 
      }
    }
  }
}

int main() {
  int n;
  cin >> n;
  
  vvpii g(n);
  rep(_, n) {
    int u, k;
    cin >> u >> k;

    rep(__, k) {
      int v, c;
      cin >> v >> c;

      g[u].push_back(make_pair(v, c));
    }
  }
  
  vi d(n, 1 << 21), s(n, WHITE);
  d[0] = 0;
  dks(g, d, s);

  rep(i, n) printf("%d %d\n", i, d[i]);
}



Measured memory_bytes: 8008
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int f_overflow = 0;
		int f_zero = 0;
		long[] A = new long[N];
		long X = 1;

		for(int i = 0; i < N; i++) {
			A[i] = scan.nextLong();
		}

		for(int i = 0; i < N; i++) {
			if(A[i] == 0) {
				X = 0; f_zero = 1;
			}
		}

		if(f_zero == 0) {
			for (int i = 0; i < N; i++) {
				if(X * A[i] / A[i] == X && X <= (long) Math.pow(10, 18)) {
					X = X * A[i];
				} else {
					f_overflow++;
					break;
				}
			}
		}

		if(f_overflow == 0 && X <= (long) Math.pow(10, 18)) System.out.println(X);
		else System.out.println("-1");
	}
}


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

using namespace std;

int main(void)
{
	string s;
	bool reversed = false;
	cin >> s;
	int q;
	cin >> q;
	//int ts[q];
	//vector<pair<int, char>> fc;
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (t == 1)
			reversed = !reversed;
		else  {
			int f;
			char c;
			cin >> f >> c;
			if (!reversed) {
				if (f == 1)
					s.insert(s.begin(), c);
				else
					s.push_back(c);
			} else {
				if (f == 1)
					s.push_back(c);
				else
					s.insert(s.begin(), c);
			}
		}
	}
	if (reversed)
		reverse(s.begin(), s.end());

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c; 
	cin>>a>>b>>c;
	a=abs(a);
	if(b<=a/c){
		cout<<a-b*c<<endl;
		return 0;
	}
	long long k=a/c,y=(b-k)%2;
	if(y%2>0){
		cout<<abs(a-k*c-c)<<endl;
		return 0;
	}
	cout<<abs(a-k*c)<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 100005; 
vector<pair<int, int>> edges[NMAX];
int ans[NMAX];
 
void dfs(int i, int par, int pc){
  int c = 1;
  for(auto p : edges[i]){
      int j = p.first, idx = p.second;
      if(j == par) continue;
      if(c == pc) c++;
      ans[idx] = c;
      dfs(j, i, c);
      c++;
    }
}
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for(int i=0; i<N-1; i++){
      int a, b;
      cin >> a >> b;
      a--; b--;
      edges[a].emplace_back(b, i);
      edges[b].emplace_back(a, i);
    }
    dfs(0, -1, -1);
    cout << *max_element(ans, ans+N-1) << endl;
    for(int i=0; i<N-1; i++) cout << ans[i] << endl;
    return 0;
}


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

string lower(string str) {
    for (int i = 0; i < str.length(); i++)
        if (str[i] >= 'A' && str[i] <= 'Z')
            str[i] += 'a' - 'A';

    return str;
}

int main() {
    string W;
    string word;
    int sum = 0;

    cin >> W;
    cin >> word;
    while (word != "END_OF_TEXT") {
        if (lower(word) == W) {
            sum++;
        }
        cin >> word;
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;


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

int main(){
    ll n,k; cin >> n >> k;
    vector<ll> x(n);
    ll minus = 0, plus = 0;
    rep(i,n) {
        cin >> x[i];
        if(x[i] < 0)minus++;
        else plus++;
    }
    ll ret = INF;
    rep(i,n-k+1){
        ll temp = 0;
        if(x[i] * x[i+k-1] > 0)temp = max(abs(x[i]), abs(x[i+k-1]));
        else {
            temp = min(abs(x[i]), abs(x[i+k-1])) + abs(x[i] - x[i+k-1]);
        }
        chmin(ret, temp);
    }

    cout << ret << endl;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int x=sc.nextInt();
        int[] a=new int[N];
        for(int i=0;i<N;i++){
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int ans=0;
        int px=0;
        for(int i=0;i<N;i++){
            px += a[i];
            if(px>x){
                break;
            }
            ans++;
        }
        if(px<x){
            System.out.println(ans-1);
        }else{
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string readLine = Console.ReadLine();

            int val = int.Parse(readLine);

            int ans = (int)Math.Pow(val, 3);

            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 17964
#abc086_c
N = int(input())
T=[0]
X=[0]
Y=[0]
for i in range(N):
    ti,xi,yi =map(int,input().split())
    T.append(ti)
    X.append(xi)
    Y.append(yi)
ans = "Yes"
for i in range(1,N+1):
    if X[i]-X[i-1]+Y[i]-Y[i-1]<=T[i]-T[i-1] and (T[i]-T[i-1])%2 == (X[i]-X[i-1]+Y[i]-Y[i-1])%2:
       continue
    else:
        ans="No"
        break
print(ans)




Measured memory_bytes: 11764
a, b, c = gets.chomp.split(/\s/).map(&:to_f)

c = c / 180 * Math::PI

h = Math.sin(c) * b

s = a * h / 2

d = a - Math.cos(c) * b

l = a + b + Math.sqrt(d ** 2 + h ** 2)

puts s
puts l
puts h



Measured memory_bytes: 6960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
  int N,M;
  cin>>N>>M;
  int dp[M+1]={};
  int K,A;
  for(int i=0;i<N;i++){
    cin>>K;
    for(int j=0;j<K;j++){
      cin>>A;
      dp[A]+=1;
      }
    }
  int ans=0;
  for(int i=1;i<=M;i++){
    if(dp[i]==N){
      ans+=1;
    }
  }
  cout<<ans<<"\n";
return 0;
}


Measured memory_bytes: 256
import numpy as np

H, N = map(int, input().split())

A = []
B = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

A = np.array(A)
B = np.array(B)

dp = np.full((H+1), np.inf)
dp[0] = 0

def solve():
    for i in range(1, H + 1):
        dp[i] = np.amin(dp[np.maximum(i - A , 0)] + B)
    return int(dp[H])

print(solve())

Measured memory_bytes: 12500
#include <bits/stdc++.h>
#define for0(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;




int main()
{
  int n,j;
  string str ;
  cin >> str ;
  n = str.size() ;


  for (int i =0 , j=(n/2)+1 ; i<(n-1)/2 ; i++,j++ ){
    if(str[i]!= str[j]){
      cout << "No";return 0 ;
    }
}
cout<<"Yes" ;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
#include <functional>
#include <cassert>
typedef long long int ll;
using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl;

void solve(){
	string a, b;
	int n;
	cin >> a >> b;
	n = stoi(a+b);
	if(sqrt(n) == floor(sqrt(n))){
		cout << "Yes";
	}else{
		cout << "No";
	}
	cout << endl;
}

int main(){
	solve();
	return 0;
}

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

const int INF = 1 << 30;

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

  int n; cin >> n;
  string s; cin >> s;

  vector<int> b(n+1,INF),w(n+1,INF);
  b[0] = w[0] = 0;
  for(int i = 0; i < n; i++){
    b[i+1] = min(b[i],w[i]) + (s[i] != '#');
    w[i+1] = w[i] + (s[i] != '.');
  }
  cout << min(b[n],w[n]) << endl;

  return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

int main(){
    std::string s;
    std::cin >> s;

    int t = s.size();
    if (s[t - 1] == 's')
    {
        std::cout << s + "es" << std::endl;
    }
    else
    {
        std::cout << s + "s" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

void sort(int *a,int len);
int total(int *a,int len);

int main(void)
{
    int n=0,m=0;
    int array[1000];
    int sum=0;

    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%d",&array[i]);
    }
    sum=total(array,n);
    sort(array,n);
    
    if(4*m*array[m-1]>=sum){
        printf("Yes");
    } else {
        printf("No");
    }

    return 0;
}

void sort(int *a,int len){
    int index=0,max=0;
    int temp=0;
    for(int i=0;i<len-1;i++){
        max=a[i];
        index=i;
        for(int j=i+1;j<len;j++){
            if(a[j]>max){
                max=a[j];
                index=j;
            }
        }
        temp=a[i];
        a[i]=a[index];
        a[index]=temp;
    }
}

int total(int *a,int len){
    int sum=0;
    for(int i=0;i<len;i++){
        sum+=a[i];
    }

    return sum;
}


Measured memory_bytes: 1728
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	out(N * N * N)
}


Measured memory_bytes: 1776
n, p = map(int, input().split())
l = list(map(int, input().split()))
a = []
for i in l:
    a.append(i % 2)
    
if p == 0:
    if a.count(1) == 0:
        print(2 ** n)
    
    else:
        print(2 ** (n - 1))
        
else:
    if a.count(1) == 0:
        print(0)
    
    else:
        print(2 **(n - 1))

Measured memory_bytes: 3060
s = input()
n = len(s)

def dfs(i, f):

    if i == n-1:
        if eval(f)==7: 
            print(f+"=7")
            exit()
        else: 
            return False
    else:
        dfs(i+1,f + "+" + s[i+1])
        dfs(i+1,f + "-" + s[i+1])
    
def main():
    if dfs(0,s[0]):
        exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    m = 100
    l = [0]*10**5
    for i in range(1, m):
        for j in range(1, m):
            for k in range(1, m):
                l[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
    n = ni()
    prn(l[1:n+1])
    return

solve()


Measured memory_bytes: 10004
#include <stdio.h>
int main()
{
  int i = 0;
  char S[4];
  scanf("%s",S);
  while (S[i])
  {
    if (S[i] != 'A' && S[i] != 'B')
    {
      printf("No");
      return (0);
    }
    i++;
  }
  if (S[0] == S[1] && S[1] == S[2])
  {
    printf("No");
    return (0);
  }
  printf("Yes");
  return (0);
}

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

using namespace std;


int main(){
  string s;
  int i,length;
  cin >> s;
  length = s.length();
  for(i=0;i<length;i++){
    if(i%2==0){
      if(s[i]=='L'){
      cout << "No";//偶然
      return 0;
    }
    }else{
      if(s[i]=='R'){
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  int n;
  cin >> n;
  vector<string> a(3);
  rep(i, 3) cin >> a[i];

  int ans = 0;
  rep(i, n) {
    if (a[0][i] == a[1][i]) {
      if (a[1][i] == a[2][i]) {
        
      } else {
        ans++;
      }
    } else {
      if (a[1][i] == a[2][i] || a[0][i] == a[2][i]) {
        ans++;
      } else {
        ans += 2;
      }
    }
    cerr << ans << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ll INF=1e9;
int main(){
      int n,m;
      while(cin>>n>>m&&(n||m)){
            int a[n+1],b[m+1];
            vector<int> V1,V2;
            REP(i,n)cin>>a[i+1];
            REP(i,m)cin>>b[i+1];
            REP(i,n+1)if(i!=0)a[i]+=a[i-1];
            REP(i,m+1)if(i!=0)b[i]+=b[i-1];
            REP(i,n+1)REP(j,i)V1.PB(a[i]-a[j]);
            REP(i,m+1)REP(j,i)V2.PB(b[i]-b[j]);
            sort(ALL(V1));
            sort(ALL(V2));
            int ans=0;
            REP(i,V1.size()){
                  ans+=(upper_bound(ALL(V2),V1[i])-lower_bound(ALL(V2),V1[i]));
            }
            cout<<ans<<endl;
      }
}

Measured memory_bytes: 21136
#include<iostream>  
#include<vector>
using namespace std;  
#define  max(x,y)   (x)>(y)?(x):(y)  
int main() 
{  
    int N,W;  
    cin>>N; 
    cin>>W;  
    vector<int> f(W+1, 0);
    vector<int> value(N+1, 0);
    vector<int> weight(N+1, 0);
    for (int i=1;i<=N; i++)  
    {       
        cin>>value[i]>>weight[i];
    } 
    for (int i=1; i<=N; i++)  
        for (int j=W; j>=weight[i]; j--)  
                f[j] = max(f[j],f[j-weight[i]] + value[i]);         
    cout<<f[W]<<endl;
    return 0;
}


Measured memory_bytes: 3148
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		int x = sc.nextInt();
		int y = sc.nextInt();
		sc.close();

		List<Integer> list = new ArrayList<>();
		int cnt = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'F') {
				cnt++;
			} else {
				list.add(cnt);
				cnt = 0;
			}
		}
		list.add(cnt);

		List<Set<Integer>> sets = new ArrayList<>();
		sets.add(new HashSet<>());
		sets.add(new HashSet<>());
		sets.get(0).add(0);
		sets.get(1).add(0);
		for (int i = 0; i < list.size(); i++) {
			Set<Integer> set = sets.get(i % 2);
			Integer[] arr = set.toArray(new Integer[0]);
			set.clear();
			for (int o : arr) {
				set.add(o + list.get(i));
				if (i != 0) {
					set.add(o - list.get(i));
				}
			}
		}

		if (sets.get(0).contains(x) && sets.get(1).contains(y)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 130756
#include <bits/stdc++.h>
using namespace std;
int i;
int main()
{
	int n;
	cin >> n;
	int a[n+1];
	
	int s=0;
	for (i=1;i<=n;++i)
	{
		cin >> a[i];
	    s+=a[i];
	}
	int s1=s/n;
	int an=0;
	for (i=1;i<=n;++i)
	    an+=fabs(a[i]-s1)*fabs(a[i]-s1);
	int s2=s/n+1;
	int an1=0;
	for (i=1;i<=n;++i)
	    an1+=fabs(a[i]-s2)*fabs(a[i]-s2);
		
	if (an>=an1)
	cout <<an1;
	else
	cout <<an;
	return 0;
	}

Measured memory_bytes: 256
/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 

signed main()
{
 
    fast;
    long long x , k , d ;
    cin >> x >> k >> d ;
    int n = abs(x)/d;
    if(n>=k){
    	cout<<abs(x) - k*d<<endl;
    }
    else {
    	if((k-n)%2==0)
    	cout<<abs(x) - n*d<<endl;
    	else cout<<d-abs(x)+n*d<<endl;
    }
    return 0;
}

/* Pooja Yadav */

Measured memory_bytes: 3660
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    let a: i32 = read!();
    let mut b: i32 = 0;
    for i in 0..a {
        let mut c:usize=read!();
        while c%2==0 {
            c/=2;
            b+=1;
        }
    }
    println!("{}",b)
}

Measured memory_bytes: 2164
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

	vector<int> v;

	int idx = 0;
	while(idx < s.size())
	{
		if (s[idx] == 'A')
		{
			v.push_back(1);
			idx++;
		}
		else if (s[idx] == 'B')
		{
			if (idx + 1 < s.size() && s[idx + 1] == 'C')
			{
				v.push_back(2);
				idx += 2;
			}
			else
			{
				v.push_back(0);
				idx += 1;
			}
		}
		else if (s[idx] == 'C')
		{
			v.push_back(0);
			idx += 1;
		}
	}

	ll count = 0;
	ll ans = 0;

	rep(i, v.size())
	{
		if (v[i] == 0)
		{
			count = 0;
		}
		else if (v[i] == 1)
		{
			count++;
		}
		else
		{
			ans += count;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1532
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db long double  /* print with %Lf */
#define EPS 1e-9
#define flu fflush(stdout)
#define imp {cout<<"0\n"; return 0;}
#define yup {cout<<"YES\n"; return 0;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<"\n";}
#define debug_pvec(vec,n) {rep(idxi,n) cout<<vec[idxi].fi<<"-"<<vec[idxi].se<<"  "; cout<<"\n";}
#define debug_set(seta) {cout<<seta.size()<<"\n"; for(auto idxi:seta) cout<<idxi<<" "; cout<<"\n";}
#define debug_map(mappa) {cout<<mappa.size()<<"\n";for(auto idxi:mappa) cout<<idxi.fi<<"-"<<idxi.se<<"  "; cout<<"\n";}
#define debug_vecvec(vec,n) {rep(idxi,n) {for(auto idxi2:vec[idxi]) cout<<idxi2<<" "; cout<<"\n";}}
 
// LOOK AT THESE BEFORE SUBMISSION
// LOOK AT THESE BEFORE SUBMISSION
// ============================================================
// Nmax value and is index access offset taking it beyond Nmax.
// Precision error in case of real numbers.
// N vs N2 chosen correctly.
// Modulo applied everywhere.
// Flush in case of interactive.
// Don't erase value in multiset.
// Check for array indices out of bound (in pre or suff sums).
// Correct return value for functions.
// Confirm the letter case of yes and no.
// Dont paste code two times in the text file.
// ============================================================

int main() {

    gets(s); ll n = s.size();
    string t(n,'x');cout<<t<<endl;


    return 0;
}

Measured memory_bytes: 256
use v5.18;
use warnings;
use utf8;
sub line { chomp(my $str = <>); $str; }
sub split_line { (split / /, line) }

my $n = line;
my @nums = split_line;
my $odd_num = 0;
for my $num (@nums) {
  $odd_num++ if $num % 2 == 1;
}
say $odd_num % 2 == 1 ? 'NO' : 'YES';


Measured memory_bytes: 17376
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int a = -1,b = -1;
    for (int i = 1; i < s.size(); i ++) {
        if (s[i - 1] == s[i]) {
            a = i,b = i + 1;
            break;
        }
        if(i + 1 < s.size() && s[i - 1] == s[i + 1])
        {
            a = i,b = i + 2;
            break;
        }
    }
    cout << a << ' ' << b << endl;
    return 0;
}

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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int a, b;
  cin >> a >> b;
  int ans = 0;
  if(a > b){
    ans += a;
    a--;
  }
  else{
    ans += b;
    b--;
  }
  ans += max(a, b);
  cout << ans << endl;
}




Measured memory_bytes: 384
#include <iostream>
#include<string>
using namespace std;
int  main() {
	int A, B, C,D;

	cin >> A >> B >> C>>D;
	if(A*B>=C*D)
	{
		cout << A*B<< endl;
	}else 
	{
		cout << C*D << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n;
    cin >> n;

    ll maxnum = 1000000;
    ll num = 7;
    ll val = 0;
    for(int i = 1; i <= maxnum; i++){
        val += num;
        if(val % n == 0){
            cout << i << endl;
            return 0;
        }
        val %= n;
        num *= 10;
        num %= n;
    }
    cout << -1 << endl;


}


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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    char cur = s[0];
    int ans = 0;
    rep1(i, n) {
        if (s[i]==cur) {
            continue;
        } else {
            cur = s[i];
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1020
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var N = Console.ReadLine().ToInt32();
        var an = Console.ReadLine().SplittedStringToInt32List();
        var minsum = INF;
        for (int i = -100; i <= 100; i++)
        {
            var sum = 0;
            foreach (var item in an)
            {
                sum += (int)Math.Pow(item - i, 2);
            }
            minsum = Math.Min(minsum, sum);
        }
        Console.WriteLine(minsum);
        Console.ReadLine();
    }




    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;
    public const int Mod1e9 = 1000000007;
    

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion
}



Measured memory_bytes: 13396
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    
    long long diff = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (i & 1) {
            diff -= A[i];
        } else {
            diff += A[i];
        }
    }
    diff *= 2;
    long long sum = A[n - 1] * 2LL;
    vector<long long> res(n, 0);
    res[0] = (sum + diff) / 2;

    for (int i = 0; i < n - 1; ++i) {
        res[i + 1] = A[i] * 2LL - res[i];
    }

    for (int i = 0; i < n; ++i) {
        cout << res[i] << (i == n - 1 ? '\n' : ' ');
    }
    return 0;
}

Measured memory_bytes: 2560
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int y,x;
    int m[13] = { 0,1, 9, 1,0,1,0,1,1,0,1,0,1};
    cin >> x >> y;
    if (m[y]==m[x] ) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    //cout << ans << endl;
}

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

int main() {
  int R;
  cin >> R;
  string ans;
  if (R < 1200) {
    ans = "ABC";
  } else if (R < 2800) {
    ans = "ARC";
  } else {ans = "AGC";}
  
  
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
X = int(input())

cando = [False for i in range(X+1)]
cando[0] = True
for i in range(X+1):
    if not cando[i]: continue
    for item in [100, 101, 102, 103, 104, 105]:
        if i + item <= X:
            cando[i+item] = True
print(int(cando[X]))


Measured memory_bytes: 44784
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;


int main(int argc, char **argv)
{
	ll N, K; cin >> N >> K;
	vector<ll> x(N); for (ll i = 0; i < N; ++i) cin >> x[i];
	ll res{1ll<<60};
	for (ll i = 0; i < N-K+1; ++i)
	{
		ll left = x[i];
		ll right = x[i+K-1];
		ll tmp;
		if (right <= 0) tmp = abs(left);
		else if (left >= 0) tmp = abs(right);
		else
		{
			tmp = right - left + min(abs(right), abs(left));
		}

		res = min(res, tmp);
	}
	std::cout << res << std::endl;
}


Measured memory_bytes: 1024
//let input = "10000 1 1";

function main(input){
  let list = input.trim().split(" ");
  let d = parseInt(list[0]);
  let t = parseInt(list[1]);
  let s = parseInt(list[2]);
  let m = d/s;
  let answer = "";
  if(m<=t){answer = "Yes";}else{answer = "No";}
  console.log(answer);
}
//main(input);
main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 29636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int a[60];

int main(void)
{
    int N, L;
    cin >> N >> L;

    string all[110];

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

    sort(all, all + N);

    string ans = "";
    for(int i = 0; i < N; i++)
    {
        ans += all[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 * D - Sum of Large Numbers
 * https://atcoder.jp/contests/abc163/tasks/abc163_d
 *
 * TODO: 未完成です 
 */
#include <bits/stdc++.h>
using namespace std;

long long mod = 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7;
 
int main() {
    // 10100, 10100+1, ..., 10100+N の N+1 個の数があります。
    // この中から K 個以上の数を選ぶとき、その和としてあり得るものの個数を mod(109+7) で求めてください。
    long long N, K;
    cin >> N >> K;

    long long pattern = 0;
    for (long long i = K; i <= N + 1; i++) {
        /*
        if (i == N + 1) {
            pattern += 1;
            continue;
        }*/

        // min = 0,1,2...i - 1;
        // long long min = i * (i - 1) / 2;
        // min = N,N-1...N - i + 1;
        // long long max = i * (2 * N - i + 1) / 2;

        //cout << i << " "  << min << " " << max << endl;
        // pattern += ((i * (2 * N - i + 1) - (i * (i - 1)) / 2) + 1;
        // pattern += ((2 * N * i - i * i + i) - (i * i - i)) / 2) + 1;
        // pattern += (2Ni - ii + i - ii + i) / 2) + 1;
        pattern += (N - i + 1) * i + 1;
        pattern = pattern % mod;
    }

    cout << pattern << endl;
}
 

Measured memory_bytes: 3572