akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cctype>
#include<algorithm>
#include<map>
#define f(i,a,b)  for(int i=(a);i<=(b);i=-(~i))
#define rf(i,a,b) for(int i=(a);i>=(b);i=~(-i))
using namespace std;
template<typename T>inline void read(T &s){
	char c=getchar();int f=1;s=0;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){s=(s<<1)+(s<<3)+(c^48),c=getchar();}
	s*=f;	
}
const int N=200005;
int n,cnt,ans;
int a[N],b[N],c[N],d[N],fa[N],siz[N];
bool bo[N];
map<int,int>id;
int getfa(int x){return (x==fa[x]||fa[x]==0)?x:fa[x]=getfa(fa[x]);}
inline void merge(int a,int b){
	int x=getfa(a),y=getfa(b);
	bo[x]=bo[y]=1;
	if(x!=y)fa[x]=y;
}
int main(){
//	freopen("duliu_7.in","r",stdin);
//	freopen("duliu.out","w",stdout);	
	read(n);
	f(i,1,n){
		read(a[i]),a[n+1]^=a[i];
//		if(!id.count(a[i]]))id[a[i]]=++cnt;
	}
//	if(!id.count(a[n+1]]))id[a[n+1]]=++cnt;
	f(i,1,n){
		read(b[i]),b[n+1]^=b[i];
//		if(!id.count(b[i]]))id[b[i]]=++cnt;
	}
//	if(!id.count(b[n+1]]))id[b[n+1]]=++cnt;
	f(i,1,n+1)c[i]=a[i],d[i]=b[i];
	sort(c+1,c+n+2),sort(d+1,d+n+2);
	f(i,1,n+1){
		if(c[i]!=d[i])return (puts("-1"),0);
		if(id.count(c[i])==0)id[c[i]]=++cnt;
        if(id.count(d[i])==0)id[d[i]]=++cnt; 
	}
	f(i,1,cnt)fa[i]=i,siz[i]=1;
	f(i,1,n+1){
		a[i]=id[a[i]],b[i]=id[b[i]];
		if(a[i]!=b[i]){
			if(i<=n)++ans;
			merge(a[i],b[i]);
		}
	}
	if(ans==0)return (puts("0\n"),0);
	bo[a[n+1]]=bo[b[n+1]]=1;
	f(i,1,cnt)if(fa[i]==i&&bo[i])++ans;
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])
			ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(N):
    if "7" in N:
        return "Yes"
    return "No"


if __name__ == "__main__":

    # N
    #
    N = input()
    ans = solv(N)

    print(ans)


Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    string s; cin >> s;
    if (s=="ABC") puts("ARC");
    else puts("ABC");
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int A, B, C;
	cin >>A >>B >>C;
	if (A+B+C>=22)
		cout <<"bust" <<endl;
	else
		cout <<"win" <<endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
  int a,b;
  char s[10],t[10],u[10];
  scanf("%s",s);
  scanf("%s",t);
  scanf("%d %d",&a,&b);
  scanf("%s",u);
  if (strcmp(u,s))
  	b--;
  else
    a--;
  printf("%d %d",a,b);
}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,Q;
    cin >> N >> Q;
    vP query(Q);
    rep(i,Q){
        cin >> query[i].first >> query[i].second;
        query[i].second-=2;
    }
    ll ans=(N-2)*(N-2);
    vl fixed0(N-2,0),fixed1(N-2,0);
    vl delta0(N-2,N-2),delta1(N-2,N-2);
    int res0=N-2,res1=N-2;
    rep(i,Q){
        if(query[i].first==1){
            if(fixed0[query[i].second]==0){
                ans-=res0;
                res1=query[i].second;
                delta0[query[i].second]=res0;
            }
            else{
                ans-=delta0[query[i].second];
            }
            int nx=query[i].second;
            while(nx<=N-3&&fixed0[nx]==0){
                fixed0[nx]=1;
                delta0[nx]=delta0[query[i].second];
                nx++;
            }
        }
        else{
            if(fixed1[query[i].second]==0){
                ans-=res1;
                res0=query[i].second;
                delta1[query[i].second]=res1;
            }
            else{
                ans-=delta1[query[i].second];
            }
            int nx=query[i].second;
            while(nx<=N-3&&fixed1[nx]==0){
                fixed1[nx]=1;
                delta1[nx]=delta1[query[i].second];
                nx++;
            }
        }
        //cout << ans << '\n';
        //cout << res0 << ' ' << res1 << '\n';
    }
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 12612
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <vector>
#include <bitset>
#include <stack>
#include <iomanip>
typedef long long ll;
typedef unsigned long long ull;
#define mk make_pair

using namespace std;
const int N = 200000;
double a[N];
int main()
{
    ll n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        double val;
        cin >> val;
        a[i] = (val + 1.) / 2.;
    }

    double sum = 0;
    double ans = -1e9;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        if (i >= k) sum -= a[i - k];
        if (i >= k - 1) ans = max(ans, sum);
    }
    cout << setprecision(12) << fixed;
    cout << ans << endl;

}



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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    int N;
    int h, ans = 0, Hm = 0;

    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> h;
        if(Hm <= h) {
            ans++;
            Hm = h;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
  long long n, x, m;
  cin >> n >> x >> m;
  vector<long long> memo(m, 0);
  
  long long ans = 0;
  long long cur = x;
  long long first, last;
  bool en = false;
  for (long long i = 0; i < n; i++) {
    if (memo[cur] > 0) {
      first = memo[cur];
      last = i;
      //cout << "f:" << first << "l:" << last << endl;
      en = true;
      break;
    } else {
      memo[cur] = i;
    }
    ans += cur;
    cur = cur * cur % m;
    //cout << i << " cur:" << cur << " ans:" << ans << endl;
  }
  if (!en) {
    cout << ans << endl;
    return 0;
  }
  long long ans_f = 0, ans_m = 0, ans_l = 0;
  cur = x;
  for (long long i = 0; i < first; i++) {
    ans_f += cur;
    cur = cur*cur % m;
  }
  //cout << "m- cur: " << cur << endl;
  for (long long i = first; i < last; i++) {
    ans_m += cur;
    cur = cur*cur % m;
  }
  long long num = (n - first) / (last - first);
  long long last_s = first + num*(last-first);
  //cout << "num" << num <<"l-ls: " << last_s << " cur: " << cur << endl;
  for (long long i = last_s; i < n; i++) {
    ans_l += cur;
    cur = cur*cur % m;
  }
  cout << (ans_f + ans_m*num + ans_l) << endl;
}

Measured memory_bytes: 4048
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ar = new int[n + 1];
        int total = 0;
        for (int i = 1; i <= n; i++) {
            ar[i] = sc.nextInt();
            total += ar[i];
        }
        int m = sc.nextInt();
        for (int i = 0; i < m; i++) {
            int p = sc.nextInt();
            int x = sc.nextInt();
            System.out.println(total - ar[p] + x);
        }
    }
}

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

int main()
{
  int a[4], b[4];
  int hit, blow;
  while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
    hit = blow = 0;
    for (int i = 0; i < 4; i++){
      if (a[i] == b[i]){
        hit++;
      }
      for (int j = 0; j < 4; j++){
        if (a[i] == b[j]){
          blow++;
        }
      }
    }
    blow -= hit;
    cout << hit << " " << blow << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[]
    n=int(input())
    for i in range(n):
        s,p=input().split()
        ll=[s,-int(p),i+1]
        l.append(ll)
    l.sort()
    for i in range(n):
        print(l[i][2])
resolve()

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0xff,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(){
	int a;
	string s;
	cin>>a>>s;
	if(a<3200)puts("red");
	else cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;

void main() {
  auto input = readln.split.map!(to!int);
  int W = input[0];
  int H = input[1];
  int N = input[2];
  int[4] A = [0, W, 0, H];
  foreach (i; 0..N) {
    input = readln.split.map!(to!int);
    if (input[2]== 1)
      A[0] = max(A[0], input[0]);
    else if (input[2]== 2)
      A[1] = min(A[1], input[0]);
    else if (input[2]== 3)
      A[2] = max(A[2], input[1]);
    else if (input[2]== 4)
      A[3] = min(A[3], input[1]);
  }

  if (A[0] >= A[1] || A[2] >= A[3])
    writeln(0);
  else
    writeln((A[1]-A[0])*(A[3]-A[2]));
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<pii> vpii;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


void solve() {
    int l, r, d;
    cin >> l >> r >> d;
    put(r/d - (l-1)/d);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;

    while (q--) solve();
}


Measured memory_bytes: 3168
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
n = len(s)
K = inp()
dp = [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)]
# dp[i][j][k] j:0 kaku j:1 mikaku , k:kosuu
dp[0][1][0] = 1
for i,x in enumerate(s):
    x = int(x)
    for k in range(4):
        dp[i+1][0][k] += dp[i][0][k]
        dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1))

        if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
        for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print()
print(dp[-1][0][K] + dp[-1][1][K])


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

#define ll long long
#define rep(i, l, r) for (int i = l; i <= r; ++ i)

using namespace std;

inline int read()
{
	int cnt = 0; bool opt = false; char ch = getchar();
	
	for (; ! isdigit(ch); ch = getchar())
		if (ch == '-') opt = true;
	for (; isdigit(ch); ch = getchar())
		cnt = (cnt << 3) + (cnt << 1) + (ch ^ 48);
		
	return opt ? -cnt : cnt;
}

long long n;

int main()
{
	cin >> n;
	
	ll p = 100;
	
	for (int i = 1; ; ++ i)
	{
		if (p * 1.01 >= n)
		{
			cout << i;
			return 0;
		}
		p *= 1.01;
			
	}
}

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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  if (N == 1 || A >= B) {
    if (A != B) {
      cout << 0 << endl;
    }
    else {
      cout << 1 << endl;
    }
    return 0;
  }
  cout << (B-A) * (N-2) + 1 << endl;
}


Measured memory_bytes: 256
import math

N = int(input())
i = 0

#c = math.log(N-1, 26)
#A = list(range(int(c)+1))
A = []

while(N!=0):
  c,d = divmod(N-1, 26)
  A.append(chr(d+97))
  #A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
print("".join(A))


Measured memory_bytes: 9108
#include<iostream>
using namespace std;
int main(){
 unsigned long long int t;cin>>t;
unsigned long long int ac,tle,wa,re;ac=tle=wa=re=0;
 string a;
 while(t--){
    cin>>a;
    if (a=="AC") ac++;
    if (a=="TLE") tle++;
    if (a=="WA") wa++;
    if (a=="RE") re++;

 }
 cout<<"AC x "<<ac<<"\n"<<"WA x "<<wa<<"\n"<<"TLE x "<<tle<<"\n"<<"RE x "<<re<<"\n";
 return 0;}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, K;
    cin >> n >> K;
    vector<int> A(n);
    rep(i, n) cin >> A[i];

    unordered_map<int, int> C;
    rep(i, n) C[A[i]] = 0;
    rep(i, n) C[A[i]]++;

    vector<int> cv;
    for (auto kv: C) {
        cv.push_back(kv.second);
    }

    sort(all(cv));

    if (cv.size() <= K) {
        put(0);
        return 0;
    }

    int sum = 0;
    rep(i, cv.size() - K) {
        sum += cv[i];
    }
    
    put(sum);

    return 0;
}

Measured memory_bytes: 13844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll x;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> x;
	ll dp[100500];
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;
	rep(i, 0, x-1){
		if(dp[i] == 1){
			rep(j, 0, 5){
				dp[i+100+j] = 1;
			}
		}
	}
	print(dp[x])
	return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b>> c>> d;
  
  int L = a + b;
  int R = c + d;
  
if(L>R){
  cout << "Left" << endl;
}
  else if(L<R){
  cout << "Right" << endl;
}
  else{
      cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
H = [int(x) for x in input().split()]
lst = [0] * N
lst[1] = abs(H[0] - H[1])

for i in range(2, N):
    lst[i] = min(lst[i - 2] + abs(H[i - 2] - H[i]), lst[i - 1] + abs(H[i - 1] - H[i]))
print(lst[N - 1])


Measured memory_bytes: 13980
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<ll, ll> > ab(n);
    REP(i,n){
        ll a,b;
        cin >> a >> b;
        ab[i]= make_pair(b,a);
    }
    sort(ALL(ab));
    ll sum = 0;
    bool ans = true;
    REP(i,n){
        ll b,a;
        b=ab[i].fi;
        a=ab[i].se;
        sum+=a;
        if(sum>b){
            ans = false;
            break;
        }
    }
    if(ans){
        cout <<"Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}

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

int main()
{
	string s;
	cin >> s;

	bool yes = true;
	int ss = s.size();
	int j = ss - 1;

	int hs = ss / 2;
	for (int i = 0; i < hs; ++i) {
		if (s[i] != s[j]) {
			yes = false;
			break;
		}
		--j;
	}


	j = hs - 1;
	for (int i = 0; i < hs / 2; ++i) {
		if (s[i] != s[j]) {
			yes = false;
			break;
		}
		--j;
	}

	j = ss - 1;
	for (int i = hs + 1; i < (hs + 1 + hs / 2); ++i) {
		if (s[i] != s[j]) {
			yes = false;
			break;
		}
		--j;
	}

	if (yes) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())-1
print(a[k])

Measured memory_bytes: 38384
#include <stdio.h>

int main(void){
    int i,j,k;
    int N,answer;
    char S[8];
   
    scanf("%s",S);
    
    for(i = 0;i < 3;i++){
        if(S[i] == S[i+1]){
            printf("Bad\n");
            return 0;
        }
    }
   
    printf("Good\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(void){
  int A, B, C, X, res = 0;
  cin >> A >> B >> C >> X;
  for(int a = 0; a <= A; a++){
      for(int b = 0; b <= B; b++){
          for(int c = 0; c <= C; c++){
              int sum = 500*a + 100*b + 50*c;
              if(sum == X) res++;
          }
      }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.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++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
    int n, k;
    cin >> n >> k;
    int powk = 1, out = 0;
    while(n >= powk){
        powk *= k;
        out++;
    }

    cout << out << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

const string dict = "abcdefghijklmnopqrstuvwxyz";
const ll MX = 1000000000000001;

string num2digs(ll n, int ndig) {
    string s;
    while (n) {
        char ch = dict[n%26];
        s = ch + s;
        n = n / 26;
    }
    int rm = ndig - s.size();
    rep(i, rm) {
        s = 'a' + s;
    }
    return s;
}

int main()
{
    ll n;
    cin >> n;
    vector<ll> lm;
    ll x = 1, sum = 0;
    while (sum < MX) {
        lm.push_back(sum);
        x *= 26;
        sum += x;
    }
    lm.push_back(sum);
    // cout << lm << endl;
    int num;
    rep(i, lm.size()) {
        if (lm[i] >= n) {
            num = i;
            break;
        }
    }
    ll rem = n - lm[num - 1];
    // cout << "num : " << num << ", lm[num-1]: " << lm[num-1] << ", rem: " << rem << endl;
    string ans = num2digs(rem - 1, num);
    cout << ans << "\n";
    return 0;
}


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

int main () {
	char s[10];
	cin >> s;
	switch (s[0]) {
		case 'S':
			cout << "Cloudy" << endl;
			break;
		case 'C':
			cout << "Rainy" << endl;
			break;
		case 'R':
			cout << "Sunny" << endl;
			break;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
 
#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s
 
using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
 
 
 
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n;
	std::cin >> n;
	std::vector<uint32> a(n);
	rep(i, 0, n) {
		std::cin >> a[i];
		--a[i];
	}
	uint32 ans = 0;
	rep(i, 0, n) {
		if (a[a[i]] == i) {
			++ans;
		}
	}
	std::cout << (ans >> 1) << "\n";
	return 0;
}

Measured memory_bytes: 1024
S=raw_input()

ans=[ 0 for _ in range(len(S)) ]

r_cnt=0
l_cnt=0
start=0
prev=None
for i,a in enumerate(S):
	if prev=="L" and a=="R":
		all=r_cnt+l_cnt

		if all%2==0:
			ans[r_blackhole]=all/2
			ans[l_blackhole]=all/2
		else:
			if (r_blackhole-start)%2==0:
				ans[r_blackhole]=all/2+1
				ans[l_blackhole]=all/2
			else:
				ans[r_blackhole]=all/2
				ans[l_blackhole]=all/2+1

		l_cnt, r_cnt=0,1
		l_blackhole , r_blackhole=None,None
		start=i
		
	else:
		if a=="R": r_cnt+=1
		elif a=="L": l_cnt+=1
		if prev=="R" and a=="L":
			r_blackhole , l_blackhole=i-1,i
	prev=a
else:
	all=r_cnt+l_cnt

	if all%2==0:
		ans[r_blackhole]=all/2
		ans[l_blackhole]=all/2
	else:
		if (r_blackhole-start)%2==0:
			ans[r_blackhole]=all/2+1
			ans[l_blackhole]=all/2
		else:
			ans[r_blackhole]=all/2
			ans[l_blackhole]=all/2+1


for i in ans:
	print i,

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> coins(h, vector<int>(w, 0));
    rep(i, h) {
        rep(j, w) {
            cin >> coins[i][j];
        }
    }
    int n = 0;
    vector<vector<int>> ans;
    rep(i, h) {
        rep(j, w) {
            if (coins[i][j] & 1) {
                if (i + 1 < h) {
                    coins[i][j]--;
                    coins[i + 1][j]++;
                    n++;
                    ans.push_back({i, j, i + 1, j});
                } else if (j + 1 < w) {
                    coins[i][j]--;
                    coins[i][j + 1]++;
                    n++;
                    ans.push_back({i, j, i, j + 1});
                }
            }
        }
    }
    cout << n << endl;
    for (auto v : ans) {
        printf("%d %d %d %d\n", v[0] + 1, v[1] + 1, v[2] + 1, v[3] + 1);
    }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int c[3][3];
	rep(i, 3) {
		rep(j, 3) {
			cin >> c[i][j];
		}
	}

	int a[3], b[3];
	b[0] = c[0][0];
	b[1] = c[0][1];
	b[2] = c[0][2];

	a[0] = 0;
	a[1] = c[1][0] - b[0];
	a[2] = c[2][0] - b[0];

	rep(i, 3) {
		rep(j, 3) {
			if (c[i][j] != (a[i] + b[j])) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

	return 0;
}

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

ll N, M;
set<ll> A;
ll memo[200000];
bool vis[200000];
ll mod =  1000000007;

ll go(ll pos){
	if(pos > N){
		return 0;
	}
	if(A.count(pos)){
		return 0;
	}
	if(pos == N){
		return 1;
	}
	if(vis[pos]){ return memo[pos]; }
	ll res = 0;
	//salto 1 
	res += go(pos + 1) % mod;
	//salto 2
	res += go(pos + 2) % mod ;
	res %= mod;
	memo[pos] = res;
	vis[pos] = 1;
	return res;
}

int main(){
	cin >> N >> M;
	ll k;
	for(int i = 0; i < M; i++){
		cin >> k;
		A.insert(k);
	}
	cout << go(0);
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

void primeFactor(int n, map<int,int>& m){
	for(int i = 2; i * i <= n; i++){
		while(n % i == 0){
			++m[i];
			n /= i;
		}
	}
	if(n != 1) m[n] += 1;
}

int ans;

void dfs(int idx, int p, vector<int>& v){
	if(p == 75) ans++;
	if(idx >= v.size() or p >= 75){
		return;
	}

	rep(i,v[idx] + 1){
		dfs(idx + 1, p * (i + 1), v);
	}
}

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

	map<int,int> m;
	range(i,1,n + 1){
		primeFactor(i,m);
	}

	vector<int> v;
	for(auto i : m){
		//cout << i.second << endl;
		v.emplace_back(i.second);
	}
	dfs(0, 1, v);
	cout << ans << endl;
}


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

int main(){
    
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }

    for(int i=0; i<n-k; i++){
        if(a.at(i)<a.at(i+k)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4044
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
#define fcout cout<<fixed<<setprecision(10)
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
//template<typename T>void pp(T x){cout<<x<<endl;}

using namespace std;
template<typename T> void test(vector<T> v){for(int i=0;i<v.size();i++){if(i)cout<<" ";cout<<v[i];}cout<<endl;}

int main(){
    int n;
    cin>>n;
    int ans=0;
    string s; cin>>s;
    rep(p,0,n){
        string t;
        cin>>t;
        rep(i,0,t.size()){ //見始める終点
            rep(k,0,50){
                bool f=true;
                rep(j,0,s.size()){
                    if(i+j*k>=t.size()){
                        f=false;
                        break;
                    }
                    if(s[j]!=t[i+j*k])f=false;
                }
                if(f){
                    ans++;
                    goto A;
                }
            }
        }
        A:;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3216
N = int(input())
L = []
l = []
for i in range(N):
  S, P = input().split()
  L.append((S, 100 - int(P)))
  l.append((S, 100 - int(P)))
  
L.sort()
for i in L:
  print(l.index(i) + 1)

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

int main() {
    int N; cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N ;i++) cin >> s.at(i);
    int M; cin >> M;
    vector<string> t(M);
    for (int i = 0; i < M ;i++) cin >> t.at(i);

    int ans = 0;

    for (int i = 0; i < N; i++) {
        int point = 0;
        for (int j = 0; j < N; j++) {
            if (s.at(i) == s.at(j)) point++;
        }

        for (int j = 0; j < M; j++) {
            if (s.at(i) == t.at(j)) point--;
        }

        if (point > ans) ans = point;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3640
#include<stdio.h>
int main()
{
  int a,b,c,d,i;
  scanf("%d",&a);
  if(a==1 || a==2)printf("0\n");
  else if(a%2==1)printf("%d\n",a/2);
  else printf("%d\n",a/2-1);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int a;
	cin>>a;
	cout<<(a+(a*a)+(a*a*a))<<"\n";
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 3608
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.In.ReadToEnd();

        var k = 0;
        for (int i = 1; i < s.Length; i++)
        {
            if (s[i - 1] != 'A' || s[i] != 'B')
            {
                continue;
            }

            k++;
            i++;
        }
        var ss = s.Split('\n').Select(x => x.Trim()).Where(x => !string.IsNullOrEmpty(x)).ToArray();
        var prefixB = ss.Count(x => x.First() == 'B');
        var suffixA = ss.Count(x => x.Last() == 'A');
        var coexistence = ss.Count(x => x.First() == 'B' && x.Last() == 'A');
        var atBound = Math.Min(prefixB, suffixA);
        if (atBound > 0 && atBound == coexistence && prefixB == suffixA)
        {
            atBound--;
        }
        k += atBound;
        Console.WriteLine(k);
    }
}


Measured memory_bytes: 14304
using System;
using System.Linq;

// 最小値、最大値、合計値

public class ITP1_4_D
{
    public static void Main(string[] args)
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int n = int.Parse(Console.ReadLine());
        int[] nums = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int max = nums[0];
        int min = nums[0];
        long sum = 0;

        for (int i = 0; i < n; i++)
        {
            sum += nums[i];
            if (max < nums[i])
            {
                max = nums[i];
            }
            if (nums[i] < min)
            {
                min = nums[i];
            }
        }

        Console.WriteLine($"{min} {max} {sum}");
    }
}



Measured memory_bytes: 20404
try:
  N = int(input())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  __ = a_[N:]
  b = sorted(__, reverse=True)
  c = [b[i] for i in range(len(b)) if i%2!=0]
  print(sum(c))
except EOFError:
  pass

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

int main(){
    ll a,b,k; cin >> a >> b >> k;
    if(a >= k){
        a -= k;
    }else if(a+b >= k){
        k -= a;
        a = 0;
        b -= k;
    }else{
        a = b = 0;
    }
    cout << a << " " << b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
    ll a;cin>>a;
    string s;cin>>s;
    if(a>=3200)cout<<s<<"\n";
    else cout<<"red\n";
}


Measured memory_bytes: 256
import sys
import itertools


class UnionFindTree:
    def __init__(self, n: int) -> None:
        self.par = list(range(n))
        self.rank = [0] * n

    def find(self, x: int) -> int:
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x: int, y: int) -> None:
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)


def resolve(in_):
    N, M, K = map(int, in_.readline().split())
    ab = tuple(tuple(map(int, line.split())) for line in itertools.islice(in_, M))
    cd = tuple(tuple(map(int, line.split())) for line in itertools.islice(in_, K))

    ng = [set() for _ in range(N + 1)]
    friends_tree = UnionFindTree(N + 1)

    for a, b in ab:
        friends_tree.unite(a, b)
    for a, b in ab:
        if friends_tree.same(a, b):
            ng[a].add(b)
            ng[b].add(a)
    for c, d in cd:
        if friends_tree.same(c, d):
            ng[c].add(d)
            ng[d].add(c)
    ok = [0] * (N + 1)
    for i in range(1, N + 1):
        ok[friends_tree.find(i)] += 1    

    ans = [0] * (N + 1)
    for i in range(1, N + 1):
        ans[i] = ok[friends_tree.find(i)] - len(ng[i]) - 1

    return ' '.join(map(str, ans[1:]))


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


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

int main(void){
    int H,W;
    cin >> H >> W;

    for(int i=0; i<W+2; i++){
        cout << "#";
    }
    cout << endl;

    for(int i=0; i<H; i++){
        string s; cin >> s;
        cout << "#" << s << "#" << endl;
    }

    for(int i=0; i<W+2; i++){
        cout << "#";
    }
    cout << endl;

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    double ans;
    double a = N/2;
    double b = N;
    ans = 1 - a/b;
    cout << ans << 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 int mod = 1000000007;
struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
} comb(10000005);
int main() {
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    //mint res = comb(n,k);
    mint ans = 0;
    for(int i=c1;i<=c2;i++) {
        ans += comb(r2+i+1,r2) - comb(r1+i, r1-1);
        //cout << ans.x << endl;;
    }
    cout << ans.x;
}


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

int main()
{
	int n,k;
	cin >>n>>k;
	int h[n];
	for(int i=0;i<n;i++)
		cin >> h[i];

	vector<int> dp(n,0);
	dp[0]=0;
	dp[1]=abs(h[0]-h[1]);
	for(int i=2;i<n;i++)
	{
		int a,b;
		int l = max(i-k,0);
		int m=1000000000;
		for(int j=i-1;j>=l;j--)
		{
			m = min(m,dp[j]+abs(h[i] - h[j]));
		}
		dp[i]=m;
	}

	cout << dp[n-1] ;
	return 0;
}

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

using namespace std;

int main() {
	int s;
	cin >> s;
	set<int> a;
	for (int j = 1;; j++) {
		auto i = a.insert(s);
		if (!i.second) {
			cout << j << endl;
			return 0;
		}
		s = s % 2 ? s * 3 + 1 : s / 2;
	}
}


Measured memory_bytes: 256
N = int(input())
import math as m
div = []

for i in range(1,int(m.sqrt(N))+1):
    if N % i == 0:
        div.append(i)

min = float("inf")
for i in div:
    if max(len(str(i)),len(str(N//i))) <= min:
        min = max(len(str(i)),len(str(N//i)))
print(min)

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

using namespace std;

const int N = 2e5 + 10;
const long long MOD = 1e9 + 7;

long long dp[N], size[N], _count[N];
long long factorial[N];

int n;
vector <int> adjList[N];

void setup(){
    factorial[0] = 1;
    for (long long i=1;i<N;i++){
        factorial[i] = factorial[i - 1] * i % MOD;
    }
}

long long fpow(long long a, long long b){
    if (b == 0) return 1;
    long long temp = fpow(a, b / 2);
    temp = temp * temp % MOD;
    if (b & 1) temp = temp * a % MOD;
    return temp;
}

long long inv(long long a){
    return fpow(a, MOD - 2);
}

void solveSize(int i, int parent){
    size[i] = 1;
    for (auto j : adjList[i]){
        if (j == parent) continue;
        solveSize(j, i);
        size[i] += size[j];
    }
}

void solveDp(int i, int parent){
    if (size[i] == 1){ // Basis
        dp[i] = 1;
        return;
    }
    dp[i] = factorial[size[i] - 1];
    for (auto j : adjList[i]){
        if (j == parent) continue;
        solveDp(j, i);
        dp[i] = (dp[i] * dp[j] % MOD) * inv(factorial[size[j]]) % MOD;
    }
}

void solve_count(int i, int parent){
    if (i == parent){ // akar
        _count[i] = dp[i];
    } else{
        _count[i] = (((_count[parent] * factorial[size[i]] % MOD) * factorial[n - size[i] - 1] % MOD) * inv(factorial[n - size[i]]) % MOD) * inv(dp[i]) % MOD;
        for (auto j : adjList[i]){
            if (j == parent) continue;
            _count[i] = (_count[i] * dp[j] % MOD) * inv(factorial[size[j]]) % MOD;
        }
    }
    for (auto j : adjList[i]){
        if (j == parent) continue;
        solve_count(j, i);
    }
}

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

    setup();

    cin >> n;
    for (int i=1;i<n;i++){
        int a, b;
        cin >> a >> b;
        adjList[a].push_back(b);
        adjList[b].push_back(a);
    }

    // akar = 1
    solveSize(1, 1);
    solveDp(1, 1);
    solve_count(1, 1);

    for (int i=1;i<=n;i++){
        cout << _count[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 21120
// {{{
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long int i32;
typedef unsigned long int u32;
typedef long long int i64;
typedef unsigned long long int  u64;
typedef pair<i32, i32> PII;
typedef vector<i32> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<i32, i32> MPII;
typedef set<i32> SETI;
typedef multiset<i32> MSETI;
#define IN(x) cin >> x;
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define BTW(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define PF push_front
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
// }}}

const i64 MAX_N = 100;
const i64 MAX_W = (i64)1e9;
array<i64, MAX_N> w, v;
i64 dp[3 * MAX_N][3 * MAX_N];
int main() {
    i64 N, W;
    cin >> N >> W;
    REP(i, N) {
        cin >> w[i] >> v[i];
    }
    const i64 minW = w[0];
    REP(i, N) {
        w[i] -= minW;
    }
    i64 ans = 0;
    REP(i, 3 * MAX_N)REP(j, 3 * MAX_N) {
        dp[i][j] = -(i64)INF * MAX_N;
    }
    dp[0][0] = 0;
    REP(i, N)RREP(j, N)REP(k, 3 * N) {
        if(3 * N  <= k + w[i] || dp[j][k] < 0) {
            continue;
        }
        if((i64)k + w[i] + minW * (i64)(j + 1) <= W) {
            amax(dp[j+1][k+w[i]], dp[j][k]+v[i]);
            // printf("dp[%d][%d]: %d\n", j+1, k+w[i], dp[j+1][k+w[i]]);
            // DEBUG(dp[j+1][k+w[i]]);
            amax(ans, dp[j+1][k+w[i]]);
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 896