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

const int INF = 1e9;

#define int              long long
#define FOR( i, m, n )   for( int i = m; i < n; i++ )
#define REP( i, n )      FOR( i, 0, n )
#define ALL( a )         (a).begin(), (a).end()


signed main(){
  int n; cin >> n;
  int cnt[1001] = {};

  FOR( i, 2, n + 1 ){
    int t = i;
    FOR( j, 2, i + 1 ){
      while( t % j == 0 ){
	cnt[j]++;
	t /= j;
      }
      
    }
  }

  int ans = 1;
  REP( i, 1001 ){
    if( cnt[i] ){
      ans *= cnt[i] + 1;
    }
    ans %= INF + 7;
  }

  cout << ans << endl;
  
}
  


Measured memory_bytes: 256
// BMI

#include <iostream>
#include <map>
#include <cstdio>

using namespace std;

int main(void)
{
	map<int, double> students; // 学籍番号とBMI
	int num;
	double weight, height;
	double BMI;

	while (scanf("%d,%lf,%lf", &num, &weight, &height) == 3) {
		BMI = weight / (height * height);

		students.insert(make_pair(num, BMI));
	}

	for (map<int, double>::const_iterator it = students.begin();
		it != students.end(); it++) {
		if ((*it).second >= 25.0) {
			cout << (*it).first << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
int main(void)
{
	int m1, m2, m3, a ,i;
	m1=m2=m3=0;
	for(i=1; i<11; i++){
	scanf("%d", &a);
	if(m1<a){
		m3=m2;
		m2=m1;
		m1=a;
	}else if(m2<a){
		m3=m2;
		m2=a;
		}else if(m3<a){
			m3=a;
			}
	}
	printf("%d\n%d\n%d\n", m1,m2,m3);
	return 0;
}	

Measured memory_bytes: 600
<?php
$n = trim(fgets(STDIN));
$m1 = explode(" ", trim(fgets(STDIN)));
$m2 = explode(" ", trim(fgets(STDIN)));

$max = 0;
for($i = 0; $i < $n; $i++){
    $num = 0;
    for($j = 0; $j < $n; $j++){
        if($j <= $i)$num+=$m1[$j];
        if($j >= $i)$num+=$m2[$j];
    }
    $max = max($num, $max);
}
echo $max;

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


typedef unsigned long long ll;
ll t,i,j,n,k,x,y,a,b;
string s,s1,s2;
float f;
const ll M=1e9+7;


ll mod(ll x)
{
    return((x%M+M)%M);
}
ll add(ll a,ll b)
{
    return mod(mod(a)+mod(b));
}
ll mul(ll a,ll b)
{
    return mod(mod(a)*mod(b));
}

int main()
{   
    cin>>n;
    ll c;
    c=0;
    while(n--)
    {
        cin>>a>>b;
        
        if(a==b)
        c++;
        else
        {   if(c>=3)
             {
                 cout<<"Yes";
                 return 0;
             }
            c=0;
        }
    }
    
    //cout<<c<<"\n";
    if(c>=3)
    cout<<"Yes";
    else
    cout<<"No";
    
    return 0;
}


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

int main(){
    int a,b,k,count=0;
    cin >> a >> b >> k;
    if(a>b) swap(a,b);
    for(int i=a;i>0;i--){
        if(a%i==0){
            if(b%i==0) count++;
            if(count==k){
                cout << i << '\n';
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 20;
int n, m, x, y, q, d,z, w = 0, sum, ans = 0;
vector<int>a;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	string s, t, u; cin >> s >> t >> u;
	cout << s[0] << t[1] << u[2] << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define pb push_back
#define int long long 
#define pii pair<int,int>
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define ld long double
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
map<int,int> mp;
signed main(){
    fast;
    int n;
    cin>>n;
    for(int i = 2;i*i<=n;i++){
    	int cnt = 0;
    	while(n%i == 0){
    		cnt++;
    		n = n/i;
    	}
    	if(cnt>0)
    		mp[i]+=cnt;
    }
    if(n>1)
    	mp[n]++;
    int ans = 0;
    for(auto &x:mp){
    	int cnt = x.second;
    	int fac = x.first;
    	//cout<<fac<<" "<<cnt<<endl;
    	int sum = 0;
    	int curans = 0;
    	for(int i = 1;;i++){
    		if(sum + i <= cnt){
    			curans++;
    			sum+=i;
    		}
    		else break;
    	}
    	ans+=curans;
    }
    cout<<ans;
}

Measured memory_bytes: 3612
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FAST   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
   double n,m,d; cin>>n>>m>>d;
   double ans;
   if(d==0) ans=1/n;
   else ans=2.0*(n-d)/(n*n);
   ans*=(m-1);
   cout<<setprecision(15)<<ans;
} 
int main()
{   
   FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main() {
    int ans = 0;
    string line;
    while(cin >> line) {
        int v = 0;
        for(int i = 0; i < line.size(); ++i) {
            if(isdigit(line[i])) {
                v *= 10;
                v += line[i]-'0';
            }
            else {
                ans += v;
                v = 0;
            }
        }
        ans += v;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,l,bu;
  cin>>n>>m;
  vector<int>a,b,c;
  int x,y,z;
  while(cin>>x>>y>>z,x){
    a.push_back(x-1);
    b.push_back(y-1);
    c.push_back(z);
  }
  cin >> l;
  vector<int>d(m);
  for(int i=0;i<l;i++){
    vector<int>co(n);
    for(int j=0;j<m;j++){
      cin>>bu;
      d[j]=bu;
    }
    for(int j=0;j<a.size();j++)
      co[a[j]]+=d[b[j]]*c[j];
    for(int j=0;j<n;j++){
      cout << co[j] ;
      if(j+1!=n)
    cout<<' ';
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(ALL(a));
	int m = a[n-1];
	int l = a[0];
	for(int i = 1; i < n - 1; ++i) {
		if(abs((m + 1) / 2 - a[i]) < abs((m + 1) / 2 - l)) {
			l = a[i];
		}
	}
	cout << m << " " << l << endl;
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int N, int K, vector<int> v) {
  int ans = 0;
  for (int l = 0; l <= min(N, K); l++) {
    for (int r = 0; r <= min(N, K); r++) {
      if (l + r > min(N, K)) {
        continue;
      }
      int d = K - l - r;
      int cur = 0;
      vector<int> vv;
      for (int i = 0; i < l; i++) {
        cur += v[i];
        vv.emplace_back(v[i]);
      }
      for (int i = N - r; i < N; i++) {
        cur += v[i];
        vv.emplace_back(v[i]);
      }
      sort(vv.begin(), vv.end());
      for (int i = 0; i < d; i++) {
        if (i >= vv.size()) {
          break;
        }
        if (vv[i] < 0) {
          cur -= vv[i];
        }
      }
      ans = max(ans, cur);
    }
  }
  printf("%d\n", ans);
}

int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  solve(N, K, v);
  return 0;
}

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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define ll                      long long
#define read1(x)                 cin>>x
#define read2(x,y)               cin>>x>>y
#define print(x)				cout<<x<<endl
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define uset                    unordered_set
#define clr(a,b)                memset(a,b,sizeof a)
#define all(ds)                 ds.begin(), ds.end()
#define rev(ds)                 ds.rbegin(), ds.rend()
#define asc(A)                  sort(A.begin(), A.end())
#define dsc(A)                  sort(A.begin(), A.end(), greater<int>())
#define gcd(x,y)                __gcd(x,y)
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(int i=0; i<n;++i)
#define fr1(i, n)               for(int i=1; i<=n; ++i)
#define rfr(i, n)               for(int i=n-1; i>=0; --i)
#define printVector(v)          for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define precise(x)              cout<<fixed<<setprecision(x)
#define inf                     10000000000000

 

ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
ll power(ll x, ll y, ll m) { if(!y) return 1; ll p=power(x, y>>1, m)%m; p=p*p%m; return (y&1)?(x*p)%m:p;}
ll modInverse(ll a, ll m){ return power(a, m-2, m); }
bool isPrime(ll num){bool flag=true;for(ll i =2;i<=num/2;i++){if(num%i==0) {flag=false; break;} }return flag;}
ll sumofdigits(ll n){ll c=0;while(n>0){c++;n/=10;}return c;}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) {return a.first > b.first; }
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) {return a.second < b.second; }

//const double PI= 2*acos(0.0);
const long long MOD= 1000000007;



void solve(){
    int n; cin>>n;
    vector<int>v(n);
    ll sum = 0;
    fr(i, n){
    	cin>>v[i];
    	sum = (sum + v[i])%MOD;
    }
    ll ans = 0;
    fr(i,n-1){
    	sum = (sum-v[i]+MOD)%MOD;
    	ans = (ans + (sum*v[i])%MOD)%MOD;
    }
    print(ans);


}
int main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

    int t =1 ;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

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

int main() {
  int N, sum, sum1, k;
  cin >> N;
  vector<int> a(N);
  vector<int> b(201);
  for(int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  for(int i = -100; i <= 100; i++) {
    sum = 0;
    for(int j = 0; j < N; j++) {
      sum += (a.at(j)-i)*(a.at(j)-i);
    }
    b.at(k) = sum; 
    k++;
  }
  sort(b.begin(), b.end());
  cout << b.at(0) << endl;
}



Measured memory_bytes: 256
N = int(input())
h_list = list(map(int,input().split()))
dp = [[] for _ in range(N)]

dp[0] = 0
dp[1] = abs(h_list[1]-h_list[0])
for i in range(2,N):
  dp[i] = min(dp[i-2]+abs(h_list[i]-h_list[i-2]), dp[i-1]+abs(h_list[i]-h_list[i-1]))
print(dp[-1])

Measured memory_bytes: 14584
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int x = Integer.parseInt(sc.next());
    int y = Integer.parseInt(sc.next());
    out.println(min(k,n)*x+max(0,n-k)*y);
}}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  int n;cin >> n;
  vector<int> v(n);
  int sum =0;
  for(int i=0;i<n;++i){
    int t;cin >>t;
    sum += t;
    v[i] = sum;
  }
  int min_val=sum;
  for(int i=0;i<n;++i){
    min_val = min(min_val, abs(2*v[i]-sum));
  }
  cout << min_val << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int N, M;

class Edge{
public:
    int from, to, cost;
    Edge(int from = 0, int to = 0, int cost = 0) :
            from(from), to(to), cost(cost){}

    bool operator < (const Edge &e) const{
        return cost < e.cost;
    }
    bool operator >(const Edge &e) const{
        return cost > e.cost;
    }

};

class Node{
public:
    vector<Edge> edges;
    int sign;
    Node(){
        sign = 0;
    }
};

class Graph{
public:
    vector<Node> nodes;
    Graph(int n) {
        rep(i, n) { Node n;  nodes.push_back(n); }
    }
    Node& operator[](int i){
        return nodes[i];
    }
};

class Data{
public:
    int from, to, sign;
    Data(int from, int to, int sign) {
        this->from = from;
        this->to   = to;
        this->sign = sign;
    }
};

Graph G(0);

bool bfs(){

    queue<Data> q;
    q.push(Data(-1, 0, 1));

    rep(i, N) G[i].sign = 0;

    bool flg = false;

    while(!q.empty()){
        Data d = q.front(); q.pop();
        fprintf(stderr, "%d->%d %d\n", d.from, d.to, d.sign);
        Node &n = G[d.to];
        n.sign = d.sign;

        for(auto &ee : n.edges){
            int s = d.sign * -1;
            Node &nn = G[ee.to];
            if(nn.sign != 0 && nn.sign != s){
                flg = true;
                continue;
            }
            if(nn.sign != 0 && nn.sign == s) {
                continue;
            }
            if(nn.sign == 0){
                nn.sign = s;
                q.push(Data(ee.from, ee.to, s));
            }
        }
    }

    return flg;
}

int main() {

    // input
	cin >> N >> M;
    G = Graph(N);

	rep(i, M){
		int a, b;
        cin >> a >> b; a--; b--;
        G[a].edges.push_back(Edge(a, b, 0));
        G[b].edges.push_back(Edge(b, a, 0));
	}

    // run
    bool extra = bfs();

    if(extra){
        ll all = (ll)(N) * (ll)(N-1) / 2LL;
        ll ret = all - M;
        cout << ret << endl;
    }
    else{
        ll countP = 0;
        ll countM = 0;
        rep(i, N){
            if(G[i].sign == 1) countP++;
            if(G[i].sign == -1) countM++;
        }

        ll all = countP * countM;
        ll ret = all - M;
        cout << ret << endl;
    }

}


Measured memory_bytes: 8300
#include<cstdio>
#include<vector>
#include<cstring>
using i64=long long;
int n,flg=1,t[300007];std::vector<int>p[3];
int read(){int x;scanf("%d",&x);return x;}
void add(int p){while(p)++t[p],p^=p&-p;}
int ask(int p){int r=0;while(p<=n)r+=t[p],p+=p&-p;return r;}
i64 tao(std::vector<int>p){i64 r=0;memset(t,0,sizeof t);for(int x:p)r+=ask(x),add(x);return r;}
int main()
{
    n=read();
    for(int i=1,x;i<=n;++i) p[2].push_back(x=read()),p[i&1].push_back(x),flg&=!((i^x)&1);
    puts(flg&(tao(p[2])==3*(tao(p[0])+tao(p[1])))? "Yes":"No");
}


Measured memory_bytes: 7156
use proconio::{fastout, input};
use std::collections::BTreeSet;

#[fastout]
fn main() {
    input! {s1: String,s2: String};
    let s1 = s1;
    let s2 = s2;

    let mut count = 0;

    for i in 0..3 {
        if s1[i..i + 1] == s2[i..i + 1] {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 2192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
// __uint128_t

int main(){
    string S; cin >> S;
    for(int i = 0; i < S.size() ;i++){
        if(S[i] != '?') continue;
        if(i >= 1 && S[i-1] == 'P') S[i] = 'D';
        else if(i < S.size()-1 && S[i+1] == 'D' ) S[i] = 'P';
        else if(i < S.size()-1 && S[i+1] == '?'){
            S[i] = 'P', S[i+1] = 'D', i++;
        }
        else S[i] = 'D';
    }
    cout << S << endl;
}


Measured memory_bytes: 3748
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0

queue<ll> q;
ll info[maxn];
int id = 0;
void bfs()
{
    repd(i, 1, 9)
    q.push(i);
    ll temp;
    while (!q.empty())
    {
        temp = q.front();
        info[++id] = temp;
        if (id > 1e5)
            break;
        // printf("%lld\n", temp );
        q.pop();
        int x = temp % 10;
        repd(i, max(0, x - 1), min(9, x + 1))
        {
            q.push(temp * 10 + i);
        }
    }

}
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    bfs();
    int x = readint();
    printf("%lld\n", info[x] );
    return 0;
}




Measured memory_bytes: 2560
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 2)
b[1] = abs(a[0])
for i in range(2, n + 1):
    b[i] = b[i - 1] + abs(a[i - 2] - a[i - 1])
b[n + 1] = abs(0 - a[n - 1]) + b[n]
a = [0] + a + [0]
for i in range(n):
    print(b[n + 1] + abs(a[i] - a[i + 2]) - abs(b[i] - b[i + 2]))

Measured memory_bytes: 14172
def s2coeff(s)
  t = s.split(//)
  a = 0
  b = 0
  while t.length > 0
    a = a*10
    b = b*10
    x=t.shift
    if x=="X" then
      a += 1
    else
      b += x.to_i
    end
  end
   [a,b]
end

def goodNumberStr(x)
  x =~ /^0|[1-9X][0-9X]*$/
end

def goodNumber(x)
  x =~ /^[1-9][0-9]*$/
end

if true then
  fh=STDIN
else
  fh=open("in0110.txt")
end

reg = Regexp.new("[+=]")
while fh.gets do
  s=[]
  $_.chomp =~ /([0-9X]+)\+([0-9X]+)=([0-9X]+)/
  s[0]=$1
  s[1]=$2
  s[2]=$3
  if not goodNumberStr(s[0]) then
    puts "NA"
    next
  end
  if not goodNumberStr(s[1]) then
    puts "NA"
    next
  end
  if not goodNumberStr(s[2]) then
    puts "NA"
    next
  end

  a,b = s2coeff(s[0])
  c,d = s2coeff(s[1])
  e,f = s2coeff(s[2])

  if (a+c-e)==0 then
    puts "NA"
    next
  end
  y = (f-b-d)/(a+c-e)
  s0=s[0].gsub(/X/, y.to_s)
  s1=s[1].gsub(/X/, y.to_s)
  s2=s[2].gsub(/X/, y.to_s)
  if (f-b-d)%(a+c-e)==0 and goodNumberStr(s[0].gsub(/X/,y.to_s)) and goodNumberStr(s[1].gsub(/X/,y.to_s)) and goodNumberStr(s[2].gsub(/X/,y.to_s)) and s0.to_i.to_s==s0 and s1.to_i.to_s==s1 and s2.to_i.to_s==s2 then
    puts y
  else
    puts "NA"
  end
end

Measured memory_bytes: 8908
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n;
    cin>>n;
    vector<tuple<string,int,int>> v(n);
    string tmps;
    int tmpi;

    REP(i,n){
        cin>>tmps>>tmpi;
        v[i]=make_tuple(tmps,-tmpi,i+1);
    }
    sort(v.begin(),v.end());
    REP(i,n){
        cout<<get<2>(v[i])<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
a = [int(s) for s in input().split()]
N = a[0]
bks = a[1]
bd = a[2]

s = [input().split() for i in range(N)]
anslist = []
for i in range(2**N):
  templist = []
  for t in range(bks+1):
    templist.append(int(0))
  for j in range(N):
    if (i >> j) & 1 == 1:
      for k in range(bks + 1):
        templist[k] += int(s[j][k])
  anslist.append(templist)

ans = int(-1)
flag = int(0)
for i in range(2**N):
  flag = 0
  for j in range(1, bks+1):
    if anslist[i][j] < bd:
      flag = 1
      break
    else:
      pass
  if flag == 0:
      if anslist[i][0] < ans or ans == -1:
        ans = anslist[i][0]

print(ans)

Measured memory_bytes: 11176
from collections import namedtuple


Item = namedtuple('Item', 'w v')

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

items = []

for _ in range(N):
  w, v = map(int, input().split())
  items.append(Item(w, v))

memo = [0] * (W + 1)

for item in items:
  for w in range(W, item.w - 1, -1):
    memo[w] = max(memo[w], memo[w - item.w] + item.v)
    
print(memo[W])    

Measured memory_bytes: 43900
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])

def graphm():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(m):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append((w,b))
        g[b].append((w,a))
    return n,m,g

def warshall_floyd(): # d[i][j]: iからjへの最短距離
    h,w = map(int,input().split()) #n:頂点数　w:辺の数
    d = []
    for _ in range(10):
        d.append(inpl())
    n=10
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    a=[]
    for _ in range(h):
        a.append(inpl())
    pre = []
    for i in range(10):
        pre.append(d[i][1])
    check = defaultdict(int)
    for i in range(h):
        for j in range(w):
            if a[i][j]==-1:
                continue
            check[a[i][j]]+=1
    ans=0
    for i in range(10):
        ans += pre[i]*check[i]
    print(ans)

def main(): 
    warshall_floyd()

if __name__ == "__main__":
    main()

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

using namespace std;

int main(int argc, char *argv[]) {
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;

    int sum_ac = 0;
    char prev = 'Z';
    vector<int> sumarr;
    for (int j = 0; j < S.size(); j++) {
        if (prev == 'A' && S[j] == 'C') {
            sum_ac++;
        }
        sumarr.push_back(sum_ac);
        prev = S[j];
    }

    int l, r;
    for (int j = 0; j < Q; j++) {
        cin >> l >> r;
        cout << (sumarr[r - 1] - sumarr[l - 1]) << endl;
    }
    return 0;
}


Measured memory_bytes: 1528
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int get_id(char c){
	if(c>='a'&&c<='z')return c-'a';
	if(c>='A'&&c<='Z')return c-'A'+26;
	return c-'0'+52;
}
char rev(int x){
	if(x<26)return 'a'+x;
	if(x<52)return 'A'+x-26;
	return '0'+x-52;
}
int cnt[66],func[66],n,tot_ask;
string cmp="";
int dp[199][199];
int dist(string s){
	memset(dp,inf,sizeof dp);
	dp[0][0]=0;tot_ask++; 
	for(int i=0;i<=s.size();i++){
		for(int j=0;j<=cmp.size();j++){
			if(j)dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
			if(i)dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
			if(i&&j)dp[i][j]=min(dp[i][j],dp[i-1][j-1]+(s[i-1]!=cmp[j-1]));
		}
	}
	return dp[s.size()][cmp.size()];
}
int ask(string s){
	#ifdef LOCAL
		return dist(s);
	#endif
	cout<<"? "<<s<<endl;
	fflush(stdout);int x;cin>>x;return x;
}
int Get(string ret,string s,int pos,char c){
	int tot=ret.size()+1+s.size()-pos;
	string ss=ret+c+getstr(s,pos,s.size()-1);
	tot=ss.size();
	#ifdef LOCAL
		return dist(ss)==n-tot;
	#endif
	return n-tot==ask(ss);
}
string merge(string s1,string s2){
	int pos=0;
	string ret="";
	if(rand()&1)swap(s1,s2);
	for(int i=0;i<s1.size();i++){
		while(pos<s2.size()&&Get(ret,s2,pos,s1[i])==0)
		ret.push_back(s2[pos]),pos++;
		ret.push_back(s1[i]);
	}
	while(pos<s2.size())ret.push_back(s2[pos++]);
	return ret;
}
int main(){
	srand(time(0));
	for(int i=0;i<128;i++)cmp.push_back(rev(rand()%62));
	for(int i=0;i<62;i++){
		string s="";s.push_back(rev(i));
		for(int i=0;i<7;i++)s=s+s;
		int got=ask(s);
		cnt[i]=128-got;
	}
	for(int i=0;i<62;i++)n+=cnt[i];
	set<pair<int,string> >s;
	for(int i=0;i<62;i++){
		if(cnt[i]){
			string ins="";
			for(int j=0;j<cnt[i];j++)ins.push_back(rev(i));
			s.insert(make_pair(cnt[i],ins));
		}
	}
	while(s.size()>1){
		string s1=s.begin()->second;s.erase(s.begin());
		string s2=s.begin()->second;s.erase(s.begin());
		string s3=merge(s1,s2);
		s.insert(make_pair(s3.size(),s3));
	}
	cout<<"! "<<s.begin()->second<<endl;
	if(tot_ask>=855-128)assert(0);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 3784
#include <iostream>

using namespace std;

int main(void){
    int n,x;
    cin >> n >> x;
    int d = 0;
    int res = 1;
    for(int i=0;i<n;i++){
        int box;
        cin >> box;
        d += box;
        if(d <= x)res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
def solve():
    from sys import stdin
    f_i = stdin
    
    while True:
        s1A, s2A = map(int, f_i.readline().split())
        
        if s1A == 0 and s2A == 0:
            break
        
        sales = [(s1A + s2A, 'A')]
        for shop in 'BCDE':
            cnt = sum(map(int, f_i.readline().split()))
            sales.append((cnt, shop))
        
        cnt, shop = max(sales)
        
        print(f"{shop} {cnt}")

solve()


Measured memory_bytes: 5624
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll q;
  	ci(q);
  vll A(100100);
  vll B(100100);
  
  FOR(i,1,100100){
    bl b=true;
    FOR(j,2,sqrt(i)+1){
      
      if(i%j==0){
        b=false;
        break;
      }
      
    }
    
    if(b){
      B[i]++;
    }
    
  }
  
  B[2]=1;
  
  oFOR(i,3,100000){
    A[i]+=A[i-2];
    
    if(B[i]==1&&B[(i+1)/2]==1){
      A[i]++;
    }
    
  }
  
  FOR(i,0,q){
    ll l,r;
    	ci(l>>r);
    
    if(l==1){
      co(A[r])
    }
    
    else{
    co(A[r]-A[l-2])
    }
    
  }
  
}

Measured memory_bytes: 2176
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vv<ll> dp = vvec(N + 1, N * 1e3 + 1, LINF);
    dp[0][0] = 0;
    rep(i, N) rep(j, i * 1e3 + 1) {
        dp[i + 1][j + v[i]] = dp[i][j] + w[i];
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
    }

    for (int j = N * 1e3; j >= 0; --j) {
        if (dp[N][j] <= W) {
            write(j);
            return 0;
        }
    }
}

Measured memory_bytes: 80256
#include <iostream>
#include <map>
using namespace std;
long long a[200010],sum[200010] = {},x[200010];
map<long long,long long> mp;
int main(){
	long long i,n,k;
	cin >> n >> k;
	for(i=0;i<n;i++){
		cin >> a[i];
		sum[i + 1] = sum[i] + a[i];
	}
	for(i=0;i<=n;i++){
		x[i] = sum[i]%k - i;
	}
	long long ans = 0;
	for(i=0;i<=n;i++){
		long long y = x[i];
		if(i>=k) mp[x[i - k]]--;
		if(mp.find(y)!=mp.end()){
			ans += mp[y];
		}
		if(mp.find(y + k)!=mp.end()){
			ans += mp[y + k];
		}
		mp[y]++;
	}
	cout << ans << endl;
}

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

using namespace std;

int main(){
    string s;
    cin>>s;
    set<char> hoge;
    for(auto t:s) hoge.insert(t);
    if(hoge.size()==3) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

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


Measured memory_bytes: 3620
import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7
#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(2147483647)
#rstrip().decode('utf-8')
#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#map(int,input().split())


def main():
	r=int(input())
	print(r**2)
	



if __name__ == '__main__':
	main()

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#define M 1000000
int lub(int l,int r,int n,int *d){
  int m=(l+r)/2;
  if(l==r)return m;
  return n<=d[m]?lub(l,m,n,d):lub(m+1,r,n,d);
}
int main(){
  int n,m,d[100010],c=0,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&d[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%d",&i);
    if(d[lub(0,n-1,i,d)]==i)c++;
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 988
#include <cstdio>

int main(){
  int a,b,c;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);

  if(a == b){
    printf("%d",c);
  }else{
    if(b == c){
      printf("%d",a);
    }else{
      printf("%d",b);
    }
  }

  return 0;
}

Measured memory_bytes: 128
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    md = 10 ** 9 + 7
    n = II()
    cc = LI()
    cc.sort()
    exp2 = [1]
    for x in range(1, n + 1):
        exp2.append(exp2[-1] * 2 % md)
    #print(exp2)
    ans = 0
    for i, c in enumerate(cc):
        s = exp2[n - 1 - i]
        if n - i - 1 != 0: s += (n - 1 - i) * exp2[n - 2 - i]
        s *= exp2[i] * c
        ans = (ans + s) % md
    ans = ans * exp2[n] % md
    print(ans)

main()


Measured memory_bytes: 27116
#include <stdio.h>

int main(void)
{
	int a, b, c, d, e, q;
	int fu, ze;
	int card[5];
	int check[5];
	int straight[5] = {1, 10, 11, 12, 13};
	
	while (scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4]) != EOF) {
		for (a = 0; a < 5; a++) {
			fu = a;
			for (b = a + 1; b < 5; b++) {
				if (card[b] < card[fu]) {
					fu = b;
				}
			}
			ze = card[a];
			card[a] = card[fu];
			card[fu] = ze;
		}
		for (a = 0; a < 5; a++) {
			check[a] = 0;
		}
		d = 0;
		q = 0;
		if (card[0] == straight[0]) {
			q++;
		}
		for (a = 1; a < 5; a++) {
			if (card[a - 1] == (card[a] - 1)) {
				d++;
			}
			if (card[a] == straight[a]) {
				q++;
			}
		}
		for (a = 0; a < 5; a++) {
			c = 0;
			for (b = a + 1; b < 5; b++) {
				if (card[a] == card[b] && card[a] != -1 && card[b] != -1) {
					c++;			
					card[b] = -1;
				}
			}
			if (c == 1) {
				check[0]++;
			}
			else if (c == 2) {
				check[1]++;
			}
			else if (c == 3) {
				check[2]++;
			}
			card[a] = -1;
		}
		if (check[0] == 2) {
			printf("two pair\n");
		}
		
		else if (check[0] == 1) {
			if (check[1] == 1) {
				printf("full house\n");
			}
			else {
				printf("one pair\n");
			}
		}		
		else if (check[1] == 1) {
			printf("three card\n");
		}
		else if (check[2] == 1) {
			printf("four card\n");
		}
		else if (d == 4 || q == 5) {
			printf("straight\n");
		}
		else {
			printf("null\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 580
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        if (N == 3 || N == 5 || N == 7) Console.WriteLine("YES");
        else Console.WriteLine("NO");


    }
    
}




class Scanner
{
    string[] s;
    int i;

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

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

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

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

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

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

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


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



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

using namespace std;

typedef long long ll;

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

    ll m = sqrt(n);

    for (int i=m;i>=1;i--) {
        if (n%i == 0) {
            n=n/i;
            cout << (n-1) + (i-1) << endl;
            break;
        }
    }

    return 0;
}

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

int main() {
    //int a, b, c;
    string a, b;
    cin >> a;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] == 'B' && b.size() > 0) {
            b.pop_back();
        } 

        if (a[i] != 'B') {
            b.push_back(a[i]);
        }
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
    #include <iostream>
    #include <algorithm>
    #include <string>
    #include <map>
    #include <vector>
    #include <limits.h>
    const long long INF = LLONG_MAX / 2;
    #define FOR(i, r, n) for(int i=(r); i<(n); i++) 
    #define REP(i, n) FOR(i, (0), n)
    #define ll long long int
    template<typename T>
    void remove(std::vector<T>& vector, unsigned int index)
    {
    	vector.erase(vector.begin() + index);
    }
     
    using namespace std;
    ll ans = 0, sum = 0, n, k, t;
    string s;
     
    map<ll, ll> m;
     
    int main() {
    	cin >> n;
    	cout << n*(n + 1) / 2 << endl;
    }

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stdio.h>

using namespace std;
using ll = long long;
using ld = long double;
template <class T> using vec = std::vector<T>;
template <class T> using vvec = std::vector<std::vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int N; cin >> N;
    vec<int> H(N);
    REP(i, 0, N) cin >> H[i];

    bool r = true;
    for (int i = N - 1; i > 0; --i)
    {
        int sub = H[i] - H[i - 1];
        if (sub == -1) --H[i - 1];
        else if (sub <= -2)
        {
            r = false;
            break;
        }
    }

    cout << (r ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 640
#include <functional>
#include <queue>
#include <vector>
#include <iostream>
#include <cstdint>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
  	const int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;

	cin >> n;

	cout << a[n-1];
  
  	return 0;
}


Measured memory_bytes: 256
void main()
{
    string s = rdStr;

    if (s[0] == '>') s = '<' ~ s;
    if (s[$-1] == '<') s ~= '>';
    auto g = s.group.array;
    long result;
    for (long i = 0; i < g.length; i += 2)
    {
        long x = g[i][1], y = g[i+1][1];
        if (x < y)
        {
            result += x * (x - 1) / 2;
            result += y * (y + 1) / 2;
        }
        else
        {
            result += x * (x + 1) / 2;
            result += y * (y - 1) / 2;
        }
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4264
s = gets.to_s.chomp.split('')

flag = true
odd_group = ['R', 'U', 'D']
even_group = ['L', 'U', 'D']

s.each_with_index do |n, i|
  flag = odd_group.include?(n) if i.even?
  flag = even_group.include?(n) if i.odd?
  break if !flag
end

puts (flag) ? 'Yes' : 'No'



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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}


int main() {
  lint n; cin >> n;
  vector<lint> a(n); for(lint i=0;i<n;i++) { cin >> a[i]; }

  sort(a.begin(),a.end(),greater<lint>());

  vector<lint> lmax(2,0);
  for(lint i=1;i<n;i++) {
    if(a[i] == a[i-1]) {
      lmax.push_back(a[i]);
      i++;
    }
    if((int)lmax.size() >= 4) { break; }
  }

  sort(lmax.begin(),lmax.end(),greater<lint>());
  cout << lmax[0] * lmax[1] << endl;
  return 0;
}

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

int main(void) {
    int x, y;
    vector<int> a{1, 3, 5, 7, 8, 10, 12};
    vector<int> b{4, 6, 9, 11};
    cin >> x >> y;
    if (x == 2 || y == 2) {
        cout << "No";
        return 0;
    }
    if (count(a.begin(), a.end(), x) + count(a.begin(), a.end(), y) == 2) cout << "Yes";
    else if (count(b.begin(), b.end(), x) + count(b.begin(), b.end(), y) == 2) cout << "Yes";
    else cout << "No";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int a, b;

int main()
{
    cin>>a>>b;
    int ans = -INF;
    MAX(ans, a+b);
    MAX(ans, a-b);
    MAX(ans, a*b);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256