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

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
        if (k == a.at(i)) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    sort(a.begin(), a.end(), greater<int>());

    if (a.at(0) < k) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    set<ll> set1;
    for(ll i=0; i<n; i++){
        if (a.at(i) - k < 0) break;
        set1.insert(a.at(i) - k);
    }

/*
    for(auto s1: set1){
        cout << s1;
    }
    cout << 0 % 1 << endl;
    return 0;
*/

    set<ll> set2;
    for(ll i=0; i<n-1; i++){
        if (a.at(i) - a.at(i+1) > 0){
            set2.insert(a.at(i) - a.at(i+1));
        }
    }
/*
    for(auto s2: set2){
        cout << s2;
    }
*/

    for (auto s1: set1){
        for (auto s2: set2){
            if (s1 % s2 == 0){
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;

}


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

int main(){
  int N ; 
  cin >> N ; 
  int M = 0 , L=0 , P=0 ; 
  
  for(int i = 0 ; i < N ; i++){
    long long a ;
    cin >> a ; 
    if(a%2 != 0 && a%4 != 0 ) P++  ;
    else if(a%4 == 0 ) L++ ; 
  }
  
  if( P <= L || ( P == L+1  && P+L == N  )) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}

Measured memory_bytes: 3596
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll mod = 1000000007;
ll a[200005];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n, greater<ll>());
	ll ans = 0;
	n--;
	ll count = 0;
	ll flag = 0;
	if (n == 1) {
		cout << a[0] << endl;
		return 0;
	}
	while (n > 0) {
		if (flag == 0) {
			flag = 1;
			ans += a[count];
			count++;
			n--;
		}
		if (n - 2 >= 0) {
			ans += 2 * a[count];
			n -= 2;
			count++;
		}
		else {
			ans += a[count];
			n--;
			count++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5188
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, M, X;
	cin >> N >> M >> X;
	vector<int>A(M);
	int x = 0;
	int y = 0;
	for (int i = 0;i<M;++i) {
		cin >> A[i];
		if(X<A[i]){
			x++;
		}
		else {
			y++;
		}
	}
	cout << min(x,y) << endl;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<complex>
#include<set>
#include<map>
#include<queue>

using namespace std;

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

const int H = 33;

class P{
	public:
	int x,y,dir,val;
	P(int x,int y,int dir,int val):x(x),y(y),dir(dir),val(val){}
	bool operator<(const P& a)const{
		return val>a.val;
	}
};

int w,h;
int masu[H][H];
int cost[4];

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

void initQue(priority_queue<P>& que){
	que.push(P(0,0,0,0));
}

void addQue(priority_queue<P>& que, P& u){
	
	int ndx = dx[u.dir];
	int ndy = dy[u.dir];
	
	for(int i=0;i<4;i++){
		
		int c = cost[i];
		if(i==masu[u.y][u.x])c = 0;
		
		que.push(P(u.x+ndx, u.y+ndy, (u.dir+i)%4, u.val+c));
		
		int temp = ndx;
		ndx = -ndy;
		ndy = temp;
	}
}

bool isGoal(P& u){
	return u.x==w-1 && u.y==h-1;
}

int visit[H][H][4];
int solve(){
	rep(i,h)rep(j,w)cin>>masu[i][j];
	
	priority_queue<P> que;
	initQue(que);
	
	rep(i,4)cin>>cost[i];
	
	rep(i,H)rep(j,H)rep(k,4)visit[i][j][k]=0;
	while(1){
		if(que.empty())break;
		
		P u = que.top();
		que.pop();
		
		if(u.x<0 || u.y<0 || u.x>=w || u.y>=h)continue;
		
		if(visit[u.x][u.y][u.dir]==1)continue;
		visit[u.x][u.y][u.dir]=1;
		
		//printf("%d %d %d %d\n",u.x,u.y,u.dir,u.val);
		
		if(isGoal(u)){
			return u.val;
		}
		
		addQue(que,u);
	}
	return -1;
}

int main(){
	while(1){
		cin>>w>>h;
		if(w==0 && h==0)break;
		printf("%d\n",solve());
		//break;
	}
}

Measured memory_bytes: 1328
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, m;
    int[] dis;
    int ans;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    m = sc.nextInt();
	    dis = new int[n+1];
	    for(int i=2; i<dis.length; i++)
		dis[i] = dis[i-1]+sc.nextInt();

	    ans = 0;
	    int here = 1;
	    for(int k=0; k<m; k++){
		int next = sc.nextInt() + here;
		ans += Math.abs(dis[next] - dis[here]);
		ans %= 100000;
		here = next;
	    }
	    System.out.println(ans);
	}
    }
}

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

using namespace std;

string s;

std::string replaceStringAll(std::string str,
                             const std::string &replace,
                             const std::string &with) {
    if (!replace.empty()) {
        std::size_t pos = 0;
        while ((pos = str.find(replace, pos)) != std::string::npos) {
            str.replace(pos, replace.length(), with);
            pos += with.length();
        }
    }
    return str;
}


void solve() {
    reverse(s.begin(), s.end());
    string divide[4] = {"dream", "dreamer", "erase", "eraser"};
    for (auto &i : divide) {
        reverse(i.begin(), i.end());
    }
    bool can = true;
    for (int j = 0; j < s.size();) {
        bool can2 = false;
        for (int k = 0; k < 4; ++k) {
            string d = divide[k];
            if (s.substr(j, d.size()) == d) {
                can2 = true;
                j += d.size();
            }
        }
        if (!can2) {
            can = false;
            break;
        }
    }
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main() {
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 3636
import numpy as np
def solve(n, k, aaa, fff):
    aaa = np.sort(aaa)
    fff = np.sort(fff)[::-1]
    l = 0
    r = 10 ** 12
    while l <= r:
        m = (l + r) // 2
        req = np.clip(aaa - m // fff, 0, None).sum()
        if req > k:
            l = m + 1
        else:
            r = m - 1
    return l
n, k = list(map(int, input().split()))
aaa = np.array(list(map(int, input().split())), dtype=np.int64)
fff = np.array(list(map(int, input().split())), dtype=np.int64)
print(solve(n, k, aaa, fff))

Measured memory_bytes: 37196
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	in := readLine()
	ins := strings.Split(in, "")

	for i := 0; i < 4; i++ {
		if 2 != strings.Count(in, ins[i]) {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

int main()
{
    long long n, i, l, cnt = 0;
    string s;
    cin >> s;
    l = s.size();

    for(i=0; i<l; i++)
    {
        if(i%2 == 0 && (s[i] == 'L'))
        {
            cout << "No\n";
            return 0;
        }
        else if(i%2 == 1 && (s[i] == 'R'))
        {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 256
test = "keyence"
S = input()

isOk = False

for k in range(8):
    if k == 0:
        temp = S[-7:]
    elif k == 7:
        temp = S[:7] 
    else:
        temp = (S[0:k] + S[-(7 - k):])
    if temp == test:
        isOk = True

if isOk:
    print("YES")
else:
    print("NO")            

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int d;

    cin >> d;

    cout << "Christmas";

    REP(i, 25 - d)
    {
        cout << " Eve";
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;

int n;
LL a[505][505];

LL gcd(LL a,LL b){
	return !b?a:gcd(b,a%b);
}
LL lcm(LL a,LL b){
	if(a==0)return b;
	if(b==0)return a;
	return a/gcd(a,b)*b;
}

int notpm[100005],pm[100005],pcnt=0;
void xxs(){
	notpm[1]=1;
	for(int i=2;i<=100000;i++){
		if(!notpm[i]){
			pm[++pcnt]=i;
		}
		for(int j=1;pm[j]*i<=100000&&j<=pcnt;j++){
			notpm[i*pm[j]]=1;
			if(i%pm[j]==0)break;
		}
	}
}

int main(){
	LL cnt=0;
	scanf("%d",&n);
	if(n==2){
		puts("4 7\n23 10");
		return 0;
	}
	xxs();
	
	for(int i=1;i<=n;i++){
		for(int j=(i%2==0)+1;j<=n;j+=2){
			a[i][j]=pm[(i+j)/2];
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=(i%2==0)+1;j<=n;j+=2){
//			printf("%d %d %d\n",i,j,n+(j-i+1)/2+2);
			a[i][j]*=pm[n+(j-i+((j-i)%2==0?0:1))/2+2];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(!a[i][j]){
				a[i][j]=lcm(lcm(lcm(a[i-1][j],a[i][j-1]),a[i][j+1]),a[i+1][j])+1;
			}
		}
	}
	LL mx=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
//			if(a[i][j]==9223216780099161841){
//				printf("%d %d %lld %lld %lld %lld\n",i,j,a[i-1][j],a[i+1][j],a[i][j-1],a[i][j+1]);
//			}
//			mx=max(mx,a[i][j]);
			printf("%lld ",a[i][j]);
		}
		puts("");
	}
//	printf("%lld\n",mx);

	return 0;
}


Measured memory_bytes: 5504
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){

    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> v(n);
    for(int i = 0; i < n; i++){
    	scanf("%d", &v[i]);
    }
	vector<int> dp(n, 0);
	dp[0] = 0;
	for(int i = 1; i < n; i++){
		dp[i] = dp[i-1] + abs(v[i] - v[i-1]);
		for(int j = 2; j <= k; j++){
			if(i < j) break;
			dp[i] = min(dp[i], dp[i-j] + abs(v[i]-v[i-j]));
		}
	}
	printf("%d\n", dp[n-1]);
	return 0;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    var ps = readLine()!!.split(" ").map { it.toLong() }
    var max = Long.MAX_VALUE
    var ans = 0L
    for (p in ps) {
        if (p <= max) {
            ans++
            max = p
        }
    }
    println(ans)

}


Measured memory_bytes: 82508
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


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

ll lcm(ll a, ll b){
    ll g = gcd(a, b);
    return a / g * b;
}

int main(){
    int n; ll a; cin >> n >> a;
    REP(i, n-1){
        int b; cin >> b;
        a = lcm(a, b);
    }
    cout << a << endl;
    return 0;
}



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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a[123456], c;

int main() {
	cin >> n;
	repst(i,1,n) {
		cin >> a[i];
		c += (a[a[i]]==i);
	}
	cout << c << ln;
}

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

int main(){
  int N;
  cin >> N;
 
  vector<vector<int>> data(4, vector<int>(2));
 
  data.at(0).at(0) = N/1000;
  data.at(0).at(1) = data.at(0).at(0);
  N -= 1000*data.at(0).at(0);
  
  data.at(1).at(0) = N/100;
  data.at(1).at(1) = -data.at(1).at(0);
  N -= 100*data.at(1).at(0);
  
  data.at(2).at(0) = N/10;
  data.at(2).at(1) = -data.at(2).at(0);
  N -= 10*data.at(2).at(0);
  
  data.at(3).at(0) = N;
  data.at(3).at(1) = -data.at(3).at(0);

  int sum = 0;
  bool flag1,flag2;
  flag1 = false;
  flag2 = false;
  for (int i = 0; i < 2; i++){
    if (flag1) break;
     for (int j = 0; j < 2; j++){
       if (flag2) break;
        for (int k = 0; k < 2; k++){
          sum = data.at(0).at(0) + data.at(1).at(i) + data.at(2).at(j) + data.at(3).at(k);
          if (sum == 7){
            string eq = to_string(data.at(0).at(0));
            if (data.at(1).at(i) >= 0){
              eq += "+"+to_string(data.at(1).at(i));
            }else{
              eq += to_string(data.at(1).at(i));
            }
            if (data.at(2).at(j) >= 0){
              eq += "+"+to_string(data.at(2).at(j));
            }else{
              eq += to_string(data.at(2).at(j));
            }
            if (data.at(3).at(k) >= 0){
              eq += "+"+to_string(data.at(3).at(k));
            }else{
              eq += to_string(data.at(3).at(k));
            }
            eq += "=7";
            cout << eq << endl;
            flag1 = true;
            flag2 = true;
            break;
     
          }
        }
     }
  }
  
 

  
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main() {
  int N;
  cin >> N;
  vector<int> T(N), A(N);
  rep(i, N) cin >> T[i] >> A[i];
  vector<ll> d(N);
  d[0] = 1;
  for(int i=1; i<N; i++)
    d[i] = max((d[i-1]*T[i-1]+T[i]-1)/T[i], (d[i-1]*A[i-1]+A[i]-1)/A[i]);
  cout << T[N-1]*d[N-1]+A[N-1]*d[N-1] << endl;
  return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

struct UnionFindTree {
  vector<int> data;

  UnionFindTree(int sz) { data.assign(sz, -1); }

  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }

  int find(int k) {
    if (data[k] < 0) return k;
    return data[k] = find(data[k]);
  }

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

  int size(int k) { return -data[find(k)]; }
};

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  UnionFindTree uf(n);
  vector<int> fri(n, 0), nofri(n, 0);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    uf.unite(a, b);
    fri[a]++;
    fri[b]++;
  }
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    if (uf.same(c, d)) {
      nofri[c]++;
      nofri[d]++;
    }
  }

  rep(i, n) { cout << uf.size(i) - 1 - fri[i] - nofri[i] << ' '; }

  cout << endl;
}


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

int main()
{
  i64 A, B;
  cin >> A >> B;
  for (i64 i = 0; i < 10000; i++)
    if ((i64)(i * 0.08) == A && (i64)(i * 0.1) == B)
    {
      cout << i << endl;
      return 0;
    }
  cout << -1 << endl;
  return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	double A, B, H, M;
	cin >> A >> B >> H >> M;
	double deg = H*30+M/60*30 - M*6;
	while (deg < 0) deg += 360;
	double res = sqrt((A*A + B*B) - 2*A*B*cos(deg/180*M_PI));

	cout << fixed << setprecision(15) << res << endl;
}


Measured memory_bytes: 4244
R,G,B,N = map( int, input().split())
count = 0
rmax = N//R
gmax = N//G
for r in range(rmax+1):
  tmp = r * R
  for g in range(gmax+1):
    tmp2 = N - (tmp+g*G)
    if tmp2 < 0:
      break
    if (tmp2 % B) == 0:
      count+=1
print(count)


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

using namespace std;
using ll = long long;


int main()
{
    int n, m;
    cin >> n >> m;
    map<int,vector<int>> a;
    for(int i = 0; i < n; i++){
        int t, k; cin >> t >> k;
        a[t].push_back(k);
    }

    priority_queue<int> que;
    int sum = 0;
    for(int i = 0; i <= m; i++) {
        for(auto j : a[i]) {
            que.push(j);
        }
        if(que.empty())continue;
        sum += que.top();
        que.pop();
    }
    cout << sum << endl;

}

Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
struct activities {
    int A, B, C;
};


int maxhappines(vector<activities>& act, int N) {
    vector<vector<int>> dp(N, vector<int>(3, 0));

    // base case - if only one day
    dp[0][0] = act[0].A;
    dp[0][1] = act[0].B;
    dp[0][2] = act[0].C;

    for(int i = 1; i < N; ++i) {
        dp[i][0] = act[i].A + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = act[i].B + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = act[i].C + max(dp[i - 1][0], dp[i - 1][1]);
    }

    // for(auto& x : dp) {
    //     for(auto& n : x) {
    //         cout << n <<" ";
    //     }
    //     cout <<"\n";
    // }
    return max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
}
int main() {
    int N;
    cin >> N;

    vector<activities> act(N);

    for(int i = 0; i < N; ++i ) {
        cin >> act[i].A >> act[i].B >> act[i].C;
    }
    
    cout << maxhappines(act, N) << endl;
}


Measured memory_bytes: 6912
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let a = get!();
    let b = get!();
    
    let ans = std::cmp::min(n * a, b);
    
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    ll N, X, M;
    void input() { cin >> N >> X >> M; }
    void output() {
        ll res = X;
        ll i = 1;
        set<ll> st;
        ll r = X % M;
        vector<ll> v;
        for (; i < N; ++i) {
            r = r * r % M;
            if (st.count(r)) break;
            st.emplace(r);
            v.emplace_back(r);
        }
        if (i == N) {
            for (auto &x : v) { res += x; }
            cout << res << endl;
            return;
        }
        ll j = 0;
        for (; j < v.size(); ++j) {
            if (v[j] == r) break;
            res += v[j];
        }
        vector<ll> csum = {0};
        for (ll k = j; k < v.size(); ++k) {
            csum.emplace_back(csum.back() + v[k]);
        }
        res += (N - 1 - j) / (v.size() - j) * csum.back();
        res += csum[(N - 1 - j) % (v.size() - j)];
        cout << res << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


Measured memory_bytes: 6708
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((int)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    int n;
    string s;
    cin >> n >> s;
    if (n >= 3200) cout << s << endl;
    else cout << "red\n";
}

int main()
{
    solve();
//    cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




Measured memory_bytes: 256
N=int(input())
s=['a']*N
for i in range(N):
	s[i] = input()

M=int(input())
t=['b']*M
for k in range(M):
	t[k] = input()

ans = 0
tmp = 0

for i in range(N):
	tmp = int(s.count(s[i]) - t.count(s[i]))
	if ans < tmp:
		ans = tmp

print(ans)

Measured memory_bytes: 3064
var
	L,R,a,b,c,now,ans:Longint;
begin
	read(L,R);
	for a:=1 to 9 do for b:=0 to 9 do for c:=0 to 9 do begin
		now:=a*10000+b*1000+c*100+b*10+a;
		if(L<=now)and(now<=R)then inc(ans);
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    // Your code here!
    long long n,x;
    cin >> n >> x;
    vector<long long> v(n);
    for(int i = 0; i < n; i++)cin >> v[i];
 
    long long ans = 0;   
	if(v[0] > x){
    	ans += (v[0]-x);
    	v[0] -= (v[0]-x);
  	}
 
    for(long long i = 1; i < n; i++){
        if(v[i-1] + v[i] > x){
            ans += abs(v[i-1] + v[i]) - x;
            v[i] -= abs(v[i-1] + v[i]) - x;
        }
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 1024
import math
n, m = map(int, input().split())
root_m = int(math.sqrt(m))
ans = 1
for a in range(1, root_m):
    # print(a, ans)
    if m % a == 0:
        b = m // a
        if a * n <= m:
            ans = max(ans, a)
        if b * n <= m:
            ans = max(ans, b)
print(ans)

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

int h,w;

void dfs(int i,int j,vector<string> s,vector<vector<int>> &t,ll &white,ll &black,stack<vector<int>> &tmp){
    if(t[i][j]!=-1)return;
    if(s[i][j]=='.'){white++; t[i][j]=0;}
    else{black++; t[i][j]=1;}
    vector<int> x={0,0,-1,1},y={-1,1,0,0};
    rep(k,4){
        if(i+x[k]>=0 && i+x[k]<h && j+y[k]>=0 && j+y[k]<w){
            if(s[i][j]==s[i+x[k]][j+y[k]]) continue;
            tmp.push({i+x[k],j+y[k]});
        }
    }
}

int main(){
    cin>>h>>w;
    vector<string> s(h);
    vector<vector<int>> t(h,vector<int>(w,-1));
    ll ans=0;
    stack<vector<int>> tmp;
    rep(i,h) cin>>s[i];
    rep(i,h){
        rep(j,w){
            if(t[i][j]==-1){
                ll white=0,black=0;
                tmp.push({i,j});
                while(!tmp.empty()){
                    vector<int> a=tmp.top();
                    tmp.pop();
                    dfs(a[0],a[1],s,t,white,black,tmp);
                }
                ans+=white*black;
            }
        }
    }
    cout<<ans<<endl;
}

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

int N, K;

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

    if(K > (N - 1) * (N - 2) / 2){
        cout << -1 << endl;
        return 0;
    }

    int M = (N - 1) + ( (N - 1) * (N - 2) / 2 - K );
    cout << M << endl;
    for(int i = 2; i <= N; i++){
        cout << 1 << " " << i << endl;
    }
    int edge_cnt = 0;
    for(int i = 2; i <= N; i++){
        for(int j = i + 1; j <= N; j++){            if(edge_cnt >= (N - 1) * (N - 2) / 2 - K){
                return 0;
            }

            cout << i << " " << j << endl;
            edge_cnt++;
        }
    }
}

Measured memory_bytes: 256
def main():
  N, K = map(int, input().strip().split())

  # 回答が存在するかチェックする
  # スター型のグラフで、中心以外の頂点同志はすべて最短距離が2になる
  MAX = N * (N - 1) // 2 - (N - 1)
  if K > MAX:
    print("-1")
    return

  # 条件を満たす組み合わせが最大時の辺の数
  M = N - 1
  # Kに合わせて組み合わせを減らす。辺を一つ追加すれば組み合わせも一つ減る
  M += MAX - K
  print(M)

  # スター型
  for i in range(N - 1):
    print('{} {}'.format(1, i + 2))

  u = 2
  v = u + 1
  # 減らしたい分だけループ回す
  for _ in range(MAX - K):
    print('{} {}'.format(u, v))
    v += 1
    if v > N:
      u += 1
      v = u + 1


if __name__ == '__main__':
  main()

Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N ;
  cin >> N ;
  
  vector<int> vec(2*N) ;
  for(int i=0 ; i < 2*N ; i++){
    cin >>vec.at(i) ;
  }
  sort(vec.begin(), vec.end());
  int ans=0 ;
  for(int j=0 ; j<N ; j++){
   ans += vec.at(2*j) ;
  }
cout<< ans << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
using namespace std;


int main() {
  int a,b,k;
  cin>>a>>b>>k;
  set<int> ans;
  fr(i,0,k) {
    if(a+i <= b) ans.insert(a+i); 
  }
  for(int i = 0;i < k;i++) {
    if(b-i >= a) ans.insert(b-i);
  }
  for(int x: ans) {cout<<x;nl;}
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define mod 1000000007

int main()
{

    ll n, k;
    cin >> n >> k;
    map<ll,ll> m;
    vector<ll> v;
    for(ll i = 0; i < n; i++)
    {

        ll x, y;
        cin >> x >> y;
        if(m[x]==0) v.pb(x);
        m[x]+=y;
    }
    sort(all(v));
    ll ans=v[0];
    for(ll i  =0; i < v.size(); i++)
    {

        if(k==0) break;
        ll x = v[i];
        if(k > m[x]) k-=m[x];
        else
        {

            k=0;
            ans=v[i];
        }
    }
    cout << ans;
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define mk make_pair
#define pp pair<int,int>
#define ppl pair<long long int,long long int>
#define vec vector<int> 
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt") 

//solve()
int main(){
	string s;
	ll int k;
	int n;
	cin>>s>>k;
	n=s.length();
	int count=0;
	//cout<<n<<endl;
	for(int i=0;i<n;i++){
		//cout<<s[i]<<" "<<(s[i]=='1')<<endl;
		if(s[i]=='1') {
			count++;
		}
		else break;
	}
//	cout<<count<<endl;
	if(k<=count){
		cout<<1;
		return 0;
	}
	cout<<s[count];
}

Measured memory_bytes: 256
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0): # 四捨五入
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def round_up(a): # 切り上げ
    return int(a + 0.9)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a,b = map(int,input().split())
    ans = []
    if a < b:
        for i in range(b):
            ans.append(str(a))
    else:
        for i in range(a):
            ans.append(str(b))
    print(''.join(ans))
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 39020
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, T;
	cin >> N >> T;

	int ans = T;

	int a;
	cin >> a;
	FOR(i,1, N) {
		int b;
		cin >> b;
		ans += min(b - a, T);
		a = b;
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std;

#define ll long long

void solve() {
	int n;
	cin >> n;
	vector<int> a, b, c;
	for (int i = 0; i < n; i++) {
		int d;
		cin >> d;
		a.push_back(d);
	}
	for (int i = 0; i < n; i++) {
		int d;
		cin >> d;
		b.push_back(d);
	}
	for (int i = 0; i < n; i++) {
		int d;
		cin >> d;
		c.push_back(d);
	}
	sort(a.begin(), a.end());
	sort(c.begin(), c.end());
	
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ll dis = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		ll dis2 = c.end() - upper_bound(c.begin(), c.end(), b[i]);
		ans += dis*dis2;
	}
	cout << ans << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 4676
#include<bits/stdc++.h>
using namespace std;
int N;
int sum;
vector<int> as;
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        int A;
        cin >> A;
        as.push_back(A);
        sum += A;
    }
    sort(as.rbegin(), as.rend());

    sum -= 2* as[N - 1];
    for(int i = N - 2; i > 0; i--){
        if(as[i] < 0) sum -= 2 * as[i];
    }

    cout << sum << endl;

    int idx = 1;

    int x = as[N - 1], y;
    for(;idx < N - 1; idx++){
        if(as[idx] < 0) break;
        
        y = as[idx];
        cout << x << " " << y << endl;
        x = x - y;
    }

    y = x;
    x = as[0];
    cout << x << " " << y << endl;
    x = x - y;

    for(;idx < N - 1; idx++){
        y = as[idx];
        cout << x << " " << y << endl;
        x = x - y; 
    }
    return 0;
}

Measured memory_bytes: 2424
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    vector<P> p(n);
    REP(i,n){
        p[i].first = in();
        p[i].second = i;
    }
    sort(ALL(p));
    REP(i,n) cout << p[i].second + 1 << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 1536
#include <iostream>

using namespace std;

string prediction, actual;

int main() {

    cin >> prediction >> actual;

    int correct = 0;

    for (int i=0; i < prediction.length(); i++){
        if (prediction[i] == actual[i]){
            correct += 1;
        }
    }

    cout << correct;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, m, p, x;
		int[] t = new int[100];
		n = sc.nextInt();
		int[] xdiff = new int[100];
		for (int i = 0; i < n; i++) {
			t[i] = sc.nextInt();
		}
		m = sc.nextInt();
		for (int i = 0; i < m; i++) {
			p = sc.nextInt();
			x = sc.nextInt();
			xdiff[i] = t[p-1] - x;
			//System.out.println(t[p-1] + "-" + x);
		}
		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += t[i];
		}
		for (int i = 0; i < m; i++) {
			int result = sum - xdiff[i];
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 21972
s = input()
t = input()
num_s ={}
num_t ={}
for i in range(len(s)):
    si = s[i]
    ti = t[i]
    if si in num_s:
        num_s[si] +=1
    else:
        num_s[si] =1
    if ti in num_t:
        num_t[ti] +=1
    else:
        num_t[ti] =1

values_s = list(num_s.values())
values_t = list(num_t.values())
values_s.sort()
values_t.sort()
if values_s==values_t:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3632
#include<iostream>

using namespace std;

int main(){
    int N;
    int P[222222];
    int min[222222];
    int i;
    int ans = 1;
    cin >> N;
    for(i=0;i<=N-1;i++)
        cin >> P[i];
    min[0] = P[0];
    for(i=0;i<=N-2;i++){
        if(P[i+1]<min[i]){
            min[i+1] = P[i+1];
          	ans++;
        }
        else{
            min[i+1] = min[i];
        }
    }
  	if(N==1) ans = 1;
    cout << ans;
}

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

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

int A, B;

int main() {
	cin >> A >> B;

	int res = A + B;

	res = A - B > res ? A - B : res;
	res = A * B > res ? A * B : res;

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define pii pair<ll,ll>
#define ve(x) vector<x>
#define f(a,b,c) for(ll a=b;a<c;a++)
#define foto(x,v) for(auto x:v)
#define read(t) ll t; cin>>t;
#define reads(t) string t; cin>>t;
#define readarr(arr,n) ll arr[n]; f(i,0,n) cin>>arr[i];
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);	cout.tie(NULL);
const ll M = 1e9+7 , INF = 1e16;


// 														MAIN
int32_t main()
{ 
    FASTIO
    read(x)
    if(x>=30) cout<<"Yes\n";
    else cout<<"No";
}



Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * A-Z Cat
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		line = br.readLine();

		int count = 0;
		boolean a = true;
		for (char c : line.toCharArray()) {
			if (c == 'A' && a) {
				a = false;
			}
			if (c == 'Z' && !a) {
				count++;
				a = true;
			}
		}

		if (count != 0) {
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < count; i++) {
				sb.append("AZ");
			}
			System.out.println(sb.toString());
		} else {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 24492
#include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
int main(){
	fio;
	char s;
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>s;
		if(i==m)s+=32;
		cout<<s;
	}
}

Measured memory_bytes: 256
import sys
import numpy as np
input = sys.stdin.readline
def main():
    n,m = map(int,input().split())
    xyz = [[] for _ in range(8)]
    pm = [[ 1, 1, 1],
          [ 1, 1,-1],
          [ 1,-1, 1],
          [-1, 1, 1],
          [ 1,-1,-1],
          [-1, 1,-1],
          [-1,-1, 1],
          [-1,-1,-1]]
    pm = np.array(pm)
    for _ in range(n):
        x,y,z = map(int,input().split())
        for i in range(8):
            k = np.array([x,y,z])
            xyz[i].append(sum(pm[i]*k))
    ans = -10**20
    for i in range(8):
        X = xyz[i]
        X.sort(reverse=True)
        cnt = 0
        for j in range(m):
            cnt += X[j]
        ans = max(ans,cnt)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 14788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long A = GetLong();
		long B = GetLong();
		long K = GetLong();

		long dA = Min(A, K);
		long dB = Min(B, K - dA);
		WriteLine($"{A - dA} {B - dB}");
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

int main(void){
    int n;
    cin >> n;
    int ans=0;
    for(int i=1;i<=n;i+=2){
        ll cnt =0;
        for(int j=1;j<=i;j++){
            if(i%j==0){
                cnt++;
            }
        }
        if(cnt==8){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

    int swi[m][n];
    rep(i, m) rep(j, n) swi[i][j] = 0;

    rep(i, m)
    {
        int k;
        cin >> k;
        rep(j, k)
        {
            int s;
            cin >> s;
            s--;
            swi[i][s] = 1;
        }
    }

    int p[m];
    rep(i, m) cin >> p[i];

    int cnt = 0;

    for (int bit = 0; bit < (1 << n); bit++)
    {
        int a[n] = {};
        for (int i = 0; i < n; i++)
        {
            if (bit & (1 << i))
                a[i] = 1;
        }
        bool flag = 0;
        rep(i, m)
        {
            int sum = 0;
            rep(j, n)
            {
                if (swi[i][j] == 0)
                    continue;
                if (a[j] == 1)
                    sum++;
            }
            if (sum % 2 != p[i]) //点灯するかどうか
                flag = 1;
        }
        if (flag == 0)
            cnt++;
    }

    OP(cnt);
    return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  int ans = 0;
  int x;
  
  if (a < b) {
    // bをa桁
    x = a;
    for (int i = 0; i < b; i++) {
      ans += x;
      x *= 10;
    }
  } else if (a > b) {
    x = b;
    for (int i = 0; i < a; i++) {
      ans += x;
      x *= 10;
    }
  } else {
    x = a;
    for (int i = 0; i < a; i++) {
      ans += x;
      x *= 10;
    }
  }
  cout << ans << endl;
    
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <assert.h>

using namespace std;

#define sz(X) ((int)(X).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(X) (X).begin(),(X).end()
#define FOR(I,S,N) for(int I=(S);I<(N);++I)
#define REP(I,N) FOR(I,0,N)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

pair<int, ll> processBlock(int n, ll c) {
    assert(c > 0);
    if (c == 1) {
        return mp(n, 0LL);
    }
    if (c % 2 == 0) {
        if (2 * n < 10) {
            auto x = processBlock(2 * n, c / 2);
            return mp(x.X, x.Y + c/2);
        } else {
            int d = (2 * n) / 10 + (2 * n) % 10;
            auto x = processBlock(d, c / 2);
            return mp(x.X, x.Y + c);
        }
    }
    auto x = processBlock(n, c - 1);
    if (n + x.X < 10) {
        return mp(n + x.X, x.Y + 1);
    } else {
        int d = (n + x.X) / 10 + (n + x.X ) % 10;
        return mp(d, x.Y + 2);
    }
}

ll solve(const vll& d, const vll& c) {
    ll ret = 0;
    vll a;
    REP(i, sz(d)) {
        auto x = processBlock(d[i], c[i]);
        ret += x.Y;
        a.pb(x.X);
    }
    while (sz(a) > 1) {
        int d1 = a[sz(a)-1];
        int d2 = a[sz(a)-2];
        a.pop_back();
        a.pop_back();
        ret += 1;
        if (d1 + d2 < 10) {
            a.pb(d1 + d2);
        } else {
            a.pb(1);
            a.pb((d1 + d2) % 10);
        }
    }
    return ret;
}

int main() {

    int n;

    cin >> n;
    vll d(n), c(n);

    REP(i, n) {
        cin >> d[i] >> c[i];
    }

    ll ans = solve(d, c);
    cout << ans << endl;
}


Measured memory_bytes: 5620