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

#define AS(arr)  (sizeof(arr)/sizeof(arr[0]))
#define ALL(c) (c).begin(),(c).end() 
#define SIZE(a) int((a).size())
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define REP(i,n) for(int i=0;i<(int)n;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl

#define pb push_back
#define mp make_pair

typedef vector<int> VI;
typedef vector<string> VS;
typedef long long LL;

const double EPS = 1e-11;
#define EQ(a,b) (abs(a-b)<EPS)
#define EQ0(x) (abs(x)<EPS)

int main(void){
    LL x[3];
    cin >> x[0] >> x[1] >> x[2];
    sort(&x[0], &x[3]);
    if(x[0] % 2 == 0 || x[1] % 2 == 0 || x[2] % 2 == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << min(min(x[0] * x[1], x[1] * x[2]), x[0] * x[2]) << endl;
        
        
    }
    
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n, x0, y0, x1, y1, x2, y2, x3, y3;
    scanf("%d", &n);
    while(n--) {
        scanf("%d%d%d%d%d%d%d%d", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
        if ((x1-x0) * (y3-y2) - (y1-y0) * (x3-x2) == 0) puts("2");
        else if ((x1-x0) * (x3-x2) + (y1-y0) * (y3-y2) == 0) puts("1");
        else puts("0");
    }
}



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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1000000007ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;



int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    vector<pair<ll, int>> store(n);
    ll a; int b;
    rp(i, 0, n) {
        scanf("%lld%d", &a, &b);
        store.at(i) = make_pair(a, b);
    }
    sort(store.begin(), store.end());
    ll res = 0;
    int count = 0;
    int i = 0;
    while(count < m) {
        ll a = store.at(i).first;
        int b = store.at(i).second;
        if(count + b <= m) {
            res += a * b;
            count += b;
        } else {
            res += a * (m - count);
            count = m;
        }
        i++;
    }
    printf("%lld", res);
    return 0;
}

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

const int nmax = 8;
bool graph[nmax][nmax];

int main() {
  int N, M; cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int A, B; cin >> A >> B;
    graph[A-1][B-1] = graph[B-1][A-1] = true;
  }
  vector<int> nodes(N);
  for (int i = 0; i < N; i++) nodes[i] = i;
  int cnt = 0;
  do {
    bool flag = true;
    if (nodes[0] != 0) continue;
    for (int i = 0; i < N-1; i++) {
      if (graph[nodes[i]][nodes[i+1]] == false) flag = false; continue;
    }
    if (flag) cnt++;
  } while (next_permutation(nodes.begin(), nodes.end()));
  cout << cnt << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = a[0];
  for (int i = 1; i < n; i++) {
    int x = ans, y = a[i], z;
    if (x < y) {
      z = x;
      x = y;
      y = z;
    }
    int r = x%y;
    while (r != 0) {
      x = y;
      y = r;
      r = x%y;
    }
    ans = y;
  }
  cout << ans << endl;
}
   

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll long long
#define int long long
#define pb push_back
#define x first
#define ld long double
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) a.begin(),a.end()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ll ans = 0;
    vector <pair<int, int> > a(n);
    string s;
    map <pair<int, int>, int> have;
    for (int i = 0; i < n; i++) {
        cin >> s;
        int x = 0, len = 1;
        bool ok = false;
        for (char c : s) {
            if (c == '.') {
                ok = true;
            }
            else {
                x = x * 10 + c - '0';
                if (ok) len *= 10;
            }
        }
        int cnt2 = 0, cnt5 = 0;
        while (x % 2 == 0) {
            ++cnt2;
            x /= 2;
        }
        while (len % 2 == 0) {
            --cnt2;
            len /= 2;
        }
        while (x % 5 == 0) {
            ++cnt5;
            x /= 5;
        }
        while (len % 5 == 0) {
            --cnt5;
            len /= 5;
        }
        ++have[{cnt2, cnt5}];
    }
    for (auto &i : have) {
        for (auto &j : have) {
            if (i.x.x + j.x.x >= 0 && i.x.y + j.x.y >= 0) {
                if (i == j) {
                    ans += (ll)i.y * (i.y - 1ll);
                }
                else {
                    ans += (ll)i.y * j.y;
                }
            }
        }
    }
    cout << ans / 2ll << '\n';
}


Measured memory_bytes: 6336
//Author: master19
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ff first 
#define ss second 
#define pb push_back
#define endl "\n"
#define mod 1000000007LL // fixed...
#define modd 1000000007LL // Can be changed for global use
#define all(arr) arr.begin(),arr.end()
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define Sort(arr) sort(arr.begin(), arr.end())
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > new_ds; 
void debug_out() { cerr << endl; }
template <typename HeadStart, typename... TailEnd>
void debug_out(HeadStart H, TailEnd... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
ll lets_do_it();
pair < ll, ll > xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
pair < ll, ll > dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
bool isValid(ll x, ll y, ll row, ll col){
    return ((x>=0) && (y >=0)  && (x < row) && (y < col));
}
int main(int argc, const char** argv) {
    crap;
    ll test = 1;
    // cin >> test;
    for(int loop=0; loop<test; loop++){
        // cout << "Case #" << (loop+1) << ": "; 
        lets_do_it();
    }
    return 0;
}
ll lets_do_it(){
    // Your code goes by here !!
    ll num;
    cin >> num;
    vector < ll > arr(num+2, 1);
    arr[0] = arr[1] = arr[2] = 0;
    for(int i=3; i<=arr.size(); i++){
        for(int j=3; j>0; j++){
            if(i+j >= arr.size())
                break;
            arr[i+j] += arr[i];
        }
        for(int j=0; j<arr.size(); j++)
            arr[j] %= mod;
    }
    cout << arr[num]%mod << endl;





    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

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

	int ans = 0;
	int min = 99999999;
	for(int i = 1; i <= N; i++)
	{
		int tmp = L + i - 1;
		ans += tmp;
		if(abs(tmp) < abs(min)) min = tmp;
	}

	ans -= min;

	cout << ans << endl;

	return 0;
}


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

int N, K;

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

    if (K > (N-1)*(N-2)/2) {
        cout << -1 << endl;
    }
    else {
        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 x = (N-1)*(N-2)/2 - K;
        int p = 2;
        int q = 1;
        for (int i = 0; i < x; i++) {
            cout << p << " " << p+q << endl;
            q++;
            if (p+q > N) {
                p++;
                q = 1;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long ans=0;
long long db=0;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    for(long long i=0; i<s.size(); i++)
    {
        if(s[i]=='W')
        {
            ans+=i;
            ans-=db;
            db++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 720
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
B = inlist()
A = [0] * N
A[0] = B[0]
for i in range(N-2):
    A[i+1] = min(B[i], B[i+1])

A[N-1] = B[N-2]
print(sum(A))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#define PI 3.141592653589
typedef long long ll;
const int MOD = 1000000007;
const int INF = 2002002002;
const int di[] = { -1, 0, 1, 0 };
const int dj[] = { 0, -1, 0, 1 };
using namespace std;

int main() {
	int k;
	string s;
	cin >> k >> s;
	if (s.size() <= k)
		cout << s << endl;
	else {
		for (int i = 0; i < k; i++)
			cout << s[i];
		cout << "..." << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%d %d", $N, $M);

$ans = 0;
$v = array();
$sum = array();

for ($i = 0; $i < $M; $i++) {
    fscanf(STDIN, "%d %d", $a, $b);
    $v[$a][$b] = 1;
    $v[$b][$a] = 1;
}
if (DEBUG) var_dump($v);

$flag = true;
while($flag) {
    $flag = false;
    foreach ($v as $key => $val) {
        if (DEBUG) echo "no.{$key} " . count($val) . PHP_EOL;
        if (count($v[$key]) == 1) {
            $ans++;
            $flag = true;
            foreach ($v[$key] as $no => $one) {
                if (DEBUG) echo "X: no:{$no} one:{$one}\n";
                unset($v[$key][$no]);
                unset($v[$no][$key]);
            }
        } 
    }
    // sleep(1);
}
echo $ans . PHP_EOL;


Measured memory_bytes: 4604
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if X == 500 * i + 100 * j + 50 * k:
                cnt += 1
print(cnt)

Measured memory_bytes: 3316
# include <bits/stdc++.h>
# define fi first
# define se second
# define ll long long

using namespace std ;

string s, n ;
int x[30], cnt;

int main() {
    cin >> s ;
    for( int i = 0 ; i < 4 ; i ++ ) {
        x[s[i]-'A'] ++ ;
    }
    for( int i = 0 ; i < 26 ; i ++ ) {
        if( x[i] > 1 ) cnt ++ ;
    }
    if( cnt == 2 ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var s string
	fmt.Fscan(read, &s)

	ans := "Good"
	for i := 1; i < 4; i++ {
		if s[i-1] == s[i] {
			ans = "Bad"
		}
	}
	fmt.Fprintln(write, ans)
}


Measured memory_bytes: 640
/****************************************************************************************************
                                        SUBMITTED BY-

                                            AISH_07

****************************************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
#define sl set<ll>
#define vs vector<string>
#define pb push_back
#define vl vector<ll>
#define vi vector<int>
#define PI  3.14159265
#define mod 998244353
int main()
{
    ll n;
    cin>>n;

    cout<<(n*(n-1))/2<<"\n";
   return 0;
}


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

int main() {
  int a,b; cin >> a >> b;
  if(a<=b){
    cout << a;
  }
  else{
    cout << a-1;
  }
  
}

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

using namespace std;

#define db(x) cout << (x) << '\n';
#define all(x) x.begin(),x.end()
#define UNIQUE(x) sort(all(x)),x.resize(unique(all(x))-x.begin())
#define LB(v,x) lower_bound(all(v),x)
#define UB(v,x) upper_bound(all(v),x)
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define int long long
#define trick int m = (l+r)>>1,lc=n<<1,rc=lc|1

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

int dy[]={0,1,1,1,0,-1,-1,-1};
int dx[]={-1,-1,0,1,1,1,0,-1};
const int maxn = 1e5;
const int OO = 1e18;
const int mod = 1e9 + 7;
const double PI = acos(-1);

void maxself(int &a,int b)
{a=max(a,b);}
void minself(int &a,int b)
{a=min(a,b);}

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

//	freopen("name.in","r",stdin);
//	freopen("name.out","w",stdout);
	string s;
	cin >> s;
	int b=0,a=0;
	for(int i=0;i<s.size();i++)
	if(s[i]=='A')
	a++;
	else
	b++;
	if(a and b)
	cout << "Yes";
	else
	cout << "No";
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	vector<double> vec(n);
	rep(i, n) cin >> vec.at(i);

	while(vec.size()>1) {
		sort(vec.begin(), vec.end());
		vec.at(1) = (vec.at(0) + vec.at(1)) / 2;
		sort(vec.begin(), vec.end(), greater<double>());
		vec.pop_back();
	}
	cout << vec.at(0) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private static final int MAX = 10000000;
	private static final long[] fac = new long[MAX];
	private static final long[] finv = new long[MAX];
	private static final long[] inv = new long[MAX];
	private static final int MOD = 1_000_000_007;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		sc.close();

		int a=2*x-y,b=2*y-x;

		if(a<0||b<0||a%3+b%3>0) {
			System.out.println(0);
			return;
		}
		a/=3;
		b/=3;
		COMinit();
		System.out.println(COM(a+b,Math.min(a,b)));

	}

	private static void COMinit() {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[0] = inv[1] = 1;
		for(int i = 2;i < MAX;i++) {
			fac[i] = fac[i-1] * i %MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
			finv[i] = finv[i-1] * inv[i] %MOD;
		}
	}
	private static long COM(int n,int k) {
		if(n < k) {
			return 0;
		}
		if(n < 0 || k < 0) {
			return 0;
		}
		return fac[n] * (finv[k] * finv[n-k] % MOD)%MOD;
	}
}

Measured memory_bytes: 258644
#include<iostream>
#include<stdio.h>
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()

using namespace std;

int main(void){
    int n;
    int num[200];
    int i, cnt=0;
    int j=0;
    bool stu=true;

    cin >> n;

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

    while(stu){
        if(j == n-1){
            j = 0;
            cnt++;
        }
        else if(num[j]%2 == 1){
            stu = false;
        }
        else {
            num[j] = num[j]/2;
        }
        j++;
    }
    
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <stdio.h>
#include <algorithm>
using namespace std;

const double pi = acos(-1);

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm

    int N, M;
    cin >> N >> M;

    int a, s = 0;
    for( int i = 1; i <= M; i++ )
        cin >> a, s += a;

    if( s > N ){
        cout << "-1\n";
        return 0;
    }

    cout << N - s << "\n";
    return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

int a,b,x;

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

	cin>>x>>a>>b;
	x-=a;
	while(x-b>=0) x-=b;
	cout<<x<<endl;

	return 0;
}


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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll r = 0, g = 0, b = 0;
  for (const auto& c : s) {
    if (c == 'R')
      r++;
    else if (c == 'G')
      g++;
    else
      b++;
  }
  ll cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int k = 2 * j - i;
      if (k <= j || k > n - 1) continue;
      if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) {
        cnt++;
      }
    }
  }
  ll ans = r * g * b - cnt;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void) {

  int H, W;
  do {
    scanf("%d %d", &H, &W);
  } while (H < 1 || H > 20 || W < 1 || W > 20);

  int h, w;
  do {
    scanf("%d %d", &h, &w);
  } while (h < 1 || h > H || w < 1 || w > W);

  int n;
  n = (H * W) - (h * W) - (w * H) + (h * w);

  printf("%d\n", n);

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;

	if (s == u)a--;
	else b--;

	cout << a << " " << b << endl;
	return 0;
}

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

int main(){
  int n;cin>>n;
  string s;cin>>s;
  
  int cnt=0;
  string head="";
  for(int i=0;i<n;++i){
    if(s[i]=='(') {
      ++cnt;
    }else{
      if(cnt>0) {
        --cnt;
      }else{
        head += "(";
      }
    }
  }
  cout<<head<<s<<string(cnt,')')<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int K = 0, U = 1, P = 2, C = 3;

int main()
{
    string s;
    int n;
    while(getline(cin, s))
    {
        n = s.size();
        int cnt[4] = {};
        REP(n)
        {
            if(s[i] == 'K') cnt[K]++;
            if(s[i] == 'U') cnt[U]++;
            if(s[i] == 'P') cnt[P]++;
            if(s[i] == 'C') cnt[C]++;
        }
        int ans = 300;
        REP(4) ans = min(ans, cnt[i]);
        cout << ans << endl;

    }
    return 0;
}

Measured memory_bytes: 0
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int MOD = 1000000007;
int i, j, k, m, n, l;
ll ans;

int main() {
	//freopen("x.in", "r", stdin);
	cin >> n;
	vector<pii> v;
	F0(i, n) {
		cin >> j;
		v.push_back(pii(j, -1));
	}
	F0(i, n) {
		cin >> j;
		v.push_back(pii(j, 1));
	}
	sort(v.begin(), v.end());
	ans = 1;
	int b = 0;
	for (pii p : v) {
		if (p.second == 1) {
			if (b >= 0) b++; else {
				ans = ans * abs(b) % MOD;
				b++;
			}
		}
		else {
			if (b <= 0) b--; else {
				ans = ans * abs(b) % MOD;
				b--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2420
x1, y1, x2, y2 = [int(i) for i in input().split()]

dx = x2 - x1 
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx

x4 = x1 - dy
y4 = y1 + dx

#print(dx, dy)
print(x3, y3, x4, y4)

Measured memory_bytes: 3060
import sys
import time
st = time.perf_counter()
# ------------------------------

from collections import deque

N, M = map(int, input().split())
graph = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
D = deque([0])
visited = [False] * N
visited[0] = True
sirusi = [0] * N
while D:
    d = D.popleft()
    for i in graph[d]:
        if visited[i]: continue
        visited[i] = True
        D.append(i)
        sirusi[i] = d
print('Yes')
for i in range(1, N):
    print(sirusi[i] + 1)
    
# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 34760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 100000000000;
const int MOD = 1000000007;
int main(){
  int n,m;
  std::cin >> n>>m;
  vector<ll> a(n),b(n),c(m),d(m);
  rep(i,n)std::cin >> a[i]>>b[i];
  rep(i,m)std::cin >> c[i]>>d[i];
  
  rep(i,n){
    ll dist=INF,dum=0,num;
    rep(j,m){
      dum=0;
      dum+=abs(c[j]-a[i])+abs(d[j]-b[i]);
      if(dist>dum){dist=dum;num=j+1;}
    }
    std::cout << num << std::endl;
  }
  
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>vector<T> vec(int len, T elem) { return vector<T>(len, elem); } // auto dp = vec(52, vec(103, vec(103, INF)));
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>inline int popcount(T a) {return __builtin_popcount(a);}
template<class T>inline T emod(T a, T p) { return (a%p + p) % p;}
//-------------------
int h, w;
vector<string> s;
constexpr int MX = 3005;

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


int main() {
    cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15);
    cin >> h >> w;

    int C[2]; cin >> C[0] >> C[1]; C[0]--; C[1]--;
    int D[2]; cin >> D[0] >> D[1]; D[0]--; D[1]--;

    s.assign(h, "");
    rep(i, h) {
        cin >> s[i];
    }

    auto onfield = [&](int y, int x) {
        bool ans = true;
        if(y < 0 or h <= y) ans = false;
        if(x < 0 or w <= x) ans = false;
        return ans;
    };

    auto dp = vec(h, vec(w, INF));
    deque<pair<PII, int>> dq;
    dq.push_front({{C[0], C[1]}, 0});

    while(!dq.empty()) {
        auto [at, d] = dq.front(); dq.pop_front();
        if(dp[at.first][at.second]!=INF) continue;
        dp[at.first][at.second] = d;

        for(int i=-2; i<=2; i++) {
            for(int j=-2; j<=2; j++) {
                if(i==0 and j==0) continue;
                auto ni = at.first + i, nj = at.second + j;
                if(onfield(ni, nj) and s[ni][nj]=='.') {
                    if(abs(i)+abs(j) <= 1) {
                        if(dp[ni][nj] > d)
                        dq.push_front({{ni, nj}, d});
                    } else {
                        if(dp[ni][nj] > d)
                        dq.push_back({{ni, nj}, d+1});
                    }
                }
                
            }
        }
    }

    if(dp[D[0]][D[1]]!=INF) cout << dp[D[0]][D[1]] << endl;
    else cout << -1 << endl;
    return 0;
}


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

int main(){
  long long N,K;
  cin >> N >> K;
  vector<int> H(N);
  for(long long i=0;i<N;i++){
    cin >> H[i];
  }

  sort(H.begin(),H.end());
  reverse(H.begin(),H.end());
  
  if(K>=N){
    cout << 0 << endl;
  }
  else if(K<N){
    long long sum=0;
    for(long long i=K;i<N;i++){
      sum=sum+H[i];
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1024
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]

c = sorted(ab, key= lambda x:x[0])
s = [0]
for i in range(n):
    s.append(s[i] + c[i][1])
    if s[i] <= m <= s[i+1]:
        stop = i

ans=0
for i in range(stop):
    ans += c[i][0]*c[i][1]
while s[stop] < m:
    ans += c[stop][0]
    s[stop] += 1
print(ans)


Measured memory_bytes: 33252
using System;
using static System.Console;
using static System.Convert;
class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var pow = 1;
        for(var i = 1; i <= num; i++)
        {
            if (Math.Pow(2,i) > num) { break; }
            pow = (int)Math.Pow(2, i);
        }
        WriteLine(pow);
    }
}



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

int main(){
  long long N;
  cin >> N;
  long long m = 0, steps = 0;
  vector<long long> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
    if(A[i]>m){
      m = A[i];
    }
    steps += m - A[i];
  }
  cout << steps;
}
  

Measured memory_bytes: 4848
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int r = sc.nextInt();
        int d = sc.nextInt();
        long x = sc.nextLong();
        long ans = x;
        for (int i = 0; i < 10; i++) {
            ans = r * ans - d;
            System.out.println(ans);
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

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

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

  priority_queue<int> q;
  REP(i, n){
    int a;
    cin >> a;
    q.push(a);
  }

  REP(i, m){
    int a = q.top(); q.pop();
    q.push(a/2);
  }

  ll ans = 0;
  REP(i, n){
    ans += q.top(); q.pop();
  }

  cout << ans << endl;
}


Measured memory_bytes: 1020
#include<iostream>
using namespace std;
int main(){
  char a;
  cin >> a;
  if(a == 'A') cout << 'T' << endl;
  else if(a == 'T') cout << 'A' << endl;
  else if(a == 'C') cout << 'G' << endl;
  else cout << 'C' << endl;
}

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

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

    int ans = 0;
    int minv = 101;
    for (int i = 0; i < n; i++) {
        ans += l + i;
        if (abs(l + i) < abs(minv)) minv = l + i;
    }

    cout << ans - minv << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
// Solution: from workding days point of view, for a single working day, there
// is a range it can be scheduled on, if this range is 1 then that day is
// required to work. We can greedy fill the working days to find out the ranges.
std::vector<int> CalculateDaysBoundToWork(const int M, const int N, const int K,
                                          const std::string& calendar) {
  // The earliest and latest possible days for each of the working days.
  std::vector<int> earliest(M, -1), latest(M, -1);
  // Greedy approach to fill working days forwards.
  int x = 0;
  for (int i = 0; i < N; ++i) {
    if (calendar[i] == 'o') {
      earliest[x++] = i;
      i += K;
    }
    if (x >= M) break;
  }
  // Greedy approach to fill working days backwards.
  x = M - 1;
  for (int i = N - 1; i >= 0; --i) {
    if (calendar[i] == 'o') {
      latest[x--] = i;
      i -= K;
    }
    if (x < 0) break;
  }
  // A day is required to work iff there exists work day cannot be both earlier
  // and later than the given day.
  std::vector<int> results;
  for (int i = 0; i < M; ++i) {
    if (earliest[i] != -1 && earliest[i] == latest[i]) {
      results.push_back(earliest[i]);
    }
  }
  return results;
}
 
int main() {
  int M, N, K;
  std::cin >> N >> M >> K;
  std::string calendar;
  std::cin >> calendar;
  const std::vector<int> res = CalculateDaysBoundToWork(M, N, K, calendar);
  for(const int i : res) {
    std::cout << i + 1 << "\n";
  }
  return 0;
}

Measured memory_bytes: 3196
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#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>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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

int cnt_(int a) {
	int cnt = 0;
	while (true) {
		if (a % 2 == 1) break;
		a /= 2;
		cnt++;
	}
	return cnt;
}

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = 0;
	rep(i, n) {
		if (a[i] % 2 == 0) {
			ans += cnt_(a[i]);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fio ios_base::sync_with_stdio(false)
using namespace std;
int main(){
  ll n;
  cin>>n;
string k;
  while(n>0){
   if(n%26==0){
     k+=  ( 25 +'a' );
     n = n/26-1;
   }else{
     k+=(n%26-1+'a');
     n/=26;
   }
  }
   reverse(k.begin(),k.end());
   cout<<k;
  }


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int x;
    cin >> x;
    vector<bool> v(1005);
    v[1] = true;
    for (int i=2; i<=31; i++) {
        int now = i*i;
        while (now<=1000) {
            v[now] = true;
            now *= i;
        }
    }
    int ans = 0;
    for (int i=x; i>=1; i--) {
        if (v[i]) {
            ans = i;
            break;
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main(void){
    int N,K,i,j;
    cin >> N >> K;

    int d=0, A=0;

    int count=0, check[N+1]={};
    
    for (i = 1; i <= K; i++)
    {
        j=1;
        cin >> d;
        do{
            cin >> A;
            check[A]++;
            j++;
        }while(j<=d);
    }

    for (i = 1; i <= N; i++)
    {
        if(check[i] == 0) count++;
    }
    
    cout << count << endl;

    
    return 0;
}

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

int main(){
    int a[5], b[5], c[5];
    int k;
    int min=9;
    int s=0;
    int gokei = 0;
    for(int i=0;i<5;i++){
        cin>>a[i];
        b[i] = a[i]%10;
        if(a[i]%10==0){
            c[i] = a[i];
        }
        else{
            c[i] = a[i] - a[i]%10 + 10;
        }
        
        if(b[i]<=min && b[i]!=0){
            k=i;
            min=b[i];
        }
    }
    for(int i=0; i<5; i++){
        gokei += c[i];
    }
    gokei = gokei -c[k] + a[k];
    
    cout<<gokei;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    println(problem082c(n, a))
}

fun problem082c(n: Int, a: List<Long>):Int {
    val countsMap = hashMapOf<Long, Int>()
    var count = 0
    for (i in 0 until n) {
        val ai = a[i]
        if (countsMap.contains(ai)) {
            countsMap[ai] = countsMap[ai]!! + 1
            val iCount = countsMap[ai]!!
            if (iCount > ai) {
                count++
            }
        } else {
            countsMap[a[i]] = 1
        }
    }
    countsMap.forEach { entry ->
        if (entry.key > entry.value) {
            count += entry.value
        }
    }
    return count
}

Measured memory_bytes: 51028
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$res = "D";
if (
   ($key->A[0]=='H' && $key->A[1]=='H') ||
   ($key->A[0]=='D' && $key->A[1]=='D'))
{
  $res = "H";
}
printf("%s\n",$res);


Measured memory_bytes: 3576
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	int A, B;
	cin >> A >> B;

	cout << A * B - A - B + 1 << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())

s = 0
i = 0
while s < n:
    s += i
    i += 1

if i == 1:
    print(1)
else:
    ans = list(range(1,i))
    if s - n != 0: ans.remove(s-n)
    print('\n'.join(map(str,ans)))


Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

  vector<int> l(10);
  vector<int> v(2);
  while( scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &l[0], &l[1], &l[2], &l[3], &l[4], &l[5], &l[6], &l[7], &l[8], &l[9], &v[0], &v[1])!= EOF ){
    int sum = accumulate(l.begin(), l.end(), 0);
    // cerr << sum << " ";
    double tmp = sum * v[0] * 1.0 / (v[0]+v[1]);
    // cerr << tmp << endl;
    for(int i=1; i<10; i++) l[i] += l[i-1];
    // int a = 0;
    for(int i=1; i<10; i++){
      if( l[i-1] == tmp ){
        cout << i << endl;
        break;
      }else if( l[i-1] < tmp && tmp < l[i] ){
        // cerr << l[i-1] << " " << l[i] << endl;
        cout << i+1 << endl;
        // break;
      }
    }
  }



  return 0;
}

// EOF

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

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

const int N = 510;

int n, m;
char S[N][N];
bool A[N][N], B[N][N];

int main(){
	scanf("%d%d", &n, &m);
	For(i, 1, n) scanf("%s", S[i] + 1);

	for(int i = 1; i <= n; i += 2)
		For(j, 1, m - 1) A[i][j] = true;
	For(i, 1, n) A[i][1] = true;

	for(int i = 2; i <= n; i += 2)
		For(j, 2, m) B[i][j] = true;
	For(i, 1, n) B[i][m] = true;

	For(i, 1, n) For(j, 1, m) A[i][j] |= S[i][j] == '#', B[i][j] |= S[i][j] == '#';
	For(i, 1, n){
		For(j, 1, m) putchar(A[i][j] ? '#' : '.'); 
		puts("");
	}
	puts("");
	For(i, 1, n){
		For(j, 1, m) putchar(B[i][j] ? '#' : '.'); 
		puts("");
	}
	puts("");
	return 0;
}

Measured memory_bytes: 1536
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    vector<ll> x(5,0);
    for(ll i=0;i<5;++i)cin>>x[i];
    for(ll i=0;i<5;++i){
        if(x[i]==0){
            prt(i+1)return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3600
import java.math.BigInteger;
import java.util.Scanner;

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

	    BigInteger a = new BigInteger(scn.next());
	    BigInteger b = new BigInteger(scn.next());

	    if(a.equals(b)){
	    	System.out.println("EQUAL");
	    }else if(0 < a.compareTo(b)){
	    	System.out.println("GREATER");
	    }else{
	    	System.out.println("LESS");
	    }

		scn.close();
    }
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    // a b c
    // b a c
    // c a b
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

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

int main() {
  int n, m; cin >> n >> m;
  vector<int> dp(n+1);
  dp[0] = 1;
  dp[1] = 1;
  rep(i, m) {
    int a; cin >> a;
    dp[a] = -1;
  }
  for (int i = 2; i <= n; i++) {
    if (dp[i] == -1) continue;
    if (dp[i-1] != -1) dp[i] = (dp[i] + dp[i-1]) % mod;
    if (dp[i-2] != -1) dp[i] = (dp[i] + dp[i-2]) % mod;
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;
bool used[1000010];
int main(){
	int i,j,x;
	cin >> x;
	for(i=2;i<=1000000;i++){
		used[i] = true;
	}
	for(i=2;i<=1000000;i++){
		for(j=2*i;j<=1000000;j+=i){
			used[j] = false;
		}
	}
	for(i=x;i<=1000000;i++){
		if(used[i]){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
int n;
cin >> n;
ll ans =1;
for(int i=0;i<n;i++){
   ans*=(i+1);
   ans = ans%mod;
}
cout << ans << endl;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++){
		long long b,c;
		scanf("%lld%lld",&b,&c);
		if((b+1)/2<c){
			printf("-1\n");continue;
		}
		long long left=0;
		long long right=b+1;
		while(left+1<right){
			long long M=(left+right)/2;
			long long mul=1;
			long long now=b;
			long long num=0;
			while(now>0){
				if(now%2==0)now--;
				long long tmp=now/3;
				if(tmp%2==0)tmp--;
				tmp=(tmp+1)/2;
				long long t=min((M/mul+1)/2,(now+1)/2);
				if(tmp<t)num+=t-tmp;
				now=tmp*2-1;
				mul*=2;
			}
			if(num>=c){
				right=M;
			}else left=M;
		}
		printf("%lld\n",right);
	}
}

Measured memory_bytes: 1036
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool CAN=true;
using namespace std;

int main(){
  ll A[7],B[7],ans=0LL,cnt=0LL;
  REP(i,7) cin>>A[i];
  
  ans+=A[1];
  ans+=A[0]-A[0]%2;
  ans+=A[3]-A[3]%2;
  ans+=A[4]-A[4]%2;
  
  if(A[0]>0 && A[3]>0 && A[4]>0){
    cnt+=A[1];
    cnt+=(A[0]-1)-(A[0]-1)%2;
    cnt+=(A[3]-1)-(A[3]-1)%2;
    cnt+=(A[4]-1)-(A[4]-1)%2;
    cnt+=3LL;
  }
  
  chmax(ans,cnt);
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256