akhauriyash/Code-Regression huggingface dataset:
s=input()
n=len(s)
k=int(input())
if k==1:
  if n==1:
    print(0)
  else:
    i=1
    cnt=0
    while i<n:
      if s[i-1]==s[i]:
        cnt+=1
        i+=1
      i+=1
    print(cnt)
else:
  single=True
  for c in s:
    if c!=s[0]:
      single=False
      break
  if single:
    print(n*k//2)
  elif s[0]!=s[-1]:
    i=1
    cnt=0
    while i<n:
      if s[i-1]==s[i]:
        cnt+=1
        i+=1
      i+=1
    print(cnt*k)
  else:
    i=1
    while s[i]==s[0]:
      i+=1
    kk=i
    j=-1
    while s[j]==s[0]:
      j-=1
    num=i-j-1
    cnt=0
    i+=1
    while i<=n+j:
      if s[i-1]==s[i]:
        cnt+=1
        i+=1
      i+=1
    print(cnt*k+num//2*(k-1)+kk//2+(-j-1)//2)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define fi first
#define sd second
#define pow2(i) (1<<(i))

using namespace std;

const int maxn = 200200;
const int maxbit = 20;
const int inf = 1e9+7;

int odd[maxn],even[maxn],f2[maxn][maxbit+10],f1[maxn][maxbit+10],n,pos[maxn],n1,n2,l2[maxn];
priority_queue< pair<int, pair<int, int> > > heap;

int rmq_e(int x, int y) {
    int l = l2[y-x];
   // cout<<l<<" "<<x<<" "<<y<<" " <<f1[2][0]<<"lmao"<<endl;
    return min(f1[x][l],f1[y-pow2(l)+1][l]);
}

int rmq_o(int x, int y) {
    int l = l2[y-x];
  //  cout<<l<<" "<<x<<" "<<y<<"lmao"<<endl;
    return min(f2[x][l],f2[y-pow2(l)+1][l]);
}

void init() {
    int t=0;
    for (int i=1;i<=n;i++) {
        if (i%2==0) f1[i][0]=even[++t];
        else f1[i][0]=inf;
    }
    for (int k=1;k<=maxbit;k++) {
        for (int i=1;i<=n;i++) {
         //  cout<<i<<" "<<k<<" "<<f1[2][0]<<endl;
            f1[i][k] = f1[i][k-1];
            //cout<<i+pow2(k-1)<<endl;
            if (i+pow2(k-1) <= n) f1[i][k] = min(f1[i][k],f1[i+pow2(k-1)][k-1]);
        }
    }
   //  cout<<f1[2][0]<<endl;
     t=0;
    for (int i=1;i<=n;i++) {
        if (i%2==1) f2[i][0]=odd[++t];
        else f2[i][0]=inf;
      //  cout<<"fuck "<<f2[i][0]<<endl;
    }
    for (int k=1;k<=maxbit;k++) {
        for (int i=1;i<=n;i++) {
            f2[i][k] = f2[i][k-1];
            if (i+pow2(k-1) <= n) f2[i][k] = min(f2[i][k],f2[i+pow2(k-1)][k-1]);
        }
    }
}

int fin(int s,int t) {
    if (s>t) return -1;
    int x;
    if (s%2==1) x = rmq_o(s,t);
    else x = rmq_e(s,t);
    return x;
}

void add(int s,int t) {
    if (s>t) return;
    int x = fin(s,t);
    heap.push(make_pair(-x,make_pair(s,t)));
}

int main() {
  //  freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for (int i=2;i<=n;i++) l2[i]=(int) (log(i) / log(2) );
    for (int i=1;i<=n;i++) {
        int a;
        cin>>a;
        pos[a]=i;
        if (i%2==0) even[++n1]=a;
        else odd[++n2]=a;
    }
  // f2r (int i=1;i<=n1;i++) cout<<odd[i]<<endl;
    init();
    add(1,n);
   // cout<<fin(2,2)<<endl;
    for (int times=1;times<=n/2;times++) {
        int x = heap.top().fi;
        int l = heap.top().sd.fi;
        int r = heap.top().sd.sd;
        heap.pop();
       // cout<<"lol "<<x<<" "<<l<<" "<<r<<endl;
        int v1 = fin(l,r);
        int id1 = pos[v1];
        int v2 = fin(id1+1,r);
        int id2 = pos[v2];
        add(l,id1-1);
        add(id1+1,id2-1);
        add(id2+1,r);
        cout<<v1<<" "<<v2<<" ";
    }
}



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

const Int MOD=1e9+7; //<- alert!!!
typedef vector<Int> arr;
typedef vector<arr> mat;
inline arr mul(const mat &a,arr &b){
  arr res(a.size(),0);
  for(Int i=0;i<(Int)a.size();i++)
    for(Int j=0;j<(Int)a[i].size();j++)
      (res[i]+=a[i][j]*b[j])%=MOD;
  return res;
}
inline mat add(const mat &a,const mat &b){
  mat res(a.size(),arr(a[0].size(),0));
  for(Int i=0;i<(Int)a.size();i++)
    for(Int j=0;j<(Int)a[0].size();j++)
      res[i][j]=(a[i][j]+b[i][j])%MOD;
  return res;
}
inline mat mul(const mat &a,const mat &b){
  mat res(a.size(),arr(b[0].size(),0));
  for(Int i=0;i<(Int)a.size();i++)
    for(Int j=0;j<(Int)b[0].size();j++)
      for(Int k=0;k<(Int)b.size();k++)
	(res[i][j]+=a[i][k]*b[k][j])%=MOD;
  return res;
}
inline mat mat_pow(mat a,Int n){
  mat res(a);
  for(Int i=0;i<(Int)a.size();i++)
    for(Int j=0;j<(Int)a[i].size();j++)
      res[i][j]=(i==j);
  while(n){
    if(n&1) res=mul(a,res);
    a=mul(a,a);
    n>>=1;
  }
  return res;
}

//INSERT ABOVE HERE
signed main(){  
  
  mat B(3,arr(3,0));
  B[0][0]=4;B[1][0]=MOD-2;B[2][0]=1;
  B[0][1]=B[1][2]=1;
  
  mat R(3,arr(3,0));
  R[0][2]=1;R[1][2]=MOD-4;R[2][2]=2;
  R[1][0]=R[2][1]=1;
  
  mat A(3,arr(1)); 
  A[0][0]=1;A[1][0]=1;
  
  Int n,m;
  cin>>n>>m;
  
  vector<Int> d(m);
  for(Int i=0;i<m;i++) cin>>d[i];

  d.emplace(d.begin(),0);
  d.emplace_back(n);
  m++;
  
  mat x(1,arr(3,0)),y(1,arr(3,0));
  x[0][0]=1;
  x=mul(x,R);
  
  for(Int i=1;i<=m;i++){
    mat co=mat_pow(B,d[i]-d[i-1]);
    
    x=mul(x,co);
    y=mul(y,co);
    Int p=mul(y,A)[0][0],q=mul(x,A)[0][0];
    
    x=add(x,mul(mat(1,arr({p,0,0})),R));
    y=add(y,mul(mat(1,arr({q,0,0})),R));
    
    if(i==m) cout<<(q+MOD-p)%MOD<<endl;
  }
  return 0;
}


Measured memory_bytes: 1792
from statistics import mean
import itertools
import math

n = int(input())
pos = [list(map(float,input().split())) for i in range(n)]

pos_comb = itertools.combinations(pos,2)
dis_list = []
for i in pos_comb:
    dis_list.append(math.sqrt((i[0][0]-i[1][0])**2+(i[0][1]-i[1][1])**2))

print(mean(dis_list)*(float(n)-1.0))

Measured memory_bytes: 6148
k=int(input())
a=list(map(int,input().split()))
a.reverse()
ans1=2
ans2=2
for i in range(k):
	m,M=ans1,ans2
	ans1=((m-1)//a[i]+1)*a[i]
	ans2=M//a[i]*a[i]

	if ans1>ans2:
		print(-1)
		exit()

	ans1=ans1//a[i]*a[i]
	ans2=ans2//a[i]*a[i]+(a[i]-1)

if ans1>ans2:
	print(-1)
	exit()
else:
	print(ans1,ans2)

Measured memory_bytes: 14252
#include<iostream>
using namespace std;
int b[100005];
int main(void)
{
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        int t;
        cin >> t;
        b[t]=i;
    }
    for(int i=1;i<=n;i++)
        cout << b[i] << ' ';
    return 0;
}


Measured memory_bytes: 1152
s = raw_input()
n = len(s)
k1 = s[:(n-1)/2]
k2 = k1[::-1]
l1 = s[((n+3)/2)-1:]
l2 = l1[::-1]
if s == s[::-1] and k1 == k2 and l1 == l2:
    print 'Yes'
else:
    print 'No'

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize ("trapv")
using namespace std;

#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define DEBUG 1
#define cerr if (DEBUG) cerr
#define test cerr << "hi\n";

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) uniform_int_distribution<long long>(l, r)(rng)
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;

#define INF 0x3f3f3f3f3f3f3f3f
#define MAXN 300005
//#define MOD 998244353LL
#define MOD 1000000007LL

int p[MAXN];
int n, q;

int get(int x) {
    if (x == p[x]) return x;
    return p[x] = get(p[x]);
}

void join(int x, int y) {
    x = get(x), y = get(y);
    p[x] = y;
}

void solve() {
    cin >> n >> q;
    iota(p+1, p+1+n, 1);
    while (q--) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            join(u, v);
        }
        if (t == 1) {
            cout << (get(u) == get(v)) << '\n';
        }
    }
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    auto start_time = clock();
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
//    cin >> t;
    for (int no = 1; no <= t; no++) {
//        cout << "Case #" << no << ": ";
        solve();
    }

#ifdef LOCAL
    cerr << "TIME ELAPSED: " << double(clock() - start_time) / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<climits>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s;
    for (int i = 0; i < s.size(); i += 2) {
        t += s[i];
    }
    cout << t << endl;
}




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

using namespace std;

#ifdef KACTL
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
#endif
#define all(x) begin(x), end(x)

using ll = int64_t;
using ld = long double;
using pii = pair<int32_t, int32_t>;
using vi = vector<int32_t>;

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

    int s, w;
    cin >> s >> w;
    if (w >= s) {
        cout << "unsafe\n";
    } else {
        cout << "safe\n";
    }

    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)
const int N = 1e5 + 1;
int sz[N] , p[N] , cc;

void init(){
   iota(p , p + N , 0); // 0 1 2 3 .. N
   fill(sz , sz + N , 1);
}

int f(int u){
   return p[u] = (p[u] == u ? u : f(p[u]));
}

bool unite(int u , int v){
   u = f(u);
   v = f(v);

   if(u == v)return false;
   cc--;
   if(sz[v] < sz[u])swap(u , v);

   p[u] = v;
   sz[v] += sz[u];
   return true;
}

int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   int n , q;
   long long m;
   cin >> n >> m >> q;
   cc = n;
   vector<pair<int , int> > zero , one;
   for(int i = 0 ; i < q  ; ++i){
      int u , v , c;
      cin >> u >> v >> c;
      if(c){
         one.emplace_back(u , v);
      }
      else{
         zero.emplace_back(u , v);
      }
   }
   init();
   for(auto e : zero){
      int u = e.first , v = e.second;
      if(unite(u , v))m--;
   }
   vector<int> pr(n , -1);
   for(int i = 0 ; i < n ; ++i)
      pr[i] = f(i);
   bool need = false;
   for(auto e : one){
      int u = pr[e.first] , v = pr[e.second];
      if(u == v || cc <= 2){
         cout << "No\n";
         return 0;
      }
      need = true;
   }
   if(!need){     // bug is here you have to check there is no extra edges
      long long canAdd = 1ll * cc * (cc - 1) / 2;
      cout << ((m >= (cc - 1) && m <= canAdd) ? "Yes" : "No") << "\n";
      return 0;
   }
   set<pair<int , int> > s;
   for(int i = 0 ; i < n ; ++i){
      int theone = pr[i];
      s.insert({theone , sz[theone]});
   }
   m -= ((int)s.size());
   long long rem = 1ll * cc * (cc - 1) / 2;
   rem -= (int)s.size();
   cout << ((m < 0 || m > rem) ? "No\n" : "Yes\n");
}

Measured memory_bytes: 6900
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
//#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846 
vector< int > v[N];
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGE
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
   int  n,k,c;
   cin>>n>>k>>c;
   string s;
   cin>>s;
   int  arr[n+2];
   int  brr[n+2];
   arr[0]=0;
   for(int i=1;i<=n;i++)
   {
      if(s[i-1]=='o')
      {
        arr[i]=arr[i-1]+1;
        int j;
        for(j=i+1;j<min(i+1+c,n+2);j++)
          arr[j]=arr[i];
        i=j-1;
      }
      else
        arr[i]=arr[i-1];
   }
   brr[n+1]=0;
   for(int i=n;i>=1;i--)
   {
    // if(i==1)
    //   cout<<s[i]<<'\n';
    if(s[i-1]=='o')
    {
      brr[i]=brr[i+1]+1;
      int j;
      // cout<<i<<'\n';
      // cout<<i-1-c<<'\n';
      for(j=i-1;j>max(0,i-1-c);j--)
        brr[j]=brr[i];
      // cout<<j<<'\n';
      i=j+1;
    }
    else
      brr[i]=brr[i+1];
   }
  //  for(int i=1;i<=n;i++)
  //   cout<<arr[i]<<' ';
  // cout<<'\n';
  // for(int i=1;i<=n;i++)
  //   cout<<brr[i]<<' ';
   for(int i=1;i<=n;i++)
   {
    if(s[i-1]=='o' and arr[i-1]+brr[i+1]<k)
      cout<<i<<'\n';


   }
} 

Measured memory_bytes: 26900
#include <bits/stdc++.h>
 #include <math.h>
using namespace std;
#define ll long long
#define pi 3.14159265359

int main(){
 int n;
  cin>>n;
  vector<int>l(n);
  for(int i=0;i<n;i++)cin>>l[i];
  sort(l.begin(),l.end());
   vector<int>::iterator iter_lower, iter_upper;
    ll idx_lower, idx_upper;
      ll ans=0;
  
  for(int i=1;i<n;i++){
    for(int j=0;j<i;j++){
      int key_MAX=l[i]+l[j];
      int key_MIN=l[i]-l[j];
        //lower_bound(以上)
        iter_lower = lower_bound(l.begin(), l.end(), key_MAX);
        idx_lower = distance(l.begin(), iter_lower);
        //cout<<idx_lower<<" ";

        // upper_bound(より大きい)
        iter_upper = upper_bound(l.begin(), l.end(), key_MIN);
        idx_upper = distance(l.begin(), iter_upper);
        //cout<<idx_upper<<" ";
        ans+=idx_lower-idx_upper;
        ans--;
        if(key_MIN<l[j])ans--;
      //cout<<ans<<endl;
    }
  }
  cout<<ans/3<<endl;
}
      
      
      
  

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int jud(int x){
    int c=0;
    while(x){
        x/=10;
        c++;
    }
    return c;
}
int main(void){
    int a, b;
    while(cin>>a>>b){
        cout<<jud(a+b)<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int64_t> L(N+1);
  if(N>=2){
    L.at(0)=2;
    L.at(1)=1;
  for(int i=0;i<N-1;i++){
    L.at(i+2)=L.at(i+1)+L.at(i);
  }
  cout<<L.at(N);
  }
  if(N==0){
    cout<<2;
  }
  if(N==1){
    cout<<1;
  }
}

Measured memory_bytes: 256
def get_args():
    N, M = map(int, input().split())
    A, B = [], []

    for _ in range(M):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)

    # print(N, M)
    # print(A, B)

    return N, M, A, B


class Graph:
    def __init__(self, vertex_size):
        self.VERTEX_SIZE = vertex_size
        self.adjacency = [set() for i in range(self.VERTEX_SIZE)]

    def add_edge(self, a_i, b_i):
        self.adjacency[a_i].add(b_i)
        self.adjacency[b_i].add(a_i)

    def get_adj(self, i):
        return self.adjacency[i]

    def vertexes_size(self):
        return self.VERTEX_SIZE

    def edges_size(self):
        raise NotImplemented()


def solve(N, M, A, B):
    g = Graph(8 + 2)

    for i in range(M):
        g.add_edge(A[i], B[i])

    marked = [False for _ in range(N + 1)]

    def dfs(i):
        marked[i] = True

        c = 0
        if marked.count(True) == N:
            c += 1

        for a in g.get_adj(i):
            if not marked[a]:
                c += dfs(a)

        marked[i] = False
        return c

    res = dfs(1)
    return res


if __name__ == '__main__':
    res = solve(*get_args())
    print(res)


Measured memory_bytes: 42332
#include<stdio.h>

int main (){
  char a,b,c,i;
  char ans[3];
  char temp[3];
    
  scanf("%c %c %c",&a,&b,&c);
  	
  if(a == '1'){
  	ans[i] = '9';
   }else{
     ans[i] = '1';
   }
  	i++;
  if(b == '1'){
  	ans[i] = '9';
   }else{
     ans[i] = '1';
   }
  i++;
  if(c == '1'){
  	ans[i] = '9';
   }else{
     ans[i] = '1';
   }
  	
  	
  
    for(int j = 0;j < 3;j++){
      printf("%c",ans[j]);
    }
    
        return 0;
  
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
    return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void func(long long N, long long M)
{
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
}

int main()
{
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    func(N, M);
    return 0;
}


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

#define M 1046527

vector<string> hash_table(M);



string searchKey(vector<string> dict, string key){
    string ans = "no";
    for(int i = 0; i < dict.size(); i++){
        if(dict.at(i) == key){
            ans = "yes";
            return ans;
        }
    }
    return ans;
}

int string2int(string x){
    int sum = 0;
    int p = 1;
    for(int i = x.size()-1; i >= 0; i--){
        sum += p * x.at(i) % M;
        p *= 5;
    }
    return sum;
}

int h1(int key){
    return key % M;
}

int h2(int key){
    return 1 + (key % (M - 1));
}

int hash_func(string key, int i){
    int key_int = string2int(key);
    return(h1(key_int) + i * h2(key_int)) % M;
}

void insert(string key){
    int i = 0;
    while(true){
        int j;
        j = hash_func(key, i);
        if(hash_table.at(j).size() == 0){
            hash_table.at(j) = key;
            return;
        }else if(hash_table.at(j) == key){
            return;
        }else{
            i++;
        }
    }
}

int find(string key){
    int i = 0;
    while(true){
        int j;
        j = hash_func(key, i);

        if(hash_table.at(j) == key){
            return 1;
        }else if(hash_table.at(j).size() == 0){
            return 0;
        }
        i++;
    }
}

int main(){
    int n; cin >> n;
    vector<string> dict;
    vector<int> ans;

    for(int i = 0; i < n; i++){
        string command; 
        string key;
        cin >> command >> key;
        
        if(command == "insert"){
            insert(key);

        }else if(command == "find"){
            ans.push_back(find(key));
        }
    }

    // for(int i = 0; i < dict.size(); i++){
    //     cout << dict.at(i) << endl;
    // }
    rep(i, ans.size()){
        if(ans.at(i) == 0){
            cout << "no" << endl;

        }else{
            cout << "yes" << endl;
        }
    }
}


Measured memory_bytes: 28720
#include<iostream>

using namespace std;

int main()
{
	for(int n;cin>>n,n;){
		int cnt=0;
		for(int a=1;a<n;a++)for(int b=a+1;b<n;b++){
			if((b*(b+1)-(a-1)*a)/2==n)	cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 864
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    vector<int>b;
    REP(i,n)cin >> a[i];
    if(n%2==0){
        REP(i,n){
            if(i%2){
                b.insert(b.begin(),a[i]);
            }
            else {   
                b.push_back(a[i]);
            }
        }
    }else{
        REP(i,n){
            if(i%2==0){
                b.insert(b.begin(),a[i]);
            }
            else {   
                b.push_back(a[i]);
            }
        }
    }
    REP(i,n){
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <cmath>
#include <string> 
#include <cstdint>
#include <cstring>
#include <queue> 
#include <climits>
#include <unordered_map>
#include <algorithm>    // std::sort
//https://qiita.com/ofutonfuton/items/92b1a6f4a7775f00b6ae
 
using namespace std;
typedef long long ll;
std::unordered_map<ll, std::vector<pair<pair<ll,ll>,ll> > > connection;
ll N, M;
int result = 0;

int main()
{
    ll N, x;
    cin >> N >> x;
    ll* a = new ll[N];
    for(ll i = 0; i < N; i ++){
        cin >> a[i];
    }
    sort(a, a+N);


    ll result = 0;
    for(ll i = 0; i < N; i ++){
        if(i == N - 1){
            if(x == a[i]){
                result ++;
            }
        }
       else if(x >= a[i]){
           x -= a[i];
           result ++;
       }
    }
    cout << result;

    return 0;
}

Measured memory_bytes: 256
N, M, Q = map(int, input().split())
dp = [[0] * N for _ in range(N)]
for _ in range(M):
    l, r = map(int, input().split())
    dp[r-1][l-1] += 1

for i in range(1,N):
    for j in range(N-i):
        l, r = j, j+i
        dp[r][l] += dp[r-1][l] + dp[r][l+1] - dp[r-1][l+1]


for _ in range(Q):
    p, q = map(int, input().split())
    print(dp[q-1][p-1])


Measured memory_bytes: 58968
#include<stdio.h>

int main(void)
{
	int x,y;
	scanf("%d %d", &x, &y);
	int A[7] = { 1,3,5,7,8,10,12 };
	int B[4] = { 4,6,9,11 };
	int largex=0;
	int largey=0;

	if (x == y)
	{
		printf("Yes\n");
	}
	else
	{
		for (int i = 0;i < 7;i++)
		{
			if(A[i]==x)largex = 1;
			if(A[i] == y)largey = 1;
		}
		for (int j = 0;j < 4;j++)
		{
			if (B[j] == x)largex = 2;
			if (B[j] == y)largey = 2;
		}
		if (largex == largey)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}

	return 0;
}


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

int main() {
	std::string str = "CODEFESTIVAL2016";
	std::string in; cin >> in;
	int count = 0;
	for(int i = 0; i < in.size(); i++) {
		if(in[i] != str[i]) count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vpair R(n);
    rep(i, n) cin >> R[i].fi >> R[i].se;
    sort(all(R));

    int ans = 1;
    int l, r;
    l = R[0].fi - R[0].se;
    r = R[0].fi + R[0].se;
    srep(i, 1, n) {
        int li = R[i].fi - R[i].se;
        int ri = R[i].fi + R[i].se;
        if (ri < r) {
            r = ri;
        }
        else if (li >= r) {
            l = li;
            r = ri;
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define list_input(x, n) x[n]; rep(i,n){ cin >> x[i];}
#define ll long long

int main(){
  int a, b;
  cin >> a >> b;
  if (b >= a) {
    cout << a << '\n';
  }else{
    cout << a-1 << '\n';
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

int n, q;
int A[2000];
int M[2000];

bool solve(int i, int sum, int M_j)
{
	if(i == n) return sum == M_j;

	if(sum == M_j) return true;

	if(sum > M_j) return false;

	// A[i]を利用しない場合
	if(solve(i + 1, sum, M_j)) return true;
	// A[i]を利用する場合
	if(solve(i + 1, sum + A[i], M_j)) return true;

	return false;
}

int main()
{
	cin >> n;
	REP(i, n)
		cin >> A[i];

	cin >> q;
	REP(i, q)
		cin >> M[i];


	REP(i, q) {

		if(solve(0, 0, M[i]))
			cout << "yes";
		else
			cout << "no";

		cout << endl;

	}

		return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
  int N, K;
  cin >> N >> K;
  int ans= 0;
  vector<int> A(N);
    
  for(int i=0; i<K; i++){
    int X = 0;
    cin >> X;
    vector<int> D(X);
    for(int j=0; j<X; j++){
      cin >> D.at(j);
    }
    for(int j=0; j<X; j++){
      A.at(D.at(j)-1) = 1;
    }
  }
  for(int i=0; i<N; i++){
    if(A.at(i) == 0){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int n,L,a[210];
int main(){
	n=gi();L=gi();int Sum=0;
	for(int i=1;i<=n;i++)a[i]=L+i-1,Sum+=a[i];
	int Min=1e9+10,ans;
	for(int i=1;i<=n;i++){
		int sum=0;
		for(int j=1;j<=n;j++)if(i!=j)sum+=a[j];
		
		if(abs(Sum-sum)<Min){Min=abs(Sum-sum);ans=sum;}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

x = I()
q,r = x//11,x % 11
ans = 2*q
if 1 <= r <= 6:
    ans += 1
elif r >= 7:
    ans += 2
print(ans)


Measured memory_bytes: 78816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count =0;
		for (int i=1;i<N;i++) {
			for (int j =1;i*j<N;j++) {
				count ++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 35612
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

const int n_day[] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
const string name[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

int main() {
  int m, d;
  while(cin >> m >> d && (m|d)) {
    pair<int,int> end(m,d), date(1,1);
    int e = 4;
    while(date != end) {
      e = (e+1)%7;
      if(date.second == n_day[date.first]) {
	++date.first;
	date.second = 1;
      } else {
	++date.second;
      }
    }
    cout << name[e] << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

struct mint {
    const int mod = 1e9 + 7;
    long long x;
    
    mint (long long x = 0) : x((x % mod + mod) % mod) {
        
    }
    
    mint& operator=(const long long a) {
        x = a % mod;
        return *this;
    }
    
    mint& operator=(const mint a) {
        x = a.x % mod;
        return *this;
    }
    
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    
    mint& operator-=(const mint a) {
        if ((x += (mod - a.x)) >= mod) x -= mod;
        return *this;
    }
    
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    
    mint inv() const {
        return pow(mod - 2);
    }
    
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n, m;
    cin >> n >> m;
    vector<int> s(n + 1), t(m + 1);
    rep(i, n) cin >> s[i];
    rep(i, m) cin >> t[i];
    vector<vector<mint>> dp(n + 1, vector<mint>(m + 1, 0));
    s[n] = -1; t[m] = -2;
    rep(i, n + 1) dp[i][0] = 1;
    rep(i, m + 1) dp[0][i] = 1;
    reps(i, 1, n + 1) {
        reps(ii, 1, m + 1) {
            dp[i][ii] = dp[i - 1][ii] + dp[i][ii - 1] - dp[i - 1][ii - 1];
            if (s[i - 1] == t[ii - 1]) dp[i][ii] += dp[i - 1][ii - 1];
        }
    }
    cout << dp[n][m].x << endl;
    return 0;
}


Measured memory_bytes: 62976
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var t = int.Parse(Console.ReadLine());
            for (var i = 0; i < t; i++)
            {
                var nabcd = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
                var n = nabcd[0];
                var a = nabcd[1];
                var b = nabcd[2];
                var c = nabcd[3];
                var d = nabcd[4];

                var memo = new Dictionary<long, long>();
                memo[0] = 0;
                memo[1] = d;
                long Dfs(long x)
                {
                    if (memo.ContainsKey(x)) return memo[x];
                    var l2 = (x / 2) * 2;
                    var r2 = ((x + 1) / 2) * 2;
                    var l3 = (x / 3) * 3;
                    var r3 = ((x + 2) / 3) * 3;
                    var l5 = (x / 5) * 5;
                    var r5 = ((x + 4) / 5) * 5;
                    var tmp = (long)Math.Pow(10, 18);
                    if (x < tmp / d) tmp = x * d;
                    tmp = Math.Min(tmp, Math.Abs(l2 - x) * d + a + Dfs(l2 / 2));
                    tmp = Math.Min(tmp, Math.Abs(r2 - x) * d + a + Dfs(r2 / 2));
                    tmp = Math.Min(tmp, Math.Abs(l3 - x) * d + b + Dfs(l3 / 3));
                    tmp = Math.Min(tmp, Math.Abs(r3 - x) * d + b + Dfs(r3 / 3));
                    tmp = Math.Min(tmp, Math.Abs(l5 - x) * d + c + Dfs(l5 / 5));
                    tmp = Math.Min(tmp, Math.Abs(r5 - x) * d + c + Dfs(r5 / 5));
                    return memo[x] = tmp;
                }
                Console.WriteLine(Dfs(n));
            }
        }
    }
}


Measured memory_bytes: 32984
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (int)(n); i++)

int main(){
  int x;
  cin >> x;
  if(x<1200){
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define pp pop_back()
#define mp make_pair
#define fr first
#define sc second
#define sz size()
#define smin(x,y) ((x)=min((x),(y)))
#define smax(x,y) ((x)=max((x),(y)))
#define all(x) x.begin(),x.end()
#define CS ios_base::sync_with_stdio(false);
#define show(x) cerr << #x << " is " << x <<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi; 
int32_t main()
{
	string s; cin>>s;
	int x=-1,y;
	for(int i=0;i<s.sz;i++){
		if(s[i]=='A' && x==-1) x=i;
		if(s[i]=='Z') y=i;
	}
	cout<<y-x+1<<endl;
	return 0;
}


Measured memory_bytes: 640
import sys
# from functools import lru_cache, cmp_to_key
# from heapq import merge, heapify, heappop, heappush
# from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
# from itertools import combinations as comb, permutations as perm
# from bisect import bisect_left as bl, bisect_right as br, bisect
# from time import perf_counter
# from fractions import Fraction
# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n = int(data())
arr = l()
arr.sort()
p = 1
m = 10 ** 18
for i in arr:
    p *= i
    if p > m:
        p = -1
        break
out(p)


Measured memory_bytes: 91372
#include<bits/stdc++.h>
#define MAX_N 1005
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
int par[MAX_N];
int rank[MAX_N];

void init(int n){
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
}

int find(int x){
  if(par[x]==x)return x;
  return par[x]=find(par[x]);
}

void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y)return;
  if(rank[x]<rank[y])par[x]=y;
  else{
    par[y]=x;
    if(rank[x]==rank[y])rank[x]++;
  }
}

bool same(int x,int y){
  return find(x)==find(y);
}

vector<P1> G;

double solve(){
  sort(G.begin(),G.end());
  vector<int> ans;
  for(int i=0;i<G.size();i++){
    int cost=G[i].first;
    int x=G[i].second.first;
    int y=G[i].second.second;
    if(same(x,y))continue;
    unite(x,y);
    ans.push_back(cost);
  }
  return ans[ans.size()/2];
}

int main(){
  int n,m,s,t,c;
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    G.clear();
    for(int i =0;i<m;i++){
      cin>>s>>t>>c;
      s--,t--;
      G.push_back(P1(c,P(s,t)));
    }
    init(n);
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
int n,k;
string s;
int main()
{
  scanf("%d%d",&n,&k);
  cin>>s;
  //cout<<int('a')<<' '<<int('A')<<endl;
  //cout<<s<<endl; 
  s[k-1]+=32;
  cout<<s<<endl;
  
  return 0;
}

Measured memory_bytes: 256
adjacent = (
    (1, 3),       # 0
    (0, 2, 4),    # 1
    (1, 5),       # 2
    (0, 4, 6),    # 3
    (1, 3, 5, 7), # 4
    (2, 4, 8),    # 5
    (3, 7),       # 6
    (4, 6, 8),    # 7
    (5, 7)        # 8
)

GOAL = [1, 2, 3, 4, 5, 6, 7, 8, 0]

# Bidirectional search using breadth-first search
def solve(start):
    if start == GOAL:
        return 0
    # 0: forward, 1: backward
    generated_state = {tuple(start): 0, tuple(GOAL): 1}
    step = {tuple(start): 0, tuple(GOAL): 0}
    s = 0
    state1 = [(start, 0), (GOAL, 1)]
    while state1:
        state2 = state1[:]
        state1 = []
        s += 1
        for s2, d in state2:
            i = s2.index(0)
            for p in adjacent[i]:
                s1 = s2[:]
                s1[i], s1[p] = s1[p], 0
                key = tuple(s1)
                if key in generated_state:
                    if generated_state[key] != d:
                        return s + step[key]
                    continue
                state1.append((s1, d))
                generated_state[key] = d
                step[key] = s

import sys

start = list(map(int, sys.stdin.read().split()))

print(solve(start))

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

int main() {
  ll n,m;
  cin >> n >> m;
  vector<ll> a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  vector<pll> c(m);
  for(ll i=0;i<m;i++) {
    ll b,p;
    cin >> b >> p;
    c[i]=pll(p,b);
  }
  sort(c.rbegin(),c.rend());
  ll count=0;
  ll temp=0;
  for(ll i=0;i<n;i++) {
    if(a[i]>=c[count].first) {
      break;
    }
    else {
      a[i]=c[count].first;
      temp++;
    }
    if(c[count].second==temp) {
      temp=0;
      count++;
    }
    if(count>=m) {
      break;
    }
  }

  ll ans=0;
  for(ll i=0;i<n;i++) {
    ans+=a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i)
#define mod 1e9 + 7
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　　　 　 _... ..._
	　　　　　 , ´⌒ ⌒ヽ
	　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
	　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
	　　　　　　△ﾑ,8ﾑﾌつ
	　　　　　/(ﾝ_/＿ヽ＼
	　　　　 ～～i_ﾌ_ﾌ～´
	*/
int a,b;
  cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
	return 0;

}
 


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

int main(){
    int H,W;
    
    while(1){
        cin >> H >> W ;
        if(H==0 && W==0)break;
       
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            if(h==0 || h==H-1){cout << "#" ;}
            else if(w==0 || w==W-1){cout << "#";}
            else {cout << "." ;}
       
    }
        cout << endl;
    }   cout << endl;
        
        }
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int main(){
  string s;
  vector<char> out;
  cin >> s;
  
  rep(i,s.length()){
    char c = s[i];
    if(c=='B'){
      if(!out.empty()) out.pop_back();
    }else{
      out.push_back(c);
    }
  }
  
  for(auto x : out){
    cout << x;
  }
  
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

repeat = [0] * (n+1)
circle = [1]
point = 1
flag = 0
for _ in range(k):
    circle.append(a[point])
    repeat[point] = 1
    point = a[point]
    if(repeat[point] == 1):
        flag = 1
        break

if flag == 0:
    print(circle[-1])
else:
    index = circle.index(point)
    circle_cut = circle[index:-1]
    k = (k-index) % len(circle_cut)
    print(circle_cut[k])


Measured memory_bytes: 32380
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] data = new int[3];
        for(int i=0; i<3; i++) {
            data[i] = scanner.nextInt();
        }

        if(data[2] >= data[0]) {
            if(data[2] <= data[1]) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } else {
            System.out.println("No");
        }
    }
}


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

typedef long long ll;
typedef vector<ll> vi;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

#define rep(i,a,b) for(ll i = a; i<b;i++)
#define per(i,a,b) for(ll i = a; i>=b; i--)
#define inf LLONG_MAX
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define trav(a,x) for(auto &a: x)
#define mp(x,y) make_pair(x,y)

int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL); cout.tie(NULL);
  cout << setprecision(15) << fixed;
  ll h,w; cin >> h >> w;
  ll grid[h][w];
  string s;
  rep(i,0,h) {
    cin >> s;
    rep(j,0,w) {
      if (s[j] == '.') grid[i][j] = 0;
      else grid[i][j] = 1;
    }
  }
  ll dp[h][w];
  rep(i,0,h) rep(j,0,w) dp[i][j] = inf;
  if (grid[0][0]) dp[0][0] = 1;
  else dp[0][0] = 0;
  rep(i,0,h) rep(j,0,w){
    if (i == 0 && j == 0) continue;
    ll ans = inf/2;
    if (grid[i][j] == 0 && i != 0) ans = min(dp[i-1][j], ans);
    if (grid[i][j] == 0 && j != 0) ans = min(dp[i][j-1], ans);
    if (grid[i][j] == 1 && i != 0 && grid[i-1][j] == 1) ans = min(dp[i-1][j], ans);
    if (grid[i][j] == 1 && j != 0 && grid[i][j-1] == 1) ans = min(dp[i][j-1], ans);
    if (grid[i][j] == 1 && i != 0 && grid[i-1][j] == 0) ans = min(dp[i-1][j]+1, ans);
    if (grid[i][j] == 1 && j != 0 && grid[i][j-1] == 0) ans = min(dp[i][j-1]+1, ans);
    dp[i][j] = ans;
  }
  cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N,K,Q;
	int A[100010]={};
	int point[100010]={};

	cin >> N >> K >> Q;
	for(int i=0;i<Q;i++)
	{
		cin >> A[i];
		A[i]--;
	}

	for(int i=0;i<Q;i++)
		point[A[i]]++;
	
	for(int i=0;i<N;i++)
	{
		if(point[i]+K-Q>0)
			cout << "Yes";
		else
			cout << "No";
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 1408
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k,l,r = LI()
    a = LI()
    n1 = n>>1
    n2 = n-n1
    s1 = [[] for i in range(n1+1)]
    s2 = [[] for i in range(n2+1)]
    for b in range(1<<n1):
        s = 0
        j = 0
        for i in range(n1):
            if not b&(1<<i):
                continue
            s += a[i]
            j += 1
        s1[j].append(s)

    for b in range(1<<n2):
        s = 0
        j = 0
        for i in range(n2):
            if not b&(1<<i):
                continue
            s += a[i+n1]
            j += 1
        s2[j].append(s)
    for i in range(n2+1):
        s2[i].sort()
    ans = 0
    for i in range(n1+1):
        if i > k:
            break
        j = k-i
        if j > n2:
            continue
        for s in s1[i]:
            a,b = bisect.bisect_left(s2[j],l-s),bisect.bisect_right(s2[j],r-s)
            ans += b-a
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 106712
var n : int64;
    i : int64;
    ct,ans,j : longint;
begin
    readln(n);
    i := 2;
    ans := 0;
    while i * i <= n do begin
        if n mod i = 0 then begin
            ct := 0;
            while n mod i = 0 do begin
                n := n div i;
                inc(ct);
            end;
            j := 1;
            while j <= ct do begin
                ct := ct - j;
                inc(j);
                inc(ans);
            end;
        end;
        inc(i);
    end;
    if n <> 1 then inc(ans);
    writeln(ans);
end.


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

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   if(n >= 30)
      cout << "Yes";
   else
      cout << "No";
   return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>

int main() {
	int n; std::cin >> n;
	std::vector<int> time(n - 1);
	for (auto& t : time) std::cin >> t;
	std::vector<std::vector<int>> memo(2, std::vector<int>(n + 1, INT_MAX));
	memo[0][n / 2 + 1] = 0;
	for (auto i = 0; i < time.size(); ++i) {
		memo[(i + 1) % 2][0] = INT_MAX;
		for (auto j = 1; j < memo[i % 2].size(); ++j) {
			if (memo[i % 2][j] != INT_MAX) {
				memo[(i + 1) % 2][n - j + 1] = memo[i % 2][j] + time[i];
			}
			else {
				memo[(i + 1) % 2][n - j] = INT_MAX;
			}
		}
		for (auto j = 1; j < memo[i % 2].size(); ++j) {
			if (memo[(i + 1) % 2][j] > memo[i % 2][j - 1]) {
				memo[(i + 1) % 2][j] = memo[i % 2][j - 1];
			}
		}
	}
	std::cout << memo[1][n / 2] << std::endl;
}





Measured memory_bytes: 3276
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt

    def candies(n: Int): Int = {
      @tailrec
      def inner(acc: Int, n: Int): Int = {
        if (n == 0) {
          acc
        } else {
          inner(acc + n , n - 1)
        }
      }
      inner(0, n)
    }

    out.println(candies(n))

    out.flush()
  }
}


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

int main() {
  
  int N;
  cin >> N;
  
  int n1 = N / 1000;
  int n2 = N / 100 % 10;
  int n3 = N / 10 % 10;
  int n4 = N % 10;
  
  if (n1 == n2 && n2 == n3) {
    cout << "Yes" << endl;
  }
  
  else if (n2 == n3 && n3 == n4) {
    cout << "Yes" << endl;
  }
  
  else cout << "No" << endl;
  
}  

Measured memory_bytes: 3648