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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x;
string s;

// <---------------------- > //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	cout<<"Christmas ";
	for(ll i=n;i<25;i++) cout<<"Eve "; 
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {

		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3616
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

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

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int extgcd(int a, int b, int& x, int&y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else {
        x = 1;
        y = 0;
    }
    return d;
}

int inv(int a) {
    int x, y;
    extgcd(a, MOD, x, y);
    return (x + MOD) % MOD;
}

struct UniTree {
    int *par, *rank, *sz;

    UniTree(int n) {
        par = new int[n];
        rank = new int[n];
        sz = new int[n];
        for(int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            sz[i] = 1;
        }
    }

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

    void merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y]) {
            par[x] = y;
            sz[y] += sz[x];
        }else {
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
            sz[x] += sz[y];
        }
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int siz(int x) {
        return sz[root(x)];
    }
};

double bin(double left, double right) {
    return 0;
}

int main() {
    int n;
    cin >> n;
    int a = 0, b = 0;
    rep(i, n) {
        int d;
        cin >> d;
        a += d;
        b += d * d;
    }
    cout << (a * a - b) / 2 << endl;
}


Measured memory_bytes: 256
//inputing a sec and showing (h:m:s)
#include<stdio.h>
int main()
{
    int S,h,m,s;
    scanf("%d",&S);//inputing sec.
    h=S/3600;//storing hour.
    s=S%3600;//putting extra sec as reminder.
    m=s/60;//storing min.
    s=s%60;//storing sec.
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2072
n, m = list(map(int, input().split()))
li = list(map(int, input().split()))
di = {}
for i, d in enumerate([2,5,5,4,5,6,3,7,6], 1):
    di[i] = d
li.sort(reverse=True)
dd = {}
for a in li:
    hon = di[a]
    if hon not in dd:
        dd[hon] = a

h2d = [-float('inf')] * (n + 1)
h2d[0] = 0
pre = [None] * (n + 1)
for j in range(1, n + 1):
    for a in li:
        ho = di[a]
        if j < ho:
            continue
        dig = h2d[j - ho] + 1
        if dig > h2d[j]:
            h2d[j] = dig
            pre[j] = j - ho

ans = []
while n > 0:
    ans.append(dd[n - pre[n]])
    n = pre[n]
ans.sort(reverse=True)
print(*ans, sep='')


Measured memory_bytes: 4724
#include<stdio.h>
#include<stdlib.h>

#define MAX 10000

int main(void){
  
  int C[MAX];
  int n;
  int i,j;
  int s;
  int *A,*B;
  
  scanf("%d",&n);

  s = sizeof(int)*n + 1;
    
  A = malloc(s);
  B = malloc(s);
  
  for(i = 0;i < MAX;i++){
    C[i] = 0;
  }
    
  for(i = 0;i < n;i++){
    scanf("%d",&A[i+1]);
    C[ A[i+1] ]++;
  }

  for(i = 1;i <= MAX;i++){
    C[i] = C[i] + C[i-1];
  }

  for(j = 1;j <= n;j++){
    B[ C[A[j]] ] = A[j];
    C[A[j]]--;
  }

  for(i = 1;i <= n;i++){
    if(i != 1){
      printf(" ");
    }
    printf("%d",B[i]);
  }
  printf("\n");

  free(A);
  free(B);

  return 0;
}
      



Measured memory_bytes: 17036
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
using namespace std;

int solve(vector<array<int, 3>> &memo, const vector<array<int, 3>> &abc, int i, int j) {
    if (i == 0) return abc[0][j];
    if (memo[i][j] != -1) return memo[i][j];

    for (int k = 0; k < 3; ++k) {
        if (k == j) continue;
        memo[i][j] = max(memo[i][j], solve(memo, abc, i - 1, k) + abc[i][j]);
    }

    return memo[i][j];
}

int main() {
    int n; cin >> n;
    vector<array<int, 3>> abc(n);
    for (auto &e1 : abc) for (auto &e2 : e1) cin >> e2;

    int ans = 0;
    vector<array<int, 3>> memo(n, { -1, -1, -1 });
    for (int i = 0; i < 3; ++i) {
        ans = max(ans, solve(memo, abc, n - 1, i));
    }

    cout << ans << endl;
}



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


int main(){
  ll a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  if(a < b){
    if((b + w*t) - (a + v*t) > 0){
      puts("NO");
      return 0;
    }
    else{
      puts("YES");
      return 0;
    }
  }
  else if (a == b){
    puts("YES");
    return 0;
  }
  else{
    if((b - w*t) - (a-v*t) < 0){
      puts("NO");
      return 0;
    }
    else{
      puts("YES");
      return 0;
    }
  }
  return 0;
}


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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

// Constant variables
const ld PI = (acos(-1));
const ll MOD = 1000000007;

// I/O Asynchronizing
struct __io_async{
    __io_async(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((a + b + c) >= 22 ? "bust" : "win") << endl;

    return 0;
}


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

int main()
{
  int n, l;
  long long score = 0;
  cin >> n >> l;
  vector<int> dif(n);
  for(int i=0; i<n; i++)
  {
    dif[i] = abs(l + i);
    score += l + i;
  }
  
  vector<int>::iterator erase_it = min_element(dif.begin(), dif.end());
  int erase_idx = distance(dif.begin(), erase_it);
  score -= l + erase_idx;
  cout << score << endl;
  return 0;
}

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

int dp[30][1010];
int main() {
    int N;
    cin >> N;
    vector<int> V(N);
    vector<int> C(N);
    for (int i = 0; i < N; i++) cin >> V[i];
    for (int i = 0; i < N; i++) cin >> C[i];

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int cost = 0; cost <= 1000; cost++) {
            if (cost >= C[i]) dp[i + 1][cost] = max(dp[i][cost], dp[i][cost - C[i]] + V[i]);
            else dp[i + 1][cost] = dp[i][cost];
        }
    }

    int ans = 0;
    for (int i = 0; i <= 1000; i++) {
        ans = max(ans, dp[N][i] - i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N, X; cin >> N >> X;
    vector<int> m(N);
    int sum = 0;
    for(int i=0; i<N; i++){
        cin >> m[i];
        sum += m[i];
    }

    sort(m.begin(), m.end());
    cout << N + (X-sum)/m[0] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int a[3][102],n,ans=0,up[102],down[102],sum1,sum2;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {scanf("%d",&a[1][i]);sum1+=a[1][i];}
	for(int i=1;i<=n;i++) {scanf("%d",&a[2][i]);sum2+=a[2][i];}
	for(int i=1;i<=n;i++) up[i]=up[i-1]+a[1][i];
	for(int i=1;i<=n;i++) down[i]=down[i-1]+a[2][i];
	for(int i=1;i<=n;i++)
		if(up[i]+(sum2-down[i-1])>ans) ans=up[i]+(sum2-down[i-1]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
N, K = map(int,input().split())
D = list(map(str, input().split()))

while True:
    S = str(N)
    t = 0
    for x in S:
        if x not in D:
            t += 1
    if t == len(S):
        print(S)
        break
    else:
        N += 1


Measured memory_bytes: 7396
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
	static long ans = 1;
	static int n, k;
	static int mod = 1000000007;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		n = Integer.parseInt(sa[0]);
		k = Integer.parseInt(sa[1]);
		Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
		map.put(-1, new ArrayList<Integer>());
		map.put(0, new ArrayList<Integer>());
		for (int i = 0; i < n - 1; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]) - 1;
			int b = Integer.parseInt(sa[1]) - 1;

			List<Integer> list1 = map.get(a);
			if (list1 == null) {
				list1 = new ArrayList<Integer>();
				map.put(a, list1);
			}
			list1.add(b);

			List<Integer> list2 = map.get(b);
			if (list2 == null) {
				list2 = new ArrayList<Integer>();
				map.put(b, list2);
			}
			list2.add(a);
		}
		br.close();

		int[] cnt = new int[100005];
		dfs(map, 0, -1, 2, cnt);
		System.out.println(ans);
	}

	static void dfs(Map<Integer, List<Integer>> map, int c, int p, int dep, int[] cnt) {
		int x = Math.min(cnt[dep - 2], 1) + Math.min(cnt[dep - 1], 1) + cnt[dep];
		int y = Math.max(k - x, 0);
		ans *= y;
		ans %= mod;
		cnt[dep]++;

		List<Integer> list = map.get(c);
		for (int i : list) {
			if (i != p) {
				dfs(map, i, c, dep + 1, cnt);
			}
		}
		dep--;
		cnt[dep + 2] = 0;
	}
}


Measured memory_bytes: 83080
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var S = Console.ReadLine();
        var T = Console.ReadLine();

        var length = S.Length;
        var result = true;
        for(int i = 0; i < length; i++)
        {
            if(S[i] != T[i])
            {
                result = false;
            }
        }

        if (result) Console.WriteLine("Yes");
        else Console.WriteLine("No");

    }
}


Measured memory_bytes: 25868
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, A, B;
  cin >> N >> A >> B;

  long minimum = A * (N-1) + B;
  long maximum = A + (N-1) * B;

  cout << max(0l, maximum - minimum + 1) << endl;
}

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


Measured memory_bytes: 256
import bisect
N = int(input())

A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for b in B:
    a = bisect.bisect_left(A, b)
    c = bisect.bisect_right(C, b)
    ans += a*(N-c)
print(ans)

Measured memory_bytes: 29324
#pragma comment(linker, "/stack:200000000")

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
using namespace std;
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	int a , b , c;
	cin >> a>> b >> c ;
	if(a%2==0 || b % 2 == 0 || c % 2 == 0 )
		puts("0");
	else{
		cout << min(a * b , min(a * c , b * c));
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static int frog1(int N, int[] h) {
        // subproblem:
        // f(k) = cost when standing on stone k (0 <= k < N)
        // f(N-1)

        // f(0) = 0
        // f(1) = abs(h[1], h[0])
        // f(k) = min:
        //        f(k-1) + abs(h[k], h[k-1])
        //        f(k-2) + abs(h[k], h[k-2])

        int[] dp = new int[N];
        dp[0] = 0;
        dp[1] = Math.abs(h[0] - h[1]);
        for (int k = 2; k < N; k++) {
            dp[k] = Math.min(
                    dp[k-1] + Math.abs(h[k] - h[k-1]),
                    dp[k-2] + Math.abs(h[k] - h[k-2])
            );
        }
        return dp[N-1];
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] h = new int[N];
        for (int i = 0; i < N; i++) {
            h[i] = scanner.nextInt();
        }
        int res = frog1(N, h);
        System.out.println(res);
    }
}


Measured memory_bytes: 50996
// Aizu 2286: Farey Sequence
// 2017.9.23 bal4u@uu
// ?????????????????¢??° ??(n)???????????????????????¬?????°??? Fn ????????°:
//???????????(1)?????(2)???...+??(n)
// ?????????, Fn(n) = Fn(n-1) + ??(n)???????????????Fn(0) = 1
// 2017.11.22

#include <stdio.h>

#define MAX	 1000000
int phi[MAX+1];			// ??????????????¢??°??????
char isprime[MAX+1];	// ?´???°????????¨
long long fn[MAX+1];	// ??¬?????????Farey Sequence

void euler_phi()
{
	int i, j;

	for (i = 0; i <= MAX; i++) {
		phi[i] = i;
//		isprime[i] = 0;
	}
	phi[2] = 1;
	for (j = 4; j <= MAX; j += 2) isprime[j] = 1, phi[j] -= phi[j] >> 1;
	for (i = 3; i <= MAX; i++) {
		if (isprime[i]) continue;
		phi[i] -= phi[i] / i;
	    for (j = i+i; j <= MAX; j+=i) isprime[j] = 1, phi[j] -= phi[j] / i;
	}
}

char buf[10], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}
int main()
{
	int t, n;

	euler_phi();
	fn[0] = 1; for (n = 1; n <= MAX; n++) fn[n] = fn[n-1] + phi[n];

	fgets(p=buf, 10, stdin), t = getint();
	while (t-- > 0) {
		fgets(p=buf, 10, stdin);
		printf("%lld\n", fn[getint()]);
	}
	return 0;
}

Measured memory_bytes: 14468
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <set>
#include <queue>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
#define pb(x) push_back(x)
typedef long long LL;
typedef unsigned long long ull;
const int mod=1e9+7;
const double eps=1e-6;
const int INF=0x3f3f3f3f;
const int N=1e5+5;
int cnt[N],ans[N];
int main()
{
    int n,x;
    while(~scanf("%d",&n))
    {
        mem(cnt,0);
        mem(ans,0);
        int mxel=0;
        for(int i=0; i<n; i++)
        {
            scanf("%d",&x);
            cnt[x]++;
            mxel=max(mxel,x);
        }
       // for(int i=0;i<10;i++)
        //    printf("cnt[%d]=%d\n",i,cnt[i]);
        int mx=1;
        for(int i=0; i<=mxel; i++)
            for(int j=-1; j<=1; j++)
                if(i+j>=0&&i+j<=mxel)
                {
                    ans[i]+=cnt[i+j];
                    mx=max(mx,ans[i]);
                   // printf("ans[%d]=%d  mx=%d\n",i,ans[i],mx);
                }
        printf("%d\n",mx);
    }
    return 0;
}

/*
10
0 1 2 3 4 5 6 7 8 9
*/


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

ll a,b,n;

ll floor(ll N){
  ll fl1 = (a*N)/b;
  ll fl2 = N/b;
  ll ans = fl1-a*fl2;
  return ans;
}

int main(){
  cin >>a >>b >>n;
  ll ans = floor(min(b-1, n));
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

// 一行取って、一番初めのTを習得
template <class T> int streamvar(std::istream& in, T& var)
{
    string s;
    if (!in) {
        return 1;
    }
    getline(in, s);
    istringstream is(s);
    is >> var;
    if (is.fail()) 
        return 1;
    return 0;
}
// 一行取って、T vectorに格納する
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) 
        return 1;
    getline(in, s);
    if (in.fail()) 
        return 1;
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

#define EPS 1e-6
int main(void)
{
    string s;
    while (cin >> s) {
        string tmp;
        for (int i = 0; i < s.length(); i++)
            tmp += s[s.length() - i - 1];
        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 1180
//おそらくAC
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int ans = 0;
	int B_num = 0, A_num = 0;
	int N;
	cin >> N;
	string s[10050];
	for (int i = 0; i < N; i++) {
		cin >> s[i];
	}

	bool aorb = false;
	for (int i = 0; i < N; i++) {
		bool a = false;
		bool b = false;
		if (s[i][0] == 'B') {
			B_num++;
			b = true;
		}
		int leng = s[i].length();
		if (s[i][leng - 1] == 'A') {
			A_num++;
			a = true;
		}
		if (a^b == true) {
			aorb = true;
		}

		for (int j = 0; j < leng - 1; j++) {
			if (s[i][j] == 'A' && s[i][j + 1] == 'B') {
				ans++;
			}
		}
	}
	int num = 0;
	num = min(A_num, B_num);
	if (aorb == false && num != 0) {
		num--;
	}

	cout << ans+num << endl;

	return 0;
}

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

int n, res = 0;

int main(){
	cin >> n;
	for (int i = 1; i<=n; i+=2){
		int uoc = 0;
		for (int j =1; j<=i; ++j)
			if (i%j == 0) uoc++;
		if (uoc == 8) res++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = sorted(list(map(int,input().split())))
INF=10**9+7
if n%2==0:
    l_tmp=[i//2*2+1 for i in range(n)]
else:
    l_tmp=[0]+[i//2*2+2 for i in range(n-1)]
if l!=l_tmp:print(0);exit()
else:print(2**(n//2)%INF)

Measured memory_bytes: 14008
#include <iostream>
#define MAX 2000000
using namespace std;

int H, A[MAX+1];

void maxHeapify(int i){
    int l, r, largest;
    l = 2*i;
    r = 2*i+1;
    if(l<=H&&A[l]>A[i]) largest = l;
    else largest = i;
    if(r <= H && A[r] > A[largest]) largest = r;

    if(largest != i){
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int main(){
    cin >> H;

    for(int i=1;i<=H;i++) cin >> A[i];
    for(int i=H/2;i>=1;i--) maxHeapify(i);
    for(int i=1;i<=H;i++){
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5044
import sys

# sys.stdin = open("a1.in")


x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

l = [a, b, c]
g = {}
for i in range(3):
    for j in l[i]:
        g[j] = i
if g[x] == g[y]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = "No"

for i in range(N - M + 1):
  for j in range(N - M + 1):
    if [a[j:j+M] for a in A[i:i+M]] == B:
      ans = "Yes"
print(ans)

Measured memory_bytes: 3060
s1 = input()
s2 = input()

x = len(s1)
y = len(s2)

dp = [[0]*(y+1) for _ in range(x+1)]

for j in range(1,y+1):
    dp[0][j] = dp[0][j-1] + 1

for i in range(1,x+1):
    dp[i][0] = dp[i-1][0] + 1

for i in range(1,x+1):
    for j in range(1,y+1):
            cost = s1[i-1] != s2[j-1]
            dp[i][j] = min(dp[i-1][j-1] + cost, dp[i][j-1] + 1, dp[i-1][j] + 1)

ans = dp[x][y]
print(ans)


Measured memory_bytes: 43068
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m;
#define Maxn 105
int dp[Maxn][Maxn];
char a[Maxn][Maxn]; 

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%s",a[i]+1);
	if(a[1][1]=='#')dp[1][1]=1;
	else dp[1][1]=0;
	for(int i=1;i<=n;++i)
	    for(int j=1;j<=m;++j)
	        if(i+j>2){
				dp[i][j]=2147483647;
				if(i>1){
					if(a[i][j]=='.'||a[i-1][j]=='#')dp[i][j]=min(dp[i][j],dp[i-1][j]);
					else dp[i][j]=min(dp[i][j],dp[i-1][j]+1); 
				}
				if(j>1){
					if(a[i][j]=='.'||a[i][j-1]=='#')dp[i][j]=min(dp[i][j],dp[i][j-1]);
				    else dp[i][j]=min(dp[i][j],dp[i][j-1]+1);
				}
	        }
	printf("%d\n",dp[n][m]);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
    string s,t;
    cin >> s >> t;
    t+=t;
    if (t.find(s) != string::npos) {
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n,k;
string s;
lin bg[100001], ed[1000001];

int main(void)
{
    cin >> n >> k >> s;
    string ss = s;


    if(s[n-1] == '0')
        s = s + "10";
    else
        s = s + "0";

    if(s[0] == '0')
        s = "01" + s;
    else
        s = "0" + s;

    int ti = 0;
    rep(i,s.length()-1)
    {
        if(s[i] != s[i+1])
        {
            if(s[i+1] == '1')
                bg[ti] = i-1;
            else
            {
                ed[ti] = i-2;
                ti++;
            }
        }
    }

//     rep(i, ti)
//     {
//        cout << bg[i] << "," << ed[i] << endl;
//     }

    lin res = 0;
    rep(i, ti)
    {
        lin jj = min((lin)(i+k),(lin)(ti-1));

        lin rr = ed[jj] - bg[i] + 1;

        if(i == 0 && ss[0] == '0')
            rr--;

        if(jj == ti-1 && ss[n-1] == '0')
            rr--;

        res = max(res, rr);
    }

    cout << res << endl;

    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int x;
  std::cin >> x;
  if (x < 1200) {
    std::cout << "ABC" << std::endl;
  } else {
    std::cout << "ARC" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<pair<int, int>> vec;
    for(int i = 1;i<=n;i++){
    	int a;
    	cin>>a;
    	vec.pb(mp(a, i));
    }
    sort(vec.begin(), vec.end());
    for(int i = 0;i<n;i++){
    	cout<<vec[i].sc<<" ";
    }
    cout<<endl;
    return 0;
}


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

#define MAX 20000

int main(void)
{
	int a, b, flag = 0;
	char op;
	while (1) {
		do {
			cin >> a >> op >> b;
		} while (a < 0 || a > MAX || b < 0 || b > MAX && op != '+' && op != '-' && op != '*' && op != '/' && op != '?');

		switch (op) {
		case '+':
			printf("%d\n", a + b);
			break;
		case '-':
			printf("%d\n", a - b);
			break;
		case '*':
			printf("%d\n", a*b);
			break;
		case '/':
			printf("%d\n", a / b);
			if (b == 0) break;
			break;
		case '?':
			flag = 1;
			break;
		}
		if (flag == 1) break;
	}
	return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int maxH=0;
    int H;
    int answer=0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> H;
        if(H>=maxH){
            answer++;
            maxH=H;
        }
    }
    cout << answer;
    return 0;
}

Measured memory_bytes: 256
//
// Created by Tetsuya Shiota on 2019-04-13.
//

#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
#define FOR(e, o) for (auto &&e : o)
#ifdef LOCAL
#define pp(x) cerr << __LINE__ << ' ' << #x << " = " << (x) << endl
#define dump(x)                                                                \
  cerr << __LINE__ << ' ' << #x << " : ";                                      \
  FOR(e, x) cerr << e << ' ';                                                  \
  cerr << endl;
#else
#define pp(x)
#define dump(x)
#endif

using namespace std;

using Int = long long;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int, Int>;

template <typename T> void reverse(vector<T> &v) {
  reverse(v.begin(), v.end());
}

template <typename T> void sort(vector<T> &v) { sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T> &v) { sort(v.rbegin(), v.rend()); }

template <typename T> T sum(const vector<T> &v) {
  return accumulate(v.begin(), v.end(), T(0));
}

template <class T> void update_max(T &a, const T &b) { a = max(a, b); }
template <class T> bool update_min(T &a, const T &b) { a = min(a, b); }

struct BoolName : numpunct<char> {
  string t, f;
  BoolName(string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const { return t; }
  string do_falsename() const { return f; }
};

class Solver {
public:
  Solver() {}
  string s;
  int ans;
  void input() {
    cin >> s;

  }
  int solve(char c, string &s){
    int ret = 0;
    FOR(e, s){
      if(e != c)ret++;
      if(c == '0')c = '1';
      else c = '0';
    }
    return ret;
  }
  void solve() {
    ans = min(solve('0', s), solve('1', s));
  }
  void output(){
    cout << ans <<endl;

  };
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(15) << boolalpha;
  cout.imbue(locale(cout.getloc(), new BoolName));
#ifdef LOCAL
  while (1) {
    Solver s;
    s.input();
    if (cin.eof())
      break;
    s.solve();
    s.output();
  }
#else
  Solver s;
  s.input();
  s.solve();
  s.output();
#endif
}

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

const int S=1<<20;
char buf[S],*H,*T;
inline char Get()
{
	if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
	if(H==T) return -1;return *H++;
}
inline int read()
{
	int x=0;char c=Get();
	while(!isdigit(c)) c=Get();
	while(isdigit(c)) x=x*10+c-'0',c=Get();
	return x;
}
inline void reads(char *s)
{
	char c=Get();int tot=0;
	while(c<'0'||c>'1') c=Get();
	while(c>='0'&&c<='1') s[++tot]=c,c=Get();
	s[++tot]='\0';
}

inline void upmin(int &x,const int &y){if(y<x) x=y;}
inline void upmax(int &x,const int &y){if(y>x) x=y;}
inline int mymin(const int &x,const int &y){return x<y?x:y;}

typedef long long LL;
const int N=200010;
struct Edge{int to,next;} e[N<<1];
int h[N],sum=0,n;
int mx1[N],mx2[N],mn[N],num[N];
char black[N];
long long ans=0;

inline void add_edge(int u,int v)
{
	e[++sum].to=v;
	e[sum].next=h[u];
	h[u]=sum;
}

void dfs1(int u,int last)
{
	if(black[u]=='1') mn[u]=0,num[u]++;
	for(int t=h[u];t;t=e[t].next)
	{
		int v=e[t].to;
		if(v==last) continue;
		dfs1(v,u);
		num[u]+=num[v];
		if(mx1[v]+1>mx1[u])
		{
			mx2[u]=mx1[u];
			mx1[u]=mx1[v]+1;
		}
		else upmax(mx2[u],mx1[v]+1);
		if(num[v]) upmin(mn[u],mx1[v]+1);
	}
}

void dfs2(int u,int last)
{
	for(int t=h[u];t;t=e[t].next)
	{
		int v=e[t].to;
		if(v==last) continue;
		int len=((mx1[u]==mx1[v]+1)?mx2[u]:mx1[u])+1;
		if(len>mx1[v]) mx2[v]=mx1[v],mx1[v]=len;
		else upmax(mx2[v],len);
		if(num[v]<num[1]) upmin(mn[v],len);
		dfs2(v,u);
	}
	int up=mymin(mx2[u]+1,mx1[u]-1);
	if(up>=mn[u]) ans+=up-mn[u]+1;
}

int main()
{
	int x,y,up;
	n=read();
	for(int i=1;i<n;i++)
	{
		x=read();y=read();
		add_edge(x,y);
		add_edge(y,x);
	}
	reads(black);
	memset(mn,0x3f,sizeof(mn));
	dfs1(1,0);dfs2(1,0);
	printf("%lld\n",ans+1);
	return 0;
}

Measured memory_bytes: 15616
#include <iostream>
using namespace std;
int n;
int A[100000];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>A[i];
	int x=A[n-1];
	int j=A[0]<x?1:0;
	for(int i=1;i<n-1;i++)
	{
		if (A[i]<=x) 
		{
			int aj=A[j];
			A[j]=A[i];
			A[i]=aj;
			j++;
		}
	}
	A[n-1]=A[j];
	A[j]=x;
	for (int i=0;i<j;i++)
	{
		if (i) cout <<' ';
		cout<<A[i];
	}
	if(j)cout<<' ';
	cout<<'['<<A[j]<<']';
	for(int i=j+1;i<n;i++)//bug here i=j+1
	{
		cout <<' '<<A[i];
	}
	cout<<endl;//bug here
}

Measured memory_bytes: 1548
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            var O = ReadLine();
            var E = ReadLine();
            var ans = new char[O.Length + E.Length];
            for (var i = 0; i < O.Length; ++i)
                ans[i * 2] = O[i];
            for (var i = 0; i < E.Length; ++i)
                ans[i * 2 + 1] = E[i];
            WriteLine(string.Join("", ans));
        }



        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 25860
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		long S = Long.parseLong(sc.nextLine());

		if(S == 0) {
			System.out.println("0");
			return;
		}

		StringBuilder t = new StringBuilder();
		while(S != 0) {
			if(S % 2 == 0) {
				t.append(0);
				S /= (-2);
			}else {
				t.append(1);
				S = (S-1)/(-2);
			}
		}

		t.reverse();

		System.out.println(t.toString());
	}
}

Measured memory_bytes: 22868
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let x: i64 = sc.read();
    let a: i64 = x / 500 * 1000;
    let b: i64 = x % 500 / 5 * 5;
    println!("{}", a + b);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 4352
// inputに入力データ全体が入る
function Main(input) {

	input = input.split("\n");
	const num = parseInt(input[0], 10);
	let kyu;
	if (num >= 400) { kyu = 8 }
	if (num >= 600) { kyu = 7 }
	if (num >= 800) { kyu = 6 }
	if (num >= 1000) { kyu = 5 }
	if (num >= 1200) { kyu = 4 }
	if (num >= 1400) { kyu = 3 }
	if (num >= 1600) { kyu = 2 }
	if (num >= 1800) { kyu = 1 }
	//出力
	console.log('%d', kyu);
}

// 実行 ファイル名により本番かどうか判断
if (__filename.match("Main.js$")) {
	Main(require("fs").readFileSync("/dev/stdin", "utf8"));
} else {
//	Main("3\n4 5\nhello\n");
	Main(require("fs").readFileSync("q1.txt", "utf8"));
}


Measured memory_bytes: 29684
def readinput():
    n,k,q=map(int,input().split())
    a=[]
    for _ in range(q):
        a.append(int(input()))
    return n,k,q,a

def main(n,k,q,a):
    win=[0]*(n+1)
    for i in range(q):
        win[a[i]]+=1
    ans=[]
    #print(win)
    for i in range(1,n+1):
        point=win[i]-q+k
        if point>0:
            ans.append('Yes')
        else:
            ans.append('No')

    return ans

if __name__=='__main__':
    n,k,q,a=readinput()
    ans=main(n,k,q,a)
    for i in range(n):
        print(ans[i])


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

class DisjointSet {
    public:
        vector<int> rank, parent;

        DisjointSet() {}
        DisjointSet(int size) {
            rank.resize(size, 0);
            parent.resize(size, 0);
            for (int i = 0; i < size; i++) {
                makeSet(i);
            }
        }

        void makeSet(int x) {
            parent[x] = x;
            rank[x] = 0;
        }

        int findSet(int x) {
            if (x != parent[x]) {
                parent[x] = findSet(parent[x]);
            }
            return parent[x];
        }

        void unite(int x, int y) {
            link(findSet(x), findSet(y));
        }

        void link(int x, int y) {
            if (rank[x] < rank[y]) {
                parent[x] = y;
            } else {
                parent[y] = x;
                if (rank[x] == rank[y]) {
                    rank[x]++;
                }
            }
        }

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

int main() {
    int n, q;
    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);

    int com, x1, y1;
    for (int i = 0; i < q; i++) {
        cin >> com >> x1 >> y1;
        if (com == 0) {
            ds.unite(x1, y1);
        } else {
            if(ds.same(x1, y1)) {
                cout << 1 << endl;
            } else {
                cout << 0 << endl;
            }
        }
    }
}



Measured memory_bytes: 3172
import java.util.*;
import java.io.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ", 0);
        
        int a = Integer.valueOf(input[0]);
        int b = Integer.valueOf(input[1]);
        int c = Integer.valueOf(input[2]);
        int count = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 24436
#include<stdio.h>

void trace(int A[], int N){
  int i;
  for (i=0; i<N; i++) {
    if (i>0)
      printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

 
void insertionSort(int A[], int N){
  int j, i, v;
  for (i=1; i<N; i++){
    v = A[i];
    j = i-1;
    while (j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    trace(A, N);
  }
}

int main(){
  int N, i, j;
  int A[100];

  scanf("%d", &N);
  for (i=0; i<N; i++)
    scanf("%d", &A[i]);

  trace(A, N);
  insertionSort(A, N);

  return 0;
}

Measured memory_bytes: 1780
#include <stdio.h>

int main(void){

    int n, ans = 0;
    char trash,s[50];

    scanf("%d%c", &n, &trash);
    scanf("%s",s);

    int num = sizeof(s) / sizeof(s[0]);

    for(int i = 0; i < num-2; i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')ans++;
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
A, B, M = map(int, input().split())

ref = list(map(int, input().split()))
mic = list(map(int, input().split()))

price = min(ref)+min(mic)

for i in range(M):
    arg = list(map(int, input().split()))
    val = ref[arg[0]-1]+mic[arg[1]-1]-arg[2]
    if price > val:
        price = val

print(price)


Measured memory_bytes: 18736
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let a: usize = read!();
    let b: usize = read!();
    let c: usize = read!();

    let mut ans = b;

    if a + b >= c {
        ans += c;
    } else {
        ans += a + b + 1;
    }

    println!("{}", ans);
}


Measured memory_bytes: 2124
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i =(a) ; i <= (b); i++)
#define ROF(i,a,b) for(int i =(b) ; i >= (a); i--)
// FOR,ROF ... a <= i <= b
#define REP(i,n)  FOR( i, 0, (n) - 1 )
#define PER(i,n)  ROF( i, 0, (n) - 1 )
// REP,PER ... 0 <= i < n
int main(){
    int A[5],K;
    REP(i,5) cin >> A[i];
    cin >> K;
    int ans = 0;
    REP(i,5){
        REP(j,5){
            ans = max(ans,A[i]-A[j]);
        }
    }
    cout << ( (ans <= K) ? "Yay!" : ":(" ) << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#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 <memory>
#include <regex>
using namespace std;

void shortestPath(const vector<vector<int> >& edges, int start, vector<int>& dist)
{
    int n = edges.size();
    dist.assign(n, INT_MAX);
    dist[start] = 0;
    queue<int> q;
    q.push(start);

    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(unsigned i=0; i<edges[v].size(); ++i){
            int u = edges[v][i];
            if(dist[u] == INT_MAX){
                dist[u] = dist[v] + 1;
                q.push(u);
            }
        }
    }
}

int main()
{
    int n;
    cin >> n;
    vector<vector<int> > edges(n);
    for(int i=0; i<n-1; ++i){
        int a, b;
        cin >> a >> b;
        -- a;
        -- b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    vector<int> dist;
    shortestPath(edges, 0, dist);
    int pos = max_element(dist.begin(), dist.end()) - dist.begin();
    shortestPath(edges, pos, dist);
    int len = *max_element(dist.begin(), dist.end());

    if(len % 3 == 1)
        cout << "Second" << endl;
    else
        cout << "First" << endl;

    return 0;
}


Measured memory_bytes: 13556
#include <stdio.h>
#define swap(X , Y) {int Z ; Z = Y ; Y = X , X = Z}

int main()
{
	int x , y;
	int max , min;
	while(scanf("%d %d", &x , &y))
	{
		if(x > y)
		{
			max = x;
		}
		else
		{
			max = y;
		}
		if(x < y)
		{
			min = x;
		}
		else
		{
			min = y;
		}
		if(x == 0 && y ==0)
			break;
		
		printf("%d %d\n", min , max);
	}
	
	return 0;
} 


Measured memory_bytes: 2616
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);

using namespace std;

signed main()
{

 	FLASH

 	int p, q, r;
 	cin>>p>>q>>r;

 	int ans = p + q + r - max(p, max(q, r));
 	cout<<ans;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s;
    else cout << "red";
    return 0;
}

Measured memory_bytes: 256
s = list(input())
n = len(s)-1
total=0
for i in range(2**n):
  bitl = list(bin(i)[2:].zfill(len(s)-1))
  tmp=''
  for j in range(len(s)-1):
    bitl[j] = bitl[j].replace('1','+').replace('0','')
    tmp+=s[j]+bitl[j]
  tmp+=s[len(s)-1]
  total+=eval(tmp)
print(total)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int r = n % 10;
    int r2 = n / 10;
    int r3 = n / 100;
    if(r == 7 || r2 % 10 == 7 || r3 % 10 == 7){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 3636
import bisect

n = map(int, input().split())
A = list(map(int, input().split()))

pl= []
ml = []
for a in A:
    if a >= 0: pl.append(a)
    else: ml.append(a)

pl.sort()
ml.sort()

ans = 0
ans_l = []


if pl and ml:
    ans = ml[0]
    for p in pl[1:]:
        ans_l.append((ans,p))
        ans -= p
    ans_l.append((pl[0], ans))
    ans = pl[0] - ans
    for m in ml[1:]:
        ans_l.append((ans,m))
        ans -= m

elif not pl: # only ml
    ans = ml[-1]
    for m in ml[:-1]:
        ans_l.append((ans,m))
        ans -= m

else: # only pl
    ans = pl[0]
    for p in pl[1:-1]:
        ans_l.append((ans,p))
        ans -= p
    ans_l.append((pl[-1], ans))
    ans = pl[-1] - ans

print(ans)
for row in ans_l:
    print(row[0], row[1])

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

int main()
{
    string s;
    cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < s.size(); i++)
    {
        char c;
        if(i % 2 == 0)
            c = '0';
        else
            c = '1';
        if(c != s[i])
            a++;
    }
    for (int i = 0; i < s.size(); i++)
    {
        char c;
        if (i % 2 == 1)
            c = '0';
        else
            c = '1';
        if (c != s[i])
            b++;
    }
    cout << min(a, b) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int                     long long   
#define double                  long double
#define endl                    "\n"
#define pb                      push_back
#define PI                      3.1415926535897932384626433832795l
#define F                       first
#define S                       second
#define mp                      make_pair
#define f(i,n)                  for(int i=0;i<n;i++)
#define fastio                  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)                  (v).begin(),(v).end()
#define rall(v)                 (v).rbegin(),(v).rend()
#define gcd(a,b)                __gcd((a),(b))
#define fill(a,value)           memset(a,value,sizeof(a));
#define minn(v)                 *min_element(v.begin(), v.end());
#define maxx(v)                 *max_element(v.begin(), v.end());
#define print(x)                cout<<(x)<<endl;
#define sum(v)+x                accumulate(v.begin(), v.end(),x);
#define debug(x)                cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int>           pii;
typedef vector<int>             vi;


signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n,x,y;
    cin>>n>>x>>y;
    vector<int> a(n+1);
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            a[min({(j-i),abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x)})]++;
        }
    }
    for(int i=1;i<n;i++)
    {
        print(a[i])
    }
    
    
    return 0;
}


Measured memory_bytes: 3660