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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N){
    cout << (N * N * N) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

#include <bits/stdc++.h>
#define rep(i,a,n) for(ll i = a;i < n;i++)
typedef long long ll;
using namespace std;


const ll MOD = 1e9+7;
 
template <ll MOD>
struct modint{
    ll x;
    modint() : x(0) {}
    modint(ll a): x((a % MOD + MOD) % MOD) {}
    
    
 
    bool operator!() const{return !x;}
 
    bool operator<(const modint &a) const{
        modint res(*this);
        return res.x < a.x;
    }
    
    bool operator>(const modint &a) const{
        modint res(*this);
        return res.x > a.x;
    }
 
    modint &operator+=(const modint &a){
        if((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator-=(const modint &a){
        if((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
 
    modint &operator*=(const modint &a){
        (x *= a.x) %= MOD;
        return *this;
    }
 
    modint &operator/=(const modint &a){
        *this *= a.inv();
        return *this;
    }
 
    modint &operator%=(const modint &a){
        x %= a.x;
        return *this;
    }
 
    modint operator-() const{ return modint(-x); }
 
    modint operator+(const modint &a) const{ return modint(*this) += a; }
    modint operator-(const modint &a) const{ return modint(*this) -= a; }
    modint operator*(const modint &a) const{ return modint(*this) *= a; }
    modint operator/(const modint &a) const{ return modint(*this) /= a; }
    modint operator%(const modint &a) const{ return modint(*this) %= a; }
    bool operator==(const modint &a) const{ return x == a.x; }
    bool operator!=(const modint &a) const{ return x != a.x; }
 
 
    modint pow(ll n) const{
        modint res(1), a(x);
        while(n > 0){
            if(n & 1) res *= a;
            a *= a;
            n /= 2;
        }
        return res;
    }
 
    modint inv() const{
        return this->pow(MOD-2);
    }
 
    friend ostream &operator<<(ostream &os, const modint &m){
        return os << m.x;
    }
 
    friend istream &operator>>(istream &is, modint &m){
        ll t;
        is >> t;
        m = modint<MOD>(t);
        return (is);
    }
    
    static ll get_mod(){ return MOD; }
};
using mint = modint<MOD>;

int main(){ 
    ll k,x;
    cin >> k >> x;
    
    rep(i,x-k+1,x+k){
        cout << i << " ";
    }
    cout << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<class T>//ex) auto dp = make_vec(4,4,4,INF);
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int H, W;
	cin >> H >> W;

	vector<vector<Int>> A(H+1, vector<Int>(W+1));
	vector<vector<Int>> B(H+1, vector<Int>(W+1));
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			cin >> A[i][j];
		}
	}
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			cin >> B[i][j];
		}
	}

	auto dp = make_vec(H+1, W+1, 13000, 0);
	dp[0][0][abs(A[0][0]-B[0][0])] = 1;

	
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			for (Int k = 0; k < 13000; k++) {
				if (dp[i][j][k]) {
					dp[i + 1][j][k + abs(A[i + 1][j] - B[i + 1][j])] = 1;
					dp[i + 1][j][abs(k - abs(A[i + 1][j] - B[i + 1][j]))] = 1;


					dp[i][j + 1][k + abs(A[i][j + 1] - B[i][j + 1])] = 1;
					dp[i][j + 1][abs(k - abs(A[i][j + 1] - B[i][j + 1]))] = 1;

				}
			}
		}
	}

	Int ans;
	for (Int k = 0; k < 13000; k++) {
		if (dp[H-1][W-1][k]) {
			cout << k << "\n";
			return 0;
		}
	}

}


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

void solv() {
    int N;
    cin >> N;
    cout << round(N / 2.0) << endl;
}

int main() {
    solv();
    return 0;
}

Measured memory_bytes: 256
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int n, k; cin >> n >> k;
  string s; cin >> s;
  REP(i, n){
    if(i != k-1) cout << s[i];
    else cout << (char)(s[i]+32);
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long

const int maxn = 2e5 + 7;

map<string,int>mp;

int main() {
    int n;
    while(~scanf("%d",&n)) {
        mp.clear();
        for(int i = 1 ; i <= n ; i++) {
            string s;
            cin >> s;
            if(mp.count(s) == 0) mp[s] = 1;
            else mp[s]++;
        }
        int ans = 0;
        for(map<string,int>::iterator it = mp.begin() ; it != mp.end() ; it++) {
            ans = max(ans , it -> second);
        }
        for(map<string,int>::iterator it = mp.begin() ; it != mp.end() ; it++) {
            if(it -> second == ans) {
                cout << it -> first << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 26368
int main(void){
  int n;
  char s[100];
 
  scanf("%d %s",&n,s);
  
  if(n % 2 == 1) {
    printf("No");
    return 0;
  }
  
  for(int i = 0; i < n/2; i++) {
    if (s[i] != s[i+n/2]){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
}

Measured memory_bytes: 128
def checkPalindrome(str)
  l = str.size/2

  for i in 0...l do
    if str[i] != str[-(i+1)]
      return false
    end
  end  

  return true
end

count = 0
while input = gets
  if checkPalindrome(input.chomp)
    count += 1
  end
end

puts count

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

int main(){
  int a,b,ans=0,j;
  cin>>a>>b;
  for (int i=a;i<=b;i++){
    if (i/10000 == i%10){
      j=i;
      j-=(i/10000)*10000;
      j/=10;
      if (j/100 == j%10){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	int n;
	while (cin >> n, n)
	{
		bool s[64][32];
		CLEAR(s, 0);
		for (int i = 0; i < n; ++i)
		{
			int f;
			cin >> f;
			while (f--)
			{
				int t;
				cin >> t;
				s[i][t] = true;
			}
		}

		ll part[64];
		for (int i = 0; i < n; ++i)
			part[i] = 1LL << i;

		int res = -1;
		for (int d = 1; d <= 30; ++d)
		{
			ll p = 0;
			for (int i = 0; i < n; ++i)
				if (s[i][d])
					p |= part[i];
			for (int i = 0; i < n; ++i)
				if (s[i][d])
					part[i] = p;

			if (p == (1LL << n) - 1)
			{
				res = d;
				break;
			}
		}

		cout << res << endl;
	}
}

Measured memory_bytes: 868
#include<bits/stdc++.h>
using namespace std;
int main(){
long A, B, K;
  cin >> A >> B >> K;
if(A >= K){
A -= K;
}else if(B >= K-A){
  B -= K-A;
A = 0;
}else{
A = 0;
  B = 0;
}
cout << A << " " << B << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String args[]){
    int n = sc.nextInt();
    long k = sc.nextLong();
    int[] a = new int[n];
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
    }
    long ten=0;
    long jun=0;
    for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
        if(a[i]>a[j]){
          ten++;
        }else if(a[i]<a[j]){
          jun++;
        }
      }
    }
    
    System.out.println( ((ten*calc(k)+jun*calc(k-1)))%1000000007 );
  }
  static long calc(long p){
    return ((p+1)*p/2)%1000000007;
  }
}

Measured memory_bytes: 26096
#include<bits/stdc++.h>
#define int long long
#define rep(i,m,n) for(int i=m;i<n;i++)
#define repr(i,n,m) for(int i=n;i>=m ;i--)
#define mod 1000000007
#define float long double
#define pb push_back
#define mp make_pair
#define pp pop_back
#define pi 3.141592653589793238
#define print(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
using namespace std;
bool sortbysec(const pair<int,int> &a,
             const pair<int,int> &b)
{
   return (a.second < b.second);
}
bool sortinrev(const pair<int,int> &a,  
              const pair<int,int> &b)
{
      return (a.first > b.first);
}
int ispal(string s)
{
    int x=s.length();
    for(int i=0,j=x-1;i<x/2,j>=x-x/2;i++,j--)
        if(s[i]!=s[j])
            return 0;
    return 1;
}
void solve()
{
     int p;
     cin>>p;
     cout<<2*pi*p;
}    
signed main()
{
                   // #ifndef ONLINE_JUDGE
                   // freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
                   // #endif 
  int t=1;
 //cin>>t;
  while(t--){
  solve();
  cout<<"\n";
}
  cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
 return 0;
}  

Measured memory_bytes: 3792
package main

import "fmt"
var N, M int
var u, w, v int
var dp, arr, pref []int
var DP, mat [][]int
var vis, dist []int
var bit []int
const (
	MaxInt = 1<<31 - 1
	MinInt = -MaxInt - 1
	MOD = int(1e9) + 7
)

func buildMatrix(mat *[][]int, size int) {
	for i := range *mat {
		(*mat)[i] = make([]int, size)
	}
}

func addSelf(a *int, b int) {
	*a += b
}

func subSelf(a *int, b int) {
	*a -= b
}

func addSelfMOD(a *int, b int) {
	addSelf(a, b)
	if *a > MOD {
		*a -= MOD
	}
}

func subSelfMOD(a *int, b int) {
	subSelf(a, b)
	if *a < 0 {
		*a += MOD
	}
}

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

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

func abs(a int) int {
	if a < 0 { return -a }
	return a
}

func count(i int) int {
	i++
	s := 0
	for i > 0 {
		s += bit[i]
		i-= i&(-i)
	}
	return s
}

func cnt(i, k int) int {
	return count(k) - count(i-1)
}

func update(i, v int) {
	i++
	for i < len(bit) {
		bit[i] += v
		i += i&(-i)
	}
}

func main() {
	_,e := fmt.Scanf("%d", &N)
	if e != nil { return }
	DP = make([][]int, N)
	buildMatrix(&DP, N)
	pref = make([]int, N+1)
	arr = make([]int, N)
	for i:=0; i<N; i++ {
		_,e = fmt.Scanf("%d", &arr[i])
		if e != nil { return }
		pref[i+1] = arr[i] + pref[i]
	}
	for i:= range arr {
		DP[i][i] = arr[i]
	}
	for cl:=2; cl<N+1; cl++ {
		for i:=0; i<N-cl+1; i++ {
			j := i+cl-1
			if i == j {
				DP[i][j] = arr[i]
			} else if j == i+1 {
				DP[i][j] = arr[i]+arr[j]
			} else {
				for k:=i; k<j; k++ {
					tmp := DP[i][k] + DP[k+1][j] + pref[j+1] - pref[i]
					if k+1 == j { tmp -= arr[j] }
					if k == i { tmp -= arr[i] }
					//fmt.Println(i,k,j,ls/2, rs/2)
					if DP[i][j] == 0 {
						DP[i][j] = tmp
					}
					DP[i][j] = min(DP[i][j], tmp)
				}
			}
		}
	}
	fmt.Println(DP[0][N-1])
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+7;
int n;
int a[MAX];
int b[MAX];
long long int ans;

int main() {
	cin>>n;
	for(int i=0; i<n+1; i++) cin>>a[i];
	for(int i=0; i<n; i++) cin>>b[i];
	for(int i=0; i<n; i++) {
		if(b[i]>a[i]) {
			ans+=a[i];
			b[i]-=a[i];
			a[i]=0;
			if(a[i+1]>b[i]) {
				ans+=b[i];
				a[i+1]-=b[i];
				b[i]=0;
			}
			else {
				ans+=a[i+1];
				b[i]-=a[i+1];
				a[i+1]=0;
			}
		}
		else {
			ans+=b[i];
			a[i]-=b[i];
			b[i]=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(ll i=b-1;i>=a;i--)
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;

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

signed main() {
    string s,t,ans;
    ll start=-1;
    cin >> s >> t;
    rep(i,s.length()-t.length()+1){
        bool rest=true;
        rep(j,t.length())if(s[i+j]!='?' && s[i+j]!=t[j])rest=false;
        if(rest==true)start = i;
    }
    if(start==-1){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    rep(i,start)s[i]=='?'?ans+="a":ans+=s[i];
    ans+=t;
    FOR(i,start+t.length(),s.length())s[i]=='?'?ans+="a":ans+=s[i];
    cout<<ans<<endl;
}

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

using namespace std;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(ALL(a));
    int now = a[0];
    int cnt = 1;
    int ans = 0;
    for(int i=1;i<n;++i){
        if(now!=a[i]){
            if(cnt<now){
                ans+=cnt;
            }else{
                ans+=cnt-now;
            }
            now=a[i];
            cnt=1;
        }else{
            cnt++;
        }
    }
    if(cnt<now){
        ans+=cnt;
    }else{
        ans+=cnt-now;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
map<ll, ll> mpl, mpr;
int main(){
    ll n; cin >> n;
    rep(i,n){
        ll a; cin >> a;
        mpl[i - a]++;
        mpr[i + a]++;
    }
    ll ans = 0;
    for(auto it = mpl.begin(); it != mpl.end(); it++){
        ll tmp = it->second;
        ans += tmp * mpr[it->first];
    }
    cout << ans << endl;
    return 0;
}  

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

using namespace std;
typedef long long ll;

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


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

int main(void) {
	long long K, A, B;
	cin >> K >> A >> B;
	if ((B-A)<=2) {
		cout << 1+K << endl;
		return 0;
	}
	if (K==1) {
		cout << 1+K << endl;
		return 0;
	}
	if ((A-1)>(K-2)) {
		cout << 1+K << endl;
		return 0;
	}
	long long ans = 0;

	long long k = K-(A-1)-2;
	ans = B;
	ans += (k/2)*(B-A);
	if ((k%2)==1){
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] a = new int[N];
        
        for(int i = 0; i < N; i++) {
        	
        	a[i] = Integer.parseInt(sc.next());
        }
        
        sc.close();
        
        int index = 0;
        int count = 0;
        int lineNumber = 1;
        
        while (index < N) {
        	
        	if(a[index] == lineNumber) {
        		
        		lineNumber++;
        	} else {
        		
        		count++;
        	}
        	
        	index++;
        }
        
        if(lineNumber < 2) {
        	
        	count = -1;
        }
        
        System.out.print(count);
    }
}

Measured memory_bytes: 50356
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (ll)4e18;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	deque<int> deq;
	bool now = 1;
	rep(i, n) {
		if (now) {
			deq.push_back(a[i]);
			now = 0;
		}
		else {
			deq.push_front(a[i]);
			now = 1;
		}
	}
	if (!now) reverse(all(deq));
	rep(i, n) cout << deq[i] << (i == n - 1 ? "\n" : " ");
	return 0;
}


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

int main(){
	string s;
	long long int m=1e9+7;
	int pow=1;
	int n;
	cin>>s;
	n=s.size();
	vector<vector<long long int>> dp(n,vector<long long int>(13));
	if(s[n-1]=='?'){
		for (int i = 0; i < 10; i++) {
			dp[0][i%13]++;	
		}
	}else {
		dp[0][s[n-1]-'0']++;
	}
	for (int i = 1; i < s.size(); i++) {
		pow*=10;
		pow%=13;
		if(s[n-i-1]=='?'){
			for (int j = 0; j < 13; j++) {
				for (int k = 0; k < 10; k++) {
					dp[i][(j+k*pow)%13]+=dp[i-1][j];
					dp[i][(j+k*pow)%13]%=m;
				}
			}
		}else {
			for (int j = 0; j < 13; j++) {
				dp[i][(j+(s[n-i-1]-'0')*pow)%13]+=dp[i-1][j];
				dp[i][(j+(s[n-i-1]-'0')*pow)%13]%=m;
			}
		
		}
	}
	cout<<dp[n-1][5]<<endl;
}

Measured memory_bytes: 13696
#include <stdio.h>
typedef struct {
  int right;
  int left;
  int parent;
  int key;
}Node;

#define NIL NULL

Node root,A[502];

int main(){
  int i,n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&A[i].key);
  }
  for(i=1;i<=n;i++){
    A[i].parent = A[i/2].key;
    A[i].left = A[2*i].key;
    A[i].right = A[2*i+1].key;
    
  }
  
  for(i = 1; i <= n; i++){
    printf("node %d: key = %d, ",i,A[i].key);
  if(i!=1) printf("parent key = %d, ",A[i].parent);
  if(2*i<=n)  printf("left key = %d, ",A[i].left);
  if(2*i+1<=n) printf("right key = %d, ",A[i].right);
  printf("\n");
  }
  return 0;
}

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

int main() {
  double N;
  cin>>N;
  vector<int> c(N-1);
  vector<int> s(N-1);
  vector<int> f(N-1);
  for(int i=0;i<N-1;i++) cin>>c[i]>>s[i]>>f[i];
  vector<long> t(N);
  for(int i=0;i<N-1;i++){
    t[i] +=s[i];
    t[i] +=c[i];
    for(int j=i+1;j<N-1;j++){
      if(t[i]>=s[j]){
        if(t[i]%f[j]>0) t[i]+=(f[j]-t[i]%f[j]);
        t[i]+=c[j];
      }
      else{
        t[i]=s[j];
        t[i]+=c[j];
      }
    }
  }
  for(int i=0;i<N;i++){
    cout<<t[i]<<endl;
  }
}


Measured memory_bytes: 256
using System;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABN = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var A = ABN[0]; var B = ABN[1]; var N = ABN[2];
            if (B - 1 <= N) Console.WriteLine(calc(B - 1, A, B));
            else Console.WriteLine(calc(N, A, B));
        }

        static long calc(long x, long A, long B)
        {
            return ((A * x) / B) - A * (x / B);
        }
    }
}


Measured memory_bytes: 27560
#include<iostream>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    int c=1,h=a;
  if(b==1)cout<<"0";
  else{
  while(h<b){
    c++;
    h+=a-1;}
    cout<<c;
  }
    return 0;
}

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

#ifdef LOCAL
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define dbgv(x) cerr << #x << " = " << x << endl
#define dbga(arr, len) {cerr << #arr << " = "; for (int _ = 0; _ < len; _++)\
cerr << arr[_] << " "; cerr << endl;}
#define dbgi(it) {cerr << #it << " = "; for (const auto& _ : it)\
cerr << _ << " "; cerr << endl;}
#else
#define dbg(...) (void)0
#define dbgv(x) (void)0
#define dbga(arr, len) (void)0
#define dbgi(it) (void)0
#endif

using ll = long long;
using dbl = long double;
using pii = pair<int, int>;

const double PI = acos(-1);

double a, b, x;

double get_vol(double alpha) {
    if (tan(alpha) > b / a) {
        return a * b * b * tan(PI / 2 - alpha) / 2;
    }
    return a * a * b - a * a * a * tan(alpha) / 2;
}

void solve() {
    scanf("%lf%lf%lf", &a, &b, &x);

    double left = 0, right = PI / 2;
    for (int it = 0; it < 200; ++it) {
        double mid = (left + right) / 2;
        if (get_vol(mid) >= x) {
            left = mid;
        } else {
            right = mid;
        }
    }

    printf("%.10lf\n", left / PI * 180);
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    solve();

    dbg("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define N 200006
using namespace std;
long long n,x,ans,a[N],b[N],p,sum,f[N],fsum[N],g[N],gsum[N];
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)scanf("%lld",a+i),sum+=1LL*a[i];
	if(sum%(1LL*(1+n)*n/2LL)!=0)return puts("NO"),0;
	long long cs=sum/(1LL*(1+n)*n/2LL);
	for(long long i=1;i<=n;i++){
		long long nxt=i%n+1;
		if((a[nxt]-cs-a[i])%n!=0||a[i]+cs-a[nxt]<0)return puts("NO"),0;
		else b[nxt]=(a[i]-(a[nxt]-cs))/n;
	}
	for(long long i=1;i<=n;i++)f[i]=f[i-1]+b[i],fsum[i]=fsum[i-1]+b[i]*i;
	for(long long i=n;i>=1;i--)g[i]=g[i+1]+b[i],gsum[i]=gsum[i+1]+b[i]*i;
	for(long long i=1;i<=n;i++){
		long long x=(i+1)*f[i]-fsum[i]+(n+1+i)*g[i+1]-gsum[i+1];
		if(a[i]!=x)return puts("NO"),0;
	}
	puts("YES");
}

Measured memory_bytes: 8064
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == NIL/*ここを埋める (fill this blank)*/) printf("root, ");
  else if(T[u].l == NIL/*ここを埋める(fill this blank)*/) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r !=NIL/*ここを埋める(fill this blank)*/) calcDepth(T[u].r, p/*ここを埋める(fill this blank)*/);
  if(T[u].l !=NIL/*ここを埋める(fill this blank)*/) calcDepth(T[u].l, p+1/*ここを埋める(fill this blank)*/);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 6376
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n, m;
	while (cin >> n >> m){
		if (!n && !m)return 0;
		long long a[20001], ans = 0;
		for (int i = 0; i < n + m; i++)cin >> a[i]; sort(a, a + n + m);
		ans = a[0];
		for (int i = 1; i < n + m; i++)ans = max(ans, a[i] - a[i - 1]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, ans(0);
    cin >> N;
    int A[N];
    for (int i = 0; i < N; ++i)
        cin >> A[i];
    for (int i = 0; i < N - 1; ++i)
    {
        int minj = i;
        for (int j = minj + 1; j < N; ++j)
        {
            if (A[j] < A[minj])
            {
                minj = j;
            }
        }
        if (i != minj)
        {
            swap(A[i], A[minj]);
            ans++;
        }
    }
    for (int i = 0; i < N; ++i)
    {
        cout << A[i] << flush;
        if (i < N - 1)
            cout << ' ' << flush;
    }
    cout << endl
         << ans << endl;
}


Measured memory_bytes: 3088
n,x=map(int,input().split())
L=[int(_) for _ in input().split()]
S_L=[0]
count=1
for i in range(n):
    S_L.append(S_L[-1]+L[i])
    if S_L[-1]<=x:
        count+=1
    else:
        print(count)
        break
else:print(n+1)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

// 親がいれば親IDを、根ならば-(サイズ数)をデータとして持つ
struct UnionFind {
    vector<int> d;
    // データ数nを全て-1で初期化
    UnionFind(int n) : d(n, -1) {}
    // ｘの所属(=xの根)を探す関数
    int find(int x) {
        if (d[x] < 0) return x;
        // return find(d[x]);
        return d[x] = find(d[x]);  // d[x]=とすることでメモ化する
    }
    // xとyを連結する関数
    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        // すでに連結済みの場合は何もせずfalseを返す
        if (x == y) return false;
        // yのサイズの方が大きい場合はxとyを入れ替える
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];  // yのサイズの分を足す
        d[y] = x;  // yの親をxにする
        return true;
    }
    // xとyが同じ連結集合に属するか否かを判定する関数
    bool same(int x, int y) { return find(x) == find(y); }
    // xが所属する連結集合のサイズを求める関数
    int size(int x) { return -d[find(x)]; }
};

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

    UnionFind uf(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
    }

    int ans = 0;
    rep(i, n) {
        ans = max(ans, uf.size(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4004
import * as fs from 'fs';


const input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);

const s:string = input[0];

if(s === "RRR")
    console.log(3);
else if(s === "SRR" || s === "RRS")
    console.log(2);
else if(s === "SSR" || s === "RSS" || s==="SRS" || s==="RSR")
    console.log(1);
else
    console.log(0);


Measured memory_bytes: 29628
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> a >> b;
	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

	if (b<10) {
		a = a*10 + b;
	} else if (b<100) {
		a = a*100 + b;
	} else {
		a = a*1000 + b;
	}
	i = 1;
	while(1) {
		if (i*i == a) {
			cout << "Yes" << endl;
			return 0;
		}
		if (i*i > a) break;
		i++;
	}
	cout << "No" << endl;
	return 0;
}


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

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

  int p[5000];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }

  int min_sum=20000;

  for(int I=0;I<=p[0];I++){
    int q[5000];
    for(int i=0;i<N;i++){
      q[i]=p[i];
    }

    int sum=I;
    q[0]-=I;

    for(int i=0;i<=N-2;i++){
      if(q[i]<=0){
        continue;
      }
      sum+=q[i]*2;
      q[i+1]-=q[i];
    }
    if(q[N-1]>0){
      sum+=q[N-1];
    }
    min_sum=min(min_sum,sum);
  }
  cout <<min_sum<<endl;
  return 0;
}

Measured memory_bytes: 3128
package main

import "fmt"
	
func main()  {
	// ログインするたびに A 枚のコインが得られる
	// 7 日連続でログインすると，そのたびに，追加で B 枚
	// 少なくとも C 枚のコインを得るためにログインしなければならない回数
	var a, b , c int
	_, _ = fmt.Scan(&a, &b, &c)
	fmt.Printf("%d\n",calc(a, b, c))
}

func calc(a int, b int, c int) int{
	var day int
	for c > 0 {
		day++
		c -= a
		if day % 7 == 0 {
			c -= b
		}
	}
	return day
}


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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        Task[] tasks = new Task[n];

        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            tasks[i] = new Task(a, b);
        }

        Arrays.sort(tasks);

        boolean isFinish = true;
        int time = 0;
        for (Task task : tasks) {
            time += task.a;
            if (time > task.b) {
                isFinish = false;
                break;
            }
        }

        System.out.println(isFinish ? "Yes" : "No");
    }

    static class Task implements Comparable<Task> {
        int a, b;

        Task(int a, int b) {
            this.a = a;
            this.b = b;
        }

        public int compareTo(Task o) {
            return b - o.b;
        }
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

int main(void) {
    int A, B;
    
    cin >> A >> B;
    
    if (A + B == 3) {
        cout << 3 << endl;
    } else if (A + B == 4) {
        cout << 2 << endl;
    } else if (A + B == 5) {
        cout << 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import sys,itertools
def input():
    return sys.stdin.readline()[:-1]

X,Y = map(int,input().split(' '))
u = 10**9+7

S = X+Y

class Combination(object):
        """参考: https://harigami.net/contents?id=5f169f85-5707-4137-87a5-f0068749d9bb"""
        __slots__ = ['mod', 'factorial', 'inverse']

        def __init__(self, max_val_arg: int = 10**6, mod: int = 10**9 + 7):
            fac, inv = [1], []
            fac_append, inv_append = fac.append, inv.append

            for i in range(1, max_val_arg + 1):
                fac_append(fac[-1] * i % mod)

            inv_append(pow(fac[-1], mod - 2, mod))

            for i in range(max_val_arg, 0, -1):
                inv_append((inv[-1] * i) % mod)

            self.mod, self.factorial, self.inverse = mod, fac, inv[::-1]

        def combination(self, n, r):
            if n < 0 or r < 0 or n < r:
                return 0
            return self.factorial[n] * self.inverse[r] * self.inverse[n - r] % self.mod

if not S%3==0:
    print(0)
    exit()
else:
    small = S//3
    s_elm = min(X,Y)
    if s_elm<small:
        print(0)
        exit()
    r = s_elm - small
    ans = Combination().combination(small, r)
    ans %= u
print(ans)

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

int main(){
    double l;
    cin >> l;

    double ans = 1;
    rep(i, 3) {
        ans *= l / (double)3;
    }
    printf("%.7lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  int l, lsum;
  int lmax = 0;
  lsum = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> l;
    lsum += l;
    lmax = max(l, lmax);
  }
  if((lsum - lmax) > lmax){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
from collections import deque,Counter
n=int(input())
if n<357:
    print(0)
    exit()
ans=0
num753=deque()
num753.append('3')
num753.append('5')
num753.append('7')
while len(num753)!=0:
    tmp=num753.popleft()
    cou=Counter(list(tmp))
    if len(tmp)>=3 and int(tmp)<=n and len(cou)==3:
        ans+=1
        num753.append(tmp+'3')
        num753.append(tmp+'5')
        num753.append(tmp+'7')
    elif int(tmp)<=n:
        num753.append(tmp+'3')
        num753.append(tmp+'5')
        num753.append(tmp+'7')
print(ans)
        

Measured memory_bytes: 13340
N = int(input())
A = list(map(int, input().split()))
total = sum(A)
mid = total // 2
sum_left, sum_left2 = 0, 0
sep_idx = 0
for i, l in enumerate(A):
  sum_left += l
  if sum_left >= mid:
    sep_i = i
    sum_left2 = sum_left - l
    break
sum_right, sum_right2 = sum(A[sep_i + 1:]), sum(A[sep_i:])
print(min(abs(sum_right - sum_left), abs(sum_right2 - sum_left2)))

Measured memory_bytes: 26220
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	Int N, M, V, P;
	cin >> N >> M >> V >> P;
	vector<Int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }

	sort(a.begin(), a.end());
	Int ok = N - 1, ng = -1;
	while (ok - ng > 1) {
		Int idx = (ok + ng) / 2;
		bool ad = true;
		Int sum = (idx + 1) * M;
		vector<Int> add(N, 0);
		for (int i = idx + 1; i < N; ++i) {
			if (sum >= M * V) { break; }
			if (a[idx] + M < a[i]) { break; }
			add[i] = min(M, a[idx] + M - a[i]);
			sum += add[i];
		}
		for (int i = N - 1; i > idx; --i) {
			if (sum >= M * V) { break; }
			sum += M - add[i];
			add[i] = M;
		}
		if (sum < M * V) {
			ad = false;
		}
		Int cnt = 0;
		for (int i = idx + 1; i < N; ++i) {
			if (a[idx] + M < a[i] + add[i]) { ++cnt; }
		}
		if (cnt >= P) { ad = false; }

		if (ad) { ok = idx; }
		else { ng = idx; }
	}
	
	Int ans = N - ok;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin>>n>>m;
int arr[n+1];
for(int i = 1 ; i<= n ;i++)arr[i] = INT_MAX;
if(n == 1 && m == 0){
 cout<<"0"<<endl;
 return 0;
}
bool ok = true;
while(m--){
 int pos , val;
 cin>>pos>>val;
 // pos => 1 and i have to put zero , then can't do that 
 if(n == 1){
    if(pos == 1 && val == 0)arr[pos] = val;
 }
 if(arr[pos] != INT_MAX && arr[pos] != val){
   ok = false;
 }
 if(pos == 1 && val == 0 && n >= 2){
    ok = false;
 }
 arr[pos] = val;
}
if(!ok){
 cout<<"-1"<<endl;
 return 0;
}
for(int i = 1 ; i <= n ; i++){
 if(arr[i] == INT_MAX){
	 if(i == 1)arr[i] = 1;
	 else
  arr[i] = 0;
 }
}
for(int i = 1 ; i<= n ;i++){
  if(arr[i] == INT_MAX){
   cout<<"-1"<<endl;
   return 0;
  }
}
for(int i = 1;  i<= n ;i++){
 cout<<arr[i];
}

}



Measured memory_bytes: 256
/* Author:bhagatsunny96
         JGEC
	   template__
	lets_code_it_ */
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
#define loopr(n) for(long long int i=n-1;i>=0;i--)
#define lrp(a,b) for(long long int i=a;i<=b;i++)
#define lrn(a,b) for(long long int i=b;i>=a;i--)
#define endl '\n'
#define vec vector<ll>v;
#define imap map<ll,ll>mip;
#define umap unordered_map<ll,ll>ump;
#define sett set<ll>st;
using namespace std;
ll gcd(ll a, ll b)
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);
}
ll lcm(ll a, ll b)  
 {  
    return (a*b)/__gcd(a, b);  
 }
 ll power(ll x, unsigned ll y) 
 { 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
 }
 bool isPrime(ll num)
 {
    bool flag=true;
    for(ll i =2;i<=num/2;i++) 
    {
       if(num%i==0) 
       {
          flag=false;
          break;
       }
    }
    return flag;
}
bool isPalin(ll num)
{
    bool flag=false;
    ll digit,rev=0,n=num;
    do
     {
         digit = num % 10;
         rev = (rev * 10) + digit;
         num = num / 10;
     } while (num != 0);
     if(rev==n)
     flag=true;
     return flag;
}
ll sumofdigits(ll n)
{
    ll c=0;
    while(n>0)
    {
        c++;
        n/=10;
    }
    return c;
}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) 
{ 
    return (a.first > b.first); 
}
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
string sortString(string &str) 
{ 
   sort(str.begin(), str.end()); 
   return str;
} 
void countSort(ll arr[], ll n, ll exp) 
{ 
	ll output[n];
	ll i, count[10] = {0}; 
	for (i = 0; i < n; i++) 
		count[ (arr[i]/exp)%10 ]++; 
	for (i = 1; i < 10; i++) 
		count[i] += count[i - 1]; 
	for (i = n - 1; i >= 0; i--) 
	{ 
		output[count[ (arr[i]/exp)%10 ] - 1] = arr[i]; 
		count[ (arr[i]/exp)%10 ]--; 
	} 
	for (i = 0; i < n; i++) 
		arr[i] = output[i]; 
} 
void radixsort(ll arr[], ll n) 
{
    ll mx = arr[0]; 
	for (ll i = 1; i < n; i++) 
		if (arr[i] > mx) 
			mx = arr[i];
	ll m =mx;
	for (ll exp = 1; m/exp > 0; exp *= 10) 
		countSort(arr, n, exp); 
} 
void print(ll arr[], ll n) 
{ 
    for (ll i = 0; i < n; i++) 
        cout << arr[i] << " "; 
} 
int main() 
{
    fIO
    ll a,b;
    cin>>a>>b;
    ll s1=a*100;
    ll s2=b*100;
    ll x1=ceil((double)s1/(double)8);
    ll x2=ceil((double)s2/(double)10);
    ll q=(x2*8)/100;
    ll r=(x1*10)/100;
    if(q==a && r==b)
    cout<<min(x1,x2)<<endl;
    else if(q==a)
    cout<<x2<<endl;
    else if(r==b)
    cout<<x1<<endl;
    else
    cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char a[110];

int main(void)
{
	scanf("%s", a);
	
	if(strcmp(a, "SUN") == 0)
	{
		printf("7");
	}
	
	else if(strcmp(a, "SAT") == 0)
	{
		printf("1");
	}
	
	else if(strcmp(a, "FRI") == 0)
	{
		printf("2");
	}
	
	else if(strcmp(a, "THU") == 0)
	{
		printf("3");
	}
	
	else if(strcmp(a, "WED") == 0)
	{
		printf("4");
	}
	
	else if(strcmp(a, "TUE") == 0)
	{
		printf("5");
	}
	
	else if(strcmp(a, "MON") == 0)
	{
		printf("6");
	}
	
	return 0;
}

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

int main(){
  char cards[36][3], cards2[36][3];
  int n;

  cin >> n;
  rep(i, n){
    cin >> cards[i];
    strcpy(cards2[i], cards[i]);
  }

  rep(i,n){
    for (int j=n-1;j>i;j--){
      if (cards[j][1]<cards[j-1][1]){
        swap(cards[j], cards[j-1]);
      }
    }
  }

  rep(i, n){
    int minj = i;
    for (int j=i;j<n;j++){
      if (cards2[j][1]<cards2[minj][1]){
        minj = j;
      }
    }
    swap(cards2[i], cards2[minj]);
  }

  for (int i=0;i<n;i++){
    if (i!=0) cout << " ";
    cout << cards[i];
  }
  cout << endl << "Stable" << endl;

  bool flag=0;
  for (int i=0;i<n;i++){
         if (i!=0) cout << " ";
    cout << cards2[i];
    if (strcmp(cards[i],cards2[i])) flag=1;
  }
  cout << endl;

  cout << ((flag)?"Not stable":"Stable" )<< endl;

  return 0;
}


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

int main() {
  int a;
  cin >>a;
  int b=0,c=0,d=0,e,f,g;
  
  for(int i=0;i<a;i++){
    cin>>e>>f>>g;
    
    if(abs(f-c)+abs(g-d)<=e-b&&((e-b)-abs(f-c)+abs(g-d))%2==0){
      b=e;
      c=f;
      d=g;
    }
    
    else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;    
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

	int a;
	int b;

	cin >> a >> b;

	if(a > b){
		if(a < 2*b){
			cout << 0 << endl;
		}
		else{
			cout << a - 2 * b << endl;
		}
	}
	else{
		cout << 0 << endl;
	}
}

Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  200005
ll K[102][100005],val[102],wt[102];
int main()
{
	ios
	int i, w,n,W; 
   cin>>n>>W;
   for(i=0;i<n;i++)
   	cin>>wt[i]>>val[i];
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   cout<< K[n][W]; 
	return 0;
}



Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    int a, b, m, min_a, min_b, min;
    cin >> a >> b >> m;

    int aa[a];
    int bb[b];
    min_a = INT_MAX;
    min_b = INT_MAX;

    rep(i, a)
    {
        cin >> aa[i];
        min_a = (aa[i] < min_a) ? aa[i] : min_a;
    }

    rep(i, b)
    {
        cin >> bb[i];
        min_b = (bb[i] < min_b) ? bb[i] : min_b;
    }

    min = min_a + min_b;

    rep(i, m)
    {
        int ad, bd, p, tmp;
        cin >> ad >> bd >> p;
        tmp = aa[ad - 1] + bb[bd - 1] - p;
        if (tmp < min)
            min = tmp;
    }

    cout << min << endl;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
	"sort"
)

func main() {
	// var tasks [3]int
	tasks := make([]int, 3, 3)
	fmt.Scan(&tasks[0], &tasks[1], &tasks[2])

	sort.Ints(tasks)

	answer := (tasks[2] - tasks[1]) + (tasks[1] - tasks[0])
	fmt.Println(answer)
}

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

namespace ABC114 {
	class ABC114_A {
		static void Main(string[] args) {
			int line = int.Parse(Console.ReadLine());
			var answer = "NO";
			var temp = new List<int> { 7, 5, 3 };
			if (temp.Contains(line)) answer = "YES";
			Console.WriteLine(answer);
		}
	}
}


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

int main(){
	int n,y;

	cin>>n>>y;
	y/=1000;

	for(int i=0;i<=n;i++){
		if((y-n-9*i)/4<=100&&(y-n-9*i)%4==0&&(y-n-9*i)>=0&&n-i>=(y-n-9*i)/4){
			cout<<i<<" "<<(y-n-9*i)/4<<" "<<n-i-(y-n-9*i)/4<<endl;
			return 0;
		}
	}
	cout<<"-1 -1 -1"<<endl;

}

Measured memory_bytes: 256