akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>

int main() {
    int X;
    std::cin >> X;

    int ret = 1;
    for (int b = 2; b <= X; ++b) {
        for (int p = 2;; ++p) {
            const int pow_num = static_cast<int>(std::pow(b, p) + 0.5);
            if (pow_num > X) {
                break;
            }

            ret = std::max(ret, pow_num);
        }
    }

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    set<int> x;

    rep(i,N){
        cin >> A[i];
        x.insert(A[i]);
    }
    
    if(x.size() == N){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    // O(N^2)となってTLE
    // for(int i=0; i<N; i++){
    //     cin >> A[i];
    //     for(int j=0; j<i; j++){
    //         if(A[j] == A[i]){
    //             cout << "NO" << endl;
    //             return 0;
    //         }
    //     }
    // }
    // cout << "YES" << endl;

    
    return 0;
}

Measured memory_bytes: 10368
H, W, K = map(int, input().split())
c = [0] * H
ans = 0
for i in range(H):
    c[i] = input()
for row in range(1 << H):
    for line in range(1 << W):
        black = 0
        for h in range(H):
            if (row >> h) % 2 == 1:
                continue
            for w in range(W):
                if (line >> w) % 2 == 1:
                    continue
                if c[h][w] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int N;
  	cin>>N;
  	int t[110000], x[110000], y[110000];
  	t[0]=x[0]=y[0]=0;
  	rep(i,N) cin>>t[i+1]>>x[i+1]>>y[i+1];
	
  	bool can=true;
  	rep(i,N){
     	int dt=t[i+1]-t[i];
      	int distance=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
      	if(dt<distance) can=false;
      	if(dt%2!=distance%2) can=false;
      	
    }
  	if(can) cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
  	
}

Measured memory_bytes: 4792
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
using namespace std;

const long long INF = 1e18;

long long  a, b, c, n, k;
long long ne;
vector<long long> A, B, C;

long long Search(long long x) {
	long long rank = 0ll;
	if (x >= 0) {
		for (int i = 0, j = a - 1; i < a; ++i) {
			j = max(j, i);
			while (j > i && A[i] * A[j] > x) --j;
			rank += j - i;
		}
		for (int i = 0, j = b - 1; i < b; ++i) {
			j = max(j, i);
			while (j > i && B[i] * B[j] > x) --j;
			rank += j - i;
		}
		rank += ne;
	} else {
		rank = 1ll * a * b;
		for (int i = 0, j = c - 1; i < c; ++i) {
			j = max(j, i);
			while (j > i && C[i] * C[j] >= -x) --j;
			rank -= j - i;
		}
		for (int i = 0, j = a - 1; i < a; ++i) {
			j = max(j, i);
			while (j > i && A[i] * A[j] >= -x) --j;
			rank += j - i;
		}
		for (int i = 0, j = b - 1; i < b; ++i) {
			j = max(j, i);
			while (j > i && B[i] * B[j] >= -x) --j;
			rank += j - i;
		}
	}
	
	return rank;
}
int main() {
	INIT
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		long long in;
		cin >> in;
		if (in) {
			if (in > 0) {
				A.pb(in);
			} else {
				B.pb(-in);
			}
			C.pb(abs(in));
		}
	}
	a = A.size();
	b = B.size();
	c = C.size();
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	long long l = -INF, r = INF;
	ne = 1ll * a * b + 1ll * (n - a - b) * (n - a - b - 1) / 2 + 1ll * (n - a - b) * (a + b);
	while (l < r) {
		long long mid = l + (r - l) / 2;
//printf("l %lld   r %lld   mid  %lld  check(mid) %lld \n",l, r, mid, Search(mid));
		if (Search(mid) >= k) r = mid;
		else l = mid + 1;
	}
	cout << l << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
vector<ll> sil(200000);

ll Pot(ll p, ll w)
{
    if (w == 0)
        return 1;
    if (w % 2 == 0)
    {
        ll pol = Pot(p, w / 2);
        return pol * pol % MOD;
    }
    return Pot(p, w - 1) * p % MOD;
}

ll Inv(ll n)
{
    return Pot(n, MOD - 2);
}

ll C(ll n, ll k)
{
    return sil[n] * Inv(sil[n - k] * sil[k] % MOD) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);
    sil[0] = 1;
    for (ll i = 1; i < 200000; ++i)
        sil[i] = (sil[i - 1] * i) % MOD;
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    if (k == 1)
    {
        cout << "0";
        return 0;
    }
    ll odp = 0;
    for (int i = 0; i + k <= n; ++i)
        odp = (odp + a[i] * C(n - i - 1, k - 1)) % MOD;
    for (int i = n - 1; i - k + 1 >= 0; --i)
    {
        odp = (odp - a[i] * C(i, k - 1)) % MOD;
        if (odp < 0)
            odp += MOD;
    }
    cout << odp;
    return 0;
}


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

int main(){
  int X;
  cin >> X;
  
  int ans= 1;
  int base= 2;
  while(base*base <= X){
    int calc= base*base;
    while(calc*base <= X){
      calc*= base;
    }
    ans= max(ans, calc);
    base++;
  }

  cout << ans << endl;
}

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

int main(){
    using namespace std;

    constexpr unsigned long N{200000}, register_length{100}, reg(150);

    const auto& cmp = [](unsigned long i, unsigned long j, unsigned long k) -> void {
        cout << "< " << i << " " << j << " " << k << endl;
    };
    const auto& add = [](unsigned long i, unsigned long j, unsigned long k) -> void {
        cout << "+ " << i << " " << j << " " << k << endl;
    };
    const auto& bit_and_add = [&cmp, &add](unsigned long i, unsigned long j, unsigned long k) -> void {
        cmp(i, j, reg);
        cmp(j, i, reg + 1);
        add(reg, reg + 1, reg + 1);
        add(i, j, reg);
        cmp(reg + 1, reg, reg);
        add(k, reg, k);
    };
    const auto& binary_mul = [&bit_and_add](unsigned long i, unsigned long i_len, unsigned long j, unsigned long j_len, unsigned long k) -> void {
        for(unsigned long i_ofs{0}; i_ofs < i_len; ++i_ofs)for(unsigned long j_ofs{0}; j_ofs < j_len; ++j_ofs)bit_and_add(i + i_ofs, j + j_ofs, k + i_ofs + j_ofs);
    };
    const auto& bin_to_int = [&add](unsigned long beg, unsigned long len, unsigned long k) -> void {
        for(unsigned long i{len}; i--; ) {
            if(i + 1 != len)add(k, k, k);
            add(beg + i, k, k);
        }
    };
    const auto& zero_clear = [&cmp](unsigned long i) -> void {
        cmp(i, i, i);
    };
    const auto& one_clear = [&cmp](unsigned long i) -> void {
        cmp(2, 1, i);
    };
    const auto& bit_shift = [&add](unsigned long i, unsigned long s) -> void {
        for(unsigned long itr{0}; itr < s; ++itr)add(i, i, i);
    };
    const auto& int_to_bin = [&bin_to_int, &bit_shift, &zero_clear, &one_clear, &cmp](unsigned long idx, unsigned long i, unsigned long len) -> void {
        one_clear(reg + 2);
        for(unsigned long itr{1}; itr <= len; ++itr){
            zero_clear(reg);
            one_clear(i + len - itr);
            bin_to_int(i + len - itr, itr, reg);
            bit_shift(reg, len - itr);
            cmp(idx, reg, reg + 1);
            cmp(reg + 1, reg + 2, i + len - itr);
        }
    };

    cout << 8431 << endl;
    int_to_bin(0, 10, 30);
    int_to_bin(1, 40, 30);
    binary_mul(10, 30, 40, 30, 70);
    bin_to_int(70, 60, 2);
    return 0;
}

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

const long long INF = 1LL << 60;

int main() {
    int N, M;
    cin >> N >> M;
    long long students[N][2], checkpoints[M][2];
    for (int i = 0; i < N; ++i) cin >> students[i][0] >> students[i][1];
    for (int i = 0; i < M; ++i) cin >> checkpoints[i][0] >> checkpoints[i][1];

    long long ans[N];
    for (int i = 0; i < N; ++i) {
        long long best = INF;
        for (int j = 0; j < M; ++j) {
            long long distance = 0;
            distance = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1]);
            if (distance < best ) {best = distance; ans[i] = j+1;}
        }
    }
    for (int i = 0; i < N; ++i) cout << ans[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void){
    cout << "Yes" << endl;
    int n,m;
    cin >> n >> m;
    vector<vector<int>> graph(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vector<int> dist(n,-1);
    queue<int> que;
    que.push(0);
    dist[0] = 0;
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(auto i:graph[v]){
            if(dist[i]!=-1) continue;
            dist[i]=dist[v]+1;
            que.push(i);
        }
    }
    rep(i,n){
        if(i==0) continue;
        int cnt=1e9;
        int d = -1;
        for(auto j:graph[i]){
            if(dist[j]<cnt){
                cnt = dist[j];
                d = j;
            }
        }
        cout << d+1 << endl;
    }
}

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

int main()
{
  int n;
  string str;
  int c1, c2, c3, c4;
  c1 = c2 = c3 = c4 = 0;

  while (scanf("%d,", &n) != EOF){
    cin >> str;
    if (str == "A"){c1++;}
    if (str == "B"){c2++;}
    if (str == "AB"){c3++;}
    if (str == "O"){c4++;}
  }
  cout << c1 << "\n" << c2 << "\n" << c3 << "\n" << c4 << endl;

  return 0;
  }

Measured memory_bytes: 1236
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	unordered_set<int> c;
	vector<int> a(M), b(M); rep(i, 0, M) {
		cin >> a[i] >> b[i]; a[i]--, b[i]--;
		if (a[i] == 0)c.insert(b[i]);
		if (b[i] == 0)c.insert(a[i]);
	}
	bool f = false;
	rep(i, 0, M) {
		if (a[i] == N - 1) {
			if (c.count(b[i])) {
				f = true;
			}
		}
		if (b[i] == N - 1) {
			if (c.count(a[i])) {
				f = true;
			}
		}
	}
	cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 5924
import java.util.Scanner;

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

        int N = scanner.nextInt();

        int[] B = new int[N];

        for (int i = 0 ; i < N - 1 ; i++) {
            B[i] = scanner.nextInt();
        }

        long answer = B[0];

        for (int i = 1 ; i < N - 1; i++) {
            answer += Math.min(B[i], B[i - 1]);
        }
        answer += B[N - 2];

        System.out.println(answer);
    }
}


Measured memory_bytes: 35808
#include <stdio.h>
#include <algorithm>
#include <map>
#define MN 100000
typedef long long LL;
int n,m;
char s[MN+5],t[MN+5];
std::map<LL,char> mp;
int gcd(int a,int b){
	if(a<b) std::swap(a,b);
	return a%b==0?b:gcd(a%b,b);
}
int main(){
	scanf("%d%d%s%s",&n,&m,&s[1],&t[1]);
	LL len=1ll*n*m/gcd(n,m);
	LL d1=len/n,d2=len/m;
	for(LL i=1,j=1;i<=len;i+=d1,j++) mp[i]=s[j]; 
	for(LL i=1,j=1;i<=len;i+=d2,j++)
		if(mp.find(i)!=mp.end()&&mp[i]!=t[j]) return 0*puts("-1");
	printf("%lld\n",len);
}

Measured memory_bytes: 6144
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    long long min=0,max=0,total=0;
    
    int x,n;
    cin >>x;
    for (int i=1; i<=x; i++) {
        
        cin >> n;
        
        if(i==1){
            
            
            min =n;
            max=n;
            total=n;
        }else {
            if(n<min){
                min=n;
            }
            if(n>max){
                max=n;
            }
            
            total=total+n;
        }
    }
    cout <<min<<" "<<max<<" "<<total<<endl;
    
    // insert code here...
    //std::cout << "Hello, World!\n";
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 50;
string a, b, c;
int num;

int read() {
	int x = 0;
	for(int i = 0; i < c.size(); i++) {
		x = (x<<3) + (x<<1) + c[i] -'0';
	}
	return x;
}
int main() {
	
	cin >> a;
	cin >> b;
	c = a + b;
	num = read();
	
	int ans = sqrt(num);
	if(sqrt(num) != ans) {
		puts("No");
	}else puts("Yes");
	return 0;
} 


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int R,C,k;
int row[]= {1,0,-1,0,1,-1,1,-1};
int colm[]= {0,1,0,-1,1,-1,-1,1};
vector<string>maze(MAX);
void bfs(int input_x,int input_y,int tx,int ty)
{
    queue<pair<int,int> >q;
    vector<vector<int> > dis(R + 1, vector<int>(C + 1, INT_MAX));
    dis[input_x][input_y]=0;
    q.push(make_pair(input_x,input_y));
    while(!q.empty())
    {
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        for(int i=0; i<4; i++)
        {
            for(int j=1; j<=k; j++)
            {
                int u=x+row[i]*j;
                int v=y+colm[i]*j;
                if(0<=u && u<R && 0<=v && v<C)
                {
                    if(maze[u][v]=='@' || dis[u][v]<=dis[x][y])
                        break;
                    if(dis[u][v]>dis[x][y]+1)
                    {
                        dis[u][v]=dis[x][y]+1;
                        q.push(make_pair(u,v));
                    }
                }
                else
                    break;
            }
        }
    }
    if(dis[tx][ty]==INT_MAX)
        cout<<"-1"<<endl;
    else
        cout<<dis[tx][ty]<<endl;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int x1,x2,y1,y2;
    cin>>R>>C>>k;
    cin>>x1>>y1>>x2>>y2;
    for(int i=0; i<R; i++)
        cin>>maze[i];
    x1--;
    y1--;
    x2--;
    y2--;
    bfs(x1,y1,x2,y2);



    return 0;
}


Measured memory_bytes: 47396
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int mod = 1000000007;

int main(){
    string s;
    cin>>s;
    bool f=false;
    if(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]){
        f=false;
    }else{
    if(s[0]==s[1]&&s[2]==s[3]) f=true;
    if(s[0]==s[2]&&s[1]==s[3]) f=true;
    if(s[0]==s[3]&&s[1]==s[2]) f=true;
    }
    if(f==false) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    
}


Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # 全体から、Ｃの倍数 + Ｄの倍数 - (CとDの倍数でもあるやつ)をひけええ
    # C と D の最小公倍数　これは　lcmだね ~ c * d // gcd(c,d)かな
    a,b,c,d = readInts()
    # A 以上　B 以下の中　＝ B以下 - (A-1以下)
    # まず最小公倍数を求めよう
    from fractions import gcd
    lcm = ( c // gcd(c,d) ) * d
    #print(lcm)
    # まず B 以下のやつ


    # 答えは C でも　D でも割り切れないやつだからｗｗｗｗｗｗｗ


    B_ = b - (b // c + b // d - b // lcm)
    #print(B_)
    # んで A-1以下のやつ
    A_ = a-1 - ((a-1) // c  + (a-1) // d - (a-1) // lcm) # 足すな　引け
    # んで答え
    print(B_ - A_)
if __name__ == '__main__':
  main()


Measured memory_bytes: 5480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int t[n + 1] = {}, x[n + 1] = {}, y[n + 1] = {};
    rep(i, 1, n + 1) cin >> t[i] >> x[i] >> y[i];
    rep(i, 1, n + 1) {
        int dt = t[i] - t[i - 1];
        int dx = abs(x[i] - x[i - 1]);
        int dy = abs(y[i] - y[i - 1]);
        if (dt < dx + dy) {
            cout << "No" << endl;
            return 0;
        }
        if (dt % 2 != (dx + dy) % 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("03")
#pragma GCC optimization ("unroll-loops")
using namespace std;

const int maxn = 200002;
const int maxe = 20;
int a[maxn],b[maxn],c,k,pa[maxn],x,y,q,sol,d,mod=1000000007;
int m,n;
string s;
int rmq[maxn][maxe];
int st[4*maxn],la[4*maxn],ft[maxn];
char h;
set<int>se;
void build(int n){
    for(int j=1;(1<<j)<=n;j++){
        for(int i=1;i+(1<<j)-1<=n;i++){
            rmq[i][j] = min(rmq[i][j-1], rmq[i+(1<<(j-1))][j-1]);
        }
    }
}

int query(int a, int b){
    int k = 31- __builtin_clz(b-a+1);
    return min(rmq[a][k], rmq[b-(1<<k)+1][k]);
}

int fin(int i)
{
    if(pa[i]==i)return i;
    return pa[i]=fin(pa[i]);
}

int bs(int l,int r)
{

    while(l!=r)
    {
        int mi=(l+r)/2;
        if(a[mi]==x)return mi;
        if(a[mi]>x)r=mi;
        else l=mi+1;
    }
    return l;
}
void crear(int l,int r,int nod){
if(l==r)st[nod]=a[l];
else{
int mi=(l+r)/2;
crear(l,mi,2*nod);
crear(mi+1,r,2*nod+1);
st[nod]=min(st[2*nod],st[2*nod+1]);
}
}

void upd(int l,int r,int nod){
if(l>x || r<x)return;
if(la[nod]!=0){
st[nod]+=la[nod];
la[2*nod]+=la[nod];
la[2*nod+1]+=la[nod];
la[nod]=0;
}
if(l==r)st[nod]+=y;
else{
int mi=(l+r)/2;
upd(l,mi,2*nod);
upd(mi+1,r,2*nod+1);
st[nod]=min(st[2*nod],st[2*nod+1]);
}
}

int qu(int l,int r,int nod){
if(l>y || r<x)return 100001;
if(la[nod]!=0){
st[nod]+=la[nod];
la[2*nod]+=la[nod];
la[2*nod+1]+=la[nod];
la[nod]=0;
}
if(l>=x && r<=y)return st[nod];
else {
int mi=(l+r)/2;
return min(qu(l,mi,2*nod),qu(mi+1,r,2*nod+1));
}
}

void lazy(int l,int r,int nod){
if(l>y || r<x)return;
if(la[nod]!=0){
st[nod]+=la[nod];
la[2*nod]+=la[nod];
la[2*nod+1]+=la[nod];
la[nod]=0;
}
if(l>=x && r<=y){
st[nod]+=q;
if(l!=r){
la[nod*2]+=q;
la[2*nod+1]+=q;
}
}
else {
int mi=(l+r)/2;
lazy(l,mi,2*nod);
lazy(mi+1,r,2*nod+1);
st[nod]=min(st[2*nod],st[2*nod+1]);
}
}

int ftq(int n){
int c=0;
while(n){
c+=ft[n];
n-=(n&-n);
}
return c;
}

void ftupd(int x){
for(int i=x;i<maxn;i+=(i&-i))
ft[i]+=y;
}

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

    cin>>n;
    for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
    if(i*j==n){cout<<"Yes";return 0;}
    }
    }
    cout<<"No";
}


Measured memory_bytes: 2304
s = input()

if eval(s[0] + '+' + s[1] + '+' + s[2] + '+' + s[3]) == 7:
    print(s[0] + '+' + s[1] + '+' + s[2] + '+' + s[3] + '=7') 
elif eval(s[0] + '+' + s[1] + '+' + s[2] + '-' + s[3]) == 7:
    print(s[0] + '+' + s[1] + '+' + s[2] + '-' + s[3] + '=7')
elif eval(s[0] + '+' + s[1] + '-' + s[2] + '+' + s[3]) == 7:
    print(s[0] + '+' + s[1] + '-' + s[2] + '+' + s[3] + '=7')
elif eval(s[0] + '+' + s[1] + '-' + s[2] + '-' + s[3]) == 7:
    print(s[0] + '+' + s[1] + '-' + s[2] + '-' + s[3] + '=7')
elif eval(s[0] + '-' + s[1] + '+' + s[2] + '+' + s[3]) == 7:
    print(s[0] + '-' + s[1] + '+' + s[2] + '+' + s[3] + '=7')
elif eval(s[0] + '-' + s[1] + '+' + s[2] + '-' + s[3]) == 7:
    print(s[0] + '-' + s[1] + '+' + s[2] + '-' + s[3] + '=7')
elif eval(s[0] + '-' + s[1] + '-' + s[2] + '+' + s[3]) == 7:
    print(s[0] + '-' + s[1] + '-' + s[2] + '+' + s[3] + '=7')
else:# if ev == 7:
    print(s[0] + '-' + s[1] + '-' + s[2] + '-' + s[3] + '=7')

Measured memory_bytes: 3064
def main():
  import sys
  input = sys.stdin.readline
  import numpy as np
  n=int(input()) 
  a=np.array(list(map(int,input().split())))
  mod=pow(10,9)+7
  ans=0
  
  for i in range(60):
    x=np.count_nonzero(a & 1)
    ans+=pow(2,i,mod)*x*(n-x)
    ans=ans%mod
    a=a>>1
  print(ans)
if __name__=='__main__':
  main()

Measured memory_bytes: 48780
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        String op = scan.next();
        int b = scan.nextInt();

        if (op.equals("+")) {
            System.out.println(a + b);
        } else {
            System.out.println(a - b);
        }
    }
}

Measured memory_bytes: 21844
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B = MAP()

if A >= 9 or B >= 9:
	print(":(")
else:
	print("Yay!")


Measured memory_bytes: 3892
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	x := intScanner()
	m := make(map[int]int)
	for i := 0; i < 1000000; i++ {
		a := i * i * i * i * i
		m[a] = i
		d := abs(x - a)
		if v, ok := m[d]; ok {
			if x > a {
				fmt.Println(i, -v)
			} else {
				fmt.Println(i, v)
			}
			break
		}
	}
}
func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}


Measured memory_bytes: 1788
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 100000

typedef long long ll;
typedef pair<int,int> P;

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0; i < s.length(); i++){
        count += s[i] - '0';
    }
    int t = stoi(s);
    if(t % count == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<int> c(n), d(n);
    for(int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
    for(int i = 0; i < n; i++) {
        cin >> c[i];
    }
    vector<int> dist(n, -1);
    dist[0] = 0;
    queue<int> que;
    que.push(0);
    while(que.size()) {
        int v = que.front();
        que.pop();
        if(dist[v] == -1) {
            continue;
        }
        for(auto u : g[v]) {
            if(dist[u] == -1) {
                dist[u] = dist[v] + 1;
                que.push(u);
            }
        }
    }

    sort(RALL(c));
    for(int i = 0; i < n; i++) {
        int id = min_element(ALL(dist)) - dist.begin();
        d[id] = c[i];
        dist[id] = INF;
    }
    cout << accumulate(ALL(c), -c[0]) << endl;
    for(int i = 0; i < n; i++) {
        cout << d[i] << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 1024
n = int(input())
a = [int(_) for _ in input().split()]

flag = True
res = 0
while flag:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i] //2
        else:
            flag = False
            break
    if flag:
        res += 1

print(res)

Measured memory_bytes: 3060
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

s = input()
for i in range(len(s)):
    if s[i] in ['A','C','G','T']:
        f = 1
    else:
        f = 0
    if f:
        neko = neko + 1
    if nya < neko:
        nya = neko
    if f == 0:
        neko = 0
print(nya)

Measured memory_bytes: 3064
/*
  AUTHOR:SOURABH
  CREATED:01:05:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,i,n,k,d,j,v,ans;
    string s;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>k;
        bool b[n];
        memset(b,0,sizeof(b));
        fn(i,k)
        {
            cin>>d;
            fn(j,d)
            {
                cin>>v;
                b[v-1]=1;
            }
        }
        ans=0;
        fn(i,n)
        {
            if(!b[i])ans++;
        }
        cout<<ans;
    }
    return 0;
}



















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

ll n, a, b, ans;

int main() {
  cin >> n >> a >> b;
  if (a > b) swap(a, b);
  ans = (b-a)/2;
  if ((b-a) % 2 == 1) ans = min(a, n-b+1) + (b-a-1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int n;
double a,x;
int main() {
    cin>>n;
    for (int i=1;i<=n;i++){
        if (i%2==1) a++;
    }
    x=a/n;
    cout<<fixed;
    cout<<setprecision(9)<<x;
   
}

Measured memory_bytes: 256
x, n = map(int, input().split())
if n!=0:
    lst = [i for i in range(102)]
    a = list(map(int, input().split()))

    for i in range(n):
        lst.remove(a[i])
    
    if x in lst:
        print(x)
    else:
        b=x
        c=x
        for i in range(100):
            b-=1
            c+=1
            if b in lst:
                print(b)
                break
            elif c in lst:
                print(c)
                break
    
else:
    print(x)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
const int zero = 8000;

int main(){
  string s;
  int x, y;
  cin >> s >> x >> y;
  vector<int> xl, yl;
  int n = s.size();
  bool side = false, start = true;
  for(int i=0; i<n; ++i){
    int cnt = 0;
    while(i<n && s[i] == 'F'){
      ++cnt;
      ++i;
    }
    if(start){
      x -= cnt;
      start = false;
    }else if(side){
      xl.push_back(cnt);
      side = false;
    }else{
      yl.push_back(cnt);
      side = true;
    }
  }
  /*
  cout << "x:" << x << " y:" << y << endl;
  cout << "xlist:";
  for(int i=0; i<(int)xl.size(); ++i){
    if(i != (int)xl.size()-1) cout << xl[i] << " ";
    else cout << xl[i] << endl;
  }
  cout << "ylist:";
  for(int i=0; i<(int)yl.size(); ++i){
    if(i != (int)yl.size()-1) cout << yl[i] << " ";
    else cout << yl[i] << endl;
  }
  */
  vector<vector<bool>> dpx(xl.size()+1,vector<bool>(16005,false));
  vector<vector<bool>> dpy(yl.size()+1,vector<bool>(16005,false));
  dpx[0][zero] = true;
  dpy[0][zero] = true;
  for(int i=0; i<(int)xl.size(); ++i){
    for(int j=0; j<=16000; ++j){
      if(j-xl[i] >=0 && dpx[i][j-xl[i]]) dpx[i+1][j] = true;
      if(j+xl[i] <=16000 && dpx[i][j+xl[i]]) dpx[i+1][j] = true;
    }
  }
  for(int i=0; i<(int)yl.size(); ++i){
    for(int j=0; j<=16000; ++j){
      if(j-yl[i] >=0 && dpy[i][j-yl[i]]) dpy[i+1][j] = true;
      if(j+yl[i] <=16000 && dpy[i][j+yl[i]]) dpy[i+1][j] = true;
    }
  }
  if(x > -zero && dpx[xl.size()][zero+x] && dpy[yl.size()][zero+y]){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 19204
program hi;
type ars = array[1..200000] of string;
var 
    n, i, cnt: longint;
    a, tmp: ars;

procedure merge(var a, tmp: ars; l, m, r: longint);
var i, i1, i2: longint;
begin
    i := l; i1 := l; i2 := m + 1;
    while (i1 <= m) and (i2 <= r) do begin
        if a[i1] <= a[i2] then begin
            tmp[i] := a[i1];
            inc(i1);
        end else begin
            tmp[i] := a[i2];
            inc(i2);
        end;
        inc(i);
    end;
    if i1 <= m then 
        while i1 <= m do begin
            tmp[i] := a[i1];
            inc(i1); inc(i);
        end 
    else 
        while i2 <= r do begin
            tmp[i] := a[i2];
            inc(i2); inc(i);
        end;
    for i := l to r do 
        a[i] := tmp[i];
end;

procedure mSort(var a, tmp: ars; l, r: longint);
var m: longint;
begin
    if l < r then begin
        m := (l + r) div 2;
        mSort(a, tmp, l, m);
        mSort(a, tmp, m + 1, r);
        merge(a, tmp, l, m, r);
    end;
end;

begin
    readln(n);
    for i := 1 to n do 
        readln(a[i]);
    mSort(a, tmp, 1, n);
    cnt := 1;
    for i := 1 to n - 1 do 
        if a[i] <> a[i + 1] then
            inc(cnt);
    writeln(cnt);
end.

Measured memory_bytes: 59996
#include<bits/stdc++.h>
using namespace std;
int main(){
    //vector<int> c1(3);cin>>c1[0]>>c1[1]>>c1[2];
    //vector<int> c2(3);cin>>c2[0]>>c2[1]>>c2[2];
    //reverse(c2.begin(),c2.end());
    string s1,s2;cin>>s1>>s2;
    reverse(s2.begin(),s2.end());
    bool key=true;
    for(int i=0;i<3;i++){
        if(s1[i]!=s2[i]){
            key = false;
        }
    }
    if(key){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

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


long long X[101],Y[101],A[101],B[101];
int main(){
	long long n,m;
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> X[i] >> Y[i];
	}
	for(int i=0;i<m;i++){
		cin >> A[i] >> B[i];
	}
	
	
	for(int i=0;i<n;i++){
		long long a=0,sum=0,Mn=1e9;
		for(int j=0;j<m;j++){
			sum=abs(X[i]-A[j])+abs(Y[i]-B[j]);
			if(sum<Mn){
				Mn=sum;
				a=j+1;
			}
		}
		cout << a << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int mxn = 1e5;
// int cnt1[mxn+2],cnt2[mxn+2];

void solve(){
	int n,k;
	cin >> n >> k;
	long long cnt[k+1];
	memset(cnt,0,sizeof(cnt));
	for(int i =1;i<=n;i++){
		cnt[i%k]++;
	}
	long long ans = 0;
	ans += cnt[0]*cnt[0]*cnt[0];
	if(k%2==0)
		ans += cnt[k/2] *cnt[k/2] * cnt[k/2];

	cout << ans << endl;

}

int main(){
	fast;
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
	// #endif

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


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


signed main(){
    int Ans=0;
    string S,T,U;
    cin >> S;
    int p[114514]={};
    int q[114514]={};
    int j=0,k=0;
    T=S;
    REP(i,T.size()){
        if(T[i]=='x'){
            T.erase(T.begin()+i,T.begin()+i+1);
            i--;
        }
    }
    U=T;
    reverse(U.begin(),U.end());
    if(T!=U){
        cout << -1 << endl;
        return 0;
    }
    U=S;
    reverse(U.begin(),U.end());
    
    REP(i,S.size()){
        if(S[i]=='x'){
            p[j]++;
        }else{
            j++;
        }
        if(U[i]=='x'){
            q[k]++;
        }else{
            k++;
        }
    }
    REP(i,j+1){
        Ans+=max((int)0,p[i]-q[i]);
    }
    
    cout <<Ans << endl;
    return 0;
}


Measured memory_bytes: 2304
import itertools
N = int(input())
P = [int(_) for _ in input().split()]
Q = [int(_) for _ in input().split()]
R = list(itertools.permutations([i+1 for i in range(N)], N))
for i, r in enumerate(R):
    t = list(r)
    if t == P:
        a = i + 1
    if t == Q:
        b = i + 1
print(abs(a-b))



Measured memory_bytes: 8052
#line 2 "/home/toof/working/library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T &a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) os << v[i] << (i+1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for(T &i : v) is >> i; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "b.cpp"

int main() {
  string s, t;
  cin >> s >> t;
  ll n = s.size();
  ll m = t.size();
  ll ans = 1000;
  rep(i, n-m+1) {
    ll cnt = 0;
    rep(j, m) {
      if (s[i+j] != t[j]) cnt++;
    }
    cmin(ans, cnt);
  }
  cout << ans << el;
}


Measured memory_bytes: 3632
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 100005;
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,c = 0,ans = 0;
  cin >> n;
  for (int i = 1; i <= sqrt(n) ; ++i)
  {
    if(n%i == 0)
    {
      if((n/i >= 1 && n/i <= 9) && (i >= 1 && i <= 9))
      {
        cout << "Yes\n";
        return 0;
      }
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define ll long long int
#define ld double
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define pu push
#define po pop
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define be begin
#define sz(a) (ll)a.size()
#define INF 1e18
 
typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
 
ll mod=1e9+7;
// ll gcd(ll a, ll b){
//     if(a<b) swap(a,b);
//     if(b==0) return a;
//     return gcd(b,a%b);
// }
 
// ll fun(ll x, ll y){
//     ll rem=1;
//     while(y!=0){
//         if(y%2==1){
//             rem=(rem*x)%mod;
//         }
//         x=(x*x)%mod;
//         y/=2;
//     }
//     return rem;
// }

struct Line {
    ll k, m;
    mutable ll p;
    bool operator<(const Line& o) const {
        return k < o.k;
    }
    bool operator<(const ll &x) const{
        return p < x;
    }
};
struct LineContainer : multiset<Line, less<>> {
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b){
        return a / b - ((a ^ b) < 0 && a % b);
    }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,c;
	cin>>n>>c;
	ve<ll>ar(n+1);
	lr(n) cin>>ar[i+1];
	LineContainer obj;
	obj.add(2*ar[n],-ar[n]*ar[n]);
	ll ans;
	for(ll i=n-1;i>=2;i--){
		ll x=-obj.query(ar[i]);
		ans=x+ar[i]*ar[i]+c;
		ans+=ar[i]*ar[i];
		obj.add(2*ar[i],-ans);
	}
    ans=-obj.query(ar[1])+ar[1]*ar[1]+c;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 14336
#include <stdio.h>

int main() {
  int a,b,c,d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  
  while (a > 0 && c > 0) {
  c -= b;
  if (c <= 0)
    break;
  a -= d;
  }
  
  if (a > 0)
    printf("Yes");
  else
    printf("No");
  
  return (0);
}

Measured memory_bytes: 1732
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
int n,m,l;
int p;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int main(){
  cin >> n >> m;
  print(max(max(n+m,n-m),n * m));
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const ll p = (1e+9) + 7;

ll add(ll a, ll b) {
	return (a + b) % p;
}

ll sub(ll a, ll b) {
	return (a + p - b) % p;
}

ll mul(ll a, ll b) {
	return ((a%p)*(b%p)) % p;
}

ll power(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	else if (b == 1) {
		return a % p;
	}
	else if (b % 2 == 0) {
		ll c = power(a, b / 2);
		return (c*c) % p;
	}
	else {
		ll c = power(a, b / 2);
		return (((c*c) % p)*a) % p;
	}
}

ll divi(ll a, ll b) {
	return mul(a, power(b, p - 2));
}



int main() {
	ll H, W, K;
	cin >> H >> W >> K;
	ll dp[8][101] = { 0 };
	dp[0][0] = 1;
	FOR(i, 1, H + 1) {
		REP(j, 1 << (W - 1)) {
			bool f = true;
			REP(k, W - 2) {
				if (((j >> k) & 1)&&((j >> (k + 1)) & 1)) {
					f = false;
				}
			}
			if (!f) {
				continue;
			}
			
			int s[8] = { 0 };
			REP(k, W - 1) {
				
				if ((j >> k) & 1) {
					dp[k][i] = add(dp[k][i], dp[k + 1][i - 1]);
					dp[k + 1][i] = add(dp[k][i - 1], dp[k + 1][i]);
					s[k] = 1;
					s[k + 1] = 1;
					//cout << j << k << endl;
				}
			}
			REP(k, W) {
				if (s[k] == 0) {
					dp[k][i] = add(dp[k][i - 1], dp[k][i]);
				}
			}
		}
	}

	cout << dp[K - 1][H];



	return 0;
}

Measured memory_bytes: 256
s = input()
a = []
b = []
cnt = 0
if len(s)%2 == 0:
    a = list(s[:int(len(s)/2)])
    b = list(s[int(len(s)/2):])
else:
    a = list(s[:int((len(s)-1)/2)])
    b = list(s[int((len(s)+1)/2):])
b.reverse()
for i in range(len(a)):
    if a[i] != b[i]:
        cnt += 1

print(cnt)

Measured memory_bytes: 38256
<?php
// Your code here!
$temp = trim(fgets(STDIN));

list($c1,$c0,$c_1,$num) = explode(' ',$temp); 

//総数より１の数の方が多ければそれで終わり
if($c1 >= $num){
    echo $num; exit;
}

if(($c1 + $c0) >= $num ){
    echo $c1; exit;
}

$ans = $c1 - (1 * (min($c_1, $num - ($c1 + $c0)) ) );
echo $ans;
?>


Measured memory_bytes: 16240
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

int main()
{
  vector<pair<int, int>> s;
  ll h, w, n;
  cin >> h >> w >> n;
  REP(i, n)
  {
    int a, b;
    cin >> a >> b;
    REP(j, 3)
    {
      REP(k, 3)
      {
        if (0 < a - j && a - j <= h - 2 && 0 < b - k && b - k <= w - 2)
        {
          s.push_back(make_pair(a - j, b - k));
        }
      }
    }
  }
  sort(s.begin(), s.end());

  ll result[10] = {};
  int i = 0;
  while (i < s.size())
  {
    int c = 1;
    auto p = s[i];
    while (i < s.size() && s[i] == s[i + 1])
    {
      c++;
      i++;
    }
    result[c]++;
    i++;
  }

  result[0] = (h - 2) * (w - 2);
  FOR(i, 1, 10)
  {
    result[0] -= result[i];
  }

  REP(i, 10)
  {
    cout << result[i] << endl;
  }
}


Measured memory_bytes: 10476
#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<int,int>
#define vint vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define red(i,a,b) for(int i=(a);i>=(b);i--)
#define db double
#define ld long db
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
int read(){
	int g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const int N=2e5+5;
const int maxn=2e5;
const int mod=1e9+7;
int fac[N],inv[N],n,m,a,b,ans;
int C(int n,int m){return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
signed main(){
	//freopen("a","r",stdin);
	n=read(),m=read(),a=read(),b=read();
	fac[0]=1;rep(i,1,maxn)fac[i]=1ll*fac[i-1]*i%mod;
	inv[1]=1;rep(i,2,maxn)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;rep(i,1,maxn)inv[i]=1ll*inv[i-1]*inv[i]%mod;
	a=n-a-1;
	rep(i,0,a)ans=(ans+1ll*C(i+b-1,b-1)*C(n+m-2-b-i,n-1-i)%mod)%mod;
	return cout<<ans,signed();
}

Measured memory_bytes: 5192
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
#define pb push_back


const int H = 11;
const int W = 5;
int h;
int board[H][W];

bool input(){
	cin>>h;
	if(h==0)return false;
	
	rep(i,H)rep(j,W)board[i][j]=0;
	rep(i,h){
		rep(j,W)cin>>board[i][j];
	}
	return true;
}


int dela[H][W];

void calc_del(){
	rep(i,H)rep(j,W)dela[i][j]=0;
	rep(i,h){
		rep(j,W-2){
			int num = board[i][j];
			bool hit = true;
			rep(k,3){
				if(board[i][j+k]!=num)hit=false;
			}
			if(hit){
				rep(k,3)dela[i][j+k]=1;
			}
		}
	}
}

int del(){
	int ans = 0;
	rep(i,H){
		rep(j,W){
			if(dela[i][j]==1){
				ans += board[i][j];
				board[i][j]=0;
			}
		}
	}
	return ans;
}

void tume(){
	rep(i,h){
		for(int i=h-1;i>=1;i--){
			rep(j,W){
				if(board[i][j]==0){
					swap(board[i][j], board[i-1][j]);
				}
			}
		}
	}
}

void print(){
	rep(i,h){
		rep(j,W){
			printf("%d ",board[i][j]);
		}puts("");
	}
}

void solve(){
	int ans= 0;
	while(1){
		//print();puts("");
		
		calc_del();
		int val = del();
		ans += val;
		if(val==0)break;
		tume();
		
	}
	cout<<ans<<endl;
}

int main(){
	while(input())solve();
}

Measured memory_bytes: 1160
import sys
sys.setrecursionlimit(1000000)


N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(int, input().split())
  friend[a-1].append(b-1)
  friend[b-1].append(a-1)
for _ in range(K):
  c, d = map(int, input().split())
  block[c-1].append(d-1)
  block[d-1].append(c-1)


friendnetwork = []
sgn = [0 for _ in range(N)]
groupnum = 0

def makenetwork(n, groupnum):
  for item in friend[n]:
    if sgn[item] > 0:
      continue
    else:
      sgn[item] = groupnum
      makenetwork(item, groupnum)

for k in range(N):
  if sgn[k] == 0:
    groupnum += 1
    sgn[k] = groupnum
    makenetwork(k, groupnum)


friends = [[] for _ in range(groupnum)]
for k in range(N):
  friends[sgn[k]-1].append(k)

ans = []
for k in range(N):
  num = len(friends[sgn[k]-1])-1  - len(friend[k])
  for item in block[k]:
    if sgn[item] == sgn[k]:
      num -= 1
  ans.append(num)

a = str(ans[0])
for j in range(1, len(ans)):
  a += ' '+ str(ans[j])
print(a)

Measured memory_bytes: 64512
#include <iostream>

using namespace std;

const int M = 1e9+7;

int dp[1000100];

int mpow(long long a, int n) {
  if (n % 2) return mpow(a, n-1) * a;
  if (n == 0) return 1;
  return mpow(a*a, n/2);
}

int main()
{
  int n, h, d; cin >> n >> h >> d;
  
  long long kaijo = 1, kaijo_sum = 0;
  for (int i = 1; i <= n; ++i) {
    kaijo = kaijo * i % M;
    kaijo_sum = (kaijo_sum + kaijo) % M;
  }
  
  long long sum = dp[0] = kaijo;
  for (int i = 1; i < h; ++i) {
    dp[i] = sum * kaijo_sum % M;
    sum = (sum + dp[i]) % M;
    if (i >= d) sum = (sum - dp[i-d] + M) % M;
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 4096