akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <atcoder/all>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;
using namespace atcoder;

using mint = modint998244353;

mint inv[100001];
mint fact[100001];
mint finv[100001];
mint _fact2[100001];

void compare_fact(int n, int mod) {
	int i;
	
	inv[1] = 1;
	for (i = 2; i <= n; i++) {
		inv[i] = -inv[mod % i] * (mod / i);
	}
	
	fact[0] = finv[0] = 1;
	for (i = 1; i <= n; i++) {
		fact[i] = i * fact[i - 1];
		finv[i] = inv[i] * finv[i - 1];
	}
	
	_fact2[0] = _fact2[1] = 1;
	for (i = 2; i <= n; i++) {
		_fact2[i] = i * _fact2[i - 2];
	}
}

mint fact2(int n) {
	if (n < 0) return 1;
	return _fact2[n];
}

mint comb(int n, int k) {
	return fact[n] * finv[k] * finv[n - k];
}

int n;
int h[100000];		//高さは0～99999の範囲にする
int cnt[100000];	//cnt[h] = 高さhの人数
vector<vector<mint>> coe;	//coe[i][j] = i個目の多項式のx^jの係数

mint f(int i, int k) {
	return comb(cnt[i], 2 * k) * fact2(2 * k - 1);
}

//coe[l, r)
vector<mint> dfs(int l, int r) {
	if (r - l == 1) return coe[l];
	
	int m = (l + r) / 2;
	vector<mint> res1 = dfs(l, m);
	vector<mint> res2 = dfs(m, r);
	return convolution(res1, res2);
}

int main() {
	int i, j;
	
	int hmax = 0;
	
	cin >> n;
	rep(i, 2 * n) {
		cin >> h[i];
		h[i]--;
		cnt[h[i]]++;
		hmax = max(hmax, h[i]);
	}
	
	compare_fact(2 * n, 998244353);
	
	coe.resize(hmax + 1);
	rep(i, hmax + 1) {
		coe[i].resize(cnt[i] / 2 + 1);
		rep(j, coe[i].size()) {
			coe[i][j] = f(i, j);
		}
	}
	
	vector<mint> res = dfs(0, coe.size());
	while (res.size() < n + 1) {
		res.push_back(0);
	}
	
	mint ans = 0;
	rep(i, n + 1) {
		if (i % 2 == 0) {
			ans += res[i] * fact2(2 * n - 2 * i - 1);
		}
		else {
			ans -= res[i] * fact2(2 * n - 2 * i - 1);
		}
	}
	cout << ans.val() << endl;
	
	return 0;
}

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

int main(){
	int n,a,b,temp,ban;
	ban=1;
	temp=0;
	cin>>n>>a;
	
	for(int i=1;i<=n;i++){
		cin>>b;
		temp=temp+b;
		if(temp<=a){
			ban++;
		}
		else {
			break;
		}
	}
	cout<<ban<<endl;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  cin >> a >> b;
  cin >> s;
  s[b - 1] += 32;
  pr(s);
}

Measured memory_bytes: 3596
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  x = s[0]
  for j in range(n-1):
    if i & (1<<j):
      x += '+'
    x += s[j+1]
  ans += sum(map(int, x.split('+')))
print(ans)

Measured memory_bytes: 9144
import itertools
N1, K1 = map(int, input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;
N = len(listA)
#print(N)
listB = []
for n in range(0,N):
  if n%2==1:
    listB.append(listA[n])
#    print(listB)
listC = list(itertools.chain.from_iterable(listB))
#print(listB)
print(N1 - len(list(set(listC))))

Measured memory_bytes: 9380
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
count = 0
buf = 0

for xi, yi in zip(x, y):
    if xi == yi:
        buf += 1
    else:
        if buf > count:
            count = buf
        buf = 0

if buf > count:
    count = buf

if count >= 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9168
import java.util.Scanner;

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

        String a = scanner.next();
        char c = a.toCharArray()[0];
        if ('A' <= c && c <= 'Z') {
            System.out.println("A");
        } else {
            System.out.println("a");
        }
    }
}


Measured memory_bytes: 35652
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what

using namespace std;
 
const int N = (int) 1e5 + 10;
const int M = (int) 101;
const ll big =  (1LL << 51);
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const int INF1 = (int) 1e9 + 3;
const double EPS = (double) 1e-6;
const double PI =  3.14159265359;

int n;
vector<int> v[N];
int dp[N];

int calc(int x) {
  if (dp[x] != -1) 
    return dp[x];
  vector<int> cur;
  int sz = 0;
  for (auto it : v[x]) {
    cur.pb(calc(it));
  }
  sort(all(cur), greater<int>());
  dp[x] = 0;
  for (auto it : cur) {
    dp[x] = max(dp[x], it + (++sz));
  }
  return dp[x];
}

int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    srand(time(0));
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for (int i = 2; i <= n; i++) {
      int p;
      cin >> p;
      v[p].pb(i);
    }
    cout << calc(1);
    return 0;
}

Measured memory_bytes: 17024
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <climits>
using namespace std;
 
#define MOD 1000000009LL
 
typedef long long LL;
typedef pair<LL,LL> pLL;
typedef vector<LL> vLL;
typedef vector<vLL> vvLL;

vvLL ps[64];

vvLL sqmm(const vvLL &x){
	int n = x.size();
	vvLL z(n, vLL(n));
	for(int i = 0; i < n; ++i)
	for(int j = 0; j < n; ++j)
	for(int k = 0; k < n; ++k){
		z[i][j] = (z[i][j] + x[i][k] * x[k][j]) % MOD;
	}
	return z;
}

void mulvm(vLL &x, const vvLL &y){
	int n = x.size();
	vLL z(n);
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < n; ++j){
			z[i] = (z[i] + x[j] * y[j][i]) % MOD;
		}
	}
	x.swap(z);
}

void powmul(vLL &a, vvLL x, LL y){
	int n = x.size();
	for(int k = 0; y; ++k){
		if(y & 1){ mulvm(a, ps[k]); }
		y >>= 1;
	}
}
 
int main(){
	LL w, h, n;
	int T = 0;
	while(scanf("%lld%lld%lld", &w, &h, &n), w){
		vector<pLL> v(n + 1);
		vLL ys;
		LL x, y;
		for(int i = 0; i < n; ++i){
			scanf("%lld%lld", &x, &y);
			v[i] = pLL(y, x);
			if(y > 1 && y < h){
				ys.push_back(y);
			}
		}
		v[n] = pLL(LLONG_MAX, LLONG_MAX);
		sort(v.begin(), v.end());
		ys.push_back(1);
		ys.push_back(h);
		sort(ys.begin(), ys.end());
		ys.erase(unique(ys.begin(), ys.end()), ys.end());

		vvLL &s = ps[0];
		s.assign(w, vLL(w, 0));
		for(int i = 0; i < w; ++i){
			s[i][i] = 1;
			if(i != 0){ s[i][i - 1] = 1; }
			if(i != w - 1){ s[i][i + 1] = 1; }
		}
		for(int i = 1; i < 64; ++i){
			ps[i] = sqmm(ps[i - 1]);
		}

		vLL a(w);
		a[0] = 1;

		int k = 0;
		while(v[k].first <= 1){ ++k; }
		for(int i = 1; i < ys.size(); ++i){
			powmul(a, s, ys[i] - ys[i - 1]);

			while(v[k].first == ys[i]){
				x = v[k].second - 1;
				if(x >= 0 && x < w){
					a[x] = 0;
				}
				++k;
			}
		}
		 
		printf("Case %d: %lld\n", ++T, a[w - 1]);
	}
}

Measured memory_bytes: 4076
program MyFirstPascal;

Uses sysutils;

var n, sum: longint;
var ch: Char;
var nstr: string;

begin
    read(n);
    nstr := IntToStr(n);
    sum := 0;
    for ch in nstr do
        sum += Ord(ch) - Ord('0');
    if n mod sum = 0 then
        writeln('Yes')
    else
        writeln('No');
end.


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(0>=a&&0<=b) {
    cout<<"Zero";
    return 0;
  }
  if(a>0){
    cout<<"Positive";
    return 0;
  }
  
  if((b-a+1)%2==0){
    cout<<"Positive";
    return 0;
  }
  cout<<"Negative";
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
	float v;
	while (scanf("%f", &v) != EOF) {//精度&#38382;&#39064; 
		printf ("%d\n", (int)ceil((v * v / 19.6 + 5) / 5.0 + 0.000000001));
	}
	return 0;
}

Measured memory_bytes: 0
n, k = map( int, input().split() )
a = [ int( i ) for i in input().split() ]

leg = [ 0 ] * n
leg[ 0 ] = 0

p = 0
city_old = 1
for x in range( k ):
    city_new = a[ city_old-1 ]
    if leg[ city_new-1 ] == 0 and city_new != 1:
        leg[ city_new-1 ] = x + 1
    else:
        loop = x + 1 - leg[ city_new-1 ]
        modk = ( k - ( x + 1 ) ) % loop
#        print( loop, modk )
        break
    city_old = city_new
    p += 1

if p == k:
    print( city_old )
    exit()


city_old = city_new
for x in range( modk ):
    city_new = a[ city_old-1 ]
    city_old = city_new

print( city_old )


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

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

  int x = 1;
  int n = 0;
  while (x < K && n < N){
    x = x * 2;
    n++;
  }

  for(int i=0; i<N-n; i++){
    x = x + K;
  }
  
  cout << x << endl;
  
}


Measured memory_bytes: 256
import sys

# B - Making Triangle
import itertools

N = int(input())
L = list(map(int, input().split()))

combis = list(itertools.combinations(L, 3))
ans = 0

for combi in combis:
	a, b, c = combi

	if a != b and b != c and c != a:
		if a + b > c and b + c > a and c + a > b:
			ans += 1

print(ans)

Measured memory_bytes: 20620
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
    int n, m;
    bool ok;
    for (scanf("%d%d", &n, &m); n+m>0; scanf("%d%d", &n, &m)){
        if (n%2==0 || m%2==0) ok = true; else ok = false;
        if (ok) puts("yes"); else puts("no");
    }
    return 0;
}

Measured memory_bytes: 0
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

min_idx = 0
min_diff = 10**9

for i in range(len(H)):
    h = H[i]
    diff = abs(A - (T - h*0.006))
    if diff < min_diff:
        min_diff = diff
        min_idx = i
print(min_idx+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    string S;
    cin >> S;

    if(S[0] == S[1] || S[1] == S[2] || S[2] == S[3])
        cout << "Bad" << endl;
    else
        cout << "Good" << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long[] T = new long[N];
        for (int i = 0; i < N; i++) {
            T[i] = scan.nextLong();
        }
        long answer = solve(T);
        System.out.println(answer);
    }
    public static long solve(long[] T) {
        long current_lcm = T[0];
        for (int i = 0; i < T.length; i++) {
            current_lcm = lcm(T[i], current_lcm);
        }
        return current_lcm;
    }
    public static long lcm(long x, long y) {
        long gcd = gcd(x, y);
        return x/gcd*y;
    }
    public static long gcd(long x, long y) {
        if (y == 0) {
            return x;
        }
        return gcd(y, x % y);
    }
}


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

using namespace std;

int L,R;

int main(){
	scanf("%d%d",&L,&R);
	int ans=1e9;
	for(int i=L;i<L+2019 && L<R;i++)
		for(int j=i+1;j<=R && j<=i+2019;j++)
			if((i%2019)*(j%2019)%2019<ans)
				ans=(i%2019)*(j%2019)%2019;
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 256
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 3005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
class Problem {
public:
	int solve() {
		int N, M;
		scanf("%d %d", &N, &M);
		_N = N;
		_G = vector <vector <int>>(N + 1, vector <int>());
		_marks = vector <int>(N + 1, NONE);
		while (M--) {
			int u, v;
			scanf("%d %d", &u, &v);
			_G[u].push_back(v);
		}
		scanf("%d %d", &_S, &_T);
		_Q.push(_S);
		for (int step = 1; !_Q.empty(); step++) {
			_now = _Q;
			_Q = queue <int>();
			BFS3(_now, step);
			if (_marks[_T] != NONE) return step;
		}
		return NONE;
	}
protected:
	void BFS3(queue <int> Q, int step){
		queue <int> QQ[4];
		QQ[0] = Q;
		for (int p = 0; p < 3; p++) {
			vector <bool> visited(_N + 1, false);
			while (!QQ[p].empty()) {
				int u = QQ[p].front(); QQ[p].pop();
				for (int v : _G[u]) if (!visited[v]) {
					visited[v] = true;
					QQ[p + 1].push(v);
				}
			}
		}
		while (!QQ[3].empty()) {
			int u = QQ[3].front(); QQ[3].pop();
			if (_marks[u] == NONE) {
				_marks[u] = step;
				_Q.push(u);
			}
		}
	}

private:
	int _N, _S, _T;
	vector <vector <int>> _G;
	vector <int> _marks;
	queue <int> _Q, _now;
};
/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	// WF("output.txt");
	DF("err.txt");
	
	Problem pb;
	printf("%d\n", pb.solve());
	return 0;
}

Measured memory_bytes: 6272
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pli pair<ll, int> 
#define pdd pair<ld, ld> 
#define mp make_pair
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 1000000007
using namespace std;
int ub(int x[], int lo, int hi, int v){
    int ans = hi;
    while(lo <= hi){
        int m = (lo + hi) / 2;
        if(x[m] >= v){
            ans = m;
            hi = m - 1;
        }
        else
            lo = m + 1;
    }
    return ans;
}
int main(){
   FASTIO
   int n, m;
   cin >> n >> m;
   int x[m];
   rep(i, 0, m)
   cin >> x[i];
   if(n >= m){
       cout << 0;
       return 0;
   }
   sort(x, x + m);
   vector<int> dist;
   rep(i, 1, m)
   dist.pb(x[i] - x[i-1]);
   sort(dist.begin(), dist.end());
   ll ans = 0;
   rep(i, 0, m - n)
   ans += dist[i];
   cout << ans;
   
   
   return 0;
}




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

pair<int,int> topbottom(int num){
    pair<int,int> calc;
    calc.second = num%10;
    while(num/10 != 0){
        num /= 10;
    }
    calc.first = num;
    return calc;
}
 
int main(){
    int N; cin >> N;

    int dig = 1;
    int N_T = N;
    while(N_T/10 !=0){
        dig++;
        N_T /= 10;
    }

    pair<int,int> topandbottom;

    int ans = 0;
    for(int i=1; i<=N; i++){
        if(i%10 == 0){
            continue;
        }
        topandbottom = topbottom(i);

        for(int j=1; j<=dig; j++){
            //j桁のsecondがいくつあるか？

            if(j==1){
                if(topandbottom.first != topandbottom.second){
                    continue;
                }else{
                    ans ++;
                }
            }

            if(j==2){
                int counter = topandbottom.second*10 + topandbottom.first;
                if(counter <= N){
                    ans++;
                }
            }

            if(j==3){
                if(dig > 3){
                    ans += 10;
                }else{
                    for(int k=0; k<10; k++){
                        int counter = topandbottom.second*100 + k*10 + topandbottom.first;
                        if(counter <= N){
                            ans++;
                        }
                    }
                }
            }
            if(j==4){
                if(dig > 4){
                    ans += 100;
                }else{
                    for(int k=0; k<100; k++){
                        int counter = topandbottom.second*1000 + k*10 + topandbottom.first;
                        if(counter <= N){
                            ans++;
                        }
                    }
                }
            }
            if(j==5){
                if(dig > 5){
                    ans += 1000;
                }else{
                    for(int k=0; k<1000; k++){
                        int counter = topandbottom.second*10000 + k*10 + topandbottom.first;
                        if(counter <= N){
                            ans++;
                        }
                    }
                }
            }
            if(j==6){
                for(int k=0; k<10000; k++){
                    int counter = topandbottom.second*100000 + k*10 + topandbottom.first;
                    if(counter <= N){
                        ans++;
                    }
                }
            }

        }


    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdlib.h>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main(void) {
    unsigned long int n = 0, k = 0, i = 1;
    
    cin >> n >> k;
    while(pow(k, i) <= n){
        i++;
    }
    cout << i << endl;
    return 0;
}

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

int main() {
    int H,W;
    cin >> H >> W;
    string a[H];
    for(int i = 0; i < H; ++i) cin >> a[i];
    
    for(int i = 0; i < W+2; ++i) cout << "#";
    cout << endl;
    for(int i = 0; i < H; ++i) cout << "#" << a[i] << "#" << endl;
    for(int i = 0; i < W+2; ++i) cout << "#";
    cout << endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")



#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <memory>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iomanip>
#include <ctime>
#include <sstream>  
#include <deque>
#include <unordered_set>
#include <stack>
#include <functional>
#include <memory.h>
#include <bitset>
#include <numeric>

using namespace std;

#define int long long

signed main() {

    int k, a, b;
    cin >> k >> a >> b;
    int ans = k + 1;
    if (a < b && k > a - 1) {
        k -= a - 1;
        int cur = a;
        cur += (b - a) * (k / 2);
        if (k % 2) {
            cur += 1;
        }
        ans = max(ans, cur);
    }
    cout << ans << endl;
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int count = (n % 2 == 0) ? n / 2 : (n + 1) / 2;
  cout << (float)count / (float)n << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    p = [int(input()) for _ in range(N)]
    
    ans = 0
    max_p = max(p)
    flag = False
    for i in p:
        if i == max_p and flag == False:
            ans += i // 2
            flag = True
        else:
            ans += i

    print(ans)

main()

Measured memory_bytes: 38256
n,k,q = map(int,input().split())
respondent_lst = [int(input()) for _ in range(q)]
point_lst = [k-q]*n

for i in range(q):
    respondent = respondent_lst[i]
    point_lst[respondent-1] += 1

for i in range(n):
    point = point_lst[i]
    if point>0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 10452
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <climits>

using namespace std;

int main(){
    vector<vector<int>> cmat(3, vector<int>(3));
    for(int i=0; i<3; ++i){
        for(int j=0; j<3; ++j){
            cin >> cmat[i][j];
        }
    }
    int sum_c1j=0;
    for(int j=0; j<3; ++j) sum_c1j+=cmat[0][j];
    vector<int> as(3);
    for(int i=1; i<3; ++i){
        int sum_cij=0;
        for(int j=0; j<3; ++j) sum_cij+=cmat[i][j];
        int t=sum_cij-sum_c1j;
        if(t%3){
            cout << "No" << endl;
            return 0;
        }
        as[i]=t/3;
    }
    int sum_a=0;
    for(int i=0; i<3; ++i) sum_a+=as[i];
    for(int j=0; j<3; ++j){
        int sum_cij=0;
        for(int i=0; i<3; ++i) sum_cij+=cmat[i][j];
        if((sum_cij-sum_a)%3){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
r,c=map(int,input().split())
matr= [input().split() for i in range(r)]
for i in range(len(matr)):
    matr[i] = [int(j) for j in matr[i]]
matr_column=[sum(matr[i]) for i in range(len(matr))]
for i in range(len(matr)):
    matr[i].append(matr_column[i])
matr_s=sum(matr,[])
matr_row=[]
for i in range(int((r*c+r)/r)):
    matr_r=matr_s[i:len(matr_s)][::c+1]
    matr_row.append(matr_r)
for i in range(len(matr)):
    print(*matr[i])
print(*[sum(matr_row[i]) for i in range(len(matr_row))])


Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

const int n_max = 2004;

// 黒: 1 白: 0

int black[2][2 * n_max][n_max];
int dp[2* n_max][n_max];


struct Ball{
    int x,color;

};

signed main(){
    int n;
    cin >> n;
    Ball ball[2 * n];
    int ids[2][n_max];
    REP(i,2 * n){
        string s;
        cin >> s >> ball[i].x;
        if(s == "B"){
            ball[i].color = 1;
            ids[1][ball[i].x] = i;
        }
        else{
            ball[i].color = 0;
            ids[0][ball[i].x] = i;
        }
    }

    REP(i,2) REP(j,2 * n+1) REP(k,n+1) black[i][j][k] = 0;
    REP(i,2 * n){
        REP(j,2) REP(k,n+1) black[j][i + 1][k] = black[j][i][k];
        REPR(j,ball[i].x) black[ball[i].color][i+1][j] ++;
    }



    REP(i,2 * n + 1) REP(j,n+1) dp[i][j] = 0;
    dp[0][0] = 0;
    REP(i,2 * n){
        FOR(j,max( llong(0), i + 1 - n) ,min(n+1,i+2) ){
            if(j != 0 and j != i + 1) dp[i+1][j] = min(dp[i][j] + black[0][ids[0][i-j + 1]][i-j + 1] + black[1][ids[0][i-j + 1] ][j+1],  dp[i][j-1] + black[1][ ids[1][j] ][j + 1] + black[0][ ids[1][j] ][i - j + 2] ); 
            else if( j == i + 1) dp[i+1][j] =dp[i][j-1] + black[1][ ids[1][j] ][j + 1] + black[0][ ids[1][j] ][i - j + 2] ;
            else dp[i + 1 ][j] = dp[i][j] + black[0][ids[0][i + 1 -j]][i-j + 2] + black[1][ids[0][i-j + 1] ][j+1];
        }
    }

    cout << dp[2 * n][n] << endl;
}

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

typedef long long ll;
#define f first 
#define s second 
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
#define pb push_back
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> Pii;
typedef vector<Pii> vpii;
#define rep(i,n) for(int i = 0; i < (n); ++i)

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.f << "," << P.s << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int n;
const int maxn = 2e5 + 1000;
int P[maxn];
int pos[maxn];
int main()
{
	scanf("%d", &n);
	rep(i,n)
	{
		int p;
		scanf("%d", &p);
		--p;
		P[i] = p;
		pos[p] = i;
	}
	int bylo = -1;
	int res = 0;
	int cnt = 0;
	rep(i,n)
	{
		if(bylo < pos[i])
			++cnt;
		else
			cnt = 1;
		maxi(res, cnt);
		bylo = pos[i];
	}
	printf("%d\n", n - res);
}



Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    if(a < b) {
        if(c < b) {
            if(a < c) cout << a << " " << c << " " << b << endl;
            else cout << c << " " << a << " " << b << endl;
        } else cout << a << " " << b << " " << c << endl;
    } else if(c < a) {
        if(c < b) cout << c << " " << b << " " << a << endl;
        else cout << b << " " << c << " " << a << endl;
    } else cout << b << " " << a << " " << c << endl;
    
    return 0;
}


Measured memory_bytes: 3088
import sys
import math
import bisect
import re

d = dict()

def solve(n):
    global d
    if n not in d:
        if n == 1:
            d[n] = 1
        else:
            d[n] = 1 + 2 * solve(n // 2)
    return d[n]

def main():
    n = int(input())
    print(solve(n))

if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=9e15;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(long long i = 0; i < n; i++)
#define rep2(i,k,n) for(long long i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

//Union-Find木
struct UnionFind{
  //メンバ変数 
  vector<long long>par; //par[i]:=頂点iの親
  vector<long long>s; //s[i]:=頂点iが属する集合の個数(iが根のとき)
  
  //コンストラクタ
  UnionFind(long long N):par(N),s(N){
    for(long long i=0;i<N;i++){
      par[i]=i; //最初はすべてが根として初期化
      s[i]=1;
    }
  }
  //メンバ関数
  //root(i):=頂点iの根
  long long root(long long i){
    if(par[i]==i) return i;
    par[i]=root(par[i]); //経路圧縮
    return root(par[i]); //再帰
  }
  //size[i]:=iが属する集合の個数
  long long size(long long i){
    return s[root(i)];
  }
  //same(x,y) xとyが同じ根を持つか(同じ集合に含まれるか)
  bool same(long long x, long long y){
    return root(x)==root(y);
  }
  //unite(x,y) xの根をyの根に繋げる(集合を合併)
  void unite(long long x, long long y){
    if(!same(x,y)){
      long long rx=root(x);
      long long ry=root(y);
      par[rx]=par[ry];
      s[ry]=s[rx]+s[ry];
    }
  }
};

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////


//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);

  lin(N); lin(X); lin(T);

  cout << (N + X -1) / X * T << endl;
}

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

int main() {
	int n, m; cin >> n >> m;
    int rest = n;
    REP(i, m) {
    	int tmp; cin >> tmp;
        rest -= tmp;
    }
    
    cout << max(rest, -1) << endl;
    
    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int i,n,a=0,b=0;
        String sa,sb;
        n=scan.nextInt();
        for(i=0;i<n;i++) {
        	sa=scan.next();
        	sb=scan.next();
        	if(sa.compareTo(sb)>0) {
        		a+=3;
        	}
        	else if(sa.compareTo(sb)<0) {
        		b+=3;
        	}
        	else if(sa.compareTo(sb)==0) {
        		a+=1;
        		b+=1;
        	}
        }
        System.out.println(a+" "+b);
    }
}


Measured memory_bytes: 29752
n = gets.to_i
a = gets.split.map(&:to_i)

sum = a.inject(:+)
ans = 10 ** 18

x = 0
y = sum
(n - 1).times do |i|
  x += a[i]
  y -= a[i]
  ans = (x - y).abs if (x - y).abs < ans
end

puts ans


Measured memory_bytes: 15236
def cardgame(sa, sb, sc):
	tmp = sa[0]
	a = 0
	b = -1
	c = -1
	while True:
		if tmp == 'a':
			a += 1
			if a == len(sa):
				return 'A'
			else:
				tmp = sa[a]
		elif tmp == 'b':
			b += 1
			if b == len(sb):
				return 'B'
			else:
				tmp = sb[b]
		elif tmp == 'c':
			c += 1
			if c == len(sc):
				return 'C'
			else:
				tmp = sc[c]

def main():
	sa = raw_input()
	sb = raw_input()
	sc = raw_input()
	print cardgame(sa, sb, sc)

main()

Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>
using namespace std;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long calcNumOfCombination(long n, long r){
    long num = 1;
    const int MOD = 1000000007;
    for(long i = 1; i <= r; i++){
        num = num * (n - i + 1);
        num%=MOD;
        num = num*modinv(i,MOD)%MOD;
    }
    return num;
}

int main(void) {
    long X,Y;
    std::cin >> X >> Y;
    long count=0;
    if((X+Y)%3!=0 || (2*Y-X)<0 || (2*X-Y)<0){
        count=0;
    }else{
        long all=(X+Y)/3;
        long A= (2*Y-X)/3;
        count = calcNumOfCombination(all,A);
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int x,y,sx,sy,tx,ty,i;
	scanf("%d %d %d %d",&sx,&sy,&tx,&ty);
	x=tx-sx;
	y=ty-sy;
	for(i=0;i<y;i++) printf("U");
	for(i=0;i<x;i++) printf("R");
	for(i=0;i<y;i++) printf("D");
	for(i=0;i<=x;i++) printf("L");
	for(i=0;i<=y;i++) printf("U");
	for(i=0;i<=x;i++) printf("R");
	printf("DR");
	for(i=0;i<=y;i++) printf("D");
	for(i=0;i<=x;i++) printf("L");
	printf("U\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
int s[4];
cin>>s[0];
cin>>s[1];
cin>>s[2];
cin>>s[3];
if(s[0]+s[1]>s[2]+s[3])
cout <<"Left";
else
if(s[0]+s[1]==s[2]+s[3])
cout <<"Balanced";
else
cout <<"Right";
system("pause"); 
return 0;
}


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

using namespace std;

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

int main(){
  int n;
  cin >> n;
  multiset<int> s;
  REP(i, 1 << n){
    int v;
    scanf("%d", &v);
    s.insert(-v);
  }
  vector<int> v;
  int x = *s.begin();
  v.push_back(x);
  s.erase(x);
  REP(i, n){
    vector<int> w = v;
    for(auto x: w){
      auto it = s.upper_bound(x);
      if(it == s.end()){
        cout << "No" << endl;
        return 0;
      }
      v.push_back(*it);
      s.erase(it);
    }
    sort(v.begin(), v.end());
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 14200
class Stack:

  def __init__(self):
    self.stack = []

  def push(self, value):
    self.stack.append(value)

  def pop(self):
    if len(self.stack) == 0:
      raise Exception("アンダーフロー") 
    return self.stack.pop()

s = Stack()
input_str = list(input().split())

for i in input_str:
  if i == "+":
    a = s.pop()
    b = s.pop()
    s.push(a+b)

  elif i == "-":
    b = s.pop()
    a = s.pop()
    s.push(a-b)

  elif i == "*":
    a = s.pop()
    b = s.pop()
    s.push(a*b)

  else:
    s.push(int(i))

print(s.pop())




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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		solver.readA(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public void readA(String str) {
		String[] strArr = str.split("\\s+");
		boolean ok = false;
		int n = 1;
		for (int i = 0; i < N; i++) {
			int a = Integer.parseInt(strArr[i]);
			if (a == n) {
				ok = true;
				n++;
			}
		}
		if (ok)
			System.out.println(N - n + 1);
		else
			System.out.println(-1);
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 50504
N=(int)(input())
As=(input()).split(" ")

A_num = {}

for A in As:
    if A in A_num.keys():
        A_num[A] += 1
    else:
        A_num[A] = 1


total = 0
for num in A_num.values():
    total+=num*(num-1)//2
#print(A_num)
for A in As:
    print(total-A_num[A]+1)

Measured memory_bytes: 26500
words = lambda t : list(map(t, input().split()))
n = input()
a = words(int)
b = words(int)
c = words(int)

prev = -20
ans = 0
for aa in a:
    ans += b[aa-1]
    if prev == aa-2:
        ans += c[aa-2]
    prev = aa-1

print(ans)


Measured memory_bytes: 38384
'''
A - Rated for Me
https://atcoder.jp/contests/abc104/tasks/abc104_a

>>> main(1199)
ABC
>>> main(1200)
ARC
>>> main(4208)
AGC
'''


def main(r):
    if r < 1200:
        print('ABC')
    elif r < 2800:
        print('ARC')
    else:
        print('AGC')


if __name__ == "__main__":
    r = int(input())
    main(r)


Measured memory_bytes: 2940
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string s1;
    string s2;
    string s3;
    char s[3]={0};

    cin >> s1 >> s2 >> s3;
    s[0]=s1[0];
    s[1]=s2[1];
    s[2]=s3[2];

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(0)

c = 0
for i in range(n+1):
    c += abs(a[i+1] - a[i])

for i in range(1, n+1):
    print(c - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]))


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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll n;
    cin>>n;
    cout<<(n + (n*n)+ (n*n*n))<<"\n";
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>

int main()
{
	int e1,e2,e3,e4;
	scanf("%d%d%d%d",&e1,&e2,&e3,&e4);
	if((e1==e2&&e3==e4)||(e1==e3&&e2==e4)||(e1==e4&&e3==e2))
		printf("yes\n");
	else
		printf("no\n");
	return 0;
}


Measured memory_bytes: 2124
#include <cstdlib>
#include <iostream>
#include <math.h>



void Eratosthenes(int N){

}

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

    int n,m;
    while (std::cin >> n) {
        // std::cout << n << "," << std::endl;
        m = 0;
        int arr[n];
        for(int i = 0; i <= n; i++){
            arr[i] = 1;
        }
        for(int i = 2; i <= sqrt(n); i++){
            if(arr[i]){
                for(int j = 0; i * (j + 2) <= n; j++){
                    arr[i *(j + 2)] = 0;
                }
            }
        }
        for(int i = 2; i <= n; i++){
            if(arr[i]){
                // std::cout << i << std::endl;
                m++;
            }
        }
        std::cout << m << std::endl;
    }
    return EXIT_SUCCESS;
}


Measured memory_bytes: 6972
#include<bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ll long long int
#define ALL(x) x.begin(),x.end()
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h;
string s;
vector<ll> v;
vector < pair<ll, ll > > vp;
vector<vector<ll> > vv(50, vector<ll>(50, INF));
vector<string> vs;
vector<char> vc;
vector<ll> vi;
vector<ll> vii;

/*--------------------template--------------------*/

int main() {
	cin >> n >> k;
	if (n == k) {
		cout << "Draw" << endl;
	}
	else if ((n > k&&k != 1) || (n == 1 && n != k)) {
		cout << "Alice" << endl;
	}
	else if ((n < k&&n != 1) || (k == 1 && k != n)) {
		cout << "Bob" << endl;
	}
}

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
#define MOD 1000000007
const double pi=acos(-1); // value of pi


bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}


bool isPrime(ll n) {
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;
        }
    }
    return true;
}

map<ll, list<ll>> m;
// map<ll, ll> m;

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    // cin >> t;
    while(t--) {
        ll n, m, x;
        cin >> n >> m;
        for(ll i=0; i<=n; i++) {
            x=(i*2)+((n-i)*4);
            if(x==m) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        cout << "No" << endl;
    }
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


int main() {

    char c; cin >> c;

    char ans = c + 1;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int x;
  cin >> x;
  if(x==3||x==5||x==7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <vector>


using namespace std;


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

    vector<int> a(n, -q+k);
    int a_k;
    for (int i=0; i<q; i++) {
        cin >> a_k;
        a[--a_k]++;
    }

    for (int a_k: a) {
        if (a_k > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 1024
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;

bool check(long a, long b, long c) {
    return (c - b - a) >= 0 && 4*a*b < (c - b - a)^^2;
}

void main() {
    long a, b, c;
    scan(a, b, c);
    yes(check(a, b, c));
}




void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

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

    bool TF = false;

    for(int i=0;i<('z'-'a'+1);i++)
    {
        string S = s;
        S.push_back('a'+i);
        if(S==t) TF = true;
    }

    if(TF) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3624