akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vpii=vector<pair<int,int>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
int main(){
    string s,t;
    cin>>s>>t;
    reverse(all(s));
    reverse(all(t));
    int ss=s.size();
    int ts=t.size();
    string ans;
    bool can=false;
    if(ts<=ss){
        for(int i=0;i+ts<=ss;i++){
            bool can2=true;
            rep(j,ts){
                if(s[i+j]!=t[j]&&s[i+j]!='?')can2=false;
            }
            if(can2){
                rep(j,ss){
                    if(i<=j&&j<=i+ts-1)s[j]=t[j-i];
                    else{
                        if(s[j]=='?')s[j]='a';
                    }
                }
                reverse(all(s));
                can=true;
                break;
            }
        }
    }
    if(can)cout<<s<<endl;
    else cout<<"UNRESTORABLE"<<endl;
}

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

using namespace std;
typedef long long ll;

const int N=2005,M=4005,P=1e9+7;

int n,k,fac[M],ifac[M],inv[M],a,m,f[N];

inline int catalan(int n){
	return (ll)fac[n<<1]*ifac[n]%P*ifac[n]%P*inv[n+1]%P;
}

int main(){
	scanf("%d%d",&n,&k);
	fac[0]=ifac[0]=1;inv[1]=1;
	for(int i=2;i<=2*n;i++)
		inv[i]=P-(ll)(P/i)*inv[P%i]%P;
	for(int i=1;i<=2*n;i++){
		fac[i]=(ll)fac[i-1]*i%P;
		ifac[i]=(ll)ifac[i-1]*inv[i]%P;
	}
	for(int i=1;i<=n;i++){
		f[i]=catalan(i-1);
		for(int j=2,l=min(i,k+1);j<l;j++)(f[j]+=f[j-1])%=P; 
	}
	a=f[k];m=n-k-1;
	while(m>0)(a<<=1)%=P,m--;
	printf("%d",a); 
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,i;
  scanf("%d",&n);
  int a[n];

  for(i=0;i<n;i++){
    scanf("%d",&a[n-i-1]);
  }
  printf("%d",a[0]);
  for(i=1;i<n;i++)printf(" %d",a[i]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 2684
n = int(input())
A = [0] + list(map(int, input().split())) + [0]

D = [abs(A[i+1]-A[i]) for i in range(len(A)-1)]
base = sum(D)

for i in range(n):
  print(base-D[i]-D[i+1]+abs(A[i+2]-A[i]))

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

int N;
vector<vector<int>> G(101010);
int C[101010], era[101010], d[101010], deg[101010], bad[101010];

void dfs(int v,int p,int sum){
  if(era[v]) return;
  sum+=bad[v];
  d[v]=sum;
  for(int u:G[v]) if(u!=p) dfs(u,v,sum);
}

int solve(int v){
  rep(i,N) d[i]=0;
  dfs(v,-1,0);
  int ma=0;
  rep(i,N) if(d[i]>d[ma]) ma=i;
  return ma;
}

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  cin>>N;
  rep(i,N-1){
    int x,y; cin>>x>>y; x--,y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  string S; cin>>S;
  int W=0;
  rep(i,N){
    C[i]=(S[i]=='W');
    deg[i]=G[i].size();
    W+=C[i];
  }
  if(W<=1){
    cout<<W<<endl;
    return 0;
  }
  
  queue<int> que;
  rep(i,N){
    if(deg[i]==1&&C[i]==0) que.push(i);
  }
  while(que.size()){
    int v=que.front(); que.pop();
    if(era[v]) continue;
    era[v]=1;
    deg[v]=0;
    for(int u:G[v]){
      deg[u]--;
      if(C[u]==0&&deg[u]<=1) que.push(u);
    }
  }
  
  int ans=-2;
  rep(i,N) if(era[i]==0){
    ans+=2;
    bool flag=C[i]^(deg[i]%2==1);
    if(flag) ans++;
    bad[i]=flag;
  }
  int s,t;
  rep(i,N) if(era[i]==0){
    s=solve(i);
    break;
  }
  t=solve(s);
  int B=0;
  rep(i,N) if(era[i]==0){
    B+=(C[i]==0);
  }
  cout<<ans-2*d[t]<<endl;
  return 0;
}


Measured memory_bytes: 12240
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    while(true) {
        auto s = readln().chomp().drop(1);
        if(s.empty()) {
            return;
        }
        auto a = s.count('A');
        auto b = s.count('B');
        if(a < b) {
            ++b;
        } else {
            ++a;
        }
        writeln(a, " ", b);
    }
}

Measured memory_bytes: 2348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9;

int n;
const int nx = 1e5+5;
int ac[nx][3];
int dp[3][nx];
int go(int a, int i){
	if(i == n) return 0;
	if(dp[a][i] != -1) return dp[a][i];
	int& ans = dp[a][i];
	
	if(a==0){
		ans=max(ans, go(1, i+1)+ac[i][0]);
		ans=max(ans, go(2, i+1)+ac[i][0]);
	}
	if(a==1){
		ans=max(ans, go(0, i+1)+ac[i][1]);
		ans=max(ans, go(2, i+1)+ac[i][1]);
	}
	if(a==2){
		ans=max(ans, go(0, i+1)+ac[i][2]);
		ans=max(ans, go(1, i+1)+ac[i][2]);
	}
	
	return ans;
}
int main(){
	cin>>n;
	for(int i=0; i<n; i++) cin>>ac[i][0]>>ac[i][1]>>ac[i][2];
	memset(dp, -1, sizeof dp);
	cout<<max(go(0,0),max(go(1,0),go(2,0)))<<"\n";
	return 0;
}

Measured memory_bytes: 7296
N = int(input())
a = [int(x) for x in input().split()]
def bubbleSort(A, N):
	flag = 1
	count = 0
	while flag:
		flag = 0
		for j in reversed(range(1,N)):
			if A[j] < A[j-1]:
				tmp = A[j]
				A[j] = A[j-1]
				A[j-1] = tmp
				flag = 1
				count += 1
	return A,count
ans,c = bubbleSort(a,N)
print(*ans)
print(c)

Measured memory_bytes: 7728
import java.util.Scanner;
import java.util.Arrays;

class QuickSort {
    static void sort(int[] a, int[] b){
        partialySort(a, b, 0, a.length - 1);
    }

    static void partialySort(int[] a, int[] b, int left, int right){
        if(right <= left)
            return;
        
        int pivot = a[(left+right)/2];
        int i = left;
        int j = right;
        int temp;
        while(i <= j){
            while(a[i] < pivot)
                i++;
            while(a[j] > pivot)
                j--;
            if(i <= j){
                temp = a[i];
                a[i] = a[j];
				a[j] = temp;
				temp = b[i];
				b[i] = b[j];
				b[j] = temp;
                i++;
                j--;
            }
        }

        partialySort(a, b, left, j);
        partialySort(a, b, i, right);
    }
}

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		Integer[] a = new Integer[n];
		for(int i=0; i<n; i++){
			a[i] = stdIn.nextInt();
		}
		int[] b = new int[m];
		int[] c = new int[m];
		for(int i=0; i<m; i++){
			b[i] = stdIn.nextInt();
			c[i] = stdIn.nextInt();
		}

		Arrays.sort(a);

		QuickSort.sort(c, b);

		int aIdx = 0;
		int bcIdx = m-1;
		while(aIdx < n && bcIdx >= 0 && a[aIdx] < c[bcIdx]){
			a[aIdx] = c[bcIdx];
			aIdx++;
			b[bcIdx]--;
			if(b[bcIdx] <= 0){
				bcIdx--;
			}
		}

		long sum = 0;
		for(int i=0; i<n; i++){
			sum += a[i];
		}
		System.out.println(sum);
	}
}


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

int main() {
  double m[2][3], x[2];
  double a, b, c, d, e, f;
  int p, q;
  bool zf;
  while (cin>>m[0][0]>>m[0][1]>>m[0][2]>>m[1][0]>>m[1][1]>>m[1][2]) {
    zf = false;
    for (int i=0;i<2;i++) {
      for (int j=0;j<2;j++) {
        if (m[i][j] == 0) {
          p = i; q = j;
          zf = true;
        }
      }
    }
    if (zf) {
      x[1-q] = m[p][2] / m[p][1-q];
      x[q] = (m[1-p][2] - m[1-p][1-q] * x[1-q]) / m[1-p][q];
    } else {
      a = m[0][0]; b = m[0][1]; c = m[0][2];
      d = m[1][0]; e = m[1][1]; f = m[1][2];
      x[1] = (f - d*c/a) / (e - d*b/a);
      x[0] = (c - b*x[1]) / a;
    }

    printf("%.3f %.3f\n", x[0], x[1]);
  }
  return 0;
}

Measured memory_bytes: 3208
#include <iostream>

using namespace std;

int main() {

    bool P[50001];
    fill(P, P + 50001, true);
    P[0] = P[1] = false;

    for (int i = 2; i * i <= 50000; i++) {
        if (P[i]) {
            for (int j = i * 2; j <= 50000; j += i) {
                P[j] = false;
            }
        }
    }

    int n;
    while (cin >> n) {
        if (n == 0) break;
        int ans = 0;
        for (int i = 2; i <= n / 2; i++) {
            if (P[i] && P[n - i]) ans++;
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    int n,m;
    std::cin >> n>>m;
    std::vector<bool> b(n+1,1);
    
    rep(i,m){
        int d;
        std::cin >> d;
        b[d]=0;
    }
    std::vector<ll> dp(n+2,0);
    dp[0]=1;
    if(b[1])dp[1]=dp[0];
    rrep(i,2,n+1){
        if(b[i-1])dp[i]+=dp[i-1];
        if(b[i-2])dp[i]+=dp[i-2];
        dp[i]%=MOD;
    }
    std::cout << dp[n] << std::endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int ans=1;
	while(n/k)
	{
		ans++;n/=k;
	}
	printf("%d\n",ans);
}

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

int main(){
	int n;
	cin >>n;
	int a[n],b[n],c[n],d[n];
	int ans = 0,used_a[n],used_c[n];
	//memset(used_a,0,n * sizeof(used_a));
	//memset(used_c,0,n * sizeof(used_c));

	for(int i=0;i<n;i++)used_a[i]=0;
	for(int j=0;j<n;j++)used_c[j]=0;


	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	for(int i=0;i<n;i++)cin>>c[i]>>d[i];
	int tmp1=500,tmp2=-1,cntx,cnty;
	//データをソート
	for(int i=0;i<n;i++){
		tmp1 = b[i]; tmp2 = c[i];
		cntx = i; cnty =i;
		for(int j=i;j<n;j++){
			//赤のうちyが最大のもの
			if(tmp1<b[j]){
				tmp1 = b[j];
				cnty = j;
			}
			//青のうちxが最小のもの
			if(tmp2>c[j]){
				tmp2 = c[j];
				cntx =  j;
			}
			//cout<<"cntx:"<<cntx<<"cnty:"<<cnty<<endl;
		}
		b[cnty] = b[i];
		b[i] = tmp1;
		tmp1 = a[cnty];
		a[cnty] = a[i];
		a[i] = tmp1;
		c[cntx] = c[i];
		c[i] = tmp2;
		tmp2 = d[cntx];
		d[cntx] = d[i];
		d[i] = tmp2;
	}

	/*for(int i=0;i<n;i++){
		cout<<"a,b:"<<a[i]<<" "<<b[i]<<endl;
	}
	for(int i=0;i<n;i++){
		cout<<"c,d:"<<c[i]<<" "<<d[i]<<endl;
	}*/
//	cout<<endl;


	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(used_a[j] == -1 || used_c[i] == -1){
				//cout<<a[j]<<"or"<<c[i]<<"is used"<<endl;
				//cout<<a[j]<<"is"<<used_a[j]<<endl;;
				continue;
			}
			if(a[j]<c[i] && b[j]<d[i]){
				//cout<<"a,b:"<<a[j]<<" "<<b[j]<<endl;
				//cout<<"c,d:"<<c[i]<<" "<<d[i]<<endl;
				ans++;
				used_a[j] = -1;
				used_c[i] = -1;

			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 384
def solve():
    A, B = map(int, input().split())
    if A == B:
        ans = "Draw"
    elif A == 1:
        ans = "Alice"
    elif B == 1:
        ans = "Bob"
    elif A > B:
        ans = "Alice"
    elif A < B:
        ans = "Bob"
    print(ans)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3060
N = int(input())
H = list(map(int, input().split()))

ans = 0
active = 0
for i in range(N):
    if active >= H[i]:
        active = H[i]
    else:
        ans += H[i] - active
        active = H[i]
    #print("ans : ", ans, "active : ", active)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <math.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define str string
#define deb_arr(arr,n) for(ll i=0;i<(n);i++){ cout << (arr)[i] << " ";}
#define in_arr0(arr,n) for(ll i=0;i<(n);i++){ cin >> (arr)[i]; }
#define in_arr1(arr,n) for(ll i=1;i<=(n);i++){ cin >> (arr)[i];}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define vll vector<ll> 
#define fr(n) for(i=0;i<(n);i++)
#define fr1(n) for(i=1;i<=(n);i++)
#define pll pair<ll,ll>
#define f first
#define s second
#define vpll vector<pll>
#define ump unordered_map
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define IN(a,b) ((a).find(b)!=(a).end())
#define pb push_back
#define mkp make_pair
#define PI M_PI
#define INF 1e18
#define deb(x) if(ON) cout << #x <<" : " << x << endl
#define fast ios_base::sync_with_stdio(false)
#define io cin.tie(NULL),cout.tie(NULL)
#define ON !false
ll dx[]={0,-1,0,1};
ll dy[]={1,0,-1,0};
const ll mod=1e9+7;
inline ll add(ll a,ll b){
    return  ((a%mod)+(b%mod)+mod)%mod;
}
inline ll mul(ll a,ll b){
    return ((a%mod)*(b%mod)+mod)%mod;
}
void pause(ll id){
    cout << "Waiting " << id << endl;
    cin >> id;
}

const int mxn=1e5+10;


void init(){

    return ;
}


signed main(){
    fast;
    io;
    if(!true){
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    }
    init();
    ll i,j;
    ll n;
    cin >> n;
    map<string,ll> mp;
    str a;
    while(n--){
        cin >> a;
        mp[a]++;
    }
    cout << mp.size() << endl;
   
    return 0;
}


Measured memory_bytes: 19216
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    string S;
    string T;
    cin >> S;
    cin >> T;

    string ans;
    ans = ans_No;

    string roteS;
    roteS = S;
    for( int si = 0 ; si < S.length() ; si++ ){
        roteS = roteS.substr(roteS.length()-1,1) + roteS.substr(0,roteS.length()-1);
        if(roteS == T) ans = ans_Yes;
    }

    cout << ans;

}

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

template<class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[";
  for (int i = 0; i < (int) V.size(); i++) {
    if (i > 0) {
      cout << ", ";
    }
    cout << V[i];
  }
  return os << "]\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, d;
  cin >> n >> d;
  cout << n / (2 * d + 1) + (n % (2 * d + 1) != 0)<< '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new File("c:\\0509-input.txt"));

		int n = 30;
		boolean[] s = new boolean[n];

		while (scan.hasNext()) {
			int id = scan.nextInt();
			s[id - 1] = true;
		}
		
		for (int i = 0; i < n; i++)
			if (!s[i])
				System.out.println(i + 1);

		scan.close();
		System.exit(0);
	}
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

constexpr int mod = 1e9 + 7;
constexpr int32_t inf = 1001001001;
constexpr int64_t infll = 1001001001001001001ll;
constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int64_t k = in(), a = in(), b = in();

  int64_t ans = 1;

  if (k + 1 <= a) {
    ans = k + 1;
  } else {
    k -= a - 1;
    ans = a;
    ans += max((k / 2) * (b - a) + (k & 1), k);
  }

  cout << ans << endl;
}


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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (auto& e : S)cin >> e;
  sort(begin(S), end(S));
  for (const auto& e : S)cout << e;
  cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int left = Integer.valueOf(str.substring(0, 2));
		int right = Integer.valueOf(str.substring(2));
		
		String ans = "NA";
		if ((left >= 1 && left <= 12) && (right >= 1 && right <= 12)) {
			ans = "AMBIGUOUS";
		} else if (left >= 1 && left <= 12) {
			ans = "MMYY";
		} else if (right >= 1 && right <= 12) {
			ans = "YYMM";
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
n,C,*H=map(int,open(0).read().split());p=[0];P=[0]
for i in range(1,n):
 g=lambda x,y:(p[P[y]]-p[P[x]])/(H[P[x]]-H[P[y]])-H[P[y]]-H[P[x]]
 while len(P)>1and g(1,0)>-2*H[i]:P.pop(0)
 p+=[p[P[0]]+(H[P[0]]-H[i])**2+C];P+=[i]
 while len(P)>2and g(-1,-2)>g(-2,-3):P.pop(-2)
print(p[-1])

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

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

const int MAX = 8;

string s[MAX];

int main()
{
    REP(MAX) cin >> s[i];

    cout << "90"<< endl;
    rep(j,MAX){rep(i,MAX) cout << s[MAX-i-1][j]; cout << endl;}

    cout << "180" << endl;
    rep(i,MAX){rep(j,MAX) cout << s[MAX-i-1][MAX-j-1]; cout << endl;}

    cout << "270" << endl;
    rep(j,MAX){rep(i,MAX) cout << s[i][MAX-j-1]; cout << endl;}

    return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC158C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] AB = Console.ReadLine().Split(' ');
            decimal A = decimal.Parse(AB[0]);
            decimal B = decimal.Parse(AB[1]);
            decimal nuki = -1;
            for(decimal i = 1000; i > 0; i--)
            {
                decimal a = Math.Floor(i * 0.08m);
                decimal b = Math.Floor(i * 0.1m);
                if (a == A & b == B)
                {
                    nuki = i;
                }
            }
            Console.WriteLine(nuki);
        }
    }
}


Measured memory_bytes: 27512
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

vector<vector<PAIR>> edge(101);
int dist[101][101] = {};

void dijkstra(int start){
	priority_queue<PAIR, vector<PAIR>, greater<PAIR>> pq;
	dist[start][start] = 0;
	pq.push({ 0,start });
	while(!pq.empty()){
		int from = pq.top().second;
		pq.pop();
		REP(i, edge[from].size()){
			int to = edge[from][i].first;
			if (dist[start][to] > dist[start][from] + edge[from][i].second) {
				dist[start][to] = dist[start][from] + edge[from][i].second;
				pq.push({dist[start][from] + edge[from][i].second,to});
			}		
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, pair<int, int>>> cab(M);
	REP(i,M){
		int a, b, c;
		cin >> a >> b >> c;
		edge[a].push_back({ b, c });
		edge[b].push_back({ a, c });
		cab[i].first = c; cab[i].second.first = a; cab[i].second.second = b;
	}
	
	REP(i, 101)REP(j, 101) dist[i][j] = 1000000;

	FOR(i, 1, N + 1) dijkstra(i);
	int cnt = M;
	REP(i,M){
		int flag = 0;
		FOR(j,1,N+1){
			if (dist[j][cab[i].second.first] + cab[i].first == dist[j][cab[i].second.second]) {
				flag = 1;
				break;
			}
		}
		cnt -= flag;
	}
	cout << cnt << endl;
	return 0;
}


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

#define ll long long
#define MAXN 1005
#define MAXS 20005

using namespace std;

class item {

public:
    int w, s;
    ll v;

    item() {}
    item(int w, int s, ll v) {
        this->w = w;
        this->s = s;
        this->v = v;
    }

    bool operator<(const item &b) const {
        return (w + s < b.w + b.s);
    }
};

int main() {

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

    int n;
    cin >> n;
    item arr[n];
    for(int i = 0; i < n; i++) {
        int w, s;
        ll v;
        cin >> w >> s >> v;

        arr[i] = item(w, s, v);
    }
    sort(arr, arr + n);

    vector<ll> dp(MAXS + 1);
    for(int i = 0; i < n; i++)
        for(int j = min(arr[i].s, MAXS - arr[i].w); j >= 0; j--)
            dp[j + arr[i].w] = max(dp[j + arr[i].w], dp[j] + arr[i].v);
    
    ll ans = 0;
    for(int i = 0; i <= MAXS; i++)
        ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    a[i]--;
  }
  int x[n],y[n];
  for(int i=0;i<n;i++){
    x[i]=i+5e8;
    y[i]=n-i+5e8;
  }
  for(int i=0;i<n;i++){
    for(int j=a[i];j<n;j++){
      y[j]-=n-1-i;
    }
    for(int j=a[i]+1;j<n;j++){
      x[j]+=n-1-i;
    }
  }
  for(int i=0;i<n;i++){
    cout << x[i] << " ";
  }
  cout << endl;
  for(int i=0;i<n;i++){
    cout << y[i] << " ";
  }
  cout << endl;
}

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

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    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;
    }
};

mint dp[105][10];

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    dp[0][0] = mint(1);
    

    for (int i=1; i<=h; i++) {
        rep(j, 1<<(w-1)) {
            vector<bool> line(w-1);
            rep(l, w-1) {
                line[l] = ((j>>l & 1)==1);
            }
            bool ok = true;
            rep(l, w-2) {
                if (line[l] && line[l+1]) ok = false;
            }
            if (!ok) continue;
            rep(l, w) {
                if (l>0 && line[l-1]) dp[i][l-1] += dp[i-1][l];
                else if (l<w-1 && line[l]) dp[i][l+1] += dp[i-1][l];
                else dp[i][l] += dp[i-1][l];
                
            }
        }
    }

    mint ans = dp[h][k-1];
    
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 256
a, b, x = map(int, input().split())

#aの商と余り、bの商を求める
qa = a // x
qb = b // x
ra = a % x
#bの商からaの商を引く
ans = qb - qa

#ここまでの操作で、a以外の値の内、xで割り切れる値の数がansに入っているため、
#aが割り切れるかどうかで条件分岐させる
if ra == 0:
  print(ans+1)
else:
  print(ans)

Measured memory_bytes: 2940
import sys,string
A="abcdefghijklmnopqrstuvwxyz"
tbl=string.maketrans(A,A[1:]+A[0])
for s in sys.stdin.readlines():
    while not("the" in s or "that" in s or "this" in s):
        s=s.translate(tbl)
    print s[:-1]

Measured memory_bytes: 4376
//さすが解説は天才的ですねー
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 998244353;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

int ifac[5000001];

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


	int N;
	scanf("%d", &N);

	int N2 = N / 2;
	ll facN = 1;
	rep1(i, N) facN = facN * i % mod;
	ifac[0] = modpow(facN, mod - 2);
	rep(i, N2) ifac[i + 1] = (ll)ifac[i] * (N - i) % mod;

	ll kotae = modpow(3, N);
	const int inv2 = 499122177;

	ll hiku = 0;
	ll ima = ifac[N2];
	ll k = modpow(2, N2 - 1);
	rep(i, N2) {
		ima = ima * (N2 - i) % mod;
		hiku += ima * ifac[N2 - i - 1] % mod * k % mod;
		k = k * inv2 % mod;
	}
	hiku = hiku % mod * facN * 2 % mod;
	printf("%lld", (kotae - hiku + mod) % mod);

	Would you please return 0;
}

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

int main() {
   
   double num,ans=0;
   ll n;
   
   cin>>n;
   
   for(ll i=0;i<n;i++)
   {
       cin>>num;
       ans+=(1.0/num);
   }
   
   printf("%.6f",1.0/ans);
   
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
--import           Control.Monad.Loops
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Text
(+.+) = T.append
(!.!) = T.index

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- for IO
readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

-- main
main :: IO ()
main = candies

candies :: IO ()
candies = do
  n :: Int <- readLn
  a1 :: V.Vector Int <- getLineSpcVec
  a2 :: V.Vector Int <- getLineSpcVec
  let sums = [V.sum $ V.take i a1 V.++ V.drop (i - 1) a2
             | i <- [1..n]
             ]
  print $ maximum sums

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define repp(i, n) rep(i, n)
#define reppp(i, n) repp(i, n)
#define rrepp(i, n) rrep(i, n)
#define repss(i, n) reps(i, n)
#define repcc(i, n) repc(i, n)
#define repii(i, a, b) repi(i, a, b)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n, k; cin >> n >> k;
  string s; cin >> s;
  vi32 lst;
  {
    char prev = '1';
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != prev) {
        lst.push_back(cnt);
        cnt = 1;
        prev = s[i];
      } else cnt++;
    }
    lst.push_back(cnt);
    if (s[n - 1] == '0') lst.push_back(0);
  }
  n = lst.size();
  vi64 sums(n + 1);
  rep(i, n) sums[i + 1] = sums[i] + lst[i];
  k = k * 2 + 1;
  i64 ans = 0;
  for (int i = 0; i < n; i += 2) {
    int r = min(i + k, n);
    amax(ans, sums[r] - sums[i]);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 1656
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int S;
	cin >> S;
	int h = S / (60 * 60);
	int m = (S % (60 * 60)) / 60;
	int s = S % 60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}

Measured memory_bytes: 1144
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let n = line.trim().parse::<i32>().unwrap();
    let line = gets();
    let a = line.trim().parse::<i32>().unwrap();
    println!("{}", n * n - a);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include<math.h>
#include<bitset>
#include<string>
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include <iomanip>
using namespace std;


int main()
{
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<x+k;i++) cout<<i<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define mod 1000000007
#define rep(i,n)    for(ll i=0;i<n;++i)
#define forup(i,a,b)    for(ll i=a;i<=b;++i)
#define all(v)    v.begin(),v.end()
#define inf 1000000010
#define pii pair<ll,ll>
#define vl vector<ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define MAXN 110
#define bsize 555
#define sz(v) v.size()
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
ll power(ll x,ll y, ll md){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}

ll n;
vector<lld> v(3000);

lld dp[3010][3010];

int main(){
    cin>>n;
    rep(i,n)    cin>>v[i];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1-v[0];
    forup(i,1,n-1){
        dp[i][0]=dp[i-1][0]*(1-v[i]);
    }
    dp[0][1] = v[0];
    forup(i,1,n-1){
        forup(j,1,n){
            dp[i][j] = dp[i-1][j-1]*v[i] + dp[i-1][j]*(1-v[i]);
        }
    }

    lld ans=0;
    forup(i,n/2+1,n){
        ans+=dp[n-1][i];
    }
    cout<<std::fixed;
    cout<<std::setprecision(20)<<ans<<endl;
}

Measured memory_bytes: 141824
import sys
input = sys.stdin.readline


H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input().strip())


def f(i, j):
    x = 0
    for h in range(max(0, i-1), min(i+2, H)):
        for w in range(max(0, j-1), min(j+2, W)):
            if S[h][w] == "#":
                x += 1
    return x


def main():
    for y in range(H):
        s = ""
        for x in range(W):
            if S[y][x] == ".":
                s += str(f(y, x))
            else:
                s += "#"
        print(s)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42224
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int A, B, K;

int main() {
  cin >> A >> B >> K;
  set<int> ans;

  for (int i = A; i < A + K && i <= B; ++i) {
    ans.insert(i);
  }
  for (int i = B; i > B - K && i >= A; --i) {
    ans.insert(i);
  }

  auto iter = ans.begin();
  while (iter != ans.end()) {
    cout << *iter << endl;
    ++iter;
  }
}


Measured memory_bytes: 256
from collections import deque
N = int(input())
A = list(int(input()) for _ in range(N))

ans = 0
d = deque(sorted(A))
while len(d) > 3:
    ans += 2*(deque.pop(d)-deque.popleft(d))
if len(d) == 2:
    ans += deque.pop(d)-deque.popleft(d)
else:
    a, b, c = d
    ans += max(b+c-2*a, -a-b+2*c) 
    
print(ans)

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

int main()
{
    vector<string> x={"Sunny","Cloudy","Rainy"};
    string s;
    cin>>s;
    for(int i=0;i<3;++i)if(x[i]==s)cout<<x[(i+1)%3]<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    long long ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&m);
        ans+=(long long)m;
    }
    ans-=n;
    printf("%lld\n",ans);
}
/*7,46,11,20,11
35419*/


Measured memory_bytes: 256
function solve()
    n, m = [parse(Int, x) for x in split(readline())]
    h = [parse(Int, x) for x in split(readline())]

    good = ones(Bool, n)
    for _ in 1:m
        a, b = [parse(Int, x) for x in split(readline())]
        if h[a] < h[b]
            good[a] = false
        elseif h[b] < h[a]
            good[b] = false
        else
            good[a] = good[b] = false
        end
    end
    sum(good)
end

println(solve())

Measured memory_bytes: 201580
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}

ll test[1234][1234];
signed main() {
	ll n, m, k, a, b, c = 0, d = 0, cnt = 0, ans = 0;
	string s, t;
	cin >> n >> m >> a;
	for (int h = n; h <= m; h++) {
		if (h % a == 0) { cnt++; }
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define ld long double
#define fo(i,start,end) for(int i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vop vector<pll>
#define vov vector<vector<ll>>
using namespace std;
const ld pi=3.14159265358979323;

const long long mod1=1e9+7;
const long long mod2=1e18;
const ll mod3=9e18;
const ll N=1e9+7;

long long power(ll  x, ll n){if(n==0)return 1;ll temp=power(x,n/2);if(n%2==0)return temp*temp;else return x*temp*temp;}

ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return (a*b)/(gcd(a,b));}
void swap(int* a, int* b){int t = *a;*a = *b;*b = t;}
bool f(ll x,ll y){return x>y;}
bool cmp(ll x ,ll y){
    return abs(x)<abs(y);
}
ll MAX(ll a,ll b){return a>b?a:b;}
ll MIN(ll x,ll  y){return x>y?y:x;}

ll pmod(ll a, ll b,ll mod)//a^b%mod
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b/=2;
        a=(a*a)%mod;
    }
    return ans;
}
int main(){
    int t;
    cin>>t;
    if(t>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>

int prime_judge(int );

int main(){

  int i,j,n,num,flag=0;
  double tmp;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&num);
    if(prime_judge(num)== 1)flag+=1;
  }

  printf("%d\n",flag);
  return 0;
}

int prime_judge(int num){
  int j;
  if(num == 2) return 1;
    
  if(num < 2 || num%2 == 0) return 0;

  
  j=3;
 
  while(j <= sqrt(num)){  
    if(num % j == 0)return 0;
    j+=2;
  }
  return 1;
}



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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,ans=1,m=2,s[1001]={0},a;
    cin>>n;
    for(int i=1;i<=n;i++){
        a=i;
        while(a>1){
            if(a%m==0){
                a/=m;
                s[m]++;
            }
            else{
                m++;
            }
        }
        m=2;
    }
    for(int i=0;i<1000;i++){
        ans*=(s[i]+1);
        ans%=1000000007;
    }
    cout <<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        ll curr,k,d;
        cin>>curr>>k>>d;
        bool neg=false;
        // if(curr<0)neg=true;
        curr=abs(curr);
        ll take=curr/d;
        take=min(take,k);
        k-=take;
        curr-=take*d;
        if(k){
            if(k%2){
                curr-=d;
            }else{

            }
        }
        curr=abs(curr);
        cout<<curr<<endl;
    }
    return 0;

}


Measured memory_bytes: 3636
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
	int a[3],i;
	char s[4];
	scanf("%s",s);
	for(i=0;i<3;i++)
	a[i]=s[i]-'a';
	sort(a,a+3);
	for(i=0;i<3;i++)
	if(a[i]==i);
	else break;
	if(i<3)printf("No\n");
	else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256