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

using LL = long long;

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

    LL N;
    cin >> N;
    int A, B, C, D;
    A = N / 1000;
    B = (N % 1000) / 100;
    C = ((N % 1000) % 100) / 10;
    D = ((N % 1000) % 100) % 10;

    if(A+B+C+D == 7){
        cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
        return 0;
    }
    if(A-B+C+D == 7){
        cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
        return 0;
    }
    if(A+B-C+D == 7){
        cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
        return 0;
    }
    if(A+B+C-D == 7){
        cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
        return 0;
    }
    if(A-B-C+D == 7){
        cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;
        return 0;
    }
    if(A+B-C-D == 7){
        cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
        return 0;
    }
    if(A-B+C-D == 7){
        cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
        return 0;
    }
    if(A-B-C-D == 7){
        cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
        return 0;
    }

    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a := iScan()
	b := iScan()
	c := iScan()
	ans := "NO"
	for i := 1; i <= 10000; i++ {
		if (a*i)%b == c {
			ans = "YES"
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1776
#include <cstdio>
#include <algorithm>
using namespace std;

int n;
int x, y, h, w;

int size(int a){
  if(a<=60)
    return 600;
  else if(a<=80)
    return 800;
  else if(a<=100)
    return 1000;
  else if(a<=120)
    return 1200;
  else if(a<=140)
    return 1400;
  else if(a<=160)
    return 1600;
  else
    return 0;
}

int weight(int b){
  if(b<=2)
    return 600;
  else if(b<=5)
    return 800;
  else if(b<=10)
    return 1000;
  else if(b<=15)
    return 1200;
  else if(b<=20)
    return 1400;
  else if(b<=25)
    return 1600;
  else
    return 0;
}

int fee(int sz, int wt){
  if(size(sz)==0 || weight(wt)==0)
    return 0;
  else
    return max(size(sz), weight(wt));
}

void solve(){
  int f=0;
  for(int i=1; i<=n; ++i){
    scanf("%d %d %d %d", &x, &y, &h, &w);
    int s=x+y+h;
    f+=fee(s, w);
  }
  printf("%d\n", f);
}

int main(){
  while(scanf("%d", &n) && n!=0){
    solve();
  }
}

Measured memory_bytes: 1028
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
signed main(void)
{
	int h,n;
	reg int x;
	cin>>h>>n;
	for(int i=1;i<=n;++i)
	{
		read(x);
		h-=x;
	}
	if(h>0)
		puts("No");
	else
		puts("Yes");
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int n;
int main(){
	while(cin>>n){
		int sum=0;
		if(n<=10000){
			for(int i=2;i<=n;i++){
				for(int j=2;j<=sqrt(i);j++){
					if(i%j==0){
						goto loopa;
					}
				}
				sum++;
				loopa:;
			}
			cout<<sum<<endl;
		}
		else if(n<=900000){
			for(int i=10001;i<=n;i++){
				for(int j=2;j<=sqrt(i);j++){
					if(i%j==0){
						goto loopb;
					}
				}
				sum++;
				loopb:;
			}
			cout<<sum+1229<<endl;
		}
		else{
			for(int i=900001;i<=n;i++){
				for(int j=2;j<=sqrt(i);j++){
					if(i%j==0){
						goto loopc;
					}
				}
				sum++;
				loopc:;
			}
			cout<<sum+71274<<endl;
		}
	}
	return 0;
}


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

int main() {
  int a,i,N,K;
  cin >> N >> K;
  i = 0;
  a = 1;
  
  while(i<N){
    if(a+K < 2*a){
    a += K;
    }
    else{
    a *= 2;
    }
    i++;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    map<int, int> m;
    FOR(i, 0, n) {
        int a; cin >> a;
        m[a] ^= 1;
    }
    int ans = 0;
    each(i, m)ans += i.second;
    cout << ans << "\n";
}

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

ll gcd(ll a, ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(){
  ll a, b;
  cin >> a >> b;
  cout << (a/gcd(a,b))*(b/gcd(a,b))*gcd(a,b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    bool ans = false;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            if (n == i * j) {
                ans = true;
                break;
            }
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a,b,c,n=0;
	scanf("%d%d%d",&a,&b,&c);
	if(b<a)
	{
		a=a+b;
		b=a-b;
		a=a-b;
	}
	for(int i=1;i<=c;i++)
	{
		if(c%i==0&&c/i>=a&&c/i<=b)
		n++;
	}
	printf("%d\n",n);
	return 0;
}


Measured memory_bytes: 2076
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    t = input().rstrip()

    for i in range(len(s)):
        s = s[-1] + s[:-1]
        if s==t:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
def resolve():
    K, S = map(int, input().split())
    count = 0
    for x in range(K + 1):
        for y in range(K + 1):
            if S - K <= x + y <= S and max(x, y) <= K:
                count += 1
    print(count)


if __name__ == "__main__":
    resolve()

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

//#include "rubo.h"
//#define mp make_pair
//#define pb push_back
#define in int
#define ll long long
#define vc vector
#define SQ(j) (j)*(j)
//#define x first
//#define y second

//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

#define db(x) cout << #x << " = " << x << endl
#define dbCont(x) cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout << endl;

typedef long double ld;

using namespace std;


const int N = 1000+5;


int n,m;

char x[N][N];
int dp[N][N];


int main() {

    cin >> n >> m;
    loop(i,n){
        scanf("%s", x[i]);
    }

    dp[0][0] = 1;
    for(int i = 0 ; i< n; i++){
        for(int j = 0; j < m; j++){
            if(x[i][j] == '#') continue;
            if(i-1 >= 0) dp[i][j] += dp[i-1][j];
            if(j-1 >= 0) dp[i][j] += dp[i][j-1];


            dp[i][j] %= 1000*1000*1000+7;
        }
    }
    cout<< dp[n-1][m-1] << endl;

    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
 
using namespace std;
string temp = "01+-*()=";
 
int A(string&, int&);
 
int B(string&, int&);
 
int C(string&, int&);
 
int C(string& S, int& idx)
{
  int ret = 0;
  if(isdigit(S[idx])) {
    if(isdigit(S[idx + 1]) && S[idx] == '0') throw (0);
    while(isdigit(S[idx])) ret = ret * 2 + S[idx++] - '0';
  } else if(S[idx] == '(') {
    ret = A(S, ++idx);
    if(S[idx] != ')') throw (0);
    ++idx;
  } else if(S[idx] == '-') {
    ret = -C(S, ++idx);
  } else {
    throw (0);
  }
  return (ret);
}
 
int B(string& S, int& idx)
{
  int ret = C(S, idx);
  while(S[idx] == '*') {
    ret *= C(S, ++idx);
  }
  return (ret);
}
 
int A(string& S, int& idx)
{
  int ret = B(S, idx);
  while(S[idx] == '+' || S[idx] == '-') {
    if(S[idx] == '+') ret += B(S, ++idx);
    else ret -= B(S, ++idx);
  }
  return (ret);
}
 
int main()
{
  string S;
  int conv[32];
  memset(conv, -1, sizeof(conv));
 
  cin >> S;
 
  vector< char > num;
  for(char& c : S) {
    if(isalpha(c)) num.push_back(c);
  }
  sort(begin(num), end(num));
  num.erase(unique(begin(num), end(num)), end(num));
  for(int i = 0; i < S.size(); i++) {
    if(isalpha(S[i])) conv[i] = lower_bound(begin(num), end(num), S[i]) - begin(num);
  }
 
  if(num.size() > temp.size()) {
    cout << 0 << endl;
    return (0);
  }
  sort(begin(temp), end(temp));
 
  vector< string > ss;
  do {
    string T = S;
    for(int i = 0; i < S.size(); i++) {
      if(~conv[i]) T[i] = temp[conv[i]];
    }
    if(count(begin(T), end(T), '=') == 1 && T.front() != '=' && T.back() != '=') {
      ss.push_back(T);
    }
  } while(next_permutation(begin(temp), end(temp)));
  sort(begin(ss), end(ss));
  ss.erase(unique(begin(ss), end(ss)), end(ss));
 
  int ret = 0;
  for(string& al : ss) {
    string L = "", R = "";
    bool which = false;
    for(int i = 0; i < al.size(); i++) {
      if(al[i] == '=') {
        which = true;
        continue;
      }
      (which ? R : L) += al[i];
    }
    R += "$";
    L += "$";
    int idx;
 
 
    try {
      int ll = A(L, idx = 0);
      if(idx + 1 != L.size()) continue;
      int rr = A(R, idx = 0);
      if(idx + 1 != R.size()) continue;
      ret += ll == rr;
    } catch(int e) {}
  }
  cout << ret << endl;
}

Measured memory_bytes: 5796
#!/usr/bin/env python
# -*- coding: utf-8 -*-

D, N = map(lambda x: int(x), input().split())
if N != 100:
    if D != 0:
        print(100**D * N)
    else:
        print(N)
elif N == 100:
    if D != 0:
        print(100 ** D * (N + 1))
    else:
        print(N + 1)


Measured memory_bytes: 2940
H, W = map(int, input().split())
sh, sw = map(int, input().split())
gh, gw = map(int, input().split())

sh += 1
sw += 1
gh += 1
gw += 1

S = [0]*(H+4)
S[0] = '*'*(W+4)
S[1] = '*'*(W+4)
S[-2] = '*'*(W+4)
S[-1] = '*'*(W+4)
for h in range(2,H+2):
  S[h] = '**' + input() + '**'

visited = [[float('inf')]*(W+4) for _ in range(H+4)]
dh1 = [0,1,0,-1]
dw1 = [1,0,-1,0]
dh2 = [2,2,2,2,2,1,1,1,1,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-2]
dw2 = [-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2]

from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
d = []
heapify(d)
heappush(d,(0,sh,sw))
ans = float('inf')
while len(d)>0:
  cnt,h,w = heappop(d)
  if cnt>=ans:
    break
  visited[h][w] = cnt
  for i in range(4):
    h1 = h+dh1[i]
    w1 = w+dw1[i]
    if (h1,w1)==(gh,gw):
      ans = cnt
    if S[h1][w1]=='.':
      if visited[h1][w1]>cnt:
        visited[h1][w1]=cnt
        heappush(d,(cnt,h1,w1))
  for i in range(20):
    h2 = h+dh2[i]
    w2 = w+dw2[i]
    if (h2,w2)==(gh,gw):
      ans = cnt+1
    if S[h2][w2]=='.':
      if visited[h2][w2]>cnt+1:
        visited[h2][w2]=cnt+1
        heappush(d,(cnt+1,h2,w2))
ans = ans if ans<float('inf') else -1
print(ans)


Measured memory_bytes: 129848
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int N; cin >> N;
	string s; cin >> s;
	REP(i, s.size()) {
		s[i] = (char)(((int)(s[i] - 'A') + N) % ('Z' - 'A' + 1) + 'A');
	}
	print(s);





	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::string S, T;

  std::cin >> S;

  int size = S.size(), c = 0;

  for (int i = 0; i < size; i ++)
    if (T.empty()) {
      T.push_back(S[i]);
    }
    else {
      if (T.back() ^ S[i]) {
        T.pop_back();

        c += 2;
      }
      else {
        T.push_back(S[i]);
      }
    }

  std::cout << c << std::endl;

  return 0;
}


Measured memory_bytes: 592
#include <stdio.h>
 
int main(void) {

	int k, i, t;
	char s[101], n[101];
	
	scanf("%d %s", &k, s);
	
	for(i = 0; ; i++){
		if(s[i] == '\0')
			break;
	}
	
	if(i <= k)
		printf("%s", s);
	else{
		for(i = 0; i < k; i++){
			n[i] = s[i];
		}
		for(t = 0; t < 3; t++, i++)
			n[i] = '.';
		
		n[i] = '\0';
		printf("%s", n);
	}
	
		
	
	
	return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define ci(n,a)   ll a[n]; rep(i,(n)) cin>>a[i];
#define rep(i,n)  for(ll i = 0; i < (n); ++i)
#define red(i,n)  for(ll i = (n)-1; i >= 0; --i)
#define all(a)    begin(a),end(a)
#define pb(a)     push_back(a)
#define mp(a,b)   make_pair(a,b)
#define yn(a)     cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;


int main(int argc,char* argv[]) 
{
    ll n,m,ans=0;
    cin>>n>>m;
    vector<pair<ll,ll>> a;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        a.pb(mp(x,y));
    }
    sort(all(a));
    for(auto q:a){
        ll x=q.first,y=q.second;
        if(y>=m){
            ans+=m*x;
            break;
        }
        else {
            m-=y;
            ans+=x*y;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 2420
n=int(input())                                                              
s_card=[]
h_card=[]
c_card=[]
d_card=[]
for _ in range(n):
    card=str(input())
    if 'S' in card:
        s_card.append(card)
    elif 'H' in card:
        h_card.append(card)
    elif 'C' in card:
        c_card.append(card)
    elif 'D' in card:
        d_card.append(card)
for s in range(1,14):
    S=('S '+str(s))
    if (S in s_card) == False:
        print(S)
for h in range(1,14):
    H=('H '+str(h))
    if (H in h_card) == False:
        print(H)
for c in range(1,14):
    C=('C '+str(c))
    if (C in c_card) == False:
        print(C)
for d in range(1,14):
    D=('D '+str(d))
    if (D in d_card) ==False:
        print(D)   

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

int main() {
  int R,G,B,N;
  cin>>R>>G>>B>>N;
  int count=0;
  for(int r=0;r*R<=N;r++){
    for(int g=0;g*G<=N-r*R;g++){
      if((N-r*R-g*G)%B==0)count++;
    }
  }
  cout<<count<<endl;
  return 0;
}

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

// #define ANS  //for answer
#define CMP  //for compe

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define nv(x) #x,(x)
#define ncv(x) #x,":",(x)
#define ncvc(x) #x,":",(x),","
using ll = long long;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>void pPRINT(std::ostream& ost,const T t,const U... u) {ost<<t<<" ";pPRINT(ost, u...);}
template <class... T>void PRINT(const T... t) {pPRINT(std::cout, t...);}
template <class... T>void PRINTl(const T... t){pPRINT(std::cout,t...);std::cout<<"\n";}
template <class T>void PRINTa(const T* const t,const ll size){REP(i,size)PRINT(t[i]);PRINTl();}
template <class T>void PRINTal(const T* const t,const ll size){REP(i,size)PRINTl(i,":",t[i]);}
#ifdef CMP
using namespace std;
#else
#endif
#ifndef DBG
#define DEBUG(...)
void init(){}
#else
#define DEBUG(...) PRINT("##DEBUG##","file :",__FILE__,", line :",__LINE__,"[");PRINT(__VA_ARGS__);PRINTl("]");
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif
#ifdef ANS
#else
#endif

void solve();

int main(int argc, char *argv[]) {

  init();
  DEBUG();
  solve();

  return 0;
}

void solve(){
  ll a,b;
  cin>>a>>b;
  PRINTl(max(a+b,max(a-b,a*b)));

  DEBUG("SOLVE START");

}

Measured memory_bytes: 256
from math import ceil
n,a,b = map(int,input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = max(h)

def f(x):
    res = 0
    for i in range(n): res += ceil(max(0,(h[i]-b*x))/(a-b))
    return res <= x

while l+1 < r:
    m = (l+r)//2
    if f(m): r = m
    else: l = m
print(r)

Measured memory_bytes: 12964
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int sx,sy,tx,ty;
	cin >> sx >> sy >> tx >> ty;
	rep(i,abs(ty-sy)){
		cout << 'U';
	}
	rep(i,abs(tx-sx)){
		cout << 'R';
	}
	rep(i,abs(ty-sy)){
		cout << 'D';
	}
	rep(i,abs(tx-sx)){
		cout << 'L';
	}
	cout << 'L';
	rep(i,abs(ty-sy)+1){
		cout << 'U';
	}
	rep(i,abs(tx-sx)+1){
		cout << 'R';
	}
	cout << 'D';
	cout << 'R';
	rep(i,abs(ty-sy)+1){
		cout << 'D';
	}
	rep(i,abs(tx-sx)+1){
		cout << 'L';
	}
	cout << "U\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> card(N);
  for (int i=0 ; i<N ; i++){
  	cin >> card.at(i);
  }
  sort(card.begin(), card.end()); // {1, 2, 2, 5}
  reverse(card.begin(), card.end()); // {1, 2, 2, 5}
  
  int a = 0, b = 0;
  for(int i = 0 ; i< N ; i++){
    if (i%2 == 0 ){
      a += card.at(i);
    }
    else{
      b += card.at(i);
    }
  }
  
  cout << a - b << endl;
}


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

int main() {
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int dp[n];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(abs(a[i]-a[i-1])+dp[i-1], abs(a[i]-a[i-2])+dp[i-2]);
		// cout<<i<<" "<<dp[i]<<endl;
	}
	cout<<dp[n-1];
	// your code goes here
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <memory>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(S) (S).begin(), (S).end()
typedef long long ll;

const ll  INF  = 1LL << 50;
const int MAXN = 210;
const int MAXR = 1010;

ll l_dist[MAXN][MAXN];
ll s_dist[MAXN][MAXN];
ll dp[MAXR][MAXN];

int main(){
  ios::sync_with_stdio(false);

  int N, M, R;

  while (cin >> N >> M && N + M){
    fill(&l_dist[0][0], &l_dist[0][0] + MAXN * MAXN, INF);
    fill(&s_dist[0][0], &s_dist[0][0] + MAXN * MAXN, INF);
    fill(&dp[0][0], &dp[0][0] + MAXR * MAXN, INF);

    REP(i, N){
      l_dist[i][i] = 0;
      s_dist[i][i] = 0;
    }

    REP(i, M){
      int x, y, t;
      string sl;
      
      cin >> x >> y >> t >> sl; x--, y--;
      if (sl == "L"){
        l_dist[x][y] = l_dist[y][x] = min(l_dist[x][y], (ll)t);
      } else {
        s_dist[x][y] = s_dist[y][x] = min(s_dist[x][y], (ll)t);
      }
    }

    REP(k, N) REP(i, N) REP(j, N){
      l_dist[i][j] = min(l_dist[i][j], l_dist[i][k] + l_dist[k][j]);
      s_dist[i][j] = min(s_dist[i][j], s_dist[i][k] + s_dist[k][j]);
    }

    cin >> R;
    vector<int> zs(R);
    REP(i, R){
      cin >> zs[i]; zs[i]--;
    }

    dp[0][zs[0]] = 0;
    
    REP2(i, 1, R) REP(u, N) if (dp[i - 1][u] < INF){
      // cout << i - 1 << " " << u << endl;
      int cz = zs[i - 1];
      int nz = zs[i];

      dp[i][u] = min(dp[i][u], dp[i - 1][u] + l_dist[cz][nz]);
      
      REP(v, N){
        dp[i][v] = min(dp[i][v], dp[i - 1][u] + l_dist[cz][u] + s_dist[u][v] + l_dist[v][nz]);
      }
    }
    
    ll res = INF;
    REP(i, N){
      res = min(res, dp[R - 1][i]);
    }
    cout << res << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3560
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


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

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

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,x;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> x;

	int ans = 0;
	rep(i, 0, a + 1) {
		rep(j, 0, b + 1) {
			int C = x - (500 * i + 100 * j);
			int D = C / 50;
			int E = C % 50;
			if (C < 0)continue;
			if (c>=D && E == 0)ans++;
		}
	}

	cout << ans << endl;

	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#define _CRT_DISABLE_PERFCRIT_LOCKS
#include <bits/stdc++.h>

using namespace std;
#define BOOST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define fileIn freopen("1.txt", "r", stdin)
#define fileOut freopen("output.txt", "w", stdout)
#define dbg(n) cout << n <<"\n"
#define dbg2(n) cout << n <<" "
#define all(a) a.begin(), a.end()
#define cinArr(arr) for(auto &v : arr) cin>>v
#define coutArr(arr) for(auto &v : arr) cout<<v<<" "
#define FOR(i, a, b) for(int i = a; i < b; i++)
typedef int64_t ll;
typedef uint64_t ull;
typedef vector<int> vi;
typedef vector<vi > vii;


int main()
{
    BOOST;
    int a, b, t;
    cin>>a>>b>>t;
    cout<<t / a * b;
    return 0;
}





















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

struct UnionFind{
  int num;//連結成分の数
  vector<int> r,p;//そのグループのサイズ,自分の親っぽいやつ
  UnionFind(){}
  UnionFind(int n):num(n),r(n,1),p(n,0){iota(p.begin(),p.end(),0);}

  int find(int x){//どのグループに所属するか
    return (x==p[x]?x:p[x]=find(p[x]));//xがグループの名前と一致するまでxを親にする
  }

  bool same(int x,int y){//同じグループかどうか
    return find(x)==find(y);
  }

  void unite(int x,int y){//xとyを同じグループにする
    x=find(x);y=find(y);//xとyのグループの名前をどっちかが変える
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);//サイズが大きい方をxとする
    r[x]+=r[y];//yの親をxにする（今までyだったグループ名がxになる）
    p[y]=x;
    num--;
  }

  int size(int x){//グループの大きさ
    return r[find(x)];
  }

  int count() const{//グループの数
    return num;
  }
};

signed main(){
  int n,m;cin>>n>>m;
  UnionFind uf(n);
  while(m--){
    int a,b;cin>>a>>b;a--;b--;
    uf.unite(a,b);
  }
  cout<<uf.count()-1<<endl;
}


Measured memory_bytes: 4060
/*
　　　　　／＞　 フ
　　　　　| 　_　 _|
　 　　　／`ミ _x 彡
　　 　 /　　　 　 |
　　　 /　  ヽ　　 ?
　／￣|　　 |　|　|
　| (￣ヽ＿_ヽ_)_)
　＼二つ
 */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
	static short st[30];short tp=0;
	if(x<0) putchar('-'),x=-x;
	do st[++tp]=x%10,x/=10; while(x);
	while(tp) putchar('0'|st[tp--]);
	putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

int n, m, d;
char s[] = {'R', 'Y', 'G', 'B'};
int main() {
	read(n), read(m), read(d);
	for (int i = 1;i <= n; i++, puts("")) {
		for (int j = 1;j <= m; j++) {
			int x = i + j + m, y = i - j + m;
			x = (x / d) & 1, y = (y / d) & 1;
			putchar(s[2 * x + y]);
		}
	}
	return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

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; }
const int INF = 1001001001;
const long long INFL = LLONG_MAX / 3;
const double eps = (1e-9);


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

  ll n; cin >> n;
  string s; cin >> s;
  vector<set<int>> pos(26, set<int>());
  rep(i, n) {
    char c = s[i] - 'a';
    pos[c].insert(i);
  }

  ll q; cin >> q;
  rep(i, q) {
    int cmd; cin >> cmd;
    if (cmd == 1) {
      int idx; cin >> idx; idx--;
      char c; cin >> c;
      pos[s[idx] - 'a'].erase(idx);
      pos[c - 'a'].insert(idx);
      s[idx] = c;
    } else {
      int l, r; cin >> l >> r; l--; r--;
      int ans = 0;
      for (auto& v : pos) {
        auto itr = v.lower_bound(l);
        if (itr == v.end()) continue;
        if (*itr <= r) ans++;
      }
      cout << ans << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 24220
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double x = (f - ((c*e)/b)) / (d - ((a*e)/b));
        double y = (c/b) - ((a*x)/b);

        if(x == 0){
            x = 0;
        }
        if(y == 0){
            y = 0;
        }
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}



Measured memory_bytes: 3204
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int[] sum = new int[201];
		Arrays.fill(sum, 0);
		for(int i = -100;i <= 100;i++) {
			int n = i;
			for(int j = 0;j < N;j++) {
				sum[i+100] += (int)Math.pow(a[j]-n, 2);
			}
		}
		Arrays.sort(sum);
		System.out.println(sum[0]);
	}
}


Measured memory_bytes: 22356
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) REV(SORT(V)) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,x,y,z;
double c = 0;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN(n);
  Vi v(n);
  VIN(v)
  Vi up(n);
  FOR(i,0,n){up[i] = i+1;}
  REP(i,n){
    if(v[i]!=up[i]) c++;
  }
  c /= 2;
  YES(c<=1);
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>

using namespace std;
const int MAX_NUM=20;
int N,D;
int X[MAX_NUM][MAX_NUM];

int main(){
  cin>>N>>D;
  for(int k=0;k<N;k++){
    for(int i=0;i<D;i++){
      cin>>X[k][i];
    }
  }
  int p=0;
  for(int k=0;k<N;k++){
      for(int t=k+1;t<N;t++){
	int a=0;
	for(int i=0;i<D;i++){
	  a+=pow((X[k][i]-X[t][i]),2);
	}
	if(sqrt(a)==int(sqrt(a))) p++;
      }
  }
  cout << p << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
template<class _T>inline void read(_T &_a)
{
    bool f=0; char _c=getchar(); _a=0;
    while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
    while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
    if(f) _a=-_a;
}

const int MAXN=15;
int n,m,x,c[MAXN],a[MAXN][MAXN],sum[MAXN],now[MAXN],ans=2e9;

inline bool check()
{
    for (int i=1;i<=m;++i)
        if(now[i]<x) return false;
    return true;
}

void dfs(int rt,int cnt)
{
    if(cnt>=ans) return ;
    if(check()) { ans=cnt; return ; }
    if(rt>n) return ;
    for (int i=1;i<=m;++i)
        now[i]+=a[rt][i];
    dfs(rt+1,cnt+c[rt]);
    for (int i=1;i<=m;++i)
        now[i]-=a[rt][i];
    dfs(rt+1,cnt);
}

int main()
{
    read(n);
    read(m);
    read(x);
    for (int i=1;i<=n;++i)
    {
        read(c[i]);
        for (int j=1;j<=m;++j)
        {
            read(a[i][j]);
            sum[j]+=a[i][j];
        }
    }
    for (int i=1;i<=m;++i)
        if(sum[i]<x)
        {
            printf("-1");
            return 0;
        }
    dfs(1,0);
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
	fast


		
	int n,k;
	cin>>n>>k;


	string str;
	cin>>str;


	vi v;
	char ch = 'a';
	int len = 0;
	forn(i,0,n)
	{
		if(ch == str[i])
		{
			len++;
		}
		else
		{
			if(len) v.pb(len);
			len = 1;
			ch = str[i];
		}
	}

	if(len) v.pb(len);
/*
	forn(i,0,v.sze)
	{	
		cout<<v[i]<<" ";
	}

	cout<<endl;*/

	if(v.sze <= 3)
	{
		cout<<n-1;
		return 0;
	}
	else
	{
		ll maxi = 0;
		ll idx = 0;

		ll sum = 0;

		for(int i = 0; i < v.size(); i++)
		{
			sum += v[i]-1;
		}

		ll val = 0;
		ll len = v.sze;
		// cout<<len<<endl;
		bool value = false;
		while(true)
		{
			if(len > 2)
			{
				val += len/3;
				ll x = len/3;
				len = x + len%3;
			}
			else
			{
				if(len == 1) value = true;
				val++;
				break;
			}
		}

		// cout<<sum<<" "<<val<<endl;
		if(k >= val)
		{
			cout<<n-1;
			return 0;
		}
		else
		{
			sum += 2*k;
		}
		cout<<sum;
		return 0;
	}




	return 0;
}

Measured memory_bytes: 972
import sys

s = input()

alphabet = [0]*26

for i in range(len(s)):
    num_alphabet = ord(s[i])
    alphabet[num_alphabet - 97] = 1

index = -1
for i in range(len(alphabet)):
    if alphabet[i] == 0:
        index = i
        break

print("None") if index == -1 else print(chr(index+97))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
char a[12124],b[24124];
int main()
{
	scanf("%s%s",a,b);
	int lena=strlen(a),lenb=strlen(b);
	if(lena>=lenb){
		for(int i=0;i<lenb;i++){
			printf("%c%c",a[i],b[i]);
		}
		for(int i=lenb;i<lena;i++){
			printf("%c",a[i]);
		}
	}
	else{
	for(int i=0;i<lena;i++){
			printf("%c%c",a[i],b[i]);
		}
		for(int i=lena;i<lenb;i++){
			printf("%c",b[i]);
		}	
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	int c[n - 1],s[n - 1],f[n - 1];
	REP(i,n - 1) cin >> c[i] >> s[i] >> f[i];
	REP(i,n - 1){
		int x = c[i] + s[i];
		for(int j = i + 1; j < n - 1; j++){
			if(x < s[j]) x = s[j];
			else if((x - s[j]) % f[j] != 0) x += f[j] - (x - s[j]) % f[j];
			x += c[j];
		}
		cout << x << endl;
	}
	cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <chrono>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int binarySeach(vector<int> &v, int n, int t, bool eq)
{
    int r = v.size();
    int l = -1;
    while (l + 1 != r)
    {
        int med = (r + l) / 2;
        int now = v[med];
        if (now > t || (eq && now == t))
        {
            r = med;
        }
        else
            l = med;
    }
    return r;
}

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> a, b, c;
    rep(i, n)
    {
        int _;
        cin >> _;
        a.push_back(_);
    }
    rep(i, n)
    {
        int _;
        cin >> _;
        b.push_back(_);
    }
    rep(i, n)
    {
        int _;
        cin >> _;
        c.push_back(_);
    }

    sort(ALL(a));
    sort(ALL(b));
    sort(ALL(c));

    ll ans = 0;
    rep(i, n)
    {

        ll anum = binarySeach(a, n, b[i], true);
        ll cnum = n - binarySeach(c, n, b[i], false);
        // dumpl(anum);
        // dumpl(cnum);
        ans += anum * cnum;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1784
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD =  1'000'003; 
// constexpr long long MOD =  1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

class binomial_coefficients {
public:

	long long MAX_VAL;
	vector<long long> fac, mmi;

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = (x%MOD+MOD) % MOD;
		// cout<<"MMI "<<x<<" "<<" "<< power(fac[MAX_VAL-1], MOD-2)<<endl;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};

binomial_coefficients bc;

int solve(int x, int d, int n){
	
	if(d == 0) {
		return bc.power(x, n);
	}
	
	x *= bc.power(d, MOD-2);
	x %= MOD;
	
	int z = (x + MOD - 1) / MOD;
	
	
	if(!x || (x + n - 1) >= MOD) return 0;
	
	return bc.fac[x+n-1] * bc.mmi[x-1] % MOD * bc.power(d, n) % MOD;
}

signed main(){
	cout<<fixed<<setprecision(10);
	
	int Q;
	
	cin>>Q;
	
	bc.init(MOD-1);
	
	for(int i = 0; i < Q; i++){
		int x, d, n;
		
		cin>>x>>d>>n;
		
		cout<<solve(x, d, n)<<endl;
	}
	
	
	return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

class Node {
public:
    int key;
    Node* next;
    Node* prev;
};
typedef Node* NodePtr_t;

void init();
void insert(int key);
void deleteKey(int target);
void deleteFirst();
void deleteLast();
void printList();

int main()
{
    init();

    int op_num;
    // cin >> op_num;
    scanf("%d", &op_num);

    // std::string op;
    char op_cstr[20];
    int key;

    while (op_num--) {
        // cin >> op;
        scanf("%s", op_cstr);
        std::string op = op_cstr;
        if (op == "insert") {
            // cin >> key;
            scanf("%d", &key);
            insert(key);
        } else if (op == "delete") {
            // cin >> key;
            scanf("%d", &key);
            deleteKey(key);
        } else if (op == "deleteFirst") {
            deleteFirst();
        } else if (op == "deleteLast") {
            deleteLast();
        } else {
            // cout << "ERROR!" << endl;
        }
    }

    printList();

    return 0;
}

NodePtr_t root;
void init()
{
    root = new Node();
    root->next = root;
    root->prev = root;
}

void insert(int key)
{
    NodePtr_t inserted;
    inserted = new Node();
    inserted->next = root->next;
    inserted->prev = root;
    inserted->key = key;

    root->next->prev = inserted;
    root->next = inserted;
}

void deleteNode(NodePtr_t node);

void deleteKey(int target)
{
    NodePtr_t current = root->next;
    while (current != root) {
        if (current->key == target) {
            deleteNode(current);
            return;
        }
        current = current->next;
    }
}

void deleteNode(NodePtr_t node)
{
    if (node == root) {
        return;
    }
    node->next->prev = node->prev;
    node->prev->next = node->next;
    delete node;
}

void deleteFirst()
{
    deleteNode(root->next);
}

void deleteLast()
{
    deleteNode(root->prev);
}

void printList()
{
    NodePtr_t current = root->next;
    while (current != root) {
        if (current != root->next) {
            // cout << " ";
            printf(" ");
        }
        // cout << (current->key);
        printf("%d", current->key);
        current = current->next;
    }
    // cout << endl;
    printf("\n");
}

Measured memory_bytes: 32396
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());

		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = Integer.parseInt(sc.next());
		Arrays.sort(array);
		
		int sum = 0;
		for(int i = 0; i < k; i++)
			sum += array[i];
		
		System.out.println(sum);
	}

}


Measured memory_bytes: 38076
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;




int main(void) {
  ll N;
  cin >> N;
  ll i;
  ll a[MAX];
  
  for(i=0; i<N; i++) cin >> a[i];
  
  ll ans=0;
  for(i=0; i<N-1; i++) {
    ans+=a[i]/2;
    if(a[i]%2 && a[i+1]>0) {
      ans++;
      a[i+1]--;
    }
  }
  
  ans+=a[N-1]/2;
  pt(ans);
  
  
  
}


Measured memory_bytes: 1024
from collections import deque

X, Y, A, B, C = map(int, input().split())
P = [int(n) for n in input().split()]
Q = [int(n) for n in input().split()]
R = [int(n) for n in input().split()]

P.sort()
Q.sort()
R.sort(reverse=True)

PQ = deque(sorted(P[-X:] + Q[-Y:]))
R = deque(R)

while True:
    if not R or R[0] <= PQ[0]:
        break
    if R[0] > PQ[0]:
        PQ.append(R.popleft())
        PQ.popleft()

print(sum(PQ))

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

int a[20000], ans[100][100];
signed main() {
	int h, w, n; scanf("%d%d%d", &h, &w, &n);
	rep(i, n)scanf("%d", &a[i]);
	int p = 0;
	rep(i, h) {
		if (i % 2 == 0) {
			rep(j, w) {
				a[p]--; ans[i][j] = p + 1;
				if (!a[p])p++;
			}
		}
		else {
			for (int j = w - 1; j >= 0; j--) {
				a[p]--; ans[i][j] = p + 1;
				if (!a[p])p++;
			}
		}
	}
	rep(i, h) {
		rep(j, w) {
			if (j)printf(" ");
			printf("%d", ans[i][j]);
		}
		puts("");
	}
}

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

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

vector<int> a(N);
for (int i = 0; i < N; i++) {
    cin >> a[i];
}
sort(a.begin(), a.end());
cout << a[N - 1] - a[0] << endl;

}

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

int main() {
  int X, Y; cin >> X >> Y;

  bool found = false;
  for (int t = 0; t <= X; t++) {
    if (2*t+4*(X-t)==Y) {
      found = true;
    }
  }
  if (found) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
N = int(input())
P = list(map(int, input().split()))

list = []
for i in range(0, N + 1):
    list.append(0)
for i in range(0, N - 1):
    a = P[i]
    list[a] += 1
for i in range(1, N + 1):
    print(list[i])


Measured memory_bytes: 32112
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    if(N%2 == 0){
        cout << N/2-1 << endl;
    }else{
        cout << N/2 << endl;
    }
}

Measured memory_bytes: 892
#include <stdio.h>

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

    int d = a/b;
    int r = a%b;
    double f = (double)a/(double)b;
    
    


    printf("%d %d %f\n",d,r,f);
    
    
    return 0;
}


Measured memory_bytes: 2064