akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,pll> ppll;
typedef vector <ll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main(){
	FAST;
    ll n, k, m, z = 0, ans = 0, j, t = 0, x = 0, y = 0, c = 0, i;
    string s;
   	cin >> n >> s;
   	for ( i = 2 ; i < n ; i ++ ){
   		if ( s[i] == 'C' && s[i - 1] == 'B' && s[i - 2] == 'A' )
   			ans ++;
   	}
   	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cout<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

typedef pair<int,int> P;

int V;
vector<vector<int>> g;
vector<int> match;
vector<bool> used;

bool dfs(int v){
    used[v] = true;
    for(int u : g[v]){
        int w = match[u];
        if(w<0 || !used[w] && dfs(w)){
            match[v] = u;
            match[u] = v;
            return true;
        }
    }
    return false;
}

int bipartite_matching() {
    int res = 0;
    match = vector<int>(V, -INF);
    rep(v,V){
        if(match[v] < 0){
            used = vector<bool>(V, false);
            if(dfs(v)){
                res++;
            }
        }
    }
    return res;
}

int main(void){
    int n;
    cin>>n;
    V = 2*n;
    g.resize(V);
    vector<P> red(n),blue(n);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        red[i] = {a,b};
    }
    rep(i,n){
        int c,d;
        cin>>c>>d;
        blue[i] = {c,d};
    }
    rep(i,n)rep(j,n){
        if(red[i].first < blue[j].first && red[i].second < blue[j].second){
            int b = n+j;
            g[i].push_back(b);
            g[b].push_back(i);
        }
    }
    cout<<bipartite_matching()<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  string ans = "NO";
  for(int i=0;i<s.size();i++){
    for(int j=0;j+i<s.size();j++){
      string t = s;
      t.erase(i,j);
      if(t=="keyence") ans = "YES";
    }
  }


  cout << ans << endl;
}

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

int main(){
  int X;
  cin >> X;
  
  int A;
  A=X/500;
  
  int B;
  B=(X-A*500)/5;
  
  int C;
  C=A*1000+B*5;
  
  cout << C << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    bool f=0;
    if(s[0]==s[1]&&s[1]==s[2])f=1;
    if(s[1]==s[2]&&s[2]==s[3])f=1;
    if(f)cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()

	n := readInt()
	k := readInt()
	h := make([]int64, n)
	for i := range h {
		h[i] = readInt64()
	}
	sort.Sort(sortTarget0Slice(h))

	ans := int64(math.MaxInt32)
	for i := 0; i+k-1 < n; i++ {
		m := h[i+k-1] - h[i]
		if m < ans {
			ans = m
		}
	}
	println(ans)
}

// -----------------------------------------------------------------------------

type sortTarget0Slice []int64

func (s sortTarget0Slice) Len() int {
	return len(s)
}

func (s sortTarget0Slice) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortTarget0Slice) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}


Measured memory_bytes: 3072
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int N, M; {int[] a = in.ii(); N = a[0]; M = a[1];}
        int[] A = in.ii();
        int sum = 0;
        for (int i = 0; i < A.length; i++) {
            sum += A[i];
        }
        int ans = 0;
        for (int i = 0; i < A.length; i++) {
            if (A[i] * 4 * M >= sum) {
                ans++;
            }
        }
        out.println(ans >= M ? "Yes" : "No");
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	ll n, sum=0;
	cin >> n;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
		sum = sum^a[i];
	}
	rep(i,n){
		int ans = sum^a[i];
		cout << ans << " ";
	}
 	return 0;
}

Measured memory_bytes: 3992
#include <cstdio>

int main()
{
  int N;
  scanf("%d\n", &N);
  char S[101];
  scanf("%s", S);
  int x = 0, max = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'I') {
      x++;
      if (x > max)
        max = x;
    }
    else if (S[i] == 'D')
      x--;
  }
  printf("%d\n", max);
  return 0;
}


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

#define TRUE 1
#define FALSE 0

int isprime(int);

int main(){
  int i;
  int result = 0;
  int A[10000];
  int num=0;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
    if(isprime(A[i]) == TRUE)result++;
  }

  printf("%d\n",result);

  return 0;
}

  int isprime(int x){
    int i;

    if(x == 2)return TRUE;

    if(x < 2 || x % 2 == 0)return FALSE;

    i=3;

    while( i <= sqrt(x) ){

      if(x % i == 0)return FALSE;

      i = i + 2;
    }

    return TRUE;
  }



Measured memory_bytes: 2128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){

  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }

  int i = 0;
  int now;
  now = a[0];
  i++;
  while (i < n){
    if (now == 2){
      cout << i << endl;
      return 0;
    }
    now = a[now - 1];
    i++;
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 640
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

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

#define pb push_back
#define int long long
#define ld long double
#define ll long long

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, k;
	cin >> n >> k;
	if (k == 1) {
		cout << 0;
		return 0;
	}
	if (n == k) {
		cout << 0;
		return 0;
	}
	if (n < k) {
		cout << min(n, abs(k - n));
	}
	else {
		cout << min(n % k, k - n % k);
	}
	return 0;
}


Measured memory_bytes: 256
import cmath

def koch(n, p1, p2):
  if not n:
    return None
  s = (2*p1 + p2) / 3
  t = (p1 + 2*p2) / 3
  u = s + cmath.rect(1, cmath.pi/3) * (t - s)
  koch(n-1, p1, s)
  print(s.real, s.imag)
  koch(n-1, s, u)
  print(u.real, u.imag)
  koch(n-1, u, t)
  print(t.real, t.imag)
  koch(n-1, t, p2)

p1, p2 = 0j, 100+0j
print(p1.real, p1.imag)    
koch(int(input()), p1, p2)
print(p2.real, p2.imag)


Measured memory_bytes: 5788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;

int main(){
    ll n;
    cin>>n;
    int p[n],tmp[n];
    for(int i=0;i<n;i++){
        cin>>p[i];
        tmp[i]=p[i];
    }
    bool flag=false;
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        for(int k=0;k<n;k++)tmp[k]=p[k];
            cnt=0;
            //if(i==n)continue;
            int a = tmp[j];
            tmp[j] = tmp[i];
            tmp[i] = a;
            for(int k=0;k<n-1;k++){
                if(tmp[k]<tmp[k+1])cnt++;
            }
            if(cnt==n-1){
                flag=true;break;
            }
        }
    }
    if(flag)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, m, x = list(map(int, readline().split()))
    c = []
    a = []
    for i in range(n):
        temp = list(map(int, readline().split()))
        ctemp = temp[0]
        atemp = temp[1:]
        c.append(ctemp)
        a.append(atemp)

    ans = INF
    for bit in range(1 << n):
        money = 0
        learn = [0] * m
        for i in range(n):
            if bit >> i & 1:
                money += c[i]
                for j, le in enumerate(a[i]):
                    learn[j] += le

        ok = True
        for j in range(m):
            if learn[j] < x:
                ok = False

        if ok:
            ans = min(ans, money)

    if ans == INF:
        ans = -1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68344
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

vector<int> w;
auto dp = make_vec<int>(0, 0);

int rec(int l, int r) {
    if (r - l == 1) return 0;
    if (r - l == 2) {
        if (abs(w[l] - w[r-1]) <= 1) return 2;
        else return 0;
    }
    if (dp[l][r] != -1) return dp[l][r];
    int &res = dp[l][r];
    if (rec(l+1, r-1) == r - l - 2 && abs(w[l] - w[r-1]) <= 1) res = r - l;
    else {
        for (int i = l+1; i < r; ++i) chmax(res, rec(l, i) + rec(i, r));
    }
    return res;
}

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

    int n;
    while (cin >> n, n) {
        w.resize(n);
        rep(i, n) cin >> w[i];
        dp.assign(n+1, vector<int>(n+1, -1));
        cout << rec(0, n) << endl;
    }

}



Measured memory_bytes: 3436
#include <bits/stdc++.h>
using namespace std;
bool c(int x,int y){
    return y<x;
}
int main() {
    int n;cin>>n;
    vector<int > p(n);
    for (int i = 0; i < n; ++i)
        cin>>p[i];
    int q;cin>>q;
    while(q--){
        int b,e,k;cin>>b>>e>>k;
        for(int i=b,j=k;i<e;++i,++j)
            swap(p[i],p[j]);
    }
    for (int i = 0; i < n-1; ++i)
        cout<<p[i]<<" ";
    cout<<p[n-1]<<endl;
    return 0;
}



Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define break break
#define continue continue
#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;

int main(void){
	ll m; cin >> m;
	ll sum = 0;
	ll keta = 0;
	rep(i, m){
		ll d, c; cin >> d >> c;
		sum += d*c;
		keta += c;
	}
	cout << (keta-1)+(sum-1)/9 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
int n, m;
int nn[maxN] = {};

void solve()
{
    cin >> n >> m;
    vector<vector<int>> route(n);
    set<int> check;
    for (int i = 0; i < n; i++)
    {
        cin >> nn[i];
    }
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        route[a - 1].push_back(b - 1);
        route[b - 1].push_back(a - 1);
        check.insert(a - 1);
        check.insert(b - 1);
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        bool vis = true;
        if (check.count(i) == 0)
        {
            ans++;
            continue;
        }
        for (int j = 0; j < route[i].size(); j++)
        {
            if (nn[i] <= nn[route[i][j]])
            {
                vis = false;
                break;
            }
        }
        if (vis)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 12704
#include<stdio.h>
int main(void){
	int A, L, I[1000];
	scanf("%d", &A);
	for (L = 0; L < A; L++){
		scanf("%d", &I[L]);
	}
	for (L = A-1; L >= 0; L--){
		printf("%d", I[L]);
		if (L != 0){
			printf(" ");
		}
	}
        printf("\n");
	return 0;
}

Measured memory_bytes: 2668
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}


int main() {
  int n,k;
  cin >> n >> k;
  vi a(n,0);
  int mx = 0;int mn = 1000000007;
  rep(i,n) {
    cin >> a.at(i);
    mx = max(mx,a.at(i));
  }
  int r = 1000000000;
  int l = 0;

  auto f = [&](int i) -> int {
    int ai = a.at(i);
    return ai / r;
  };

  int c = (r+l) / 2;
  while(c!=r and c != l) {
    ll count = 0;
    rep(i,n) {
      count += ru(a.at(i),c)-1;
    }
    if(count <= k) r = c;
    else l = c;
    c = (r+l) / 2;
  }
  cout << c +1 << endl;

  return 0;
}


Measured memory_bytes: 4036
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#define rep(i, a, b) for (int i = (a); i <= (b); ++ i)
#define per(i, a, b) for (int i = (a); i >= (b); -- i)
#define For(i, a, b) for (int i = (a); i < (b); ++ i)
#define foreach(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)
#define fore(e, x, y) for (int ep = e(x), y = e[ep].y; ep; y = e[ep = e[ep].nxt].y)
using namespace std;
const int N = 1e5 + 7;
 
inline int ri() {
    int x = 0; bool f = 1; char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
    for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
    return f ? x : -x;
}
 
int n, L, T;
int X[N], W[N], id[N];
 
inline int pls(int x, int y, int Mod) {return (x + y) % Mod;}
inline int mul(int x, int y ,int Mod) {return 1LL * x * y % Mod;}
 
int main() {
 
    n = ri(), L = ri(), T = ri();
    rep (i, 1, n) 
        X[i] = ri(), W[i] = ri();
 
    int cur = 0, t; 
    rep (i, 1, n) {
        int tms = (T + (W[i] == 1 ? X[i] : L - 1 - X[i])) / L;  
        cur = pls(cur, mul((W[i] == 1 ? n - 1 : 1), tms, n), n);    
    }
 
    rep (i, 1, n) X[i] = pls(X[i], mul((W[i] == 1 ? 1 : L - 1), T, L), L);
    sort(X+1, X+n+1);
 
    rep (i, n - cur + 1, n) printf("%d\n", X[i]);
    rep (i, 1, n - cur) printf("%d\n", X[i]);
 
    return 0;
}

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

using namespace std;

typedef long long ll;

pair<int, int> intersect(const pair<int, int> &lhs, const pair<int, int> &rhs) {
    return {max(lhs.first, rhs.first), min(lhs.second, rhs.second)};
}

int length(const pair<int, int> &interval) {
    if (interval.first > interval.second) {
        return 0;
    } else {
        return interval.second - interval.first + 1;
    }
}

int main() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> seg(n);
    pair<int, int> left = {0, 1e9}, right = {0, 1e9};
    for (auto &i:seg) {
        cin >> i.first >> i.second;
        if (i.first > right.first) {
            right = i;
        }
        if (i.second < left.second) {
            left = i;
        }
    }
    for (int i = 0; i < seg.size(); ++i) {
        if (seg[i] == left) {
            seg.erase(begin(seg) + i);
            i--;
            if (seg.empty()) {
                break;
            } else {
                continue;
            }
        }
        if (seg[i] == right) {
            seg.erase(begin(seg) + i);
            i--;
            if (seg.empty()) {
                break;
            } else {
                continue;
            }
        }
    }
    int ans = 0;
    if (!seg.empty()) {
        pair<int, int> inter = {0, -1};
        for (const auto &i:seg) {
            if (length(i) > length(inter)) {
                inter = i;
            }
        }
        ans = length(inter) + length(intersect(left, right));
    } else {
        ans = length(left) + length(right);
    }
    if (!seg.empty()) {
        sort(begin(seg), end(seg));
        vector<int> suf(seg.size());
        suf[seg.size() - 1] = seg[seg.size() - 1].second;
        for (int i = static_cast<int>(seg.size()) - 2; i >= 0; --i) {
            suf[i] = min(suf[i + 1], seg[i].second);
        }
        for (int i = 0; i < seg.size(); ++i) {
            int first = length(intersect(seg[i], left)),
                second = i + 1 < seg.size() ? length(intersect({right.first, suf[i + 1]}, right)) : length(right);
            ans = max(ans, first + second);
        }
        ans = max(ans, length(left) + length(intersect({right.first, suf[0]}, right)));
    }
    cout << ans;
    return 0;
}

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

typedef long long int ll;
#define size 100005
ll a[size],dp[size],n;

ll func(ll n)
{
	if(dp[n]!=-1)
		return dp[n];
	dp[n]=min(func(n-1)+abs(a[n-1]-a[n]),func(n-2)+abs(a[n-2]-a[n]));
	return dp[n];
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	ll i,j;
	for(i=0;i<n;i++)
	{
		cin >> a[i];	
		dp[i]=-1;
	}
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	ll ans = func(n-1);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3328
// https://atcoder.jp/contests/abc069/tasks/abc069_b
"use strict"
function Main(input) {
  const str = input.split('\n')[0];
  const len = str.length;
  console.log(`${str[0]}${len-2}${str[len-1]}`);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

  long ans = 0;
  string T = "RGB";
  for (int i = 0; i < N; i++) {
    int t = T.find(S.at(i));
    char x = T.at(++t % 3);
    char y = T.at(++t % 3);

    string s1 = S.substr(0, i);
    string s2 = S.substr(i + 1);

    int x1 = count(s1.begin(), s1.end(), x);
    int y1 = count(s1.begin(), s1.end(), y);
    int x2 = count(s2.begin(), s2.end(), x);
    int y2 = count(s2.begin(), s2.end(), y);

    ans += x1 * y2;
    ans += y1 * x2;

    reverse(s1.begin(), s1.end());
    int mi = min(s1.size(), s2.size());
    for (int j = 0; j < mi; j++) {
      if ((s1.at(j) == x && s2.at(j) == y) || (s1.at(j) == y && s2.at(j) == x)) ans--;
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 3668
#!/usr/bin/python3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    N = read_int()
    A = read_ints()
    print(solve(N, A))


def solve(N, A):
    height_map = {}
    for i, a in enumerate(A):
        if a not in height_map:
            height_map[a] = []
        height_map[a].append(i + 1)

    heights = list(height_map)
    heights.sort(reverse=True)

    landscape = [0] * (N + 2)
    count = 0
    best = 0
    for h in heights:
        if h == 0:
            break
        for i in height_map[h]:
            l, r = landscape[i - 1], landscape[i + 1]
            if l == 0 and r == 0:
                count += 1
            elif l == 1 and r == 1:
                count -= 1
            landscape[i] = 1

        best = max(best, count)

    return best


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



Measured memory_bytes: 31060
#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;

	string a,b;
	cin>>a>>b;
	int flag=0;
	for(char c='a';c<='z';c++)
	{
		if(a+c==b)
		{
			flag=1;
			break;
		}
	}
	if(flag==0)cout<<"No";
	else
	cout<<"Yes";
		

}




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

int a[100007];
int main()
{
  ios_base::sync_with_stdio(0);
  int n,k,q,x;
  cin>>n>>k>>q;
  for(int i=1;i<=q;i++)
  {
    cin >>x;
    a[x]++;
  }
  for(int i=1;i<=n;i++)
    if(a[i]-q+k <=0) cout<<"No\n";
  	else cout<<"Yes\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)

int main()
{
    fast;
    ll n,x;
    cin>>n>>x;
    vector<ll> vec(n,0);
    for(auto &i:vec)
    {
        cin>>i;
    }
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
        ll most=x;
        if(vec[i]>=most)
        {
            ans+=vec[i]-most;
            vec[i]=most;
            most=0;
        }
        else most-=vec[i];
        if(vec[i+1]>=most)
        {
            ans+=vec[i+1]-most;
            vec[i+1]=most;
            most=0;
        }
        else most-=vec[i];
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin>>N;
    bool flg=false;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j == N){
                flg = true;
            }
        }
    }
    
    if(flg){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


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

int n,k;
int cards[100]={0};

int score(){
	int mx=0;
	for(int i=0;i<n-k+1;i++){
		int tmp=1;
		for(int j=0;j<k;j++){
			tmp*=cards[i+j];
		}
		mx=max(mx,tmp);
	}
	return mx;
}


int main(){
	while(cin>>n>>k,n){
		for(int i=0;i<n;i++){
			cin>>cards[i];
		}
		int fst;
		fst=score();
		
		int snd=0;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				swap(cards[i],cards[j]);
				snd=max(snd,score());
				swap(cards[i],cards[j]);
			}
		}
		if(snd-fst<0)cout<<"NO GAME\n";
		else cout<<snd-fst<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1160
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<climits>
using namespace std;
typedef vector<string>vs;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<double>vd;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef vector<ll>vl;
typedef pair<int,pii>piii;
#define rrep(i,x,n) for(int i=(x);i<(n);++i)
#define rep(i,x) rrep(i,0,(x))
#define fi first
#define se second
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define maxs(a,b) (a)=max(a,b)
#define mins(a,b) (a)=min(a,b)
///#include<sstream>
///#include<cstring>
///#include<stack>
///#include<complex>

typedef string::const_iterator state;

int number(state &Begin){
    int ret=0;
    while(isdigit(*Begin)){
        ret=ret*10+(*Begin)-'0';
        Begin++;
    }
    return ret;
}

int multi(state &Begin){
    int ret=number(Begin);
    while(true){
        if(*Begin=='*'){
            Begin++;
            ret*=number(Begin);
        }
        else break;
    }
    return ret;
}

int solve1(state &Begin){
    int ret=multi(Begin);

    while(true){
        if(*Begin=='+'){
            Begin++;
            ret+=multi(Begin);
        }
        else break;
    }

    return ret;

}

int solve2(state &Begin){
    int ret=number(Begin);
    while(true){
        if(*Begin=='+'){
            Begin++;
            ret+=number(Begin);
        }
        else if(*Begin=='*'){
            Begin++;
            ret*=number(Begin);
        }
        else break;
    }
    return ret;
}
int main(){
    string str;
    int ans;
    cin>>str>>ans;
    str+="=";
    state b=str.begin();
    int f1=solve1(b);
    b=str.begin();
    int f2=solve2(b);
    if(f1==ans&&f2==ans)puts("U");
    else if(f1==ans)puts("M");
    else if(f2==ans)puts("L");
    else puts("I");
}

Measured memory_bytes: 1184
#include<cstdio>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==b) {printf("Draw\n");return 0;}
	if(a==1) {printf("Alice\n");return 0;}
	if(b==1) {printf("Bob\n");return 0;}
	if(a>b) {printf("Alice\n");return 0;}
	printf("Bob\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll mod=1e9;
const int inf=0x3f3f3f3f;

int main()
{
	string	s;cin>>s;
	for (int i = 0; i < 3; i++)
	{
		cout<<s[i];
	}
}

Measured memory_bytes: 3596
n=int(input())
lista = [int(i) for i in input().split()]

import fractions
import copy

listb=[]
listc=[]
ansb= lista[0]

for i in range(1,n-1):
	ansb=fractions.gcd(ansb,lista[i])
#	print(ansb)
	listb.append(ansb)

#print(int(max(list_ans)))
ansc= lista[n-1]

for i in range(n-2,0,-1):
	ansc=fractions.gcd(ansc,lista[i])
#	print(ansc)
	listc.append(ansc)


list_b=[lista[0]]
listb=[1]+list_b+listb
list_c=[lista[n-1]]
listc=list(reversed(listc))+list_c+[1]
#print(listb)
#print(listc)

ans=0
list_ans=[listc[0],listb[n-1]]
for i in range(1,n-1):
	ans=fractions.gcd(listb[i],listc[i])
	list_ans.append(ans)
	
ansans=max(list_ans)

if n==2:
	ansans=max(lista[0],lista[1])
	
print(ansans)

Measured memory_bytes: 97376
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int N = 100010;
struct node{
	int pre, to;
}edge[N << 1];
int head[N], tot;
int n, k;
int a[N];
int dis[N], mx[N];
int ans;
bool vis[N];
void dfs(int x) {
	for (int i = head[x]; i; i = edge[i].pre) {
		int y = edge[i].to;
		dis[y] = dis[x] + 1;
		dfs(y);
		mx[x] = max(mx[x], mx[y]);
	}
	mx[x] = max(mx[x], dis[x]);
	if (x != 1) {
		if (mx[x] - dis[x] >= k) mx[x] = 0, ans++;
		if (mx[x] - dis[x] == k - 1 && a[x] != 1) mx[x] = 0, ans++;
	}
}
void add(int u, int v) {
	edge[++tot] = node{head[u], v};
	head[u] = tot;
}
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		if (i == 1) {
			if (a[i] != 1) ans++;
		} else {
			add(a[i], i);
		}
	}
	dfs(1);
	cout << ans;
	return 0;
}

Measured memory_bytes: 7296
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let n: usize = input();
    let k: usize = input();
    let x: Vec<i32> = (0..n).map(|_| input()).collect();

    let mut ans = i32::max_value();
    for x in x.windows(k) {
        if x[0] >= 0 {
            ans = std::cmp::min(ans, x[k - 1].abs());
        } else if x[k - 1] <= 0 {
            ans = std::cmp::min(ans, x[0].abs());
        } else {
            ans = std::cmp::min(ans, x[0].abs() * 2 + x[k - 1].abs());
            ans = std::cmp::min(ans, x[0].abs() + x[k - 1].abs() * 2);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cassert>// c
#include <ctime>
#include <iostream>// io
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>// container
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <algorithm>// other
#include <complex>
#include <numeric>
#include <functional>
#include <random>
#include <regex>

using namespace std;
typedef long long ll;

#define ALL(c) (c).begin(),(c).end()
#define FOR(i,l,r) for(int i=(int)l;i<(int)r;++i)
#define REP(i,n) FOR(i,0,n)
#define FORr(i,l,r) for(int i=(int)r-1;i>=(int)l;--i)
#define REPr(i,n) FORr(i,0,n)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end())
//debug
#define DUMP(x)  cerr << #x << " = " << (x)
#define LINE()    cerr<< " (L" << __LINE__ << ")"

template<typename T,typename U> T pmod(T x,U M){return (x%M+M)%M;}

//verified by AOJ0118 
struct UnionFind{
    vector<int> par,rank,ss;int size;
    vector<int> ws;
    UnionFind(int n){
        REP(i,n) par.push_back(i);
        rank = vector<int>(n);ss=vector<int>(n,1);size=n;

        ws=vector<int>(n);
    }
    int root(int x){
        if(par[x] == x)return x;
        int r = root(par[x]); ws[x] += ws[par[x]];
        return par[x] = r;
    }
    int val(int x){
    	root(x);return ws[x];
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    void unite(int x,int y,int w=0){
    	int vx=val(x),vy=val(y);
        x = root(x);y = root(y);
        if(x==y)return;
        if(rank[x] < rank[y]){//root y
        	ws[x] = w + vy - vx;
             par[x] = y;ss[y]+=ss[x];
        }else{//root x
        	ws[y] = -w +vx - vy;
            par[y] = x;ss[x]+=ss[y];
        }
        if(rank[x] == rank[y]) rank[x]++;
        size--;
    }
    int getS(int x){
        return ss[root(x)];
    }
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cerr << fixed <<setprecision(20);
	cout << fixed <<setprecision(20);
  while (true) {
  	int N,M;cin >> N >> M;if(N==0)break;
  	UnionFind uf(N);
  	REP(i,M){
  		char c;int a,b,w;cin >> c >> a >> b;a--;b--;
	
		// REP(i,N)cerr <<uf.par[i] <<" ";cerr <<endl;
  // 		REP(i,N)cerr <<uf.val(i) <<" ";cerr <<endl;
  		if(c=='!'){
  			cin >> w;
  			uf.unite(a,b,w);
  		}else{
  			if(!uf.same(a,b)){
  				cout <<"UNKNOWN"<<endl;
  			}else{
  				cout << uf.val(a)-uf.val(b) <<endl;
  			}
  		}
  		// cerr <<"aaa"<<endl;
  	}
  }
}

Measured memory_bytes: 2664
//In the name of the Almighty

   #include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
int main( )
{

  optimize();
  ll a,b,c,d; cin>>a>>b>>c>>d;
  ll num1= a*c;
  ll num2 = b*d;
  ll num3= a*d;
  ll num4 = b*c;
  ll max_1= max(num1,num2);
  ll max_2= max(num3, num4);
  ll max_final = max(max_1,max_2);
  cout<<max_final<<endl;




       return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define ll long long
#define ld long double
#define MAX (int)(7*pow(10,2) + 10)
#define pb(a) push_back(a)
// #define cout out
// #define cin in
ll inf = pow(10,9);
ll INF = inf;
ll modulo = inf;
double eps = 1e-10;
ifstream in;
ofstream out;
 
 
void deal(){
	ll n;
	cin>>n;
	string a;
	cin>>a;
	ll cnt[2] = {0,0};
	string dir = "RB";
	for(auto& f : a)
		cnt[dir.find(f)]++;
	if(cnt[0] > cnt[1])
		cout<<"Yes";
	else
		cout<<"No";
}
 
 
 
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}
 
 
 
/*
	
*/

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


int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for(auto& a : A){
    cin >> a;
  }
  sort(A.begin(), A.end());
  vector<pair<int, int>> BC(M);
  for(auto& bc : BC){
    int b, c;
    cin >> b >> c;
    bc = {b, c};
  }
  sort(BC.begin(), BC.end(), [](pair<int, int>& bc1, pair<int, int>& bc2){
    return bc1.second > bc2.second;
  });
  auto it = A.begin();
  for(auto& bc : BC){
    for(int ii=0; ii<bc.first; ii++){
      if(*it >= bc.second){
        break;
      }
      *it = bc.second;
      it++;
    }
  }

  long long int ans = 0;
  for(auto& a : A){
    ans += a;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int u, v;
} e[200010];
vector <int> to[1010];
int tag1[1010][1010], tag2[1010][1010];
int n, m;
int vis[1010];
inline void dfs(int now) {
    if(vis[now]) return;
    vis[now] = 1;
    for (auto v : to[now]) dfs(v);
}
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++) scanf("%d%d", &e[i].u, &e[i].v), to[e[i].u].push_back(e[i].v);
    for (int i = 1; i <= n; i++) {
        memset(vis, 0, sizeof vis);
        vis[i] = 1;
        for (auto v : to[i]) tag2[i][v] |= vis[v], dfs(v);
        reverse(to[i].begin(), to[i].end());
        memset(vis, 0, sizeof vis);
        vis[i] = 1;
        for (auto v : to[i]) tag2[i][v] |= vis[v], dfs(v);
        memcpy(tag1[i], vis, sizeof tag1[i]);
    }
    for (int i = 1; i <= m; i++) puts(tag1[e[i].v][e[i].u] ^ tag2[e[i].u][e[i].v] ? "diff" : "same");
    return 0;
}

Measured memory_bytes: 12288
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace abc147
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc147A();
        }

        public static void solve_abc147B()
        {

        }

        public static void solve_abc147A()
        {
            int[] abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            Console.WriteLine(abc[0] + abc[1] + abc[2] >= 22 ? "bust" : "win");
        }
    }
}


Measured memory_bytes: 13140
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def comb(n, r):
    # if n - r < 0: return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def solve():
    N, P = MI()
    A = LI()

    cnt = {}
    for a in A:
        cnt[a % 2] = cnt.get(a%2, 0) + 1
    # print(cnt)

    ans = 0

    one = cnt.get(1, 0)
    zero = cnt.get(0, 0)
    if P == 0:
        for i in range(0, one+1, 2):
            # print(i)
            # print(comb(one, i))
            ans += comb(one, i)

        print(ans * (pow(2, zero)))
    else:
        for i in range(1, one+1, 2):
            ans += comb(one, i)
        print(ans * pow(2, zero))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9296
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <ctime>
#include <random>
#include <queue>
  
using namespace std;
 
const int MAXN = 1e5 + 10;



int main(){
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
#ifndef _DEBUG
    /*freopen("trap.in", "r", stdin);
    freopen("trap.out", "w", stdout);*/
#endif
    int a;
    cin >> a;
    cout << "ABC" << a;
    return 0;
}

Measured memory_bytes: 256
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b;
    cout << b + (b - a);
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var map = getMap();
        putDot(map, a - 1);
        putSharp(map, b - 1);
        display(map);
    }
    public static char[,] getMap()
    {
        var a = new char[100, 100];
        for (int i = 0; i < 100; i++)
        {
            for (int j = 0; j < 50; j++) a[i, j] = '#';
            for (int k = 50; k < 100; k++) a[i, k] = '.';
        }
        return a;
    }
    public static void display(char[,] map)
    {
        Console.WriteLine("100 100");
        var a = new char[100];
        for (int i = 0; i < 100; i++)
        {
            for (int j = 0; j < 100; j++)
                a[j] = map[i, j];
            Console.WriteLine(string.Join("", a));
        }
    }
    public static void putDot(char[,] map, int a)
    {
        if (a == 0) return;
        var count = 0;
        for (int i = 1; i <= 61; i += 2)
            for (int j = 1; j <= 39; j += 2)
            {
                map[i, j] = '.';
                count++;
                if (count == a) return;
            }
    }
    public static void putSharp(char[,] map, int a)
    {
        if (a == 0) return;
        var count = 0;
        for (int i = 1; i <= 61; i += 2)
            for (int j = 52; j <= 90; j += 2)
            {
                map[i, j] = '#';
                count++;
                if (count == a) return;
            }
    }
}


Measured memory_bytes: 13240
#include<iostream>
using namespace std;
 
 
int main()
{
    int n;
    int room[4][3][10] = { { 0 } };
    cin >> n;
    for (int i = 0; i < n; i++){
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        room[b - 1][f - 1][r - 1] = room[b - 1][f - 1][r - 1] + v;
    }
    for (int i = 0; i < 4; i++){
        for (int j = 0; j < 3; j++){
            for (int k = 0; k < 10; k++){
                cout <<" "<< room[i][j][k];
            }
            cout << endl;
        }
        if (i < 3){
            for (int l = 0; l < 20; l++){
                cout << "#";
            }
            cout << endl;
        }
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> T(n),A(n);
	for(int i = 0;i<n;i++)
	{
		cin >> T[i] >> A[i];
	}
	ll a=1,b=1;

	for(int i = 0;i<n;i++)
	{
		ll x = a + (T[i]-(a%T[i]==0?T[i]:a%T[i]));
		ll y = b + (A[i]-(b%A[i]==0?A[i]:b%A[i]));
		ll xy = x/T[i]*A[i];
		ll yx = y/A[i]*T[i];
		for(ll i = 1;i<=1000;i++)
		{
			if(x*i>=a&&xy*i>=b)
			{
				x = x*i;
				xy = xy*i;
				break;
			}
		}		
		for(ll i = 1;i<=1000;i++)
		{
			if(yx*i>=a&&y*i>=b)
			{
				yx = yx*i;
				y = y*i;
				break;
			}
		}
		//cout<<x<<' '<<xy<<';'<<yx<<' '<<y<<endl;
		if(x+xy<y+yx)
		{
			a = x;
			b = xy;
		}
		else
		{
			a = yx;
			b = y;
		}
	}
	cout<<a+b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

long long gcd(long long m,long long n){
    if(n==0){
        return m;
    }
    return gcd(n,m%n);
}
 
long long lcm(long long a,long long b){
    long long g=gcd(a,b);
    return a/g*b;
}
int main(){
    int n;
    cin>>n;
    vector<ll> t(n);

    rep(i,n) cin>>t[i];

    ll ans=t[0];
    for(int i=1;i<n;i++){
        ans=lcm(t[i],ans);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long int ll;
void solve()
{
	int x,y,z;
	cin>>x>>y>>z;
	swap(x,y);
	swap(x,z);
	cout << x << " " << y << " " << z; 
}
int main(){
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	solve();
	return 0;
}

Measured memory_bytes: 3552