akhauriyash/Code-Regression huggingface dataset:
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const ll INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1000000007;
// const ll MAXN = 3e5;
const ld eps = 1e-6;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("sum.in", "r", stdin);
       // freopen("sum.out", "w", stdout);
#endif
}


void solve(){
    int n;
    cin >> n;
    set<string> kek;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        kek.insert(s);
    }
    cout << kek.size() << endl;
} 
 

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed;
    // cin >> q;
    while(q--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 19288
# coding: utf-8
 
w, h, N = list(map(int, input().split()))
 
rect = [0, w, 0, h]
for i in range(N):
    x, y, a = list(map(int, input().split()))
    if [1, -1][a % 2] * ([x, y][a > 2] - rect[a - 1]) < 0:
        rect[a - 1] = [x, y][a > 2]

w, h = rect[1] - rect[0], rect[3] - rect[2]
print([0, w * h][w > 0 and h > 0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<int> fact;
	vector<int> ifact;
	vector<int> inv;
	vector<int> pow2;
	const int MOD = (1e9 + 7);
	int add(int a, int b)
	{
		a+=b;
		while(a>=MOD) a-=MOD;
		return a;
	}
	void radd(int &a, int b)
	{
		a=add(a,b); 
	}
	int mult(int a, int b)
	{
		return (a*1LL*b)%MOD;
	}
	void rmult(int &a, int b)
	{
		a=mult(a,b);
	}
	int modpow(int a, int b)
	{
		int r=1;
		while(b)
		{
			if(b&1) r=mult(r,a);
			a=mult(a,a);
			b>>=1;
		}
		return r;
	}
	int choose(int a, int b)
	{
		if(a<b) return 0;
		if(b==0) return 1;
		if(a==b) return 1;
		return mult(fact[a],mult(ifact[b],ifact[a-b]));
	}
	int inverse(int a)
	{
		return modpow(a,MOD-2);
	}
	void init(int _n)
	{
		fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
		fact.resize(_n+1);
		ifact.resize(_n+1);
		inv.resize(_n+1);
		pow2.resize(_n+1);
		pow2[0]=1;
		ifact[0]=1;
		fact[0]=1;
		for(int i=1;i<=_n;i++)
		{
			pow2[i]=add(pow2[i-1],pow2[i-1]);
			fact[i]=mult(fact[i-1],i);
			//ifact[i]=mult(ifact[i-1],inv[i]);
		}
		ifact[_n] = inverse(fact[_n]);
		for(int i=_n-1;i>=1;i--)
		{
		    ifact[i] = mult(ifact[i + 1], i + 1);
		}
		for(int i=1;i<=_n;i++)
		{
		    inv[i] = mult(fact[i-1],ifact[i]);
		}
	}

int pw[1111111];
int pw3[1111111];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	init(2222222);
	int k; cin>>k;
	string s; cin>>s;
	int n=s.length();
	pw[0]=1; pw3[0]=1;
	for(int i=1;i<=1001111;i++) pw[i]=mult(pw[i-1],25);
	int ans=0;
	for(int i=1;i<=1001111;i++) pw3[i]=mult(pw3[i-1],26);
	for(int i=0;i<=k;i++)
	{
		radd(ans,mult(pw3[i],mult(pw[k-i],choose(k-i+n-1,n-1))));
	}
	//int ans = mult(pw,choose(k+n,n));
	cout<<ans<<'\n';
}


Measured memory_bytes: 46904
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


S = input()
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        print(i + 1, i + 2)
        exit(0)
    if i < len(S) - 2:
        if S[i] == S[i + 2]:
            print(i + 1, i + 3)
            exit(0)
print(-1, -1)


Measured memory_bytes: 39664
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define fcout cout << fixed << setprecision(10)
int main(){
    ll n,m,d;
    cin>>n>>m>>d;
    if(d==0){
        fcout<<1.0*(m-1)/n;
        return 0;
    }
    fcout<<(n-d)*2*(m-1)/(double)(n*n);
}

Measured memory_bytes: 256
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collections;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n+1];
        int[] b = new int[n+1];
        int[] c = new int[n+1];
        
        for (int i = 1; i <= n; i++) {
            String[] s = br.readLine().split(" ");
            a[i] = Integer.parseInt(s[0]);
            b[i] = Integer.parseInt(s[1]);
            c[i] = Integer.parseInt(s[2]);
        }
        
        int[][] dp = new int[n+1][3];
        
        for (int i = 0; i < 3; i++) {
            dp[0][i] = 0;
        }
        
        dp[1][0] = a[1];
        dp[1][1] = b[1];
        dp[1][2] = c[1];
        
        for (int i = 2; i <= n; i++) {
            dp[i][0] = Math.max(dp[i-1][1] + a[i], dp[i-1][2] + a[i]);
            dp[i][1] = Math.max(dp[i-1][0] + b[i], dp[i-1][2] + b[i]);
            dp[i][2] = Math.max(dp[i-1][0] + c[i], dp[i-1][1] + c[i]);
        }
        
        int ans = Math.max(Math.max(dp[n][0], dp[n][1]), dp[n][2]);
        System.out.println(ans);
    }
}



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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sfl(i,a,n) for (int i=a;i<n;i++)
#define ufl(i,a,n) for (int i=n-1;i>=a;i--)
#define SZ(x) ((int)(x).size())
#define endl '\n'
typedef long long ll;

ll power(ll a, ll b){
    ll res = 1;
    for(int i = 0; i<b; i++)
        res *= a;

    return res;
}

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main()
{
    init();
    int x;
    cin >>x;
    int counter1=0;
    for(int i=1;i<=x;i+=2)
    {
        int counter=0;
        sfl(j,1,i+1)
        {
            if(i%j==0)
                counter++;
        }
        if(counter>7)
            counter1++;

    }

    cout <<counter1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

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

    ll ans;

    if (x == 0)
    {
        ans = 1;
    }
    else
    {
        ans = 0;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

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

			while(true){			
			int val = s.nextInt();
				
				if(val==0)
				break;
			
			int change = 1000-val;
			int count = 0;
			
			count += change/500;
			change = change%500;
			
			count += change/100;
			change = change%100;
			
			count += change/50;
			change = change%50;
			
			count += change/10;
			change = change%10;
			
			count += change/5;
			change = change%5;
			
			count += change/1;
			change = change%1;
			
			System.out.println(count);
			}
		}
}

Measured memory_bytes: 17168
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
const ll nax = 2e5 + 5;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll&a , ll b){a=(a+b);}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n ; cin >> n ;
vector<ll> arr(n) ; for(ll i = 0 ; i<n ; i++)cin>> arr[i] ;
ll base = 1; 
while(base<=2*n)base*=2;
// cout << base << endl;
ll ans = 0 ;
vector<ll>tree(2*base) ;
for(ll i = 0 ; i< n ; i++){
	ll k ; cin >> k ; 
	ll l = 1 + base , r = base + arr[i] - 1 , res = 0;

	while(l<=r){
		if(l%2==1)max_self(res,tree[l++]);
		if(r%2==0)max_self(res,tree[r--]);
		l/=2;r/=2;
	}
	// cout << arr[i] - 1 << " " << res << endl;
	max_self(ans , k + res);
	// tree[base + arr[i]] = k ; 
	ll x = base + arr[i] ;
	while(x>0){
		max_self(tree[x] ,res + k);
		x/=2;
	}

}
cout << ans << endl;

	
}

Measured memory_bytes: 9984
straight = '12345678910111213110111213'

while True:
    try:
        lst = list(map(int, input().split(',')))
        lst.sort()
        clst = []

        for i in lst:
            clst.append(lst.count(i))

        if clst.count(4) == 4:
            print('four card')

        elif clst.count(3) == 3:
            if clst.count(2) == 2:
                print('full house')
            else:
                print('three card')
        elif clst.count(2) == 4:
            print('two pair')
        elif clst.count(2) == 2:
            print('one pair')
        else:
            s = str(lst[0]) + str(lst[1]) + str(lst[2]) + str(lst[3]) + str(lst[4])
            if s in straight:
                print('straight')
            else:
                print('null')
    
    except EOFError:
        break


Measured memory_bytes: 5604
A, B, C, X, Y = map(int, input().rstrip().split())
AB = C*2
if A+B < AB:
    print(A*X+B*Y)
else:
    answer = AB*min(X,Y) + A*(X-Y) if X > Y else AB*min(X,Y) + B*(Y-X)
    answer = AB*max(X,Y) if AB*max(X,Y) < answer else answer
    print(answer)
    

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
    int city[4] = {0};
    int n;
    for(int i = 0; i < 6; i++)
    {
        cin >> n;
        city[--n]++;
    }
    sort(city, city + 4);
    cout << ( (city[0] == 1 && city[1] == 1 && city[2] == 2 && city[3] == 2) ? "YES" : "NO") << endl;
    return 0;
}

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

#define DEBUG 1

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

using namespace std;

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

int main(){

	lli n;
	vector<lli> a;
	cin>>n;
	REP(i,n){
		lli tmp;
		cin>>tmp;
		a.push_back(tmp);
	}

	sort(a.begin(),a.end());

	lli ans=a[0];
	for(lli i=1;i<n;i++){
		ans = gcd(a[i],ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int tmp = sc.nextInt();
		
		for(int i = 0; i < tmp; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			if((a * a == (b * b) + (c * c)) ||
				(b * b == (c * c) + (a * a)) ||
				(c * c == (a * a) + (b * b))){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}
}

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

using namespace std;

void solve(){
		long long int n;
		cin>>n;
		long long int cnt=0;
		long long int mx=INT_MIN;
		while(n--){
				long long int x;
				cin>>x;
				if(mx <= x)
					mx=x;
				else
					cnt+=(mx-x);
		}
		cout<<cnt;
		
			
}

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



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}
int main() {
    long long a, n, ans = 0;
    double sum = 0;
    cin >> n;
    vector<double>as(n);
    for (int i = 0; i < n; i++){
        cin >> a;
        as[i] = 1 / double(a);
    }
    for (int i = 0; i < n; i++){
        sum += as[i];
    }
    cout << 1 / double(sum) << endl;
}

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

int main(){
    string s;
    cin >> s;
    
    bool flag = false;

    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) flag = true;
    else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) flag = true;
    else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) flag = true;
    
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main()
{
    char c;
    cin>>c;
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
    return 0;
}
     

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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t clk = clock();

    int k; cin>>k;
    queue<ll> q({1, 2, 3, 4, 5, 6, 7, 8, 9});
    while(true) {
        ll x = q.front(); q.pop();
        k--;
        if(!k) {
            cout<<x;
            return 0;
        }

        if(x % 10 != 0) {
            q.push(x * 10 + (x % 10) - 1);
        }
        q.push(x * 10 + x%10);
        if(x % 10 != 9) {
            q.push(x*10LL + (x%10)+1);
        }
    }
    cerr << endl << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

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

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

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

ll mod(int x, int m){
	if(x < 0){
		return m-(-x%m);
	}
	return x%m;
}

int N;
ll A[114514];
ll sum[114514] = {};

bool ok(ll m){
	bool flag = true;
	while(sum[m] != sum[N-1] && flag){
		ll newm;
		newm = upper_bound(A, A+N, sum[m]*2)-1-A;
		if(newm == m)
			flag = false;
		m = newm;
	}
	return flag;
}

int main(void){
	cin >> N;
	REP(i, N){
		cin >> A[i];
	}
	sort(A, A+N);
	REP(i, N){
		sum[i] += A[i];
		sum[i+1] += sum[i];
	}
	ll l = 0, r = N;
	while(r-l > 1){
		ll m = (l+r)/2;
		if(ok(m))
			r = (l+r)/2;
		else
			l = (l+r)/2;
	}
	if(ok(l)){
		cout << N-l << endl;
	}else{
		cout << N-r << endl;
	}
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;
vector<int> G[100005], revG[100005];
vector<int> topo;
bool used[100005];
int dp[100005];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}

int main(void)
{
	cin >> n >> m;
	int a, b;
	for(int i = 0; i < n+m-1; i++){
		cin >> a >> b;
		G[a].push_back(b);
		revG[b].push_back(a);
	}
	
	for(int i = 1; i <= n; i++) if(!used[i]) tpsort(i);
	reverse(topo.begin(), topo.end());
	
	for(int i = 0; i < topo.size(); i++){
		int v = topo[i];
		for(int j = 0; j < G[v].size(); j++){
			dp[G[v][j]] = max(dp[G[v][j]], dp[v]+1);
		}
	}
	
	//for(int i = 0; i < topo.size(); i++) cout << topo[i] << " "; cout << endl;
	//for(int i = 1; i <= n; i++) cout << dp[i] << " "; cout << endl;
	
	for(int i = 1; i <= n; i++){
		if(revG[i].size() == 0) cout << 0 << endl;
		else{
			int mx = -1, mx_v;
			for(int j = 0; j < revG[i].size(); j++){
				if(mx < dp[revG[i][j]]){
					mx = dp[revG[i][j]];
					mx_v = revG[i][j];
				}
			}
			cout << mx_v << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 14844
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ld long double

/* 幾何ライブラリ */

// 定数
constexpr ld PI = 3.14159265358979323846L;
constexpr ld PI_2 = 2 * PI;
const ld e = 1e-15; // 許容誤差

// 2次元座標, 2次元ベクトル
using pos = pair<ld, ld>;

// 加算
pos add(pos p1, pos p2) {
	return { p1.first + p2.first, p1.second + p2.second };
}
// 減算
pos sub(pos p1, pos p2) {
	return { p1.first - p2.first, p1.second - p2.second };
}
// 内積
ld inner_product(pos p1, pos p2) {
	return p1.first * p2.first + p1.second * p2.second;
}
// 定数倍
pos mul(ld c, pos p) {
	return { c * p.first, c * p.second };
}

// ノルムの2乗
ld norm2(pos p) {
	return p.first * p.first + p.second * p.second;
}
// ノルム
ld norm(pos p) {
	return sqrt(norm2(p));
}

// 平行判定
bool is_parallel(pos v1, pos v2) {
	return abs(v1.first * v2.second - v1.second * v2.first) < e;
}
// 直行判定
bool is_orthogonal(pos v1, pos v2) {
	return abs(inner_product(v1, v2)) < e;
}

// 射影
// pをp1, p2を通る直線に射影する
// 検証済み(https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_1_A)
pos projection(pos p1, pos p2, pos p) {
	pos q = sub(p2, p1);
	pos tmp = mul(inner_product(q, sub(p, p1)) / norm2(q), q);
	return add(p1, tmp);
}

// 反射
// pをp1, p2を通る直線に関して対称移動する
// 検証済み(https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_1_B)
pos reflection(pos p1, pos p2, pos p) {
	pos tmp = projection(p1, p2, p);
	return add(p, mul(2.0, sub(tmp, p)));
}

// 位置関係
// p0を基準に、p1, p2の位置関係を求める
// p2が
//	p1から反時計回り方向 : COUNTER_CLOCKWISE
//	p1から時計回り方向 : CLOCKWISE
//	p1と反対方向(p2, p0, p1がこの順に同一直線上) : ONLINE_BACK
//	p1の延長線上(p0, p1, p2がこの順に同一直線上) : ONLINE_FRONT
//	p1の途中(線分p0p1の上) : ON_SEGMENT
// 検証済み(https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_1_C)
string positional_relation(pos p0, pos p1, pos p2) {
	pos v1 = sub(p1, p0), v2 = sub(p2, p0);
	if (abs(v2.first) < e && abs(v2.second) < e) return "ON_SEGMENT";
	ld r1 = atan2l(v1.second, v1.first), r2 = atan2l(v2.second, v2.first);
	if (abs(r1 - r2) < e || (abs(r1 - r2) > PI - e && abs(r1 - r2) < PI + e)) { // ONLINE
		if (v1.first * v2.first < 0 || v1.second * v2.second < 0)
			return "ONLINE_BACK";
		if (abs(v1.first) < abs(v2.first) || abs(v1.second) < abs(v2.second))
			return "ONLINE_FRONT";
		return "ON_SEGMENT";
	}
	// NOT ONLINE
	if (r2 - r1 + (r2 - r1 < 0 ? PI_2 : 0) < PI)
		return "COUNTER_CLOCKWISE";
	return "CLOCKWISE";
}



int main() {
	int q; cin >> q;
	while (q--) {
		pos p0, p1, p2, p3;
		cin >> p0.first >> p0.second;
		cin >> p1.first >> p1.second;
		cin >> p2.first >> p2.second;
		cin >> p3.first >> p3.second;
		pos v1 = sub(p0, p1), v2 = sub(p2, p3);
		if (is_parallel(v1, v2)) cout << 2 << endl;
		else if (is_orthogonal(v1, v2)) cout << 1 << endl;
		else cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 3236
n=int(input())
a=[1, 6, 36, 216, 1296, 7776, 46656]
b=[1, 9, 81, 729, 6561, 59049]
def ab_cal(num,arr):
  i=len(arr)-1
  cnt1=0
  while num>0:
    if arr[i]<=num:
      num-=arr[i]
      cnt1+=1
    else:
      i-=1
  return cnt1

ans = 10**9
for i in range(0,n+1):
  cnt=ab_cal(i,a)+ab_cal(n-i,b)
  ans=min(ans,cnt)
print(ans)

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, K;

int main(){
  cin >> N >> K;
  if (K == 0){
    cout << N * N << endl;
    return 0;
  }

  ll ans = 0;
  for (ll b = K + 1; b <= N; b++){
    ans += (N / b) * (b - 1 - K + 1);
    if (N % b >= K){
      ans += (N % b) - (K - 1);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3600
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<usize>();
    let (n, m) = (line[0], line[1]);
    let h = read_as_vec::<u64>();
    let mut are_bests = vec![true;n];

    for _ in 0..m{
        let line = read_as_vec::<usize>();
        let (a, b) = (line[0]-1, line[1]-1);
        are_bests[a] = are_bests[a] && h[a] > h[b];
        are_bests[b] = are_bests[b] && h[b] > h[a];
    }

    println!("{}", are_bests.iter().filter(|x| **x).count());
}


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

int weight[105];
int value[105];
long long resenje[101][100001];

void senideresi() {
for (int i = 0; i <= 100; i++)
    for (int j = 0; j <= 100000; j++)
        resenje[i][j] = -1;
}
int main()
{
    int n, w;
    cin >> n >> w;
    int vmax = 0;
    for (int i = 0; i < n; i++) {
        cin >> weight[i] >> value[i];
        vmax += value[i];
    }
    senideresi();
    for (int i = 0; i <= n; i++)
        resenje[i][0] = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= vmax; j++) {
            if (value[i - 1] <= j) {
                long long x = resenje[i - 1][j], y = resenje[i - 1][j - value[i - 1]];
                if (x == -1 && y != -1)
                    resenje[i][j] = y + weight[i - 1];
                else if (x != -1 && y == -1)
                    resenje[i][j] = x;
                else if (x != - 1 && y != -1)
                    resenje[i][j] = min(x, y + weight[i - 1]);
            }
            else
                resenje[i][j] = resenje[i - 1][j];


        }
    for (int i = vmax; i >= 0; i--)
            if (resenje[n][i] != -1 && resenje[n][i] <= w) {
                cout << i;
                break;
            }
    return 0;
}


Measured memory_bytes: 79104
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const int inf=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;


int main(){
  ll n;cin>>n;
  vll a(n);
  rep(i,0,n){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  if(n%2){
    ll ans=0,ans2=0;
    rep(i,0,n/2){
      ans+=a[i]*2;
    }
    ans-=(a[n/2]+a[n/2+1]);
    rep(i,n/2+2,n){
      ans-=(a[i]*2);
    }
    rep(i,0,n/2-1){
      ans2+=a[i]*2;
    }
    ans2+=a[n/2-1]+a[n/2];
    rep(i,n/2+1,n){ans2-=a[i]*2;}
    cout<<max(ans,ans2)<<endl;
  }
  else{
    ll ans=0;
    rep(i,0,n/2-1){
      ans+=a[i]*2;
    }
    ans+=a[n/2-1];
    ans-=a[n/2];
    rep(i,n/2+1,n){
      ans-=a[i]*2;
    }
    cout<<ans<<endl;
  }
}



Measured memory_bytes: 4036
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n;
int a[100100];
int main()
{
	while(~scanf("%d",&n))
	{
		memset(a,0,sizeof(a));
		for(int i=0;i<n;++i)
		{
			int x;
			scanf("%d",&x);
			a[x]++;
		}
		int max_sum = 0;
		for(int i=1;i<100000;++i)
		{
			max_sum=max(max_sum,a[i-1]+a[i]+a[i+1]);
		}
		printf("%d\n",max_sum);
	}
}


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

int main() {
  int n, i;
  cin >> n;
  vector<int> a(n);
  for (i=0;i<n;++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  printf("%lu", a.size());
}

Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
use std::cmp::*;
use std::collections::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       N:usize,
       XYP:[(i64,i64,i64);N]
    }
    // 各鉄道パターンについて、集落からの距離
    let inf = std::i64::MAX;
    let mut dtate = vec![vec![0i64; N]; 2i64.pow(N as u32) as usize];
    let mut dyoko = vec![vec![0i64; N]; 2i64.pow(N as u32) as usize];
    for i in 0..dtate.len() {
        //let l: Vec<bool> = format!("{:0>15b}", i).chars().map(|c| c == '1').collect();
        //let sum = l.iter().fold(0, |sum, &a| sum + if a { 1 } else { 0 });

        for j in 0..N {
            dtate[i][j] = XYP[j].0.abs();
            dyoko[i][j] = XYP[j].1.abs();
            for k in 0..N {
                if (i >> k) & 1 == 1 {
                    dtate[i][j] = min(dtate[i][j], (XYP[j].0 - XYP[k].0).abs());
                    dyoko[i][j] = min(dyoko[i][j], (XYP[j].1 - XYP[k].1).abs());
                }
            }
        }
    }
    let mut ans = vec![std::i64::MAX; N + 1];
    for i in 0..(3usize.pow(N as u32)) {
        // i の j bit目が0なら、j番目の町に路線なし、1なら東西線、2なら南北線とする。
        // iから、dtate[x]とdyoko[y]のxとyを求める。
        let mut x = 0;
        let mut y = 0;
        let mut ii = i;
        let mut n = N;
        for j in 0..N {
            let tmp = ii % 3;
            // 順番がおかしくなるけど、全部合計するので気にしない。
            x *= 2;
            y *= 2;
            match tmp {
                1 => x += 1,
                2 => y += 1,
                _ => n -= 1,
            }
            ii /= 3;
        }
        let mut t = 0;
        for j in 0..N {
            t += min(dtate[x][j], dyoko[y][j]) * XYP[j].2;
        }
        ans[n] = min(ans[n], t);
    }
    for i in 0..=N {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 11768
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+7;
int val[1<<13];
int main(){
    int n,k,l,cos,x,m,maxn;
    scanf("%d%d",&n,&m);
    maxn=(1<<n)-1;
    for(int i=1;i<=maxn;i++){
        val[i]=INF;
    }
    for(int i=0;i<m;i++){
        scanf("%d%d",&cos,&k);
        l=0;
        for(int j=1;j<=k;j++){
            scanf("%d",&x);
            l+=1<<(x-1);
        }
        for(int j=1;j<=maxn;j++){
            val[l|j]=min(val[l|j],cos+val[j]);
        }
        val[l]=min(val[l],cos);

    }
    if(val[maxn]>=INF){
        printf("-1");
        return 0;
    }
    printf("%d",val[maxn]);

}


Measured memory_bytes: 256
n = gets.to_i
h = gets.chomp.split.map(&:to_i)

if n == 1
  puts "Yes"
  exit
end

m = [h[0]]
1.step(n - 1) do |i|
  m << [h[i], m[-1]].max
end
puts (h.zip(m).any? {|i, j| i - j < -1 })? "No" : "Yes"

Measured memory_bytes: 13956
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <climits>

using namespace std;

int a[100005];


int main(){
	int n, m, i, j;
	cin>>n>>m;
	long a[n+1], b[n+1], c[m+1], d[m+1];
	for(i = 0; i<n; i++)
		cin>>a[i]>>b[i];
	for(j = 0; j<m; j++)
		cin>>c[j]>>d[j];
	for(i = 0; i<n; i++){
		long dis = 1000000000;
		int ans;
		for(j = 0; j<m; j++){
			long dd = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if(dd < dis){
				dis = dd;
				ans = j;
			}
		}
		cout<<ans+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
c=list(input())
if c[b-1]=='A':
  c[b-1]='a'
elif c[b-1]=='B':
  c[b-1]='b'
else:
  c[b-1]='c'
d=''
for i in range(a):
  d+=c[i]
print(d)

Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>


using namespace std;

using ll = long long int;

int sum(ll a, int i)
{
  if (a < 0) {
    return 0;
  }

  if (i == 0) {
    return (a + 1) % 4 >= 2;
  }  

  ll b = a % (2LL << i);

  if (b < (1LL << i)) {
    return 0;
  } else {
    return 1 - (int)b % 2;
  }
}

ll bit(ll a, ll b, int i)
{
  return (sum(a - 1, i) + sum(b, i)) % 2;
}

ll solve(ll a, ll b)
{
  ll sum = 0;
  for (int i = 0; i < 60; i++) {
    sum |= ((ll)bit(a, b, i) << i);
  }

  return sum;
}
int main() {
  ll a, b;
  cin >> a >> b;

  cout << solve(a, b) << endl;

  return 0;
}


Measured memory_bytes: 888
A, B, C, D, E, F = [int(n) for n in input().split()]

max_ratio = -1
for cnt_A in [n for n in range(30) if 100*A*n <= F]:
  for cnt_B in [n for n in range(30) if 100*A*cnt_A * 100*B*n <= F]:
    for cnt_C in [n for n in range(1500) if n*C <= E*(A*cnt_A+B*cnt_B) and 100*A*cnt_A + 100*B*cnt_B + n*C <= F]:
      for cnt_D in [n for n in range(1500) if n*D + C*cnt_C <= E*(A*cnt_A + B*cnt_B)and 100*A*cnt_A + 100*B*cnt_B + C*cnt_C + D*n <= F]:
        if (cnt_A!=0 or cnt_B !=0)and max_ratio < (C*cnt_C+D*cnt_D)/(100*A*cnt_A+100*B*cnt_B):
          max_ratio = (C*cnt_C + D*cnt_D)/(100*A*cnt_A+100*B*cnt_B)
          a = 100*A*cnt_A + 100*B*cnt_B
          b = C*cnt_C + D*cnt_D
print(a+b, b)


Measured memory_bytes: 3064
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int n, i;
	int a[10000], b[10000];
	long A=0, B=0;
	scanf("%d", &n);
	for(i=0; i<n; i++){ scanf("%d", &a[i]); A+=a[i]; }
	for(i=0; i<n; i++){ scanf("%d", &b[i]); B+=b[i]; }
	long c=0, d=0;
	for(i=0; i<n; i++){
		if(a[i]<b[i]){c+=(b[i]-a[i])/2;}
		if(a[i]>b[i]){d+=a[i]-b[i];}
	}
	puts(c>=d?"Yes":"No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int sum,a,b,k;
int main()
{
	scanf("%d%d%d",&a,&b,&k);
	for(register int i=a;i>=1;i--)
	{
		if(a%i==0 && b%i==0)
			sum++;
		if(sum==k)
		{
			printf("%d",i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, N) for(i = 0; i < N; i++)
#define ll long long

int main() {
  ll K, N;
  cin >> K >> N;
  vector<ll> A = {};

  ll i;
  rep(i, N) {
    ll tmp;
    cin >> tmp;
    A.push_back(tmp);
  }

  ll maxlen = 0;
  rep(i, N) {
    ll tmp = A[(i + 1) % N] - A[i % N];
    ll tmplen = (tmp > 0) ? tmp : K + tmp;
    // 各家の間の幅のうちいちばんおおきいものを計算
    maxlen = max(maxlen, tmplen);
  }
  ll ans = K - maxlen;

  cout << ans;
  return 0;
}

Measured memory_bytes: 2420
//rohitkaushal
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

string s[30];
int h,w;
int dist[30][30];

bool is_pos(int i,int j){
   return i<h and j<w and i>=0 and j>=0 and s[i][j] == '.';
}

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   cin >> h >> w;
   f(i,0,h){
      cin >> s[i];
   }
   int ans = 0;
   f(i,0,h){
      f(j,0,w){
         if(s[i][j] == '.'){
            set<array<int,3>> q;
            int mx = 0;
            q.insert({0,i,j});
            vector<vector<int>> dist(h,vector<int>(w,MOD));
            dist[i][j] = 0;
            while(!q.empty()){
               auto v = *q.begin();
               q.erase(q.begin());
               int ff = v[1];
               int ss = v[2];
               vector<pii> itr = {{ff+1,ss},{ff-1,ss},{ff,ss+1},{ff,ss-1}};
               for(auto &e : itr){
                  if(is_pos(e.F,e.S)){
                     if(dist[ff][ss]+1<dist[e.F][e.S]){
                        q.erase({dist[e.F][e.S],e.F,e.S});
                        dist[e.F][e.S] = dist[ff][ss]+1;
                        mx = max(mx,dist[e.F][e.S]);
                        q.insert({dist[e.F][e.S],e.F,e.S});
                     }
                  }
               }
            }
            ans = max(ans,mx);
         }
      }
   }
   cout << ans << '\n';
   return 0;
}

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

using namespace std;

int n, x;
int ans[216000];
bool used[216000];
int main(){
	cin >> n >> x;
	if(n == 1){
		cout << "Yes" << endl;
		cout << x << endl;
		return 0;
	}
	if(n == 2){
		if(x != 2){
			cout << "No" << endl;
			return 0;
		}
		cout << "Yes" << endl;
		cout << "1\n2\n3" << endl;
		return 0;
	}
	if(x == 1 || x == 2*n-1){
		cout << "No" << endl;
		return 0;
	}
	if(x == 2){
		ans[n-2] = 3;
		ans[n-1] = 2;
		ans[n] = 1;
		ans[n+1] = 4;
		used[3] = true;
		used[2] = true;
		used[1] = true;
		used[4] = true;
	}
	else{
		ans[n-3] = x-2;
		ans[n-2] = x+1;
		ans[n-1] = x;
		ans[n] = x-1;
		used[x-2] = true;
		used[x+1] = true;
		used[x] = true;
		used[x-1] = true;
	}
	
	int p = 1;
	for(int i = 0;i < n*2-1;i++){
		while(used[p])p++;
		if(ans[i] != 0)continue;
		ans[i] = p++;
	}                
	cout << "Yes" << endl;
	for(int i = 0;i < n*2-1;i++)cout << ans[i] << endl;
	return 0;    
}

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

int main(){
    int N;  cin >> N;
    vector<ll> A(N+1), B(N+1);
    ll sumA = 0, sumB = 0;
    for(int i=1; i<=N; i++){ cin >> A[i]; sumA += A[i]; }
    for(int i=1; i<=N; i++){ cin >> B[i]; sumB += B[i]; }
    if(sumA < sumB){
        cout << -1 << endl;
        return 0;
    }

    vector<ll> D(N+1);
    int ans = 0;
    ll lack = 0;
    for(int i=1; i<=N; i++){
        D[i] = A[i] - B[i];
        if(D[i]<0){
            lack -= D[i];
            ans++;
        }
    }
    if(ans == 0){
        cout << 0 << endl;
        return 0;
    }

    sort(D.begin(), D.end());
    for(int i=N; i>=1; i--){
        if(lack > D[i]){
            ans++;
            lack -= D[i];
        }else{
            ans++;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

#define endl "\n"

void solve() {
    cini(n);

    int ans=0;
    for(int i=1; i<n; i++) {
        for(int j=1; i*j<n; j++) {
            ans++;
        }
    }

    cout<<ans<<endl;

}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  int A,B;
  cin>>A>>B;
  cout<<max(A+B,max(A-B,A*B));
  
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
/**
 *  Hi, I'm Arpan.
 *  Hardwork beats talent if talents doesn't work hard, friend me if you want to. ✌.|•͡˘‿•͡˘|.✌
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007

void solve()
{
    int x,y;
    cin >> x >> y;
    if(y%2 == 0 && y/2 >= x && y <= x*4){
		cout << "Yes";
    }
    else
		cout << "No";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

        solve();
    return 0;
}


Measured memory_bytes: 3648
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
sum = 0
for i in range(n):
  sum += b[a[i]-1]
for i in range(n-1):
  if a[i] + 1 == a[i+1]:
    sum += c[a[i]-1]
print(sum)

Measured memory_bytes: 38256
class Solver:
    def __init__(self, n, robots):
        self.n = n
        self.robots = robots

    def order_by_endpos(self, robots):
        return sorted(map(lambda pos_armrange:(pos_armrange[0] + pos_armrange[1], max(pos_armrange[0] - pos_armrange[1], 1)), robots))

    def solve(self):
        current_pos = 0
        keep = 0
        for r in self.order_by_endpos(self.robots):
            start_pos = r[1]
            end_pos = r[0]
            if current_pos <= start_pos:
                keep += 1
                current_pos = end_pos
        return keep


if __name__ == "__main__":
    n = int(input())
    robots = []
    for _ in range(n):
        robots.append(tuple(map(int, input().split())))

    s = Solver(n, robots)
    print(s.solve())


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

int main(){
    int a,b,c,k,cnt=0;
    cin >> a >> b >> c >> k;
    while (b<=a) {
        b*=2;
        cnt++;
    }
    while(c<=b) {
        c*=2;
        cnt++;
    }
    if (cnt<=k) {cout << "Yes";}
    else {cout << "No";}
}


Measured memory_bytes: 3624
#include <iostream>
using namespace	std;
int main(){

  int n,a[100],blank,i,j;

  cin>>n;

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

  for(i=0;i<n-1;i++){

    for(j=0;j<n-1;j++){

      if(a[j] > a[j+1]){

        blank=a[j];
        a[j]=a[j+1];
        a[j+1]=blank;

      }

    }

  }

  cout<<a[n-1]-a[0]<<endl;

  return 0;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

//#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	bitset<64> b(0);

	for (ll i = 0; i < n; i++)
	{
		ll q, x;
		cin >> q;

		switch (q)
		{
			case 0:
				cin >> x;
				println(b.test(x));
				break;

			case 1:
				cin >> x;
				b.set(x);
				break;

			case 2:
				cin >> x;
				b.reset(x);
				break;

			case 3:
				cin >> x;
				b.flip(x);
				break;

			case 4:
				println(b.all());
				break;

			case 5:
				println(b.any());
				break;

			case 6:
				println(b.none());
				break;

			case 7:
				println(b.count());
				break;

			case 8:
				println(b.to_ullong());
				break;
		}

	}
}



Measured memory_bytes: 3108
#include<stdio.h>

int main(void){
	long i,n,uketori,max=-1000001,min=1000001,sum=0;
	
	scanf("%ld",&n);
	
	
	
	for(i=0;i<n;i++){
		
		scanf("%ld",&uketori);
		
		if(uketori>max){
			max=uketori;
		}
		if(uketori<min){
			min=uketori;
		}
		
		sum+=uketori;
		
	}
	printf("%ld %ld %ld\n",min,max,sum);
	return 0;
	
}

Measured memory_bytes: 600
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

char A[1000001];

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


	int N = getint();

	rep(i, N) {
		int a = getint();
		A[a] += A[a] + 1;
	}

	if (A[1]) {
		if (A[1] == 1) co(1);
		else co(0);
		return 0;
	}
	if (A[2]) {
		int kotae = (A[2] == 1);
		for (int i = 3; i <= 500000; i += 2) {
			if (A[i]) {
				kotae += (A[i] == 1);
				for (int j = i + i; j <= 1000000; j += i) {
					A[j] = 0;
				}
			}
		}
		for (int i = 500001; i <= 1000000; i += 2) kotae += (A[i] == 1);
		co(kotae);
		return 0;
	}

	int kotae = 0;
	for (int i = 2; i <= 500000; i++) {
		if (A[i]) {
			kotae += (A[i] == 1);
			for (int j = i + i; j <= 1000000; j += i) {
				A[j] = 0;
			}
		}
	}
	for (int i = 500001; i <= 1000000; i++) kotae += (A[i] == 1);
	co(kotae);

	Would you please return 0;
}

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

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

C = sorted(Counter(A).items())

if C[0][1] > 2:
    print('Impossible')
    exit()

is2src = C[0][1] == 2
src = C[0][0]
depth = src - is2src + 1

if len(C) != depth:
    print('Impossible')
    exit()

for i, (k, v) in enumerate(C[1:], 1):
    prevk, prevv = C[i-1]
    if k != prevk + 1:
        print('Impossible')
        exit()
    if 2 > v:
        print('Impossible')
        exit()
print('Possible')


Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ln "\n"
#define pb push_back
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define vll vector<ll>
#define vpll vector<pll>
#define vvll vector<vector<ll>>
#define sll stack<ll>
#define qll queue<ll>
#define mp make_pair
#define f first
#define s second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define Test ll t;cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define init(x,n,v) for(ll i=0;i<=n;i++) x[i]=v;
#define all(x) x.begin(),x.end()
ll MOD = 1e9+7 , MAX = 1e18;
int main() 
{
	fast_io;
	ll n,i;
	cin>>n;
	vll dp(n,0),a(n);
	for(i=0;i<n;i++)
	{
	    cin>>a[i];
	    if(i) dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
	    if(i>1) dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 1792