akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<numeric>
#include<functional>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 2e5;
int const MAXNN = 1<<18;

template<typename T, int MAXNN>
struct seg_tree {
  typedef std::function<T(T,T)> OP;
  T data_[MAXNN*2-1], e_;
  int NN;
  OP& op_;
  
  seg_tree(int N, OP& op, T e) : op_(op), e_(e) {
    NN = 1;
    while(NN < N) NN *= 2;
    std::fill_n(data_, NN*2-1, e);
  }
  void update(int k, T v) {
    k += NN-1;
    data_[k] = v;
    while(k > 0) {
      k = (k-1)/2;
      data_[k] = op_(data_[k*2+1], data_[k*2+2]);
    }
  }
  int query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return e_;
    if(a <= l && r <= b) return data_[k];
    int m = (l+r)/2;
    int vl = query(a, b, k*2+1, l, m);
    int vr = query(a, b, k*2+2, m, r);
    return op_(vl, vr);
  }
  int query(int a, int b){ return query(a, b, 0, 0, NN); }
};

uint64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int ix[MAXN+1];

int main() {
  int N = getZ();
  seg_tree<int64_t, MAXNN>::OP op = [](int64_t x, int64_t y){ return std::max(x, y); };
  seg_tree<int64_t, MAXNN> s(N, op, 0);
  for(int i = 0; i < N; ++i) s.update(i, getZ());
  int64_t ans = 0;
  std::iota(ix, ix+N+1, 0); // 0 ... N
  for(int i = 0; i < N; ++i) {
    int p = s.query(i, i+1);
    int il2 = -1, il1 = -1, ir1 = N, ir2 = N;
    // search left
    il1 = i - *std::partition_point(ix, ix+i+1, [&](int j){ return s.query(i-j, i) <= p; });
    // search right
    ir1 = i + *std::partition_point(ix, ix+N-i, [&](int j){ return s.query(i, i+j+1) <= p; });
    if(il1 >= 0) {
      il2 = il1 - *std::partition_point(ix, ix+il1+1, [&](int j){ return s.query(il1-j, il1) <= p; });
      ans += (int64_t)(il1 - il2)*(ir1 - i)*p;
    }
    if(ir1 < N) {
      ir2 = ir1 + *std::partition_point(ix, ix+N-ir1, [&](int j){ return s.query(ir1+1, ir1+j+1) <= p; });
      ans += (int64_t)(i - il1)*(ir2 - ir1)*p;
    }
  }
  fin(ans);
  return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fin(x) cout << x << endl;

using namespace std;
using ll = long long;

int main(void) {
  ll n;
  cin >> n;
  vector<ll> v(n);
  map<ll, ll> m;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    cin >> v[i];
    m[v[i]]++;
  }
  for (auto i = m.begin(); i != m.end(); i++) {
    ans += i->second * (i->second - 1) / 2;
  }
  for (ll i = 0; i < n; i++) {
    cout << ans - (m[v[i]] - 1) << endl;
  }
}

Measured memory_bytes: 11008
IDENTIFICATION DIVISION.
PROGRAM-ID. 101B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 N       PIC 9(10).
01 N-X     REDEFINES N.
   03  N-9 PIC 9(01) OCCURS 10.
01 S       PIC 9(02).
01 SHO     PIC 9(10).
01 R       PIC 9(02).   
01 I       PIC 9(02).
*>
PROCEDURE DIVISION.
  ACCEPT N.
*>      
  MOVE 0 TO S.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 10
    ADD N-9(I) TO S
  END-PERFORM.
*>
  DIVIDE N BY S GIVING SHO REMAINDER R.
  IF (R = 0) 
    DISPLAY 'Yes'
  ELSE
    DISPLAY 'No'
  END-IF. 
*>
  STOP RUN.


Measured memory_bytes: 384
#include<stdio.h>
main(){
  int n,i,j,c;
  float h[50];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%f",&h[i]);
  }
  for(i=1;i<=6;i++){
    c=0;
    printf("%d:",i);
    for(j=0;j<n;j++){
      if(i==1 && h[j]<165.0){
	c++;
      }
      else if(i==2 && h[j]>=165.0 && h[j]<170.0){
	c++;
      }
      else if(i==3 && h[j]>=170.0 && h[j]<175.0){
	c++;
      }
      else if(i==4 && h[j]>=175.0 && h[j]<180.0){
	c++;
      }
      else if(i==5 && h[j]>=180.0 && h[j]<185.0){
	c++;
      }
      else if(i==6 && h[j]>=185.0){
	c++;
      }
    }
    for(j=0;j<c;j++){
      printf("*");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, x;
  cin >> N >> x;

  vector<long> a(N);
  rep (i, N) cin >> a[i];

  vector<long> state = a;

  long ans = 0;
  rep (i, N) ans += state[i];

  for (long i = 1; i < N; i++) {
    rep(j, N) state[j] = min(state[j], a[(j-i+N)%N]);
    long tmp = 0;
    rep (j, N) tmp += state[j];
    tmp += i * x;
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
  	ll K;
    string S;
  	cin >> S >> K;
  	rep(i, K) {
        if(S[i] != '1') {
             cout << S[i] << endl;
             return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define PI 3.141592653589793
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

ll gcd(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) { //階乗
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) { //にぶたんgreater
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll wari=1LL;
	while(n/wari) {
		digit++;
		wari*=10;
	}
	return digit;
}

bool IsPrime(ll num) { //素数判定
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

vector<ll> Divisor(ll x) { // 約数列挙
	vector<ll> result;
	ll i=1LL;
	for( ; i*i<x; i++) {
		if(x%i) continue;
		result.push_back(i);
		result.push_back(x/i);
	}
	if(i*i==x&&x%i==0)
		result.push_back(i);
	
	sort(result.begin(),result.end());
	return result;
}

vector<llpair> PrimeFact(ll x) { // 素因数分解 {素因数,指数}
	vector<llpair> result;
	ll ex=0LL;
	if(x%2==0) {
		while(x%2==0) {
			x/=2;
			ex++;
		}
		result.push_back({2,ex});
	}

	for(ll i=3LL; i*i<=x; i+=2) {
		if(x%i) continue;

		ex=0LL;
		while(x%i==0) {
			x/=i;
			ex++;
		}
		result.push_back({i,ex});
	}

	if(x!=1) result.push_back({x,1});

	return result;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}

struct posi{
	int x;
	int y;
};

int main() {
	int K,T; cin>>K>>T;
	int A[T]; for(int i=0; i<T; i++) cin>>A[i];
	gsort(A,A+T);

	if(K-A[0]>=A[0]+1)
		cout<<0<<endl;
	else
		cout<<2*A[0]-K-1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
string s;
cin>>s;
int x=0,y=0,z=0;
if (s[0]=='A') x=1;
for (int i=2 ;i<=s.size()-2 ;i++){
    if(s[i]=='C')
        y++;
}
for (int i=0 ;i<s.size();i++){
    if(isupper(s[i])){
        z++;
    }
}
if(x==1 && y==1 && z==2) cout<<"AC";
else cout<<"WA";
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

using ll =  long long;

constexpr int K_MAX = 5000;

int k;
vector<ll> d(K_MAX);

void solve() {
    ll n, x, m;
    cin >> n >> x >> m;

    vector<ll> dd(d);
    for(int i=0;i<k;++i) {
        dd[i] %= m;
    }

    ll dd_cnt, x_sum = x % m, zero = 0;
    for(int i=0;i<k;++i) {
        dd_cnt = (n-1 - (i+1) + k) / k;
        if(dd[i]) {
            x_sum += dd[i] * dd_cnt;
        } else {
            zero += dd_cnt;
        }
    }

    cout << n - 1 - x_sum/m - zero << endl;
}

int main() {
    int q;
    cin >> k >> q;
    for(int i=0;i<k;++i) cin >> d[i];
    while(q--) {
        solve();
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> F(n, vector<int>(10));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F[i][j];
    }
  }

  vector<vector<int>> P(n, vector<int>(11));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 10; j++) {
      cin >> P[i][j];
    }
  }

  int mx = (INT_MAX / 2) * -1;
  for (int msk = 1; msk <= (1 << 10); msk++) {
    int cc = 0;
    bool r = false;
    for (int i = 0; i < n; i++) {
      int c = 0;
      for (int j = 0; j < 10; j++) {
        if ((msk & (1 << j)) && F[i][j]) {
          c++;
          r = true;
        }
      }
      cc += P[i][c];
    }
    if (r) mx = max(mx, cc);
  }
  cout << mx << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;
int main() {

    int k, x;
    cin >> k >> x;
    vector<int> ans;
    for (int i = 0; i < k * 2 - 1; i++) {
        if (x + i - k + 1 >= -1000000 && x + i - k + 1 <= 1000000) {
            ans.push_back(x + i - k + 1);
        }
    }
    for (int i = 0; i < ans.size(); i++) {

        cout << ans[i] << " ";
    }
    

    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

const int MAXN=6e5;
char S[MAXN];
int DP[MAXN][27];
int reach[MAXN];

vector<PII> queries[MAXN];
bool results[MAXN];
set<int> positions[MAXN];

int N;
int nextgood[MAXN][20];
void init() {
  for (int j = 1, shift = 1; j < 20; ++j, (shift <<= 1)) {
    REP(i,N+1) {
      if (nextgood[i][j-1] == -1) {
        nextgood[i][j] = -1;
        continue;
      }
      nextgood[i][j] = nextgood[nextgood[i][j-1]][j-1];
    }
  }
}

bool is_good(int L, int R) {
  FORD(j,20,0) {
    if (nextgood[L][j] != -1 && nextgood[L][j] <= R) {
      L = nextgood[L][j];
      // printf("%d %d->%d\n", L, R, DP[L][])
    }
  }
  return L == R;
}

int main() {
  scanf("%s", S);
  N = strlen(S);
  REP(i,N) S[i] -= 'a';

  REP(i,26) DP[N][i] = -1;
  DP[N][26] = N;

  reach[N] = N;
  FORD(i,N,0) {
    REP(j,27) DP[i][j] = -1;
    DP[i][S[i]] = i + 1;
    FOR(j,S[i]+1,27) {
      if (DP[i][j-1] == -1) break;
      DP[i][j] = DP[DP[i][j-1]][j-1];
    }
    if (DP[i][26] != -1) REP(j,26) if (DP[i][j] == -1) DP[i][j] = DP[DP[i][26]][j];
  }

  REP(i,N+1) nextgood[i][0] = DP[i][26];
  init();

  // REP(i,N+1) REP(j,20) {
  //   if (nextgood[i][j] != -1) printf("%d %d=%d\n", i, j, nextgood[i][j]);
  // }

  int Q;
  scanf("%d", &Q);
  REP(i,Q) {
    int l, r;
    scanf("%d%d", &l, &r);
    --l, --r;
    bool res = is_good(l, r+1);
    printf(res ? "Yes\n" : "No\n");
  }
}


Measured memory_bytes: 144128
#include <iostream>

using namespace std;

int main()
{
    int r, g , b;
    
    cin >> r >> g >> b;
    
    int rgb = (r*100) + (g*10) + b;
    
    if(rgb%4==0){
        cout<< "YES";
    }else{
        cout<<"NO";
    }

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from collections import Counter

def main(N,A):
    A = Counter(A)
    elements = set(A)
    ans = 0
    
    for i in elements:
        tmp = A[i]
        if(i+1 in elements):
            tmp += A[i+1]
        if(i+2 in elements):
            tmp += A[i+2]
        ans = max(ans, tmp)

    print(ans)

if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    main(N,A)

Measured memory_bytes: 15072
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



// -----------------------------------------------------------------------

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

// -----------------------------------------------------------------------



void solve(){
	
	map<int,int > mp;
	for(int i=0;i<3;++i)
	{
	    int t;
	    cin>>t;
	    mp[t]++;
	}
	cout<<sz(mp);
	
		
}


// -----------------------------------------------------------------------


int32_t main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


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

if X == 0:
    if K % 2 == 0:
        print(0)
    else:
        print(abs(D))
    exit(0)
X = abs(X)
if X > 0:
    k = X - K * D
    if k >= 0:
        print(k)
    else:
        kouho1 = X % D
        kouho2 = abs(kouho1 - D)
        sho = X // D
        if (K - sho) % 2 == 0:
            print(kouho1)
        else:
            print(kouho2)
    exit(0)
if X < 0:
    k = X + K * D
    if k <= 0:
        print(k)
    else:
        kouho1 = (-X) % D
        kouho2 = abs(kouho1 - D)
        sho = (-X) // D
        if (K - sho) % 2 == 0:
            print(kouho1)
        else:
            print(kouho2)
    exit(0)


Measured memory_bytes: 9152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main() {
  int N, A, B, result;
  int i;
  scanf ("%d %d", &A, &B);
  
  result = A-2*B;
  if (result<0) result=0;
  printf("%d", result);
  return 0;
}




Measured memory_bytes: 128
#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++)

int main() {
  int A,B;
  int flg=-1;
  cin>>A>>B;
  for(int i=0;i<1010;i++){
    if(floor(i*0.08)==A && floor(i*0.1)==B){flg=i;break;}
  }
  cout<<flg<<endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    int X = N;
    
    int S;
    while(N>0) {
        S += N%10;
        N /= 10;
    }
    cout << (X%S == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n,k,c;
  string s;
  cin >> n >> k >> c >> s;

  auto check = [&]() {
    vector<int> res(n, -1);
    int t = 0;
    int sz = 0;
    for (int i = 0; i < n && sz < k;) {
      if (s[i] != 'x') {
        res[i] = t;
        t += 1;
        i += c+1;
        sz += 1;
      } else {
        i ++;
      }
    }

    return res;
  };

  auto left = check();
  reverse(s.begin(), s.end());
  auto right = check();
  for (auto &itr : right) {
    if (itr != -1) itr = k - 1 - itr;
  }
  reverse(right.begin(), right.end());

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (left[i] != -1 && right[i] != -1 && left[i] == right[i]) {
      cout << i+1 << endl;
    }
  }
}

// 3回目に働く日は10日目以降


Measured memory_bytes: 3332
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p = 0;
    cin >> n;
    ll cnt[n+1]  = {0};
    for(i = 2; i <= n; i++){
        cin >> x;
        cnt[x]++;
    }
    for(i = 1; i <= n; i++){
        cout << cnt[i] << " ";
    }

    return 0;
}


Measured memory_bytes: 5156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int N1 = N%10;
            int N2 = (N%100)/10;
            int N3 = N/100;
          if(N1 ==7 || N2 ==7 || N3 == 7)
            Console.WriteLine("Yes");
          else
            Console.WriteLine("No");            
        }
    }
}

Measured memory_bytes: 27496
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
//~ #define MOD 1000000007
#define MOD 1000003
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

ll ppow(ll a,ll b){
	a%=MOD;
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
class Fact{
	vector<ll>fact;
	vector<ll>inv;
public:
	Fact(){}
	Fact(int n){
		n=n*2+10;
		fact=inv=vector<ll>(n);
		fact[0]=inv[0]=1;
		for(int i=1;i<n;i++){
			fact[i]=(fact[i-1]*i)%MOD;
			inv[i]=ppow(fact[i],MOD-2);
		}
	}
	ll get(int n){
		return fact[n];
	}
	ll nPr(int n,int r){
		return fact[n]*inv[n-r]%MOD;
	}
	ll nCr(int n,int r){
		return nPr(n,r)*inv[r]%MOD;
	}
	ll nrP(int n,int r){
		return nPr(n+r,n);
	}
	ll nrC(int n,int r){
		return nCr(n+r,n);
	}
};

// 負の数にも対応した mod
// 例えば -17 を 5 で割った余りは本当は 3 (-17 ≡ 3 (mod. 5))
// しかし単に -17 % 5 では -2 になってしまう
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 拡張 Euclid の互除法
// ap + bq = gcd(a, b) となる (p, q) を求め、d = gcd(a, b) をリターンします
long long extGcd(long long a, long long b, long long &p, long long &q) {  
    if (b == 0) { p = 1; q = 0; return a; }  
    long long d = extGcd(b, a%b, q, p);  
    q -= a/b * p;  
    return d;  
}

// 中国剰余定理
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
  long long p, q;
  long long d = extGcd(m1, m2, p, q); // p is inv of m1/d (mod. m2/d)
  if ((b2 - b1) % d != 0) return make_pair(0, -1);
  long long m = m1 * (m2/d); // lcm of (m1, m2)
  long long tmp = (b2 - b1) / d * p % (m2/d);
  long long r = mod(b1 + m1 * tmp, m);
  return make_pair(r, m);
}

int main(){
	Fact fac(1000000);
	int q;cin>>q;
	rep(i,q){
		ll x,d,n;scanf("%lld%lld%lld",&x,&d,&n);
		if(x==0){
			puts("0");
			continue;
		}
		if(d==0){
			printf("%lld\n",ppow(x,n));
			continue;
		}
		auto p=ChineseRem(x%d,d,0,MOD);
		ll a=(x-p.first+p.second-1)/p.second*p.second+p.first;
		if((a-x)/d<n){
			puts("0");
			continue;
		}
		ll ans=ppow(d,n)*fac.get((x*ppow(d,MOD-2)+n+MOD-1)%MOD)%MOD*ppow(fac.get((x*ppow(d,MOD-2)+MOD-1)%MOD),MOD-2)%MOD;
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 33664
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
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;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end

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

    int n;
    in >> n;
    double p[n];
    REP(i, n){
        in >> p[i];
    }
    double dp[n+1][n+1] = {};
    // i枚使ってj枚表が出る確率
    dp[0][0] = 1.0;
    REP_AB(i, 1, n){
        REP_AB(j, 0, i){
            if(j-1 >= 0){
                dp[i][j] = dp[i-1][j-1] * p[i-1] + dp[i-1][j] * (1.0 - p[i-1]);
            }else{
                dp[i][j] = dp[i-1][j] * (1.0 - p[i-1]);
            }
        }
    }
    double ans = 0.0;
    REP_AB(i, ceil(n / 2) + 1, n){
        ans += dp[n][i];
    }
    out << fixed << setprecision(11) << ans << endl;
}


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

int main() {
	string O, E;
	cin >> O;
	cin >> E;
	string S;
	size_t length = E.length();
	for (size_t i = 0; i < length; i++)
	{
		S.push_back(O[i]);
		S.push_back(E[i]);
	}
	if (O.length() - E.length() == 1)
	{
		S.push_back(O[O.length() - 1]);
	}
	cout << S;
	return 0;
}

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

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

    int a[n];
    for(int i = 0; i < n; i++)  cin >> a[i];

    int q;
    cin >> q;

    while(q-- > 0){
        int k;
        cin >> k;
        cout << lower_bound(a, a+n, k) - a << " " << upper_bound(a, a+n, k) - a << endl;
    }

    return 0;
}


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

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

    int n, h, w;
    cin >> n >> h >> w;

    cout << (n + 1 - h) * (n + 1 - w) << '\n';

    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main()
{
    int K;
    string S;
    cin >> K;
    cin >> S;
    if(S.length() <= K)
    {
        cout << S << endl;
    }
    else
    {
        cout << S.substr(0, K) << "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    ll N;
    cin >> N;

    vector<int> a(N + 1);
    for(int i = 1; i <= N; i++) cin >> a[i];


    vector<int> v(N + 1);
    for(int i = N; i >= 1; i--){
        if( i + i > N ){
            v[i] = a[i];
        }
        else{
            int sum = 0;
            for(int j = i + i; j <= N; j += i){
                sum += v[j];    
            }
            v[i] = (sum + a[i]) % 2;
        }
    }

    ll ans = 0;   
    for(int i = 1; i <= N; i++){
        if(v[i]) ans ++;
    }
    cout << ans << endl;

    if(ans > 0){
        bool f = false;
        for(int i = 1; i <= N; i++){
            if(v[i] && !f){
                cout << i ;
                f = true;
            }
            else if(v[i] && f){
                cout << " " << i;
            }
        }
            cout << endl;
    }


    /*
    for(int i = 1; i <= N; i++){
        v[i] = a[i];
        if(v[i]){
            for(int j = i + i; j <= N; j+=i ){
                a[j] = (a[i] + v[i]) % 2;
            }
        }
    }

    for(int i = 1; i <= N; i++){
        cout << v[i] << endl ;
    }
    */

}

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

int main() {
    int n; char s[10000 + 1];
    scanf("%d%s", &n, s);
    for (char *ch = &s[0]; *ch != '\0'; ++ch) {
        if (*ch + n > 'Z')putchar('A' + (n - ('Z' - *ch + 1)));
        else putchar(*ch + n);
    }
}


Measured memory_bytes: 128
N, K, C = map(int, input().split())
S = input()

if N == 1:
    print(1)
    exit()

before = [[0] * 2 for _ in range(N)]
if S[0] == 'o':
    before[0] = [1, C]
for i in range(1, N):
    before[i] = list(before[i-1])
    if S[i] == 'o' and i > before[i-1][1]:
        before[i][0] += 1
        before[i][1] = i + C

after = [0] * N
end = N
if S[-1] == 'o':
    after[-1] = 1
    end = N - 1 - C
for i in range(N-1)[::-1]:
    after[i] = after[i+1]
    if S[i] == 'o' and i < end:
        after[i] += 1
        end = i - C

if after[1] < K:
    print(1)
for i in range(1, N-1):
    d, s = before[i-1]
    if s < N:
        d += after[max(i+1, s)]
    if d < K:
        print(i + 1)
if before[-2][0] < K:
    print(N)


Measured memory_bytes: 85024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int a, b, i = 0, counter = 0;
  cin >> a >> b;
  
  i = a;
  
  while (i <= b) {
    
    int grade_10000, grade_1;
    
    grade_10000 = i / 10000;    
    grade_1 = (((i % 10000) % 1000) % 100) % 10;
    
    if (grade_10000 == grade_1) {
      
      int grade_1000, grade_10;
      
      grade_1000 = (i % 10000) / 1000;    
      grade_10 = (((i % 10000) % 1000) % 100) / 10;
      
      if (grade_1000 == grade_10) {
        counter++;
      }
    }
    
    i++;
  }
 
  cout << counter << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		if(str.endsWith("s"))
		{
			System.out.println(str + "es");
		}
		
		else 
		{
			System.out.println(str + "s");			
		}
		
		scan.close();

	}

}


Measured memory_bytes: 38548
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vll a(n);re(i, n) scanf("%lld", &a[i]);
  if(n==2){
    std::cout << a[1] << " " << a[0] << '\n';
    return 0;
  }
  vll ans(n, 0);

  for(ll i=0;i<=30;i++){
    vll tmp(n), ret(n, 0);
    for(int j=0;j<n;j++) tmp[j] = (a[j]>>i)&1;
    ret[0] = 0;

    for(int j=1;j<n;j++){
      if(ret[j-1]){
        if(tmp[j]==tmp[j-1]) ret[j] = 1;
        else ret[j] = 0;
      }else{
        if(tmp[j]==tmp[j-1]) ret[j] = 0;
        else ret[j] = 1;
      }
    }
    ll xo = 0;
    for(int j=1;j<n;j++) xo ^= ret[j];
    if(xo!=tmp[0]) re(j, n) ret[j]^=1;
    //re(j, n) std::cout << ret[j] << (j==n-1?"\n":" ");
    re(j, n) ans[j] += (ret[j]<<i);
  }
  re(i, n) std::cout << ans[i] << (i==n-1?"\n":" ");
  return 0;
}


Measured memory_bytes: 9160
N, A, B = gets.split.map(&:to_i)
S = gets.chomp

a = 0
b = 0

S.each_char do |c|
  if c == 'a' && a + b < A + B
    a += 1
    puts 'Yes'
  elsif c == 'b' && a + b < A + B && b < B
    b += 1
    puts 'Yes'
  else
    puts 'No'
  end
end


Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    string S;cin>>S;
    vector<string> T={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    int k=find(All(T),S)-T.begin();
    cout<<7-k<<endl;
}

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

int main() {
    int r, g, b, n; scanf("%d%d%d%d", &r, &g, &b, &n);
    int ans = 0;
    for (int i = 0; i * r <= n; ++i) {
        for (int j = 0; j * b + i * r <= n; ++j) {
            if ((n - j * b - i * r) % g == 0)
                ++ans;
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[200];
    for(int i=0; i<n; i++) cin>>arr[i];
    int count=0,flag=0;
    while(1)
    {
        for(int i=0; i<n; i++)
        {
            if(arr[i]%2==0)
            {
                arr[i]=arr[i]/2;

            }
            else
            {
                flag=1;
                break;
            }
        }
        if(flag==1) break;
        else count++;
    }
    cout<<count<<endl;
    return 0;

}


Measured memory_bytes: 256
(N, M) = gets.split(/ /).map(&:to_i)
obj = []
M.times do |r|
  (_p, _y) = gets.split(/ /).map(&:to_i)
  obj << {r: r, p: _p, y: _y}
end
obj.sort_by! do |o|
  [o[:p], o[:y]]
end
current = nil
c = 1
obj.each do |o|
  if current.nil?
    current = o[:p]
  end
  if current != o[:p]
    current = o[:p]
    c = 1
  end

  o[:code] = format('%06d%06d', current, c)
  c += 1
end
obj.sort_by! do |o|
  o[:r]
end
obj.each do |o|
  puts o[:code]
end



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

int main() {
  int N, K;
  int res = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x <= K - x) res += x * 2;
    else res += (K - x) * 2;
  }
  cout << res << endl;
}

Measured memory_bytes: 3536
/*-----------------------------------------------,
|  __                                       __   |
| |  |--.-----.---.-.----.----.-----.-----.|  |_ |
| |  _  |  -__|  _  |  __|  __|  -__|  _  ||   _||
| |_____|_____|___._|____|____|_____|   __||____||
|                                   |__|         |
`-----------------------------------------------*/
#include <cstdint>
#define DEBUG
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
typedef long long ll; using namespace std;
#define INF 1000000000000
#define MOD 10000007
#define REP(counter, limit) for (long long counter = 0; counter < limit; counter++)
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
struct setupios{setupios(){cin.tie(0);ios::sync_with_stdio(0); /*cout<<fixed<<setprecision(20);*/};}setupios;
int main() {

  int a,b,c;
  cin>>a>>b>>c;
  for(int i=1;i<a*b;i++){
    if((i*a)%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;

}


Measured memory_bytes: 256
#include <cstdio>
#define SIZE 244140625

int Hash(const char* c)
{
    int Hash = 0;
    while(*c){
        Hash *= 5;
        switch(*c){
        case 'A':
            Hash += 1; break;
        case 'C':
            Hash += 2; break;
        case 'G':
            Hash += 3; break;
        case 'T':
            Hash += 4; break;
        }
        ++c;
    }
    return Hash;
}
int main()
{
    bool* dic = new bool[SIZE];
    int n;
    std::scanf("%d", &n);
    char command[7];
    char str[13];
    for(int i = 0; i < n; ++i){
        std::scanf("%s %s", command, str);
        if(command[0] == 'i'){
            dic[Hash(str)] = true;
        }else{
            std::puts((dic[Hash(str)] ? "yes" : "no"));
        }
    }
    return 0;
 }

Measured memory_bytes: 11812
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > graph[105];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    
    int sum = ( n - 1 ) * ( n - 2 ) / 2;
    int res = 0;
    for( int i = 2; i <= n; ++i ) {
        graph[1].pb( i );
        ++res;
    }
    if( k > sum ) {
        cout << -1 << endl;
        return 0;

    }
    int pos = n;
    while( sum != k ) {
        for( int i = pos - 1; i >= 2 && sum != k; --i ) {
            graph[pos].pb( i );
            --sum;
            ++res;

        }
        --pos;
    }
    
    cout << res << endl;
    for( int i = 1; i <= n; ++i ) {
        for( int j = 0; j < graph[i].size(); ++j ) {
            cout << i << " " << graph[i][j] << endl;

        }
    }

    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  bool ans = false;
  rep(i,k)rep(j,k-i){
    int l = k-i-j;
    int red = a*pow(2,i);
    int green = b*pow(2,j);
    int blue = c*pow(2,l);
    if(green>red&&blue>green){
      ans=true;
      break;
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  ll k,n;
  cin>>k>>n;
  vector<ll> A(n),D(n);
  rep(i,n)cin>>A.at(i);
  rep(i,n){
    if(i==0)D.at(i)=k+A.at(0)-A.at(n-1);
    else D.at(i)=A.at(i)-A.at(i-1);
  }
  sort(D.begin(),D.end());
  cout<<k-D.at(n-1)<<endl;
  
  return 0;
}

Measured memory_bytes: 3328
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll INF = 1000000000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

typedef struct _Edge{
    int from;
    int to;
    ll cost;
}Edge;

int main(void){
    int N,M;
    cin >> N >> M;
    Edge edge[M];
    REP(i,M){cin >> edge[i].from >> edge[i].to >> edge[i].cost;
        edge[i].from--;
        edge[i].to--;
        edge[i].cost *= -1;
    }

    ll dist[N];
    for(int i=0; i<N; i++) dist[i] = INF;
    dist[0] = 0;

    for(int i=0; i<N-1; i++)
        for(int j=0; j<M; j++)
            chmin(dist[edge[j].to], dist[edge[j].from] + edge[j].cost);

    bool flag[N];
    REP(i,N) flag[i] = true;
    for(int i=0; i<N; i++)
        for(int j=0; j<M; j++){
            if(chmin(dist[edge[j].to], dist[edge[j].from] + edge[j].cost)) flag[edge[j].to] = false;
            if(flag[edge[j].from] == false) flag[edge[j].to] = false;
        }

    if(flag[N-1]) cout << -dist[N-1] << endl;
    else cout << "inf" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int a,b;cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
}

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

#define ll long long
#define ar array

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

    for(int i = 0; i < 1e4; ++i){
        int t = i * 8 / 100;
        int t2 = i * 10 / 100;
        if(t == a && t2 == b){
            cout << i << endl;
            a = -100;
            break;
        }
    }
    if(a != -100){
        cout << -1 << endl;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int testCases;
    testCases = 1;
    while(testCases --){
        solve();
    }
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n, m, a[100][100], b[100], ans = 0;

  cin >> n >> m;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      cin >> a[i][j];
    }
  }
  for(int i = 0; i < m; i++){
    cin >> b[i];
  }

  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      ans += a[i][j] * b[j];
    }
    cout << ans << endl;
    ans = 0;
  }

  return 0;
}



Measured memory_bytes: 3116
#include<iostream>
#include<string>
#include <sstream>
#include <stdio.h>
#include <cmath>
#include <cstdlib>
#include <algorithm> 
 #include <vector> 
using namespace std;
 
int main() {
    string s;
    cin >> s;
    s.erase(3);
    cout <<  s<<endl;
}


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

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 false;}return true;}

int main(){
    int N,K;
    cin >> N >> K;
    const long long INF = 1LL << 60;
    long long  h[100010];
    long long dp[100010];
    for(int i = 0;i<N;i++){cin >> h[i];dp[i] = INF;}

    dp[0]=0;
    for(int i=1;i<N;i++){
        for(int j=1; j<=i&&j<=K; j++){
            chmin(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout << dp[N-1] << endl;
}

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

int N,X,Y;
int dist[2222][2222];
vector<vector<int>> graph(2222);

void BFS(int s){
	queue<int> que;
	que.push(s);
	while(!que.empty()){
		int f=que.front();
		que.pop();
		for(auto t:graph[f]){
			if(dist[s][t]==-1){
				dist[s][t]=dist[s][f]+1;
				que.push(t);
			}
		}
	}
}

int main(){
	cin >> N >> X >> Y;
	X--;
	Y--;
	
	for(int i=0;i<N;i++){
		if(i>0)graph[i].push_back(i-1);
		if(i<N-1)graph[i].push_back(i+1);
		if(i==X)graph[i].push_back(Y);
		if(i==Y)graph[i].push_back(X);
	}
	
	for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		if(i==j)dist[i][j]=0;
		else dist[i][j]=-1;
	}
	for(int i=0;i<N;i++)BFS(i);
	
	vector<int> ans(N-1,0);
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)ans[dist[i][j]-1]++;
	for(int i=0;i<N-1;i++)cout << ans[i] << endl;
	return 0;
}

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


int main(){
	long long int  a,b;
  cin >> a >>b;
  
  vector<pair<long long,long long>> p(a);
  long long int c[100010],d[100010];
  
  for(int i=0;i<a;i++){
    cin >>c[i] >> d[i];
    p[i]=make_pair(c[i],d[i]);
  }
  
  sort(p.begin(),p.end());
  for(int i=0;i<a;i++){
    if(b<=p[i].second){
      
      cout <<p[i].first;
      break;
      
    }
    else{
      b -=p[i].second;
    }
  }
  return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  map<string,int> cnt;
  rep(i,n) {
    string s;
    cin >> s;
    cnt[s]++;
  }
  for (string s : {"AC", "WA", "TLE", "RE"}) {
    cout << s  << " x " << cnt[s] << endl;
  }
  return 0;
}

Measured memory_bytes: 3140
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,A,ans=0;cin>>N;
    for(int i=0;i<N;i++){
        cin>>A;
        while(A%2==0){
            A/=2;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>

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

int main(){
    int N;
    cin >> N;
    map<string, int> mp;
    
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        mp[s]++;
    }
    int max_vote=0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++){
        max_vote = max(itr->second, max_vote);
    }
    for(auto itr=mp.begin(); itr!=mp.end(); itr++){
        if(itr->second == max_vote){
            cout << itr->first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);


ll a,b,c;
vector<int>v;
cin>>a>>b>>c;
v.push_back(a);
v.push_back(b);
v.push_back(c);
ll cnt5=0,cnt7=0;
for(int i=0;i<v.size();i++)
{
	if(v[i]==5)
	{
		cnt5++;
	}
	else
	{
		cnt7++;
	}
}


if(cnt5==2 && cnt7==1) cout<<"YES"<<"\n";
else cout<<"NO"<<"\n";









	
	
	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}

Measured memory_bytes: 3040
#include <iostream>
#include <sstream>
#include <string>
#include <bitset>
#include <cstdio>
#include <map>

#define MAX_N 200005

typedef long long ll;

using namespace std;

int N;
string X;

map<ll, ll> memo;

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll solve(ll x) {
  if (memo.count(x) > 0) { return memo[x]; }

  int mod = 0;
  for (int i = 1; i < MAX_N; i = (i<<1)) {
    if (x & i) mod++;
  }
  if (mod == 0) {
    return memo[x] = 0;
  }

  return memo[x] = 1 + solve(x % mod);
}

int main() {
  cin >> N >> X;

  int mod = 0;
  for (int i = 0; i < N; i++) {
    char c = X[i];
    if (c == '1') { mod++; }
  }

  ll baseg = 0, basel = 0;
  for (int i = 0; i < N; i++) {
    char c = X[i];
    if (c == '1') {
      baseg = (baseg + modpow(2, N-1-i, mod+1)) % (mod+1);
      if (mod-1 != 0) {
        basel = (basel + modpow(2, N-1-i, mod-1)) % (mod-1);
      }
    }
  }

  for (int i = 0; i < N; i++) {
    ll next;
    if (X[i] == '1') {
      int m = mod - 1;

      if (m == 0) {
        printf("0\n");
      } else {
        next = (basel - modpow(2, N-1-i, m) + m) % m;
        printf("%lld\n", m == 0 ? 0 : (1+solve(next)));
      }
    } else {
      int m = mod + 1;
      next = (baseg + modpow(2, N-1-i, m)) % m;
      printf("%lld\n", m == 0 ? 0 : (1+solve(next)));
    }
  }
}


Measured memory_bytes: 5424