akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int ans1 = 0, ans2 = 0;
    REP(i, s.size()) 
    {
        if(s[i] == '0')
        {
            if(i % 2 == 0) ans1 += 1;
            else ans2 += 1;
        }
        else
        {
            if(i % 2 == 0) ans2 += 1;
            else ans1 += 1;
        }
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define ALL(a) begin(a), end(a)
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    auto f = [] (ll k, ll s) {
        return (k - 1) / s + 1;
    };
    int n;
    ll kt = 1, ka = 1;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        ll t, a;
        cin >> t >> a;
        ll w = max(f(kt, t), f(ka, a));
        kt = w * t;
        ka = w * a;
    }
    cout << kt + ka << endl; 
}


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

int main(){
    double n;
    cin >> n;
    n *= n * n;
    cout << setprecision(10);
    cout << n / 27 << endl;
}

Measured memory_bytes: 256
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int grid[400][400];
int costs[400][400];
int dp[400][400];
int main(){
	iostream::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	REP(i, h) {
		string s;
		cin >> s;
		REP(q, w) {
			grid[i][q] = s[q] - 'a';
		}
	}
	long long ans = 0;
	for (int j = 1; j < w; ++j) {
		REP(i, h + 1) {
			REP(q, h + 1) {
				costs[i][q] = 1e8;
				dp[i][q] = 1e8;
			}
		}
		for (int i = 0; i <= h; ++i) {
			costs[i][0] = 0;
			costs[0][i] = 0;
		}
		for (int i = 1; i <= h; ++i) {
			for (int q = 1; q <= h; ++q) {
				costs[i][q] = costs[i - 1][q - 1];
				if (grid[i-1][j - 1] == grid[q-1][j]) {
					costs[i][q]++;
				}
			}
		}
		dp[h][h] = 0;
		for (int i = h; i >= 0; --i) {
			for (int q = h; q >= 0; --q) {
				if (i > 0) {
					dp[i - 1][q] = min(dp[i - 1][q], dp[i][q] + costs[i][q]);
				}
				if (q > 0) {
					dp[i][q - 1] = min(dp[i][q - 1], dp[i][q] + costs[i][q]);
				}
			}
		}
		ans += dp[0][0];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void) {
  int a; string s;
  cin >> a >> s;
  if(a >= 3200) {
    fin(s);
  } else {
    fin("red");
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool> vecbool;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<vecint> vec2int;
typedef vector<vecbool> vec2bool;
int dx[4]{-1, +1, 0, 0};
int dy[4]{0, 0, -1, +1};
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
int n;
double dp[301][301][301];
double rec(int i, int j, int k) {
  if (i < 0 || j < 0 || k < 0) return 0;
  if (dp[i][j][k] >= 0) return dp[i][j][k];
  if (i == 0 && j == 0 && k == 0) return 0.0;
  double res = n;
  res += rec(i - 1, j, k) * (double)i;
  res += rec(i + 1, j - 1, k) * (double)j;
  res += rec(i, j + 1, k - 1) * (double)k;
  res /= (double)(i + j + k);
  dp[i][j][k] = res;
  return res;
}
int main() {
  init();
  cin >> n;
  int n1, n2, n3;
  n1 = n2 = n3 = 0;
  REP(i, n) {
    int tmp;
    cin >> tmp;
    if (tmp == 1) {
      n1++;
    } else if (tmp == 2) {
      n2++;
    } else if (tmp == 3) {
      n3++;
    }
  }
  // cout << n1 << " " << n2 << " " << n3 << endl;
  memset(dp, -1, sizeof(dp));
  cout << rec(n1, n2, n3) << endl;
}


Measured memory_bytes: 213376
import java.util.*;

public class Main {
  private static int N;
  private static long K;
  private static int[] A;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    K = sc.nextLong();
    A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    Arrays.sort(A);
    
    long ok = -1_000_000_000_000_000_005L;
    long ng = 1_000_000_000_000_000_005L;
    while (ok+1 < ng) {
      long m = (ok+ng)/2;
      if (isOk(m)) {
        ok = m;
      } else {
        ng = m;
      }
    }
    System.out.println(ok);
  }
  private static boolean isOk(long x) {
    long count = 0;
    for (int i = 0; i < N; i++) {
      count += calcCount(i, x);
    }
    return count/2 < K;
  }
  private static int calcCount(int idx, long x) {
    int ok;
    int ng;
    if (A[idx] >= 0) {
      long max = (long)A[idx]*A[N-1];
      long min = (long)A[idx]*A[0];
      if (max < x) {
        return N-1;
      }
      if (x <= min) {
        return 0;
      }
      ok = 0;
      ng = N-1;
    } else {
      long max = (long)A[idx]*A[0];
      long min = (long)A[idx]*A[N-1];
      if (max < x) {
        return N-1;
      }
      if (x <= min) {
        return 0;
      }
      ok = N-1;
      ng = 0;
    }
    while ((A[idx] >= 0 && ok+1 < ng)
          || (A[idx] < 0 && ng+1 < ok)) {
      int m = (ok+ng)/2;
      if ((long)A[idx]*A[m] < x) {
        ok = m;
      } else {
        ng = m;
      }
    }
    if (A[idx] >= 0) {
      return idx <= ok ? ok : ok+1;
    } else {
      return idx >= ok ? N-ok-1 : N-ok;
    }
  }
}

Measured memory_bytes: 84248
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
  double w,h,x,y;cin>>w>>h>>x>>y;
  double ans;
  ans = w*h/2;
  cout << ans << " " ;
  if (w == 2*x && h == 2*y){
    cout << "1";
  }else{
  cout << "0";
  }
  
}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	ll N=in<ll>();
	auto A=vecin<ll>(N);
	vector<ll> S(N,0);
	
	REP(i,N-1){
		S[i+1] = 2*A[i]-S[i];
	}
	ll offset = (2*A[N-1]-S[N-1])/2LL;
	REP(i,N){
		if(i%2) S[i]-=offset;
		else S[i] += offset;

		if(i<N-1) cout << S[i] << ' ';
		else out(S[i]);
	}

	return 0;
}


Measured memory_bytes: 2944
//Volume0-0044
import java.util.*;

public class Main {

	//declare
	private static int   MAX = 50022;
	private static boolean[] prm = new boolean[MAX];
	
	public static void main(String[] args) {

		int n,
	    small = MAX,
	    large = 0;
		
		//initialize
		init();

		//input
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			n = sc.nextInt();
			
			//calculate
			for(int i=n-1;i>0;i--){
				if(prm[i]){small = i; break;}
			}
			for(int i=n+1;i<MAX;i++){
				if(prm[i]){large = i; break;}
			}
			
			//output
			System.out.println(small + " " + large);
		}
	}

	//Creation of a prime number table.
	private static void init(){
		for(int i=0;i<MAX;i++){prm[i] = true;}
		prm[0] = false;
		prm[1] = false;
		for(int i=4;i<MAX;i+=2){prm[i] = false;}
		for(int i=3;i<Math.sqrt(MAX);i+=2){
			if(!prm[i]){continue;}
			for(int k=i*2;k<MAX;k+=i){
				prm[k] = false;
			}
		}
	}
}

Measured memory_bytes: 18024
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        static void Main(){
            long[] md = ILongs();
            long m = md[0];
            long d = md[1];

            long ans = 0;

            for(int i=1;i<=m;i++){
                for(int j=22;j<=d;j++){
                    if(j%10!=0 && j%10!=1){
                        if((j%10)*(j/10)==i){
                            ans ++;
                        }
                    }
                }
            }
            WriteLine(ans);
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 11092
package main

import (
	"bufio"
	"container/list"
	"fmt"
	"log"
	"os"
	"strconv"
	//	"github.com/pkg/profile"
)

func print(l *list.List) {
	var w = bufio.NewWriter(os.Stdout)

	for e := l.Front(); e != l.Back(); e = e.Next() {
		fmt.Fprint(w, e.Value, " ")
	}
	fmt.Fprintln(w, l.Back().Value)
	_ = w.Flush()
}

func main() {
	//	defer profile.Start(profile.ProfilePath(".")).Stop()

	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	if !s.Scan() {
		log.Fatal("scan error")
	}

	n, _ := strconv.Atoi(s.Text())
	lst := list.New()
	for i := 0; s.Scan() && i < n; i++ {
		switch s.Text() {
		case "insert":
			s.Scan()
			x, _ := strconv.Atoi(s.Text())
			lst.PushFront(x)
		case "delete":
			s.Scan()
			x, _ := strconv.Atoi(s.Text())
			for e := lst.Front(); e != nil; e = e.Next() {
				if e.Value == x {
					lst.Remove(e)
					break
				}
			}
		case "deleteFirst":
			lst.Remove(lst.Front())
		case "deleteLast":
			lst.Remove(lst.Back())
		default:
		}
	}

	if s.Err() != nil {
		log.Fatal(s.Err())
	}

	print(lst)
}



Measured memory_bytes: 74680
#include <iostream>
using namespace std;
int main() {
	int a, b, x;
	cin >> x;
	cin >> a;
	cin >> b;
	if (abs(a - x) > abs(b - x)) {
		cout << "B" << endl;
	}
	else {
		cout << "A" << endl;
	}
}

Measured memory_bytes: 256
//デバッグ用オプション：-fsanitize=undefined,address

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//インクルードなど
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

// vector set 等
#include <map>
#include <set>
#include <vector>

//マクロ
// forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
// FORAは範囲for文(使いにくかったら消す)
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto& i : I)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(x.begin(), x.end())
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000  // 10^12:∞
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange
//略記
#define PB push_back  //挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素

signed main() {
  //入力の高速化用のコード
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  ll n, m, ans, y;

  cin >> n;
  ans = 0;
  FOR(i, 1, n) {
    y = n / i;
    ans += y * (y + 1) / 2 * i;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3192
#include<stdio.h>
typedef struct{
  int A;
  char B;
  int No;
}cards;
 
cards card[100000];
 
int partition(int, int);
void quickSort(int, int);
int stateJudge(int);
main(){
  int k, r, mid, p = 0;
  int i;
 
  scanf("%d", &k );
 
  for(i = 0; i < k; i++){
 
    scanf("%s%d",&card[i].B, &card[i].A);
 
    card[i].No = i;
     
    // printf("%c %d", card[q].B, card[q].A);
     
  }
   
   
  r = k - 1;
   
   
  quickSort(p, r);
   
  if( stateJudge(r) == 1 )printf("Stable\n");
  else printf("Not stable\n");
 
   
  for(i = 0; i < k; i++){
     
    printf("%c %d\n", card[i].B, card[i].A);
   
  }
   
  return 0;
   
}
 
 
int partition(int p, int r){
   
  int i = 0 , j;
  cards ch;
  i = p;
   
  for(j = p; j < r; j++){
    // printf("%d\n",i);
    if(card[j].A <= card[r].A ){
       
      ch = card[i];
      card[i] = card[j];
    card[j] = ch;
    i++;
     
    } 
  }
  ch = card[r];
  card[r] = card[i];
  card[i] = ch;
  //  printf("%d\n",i);
  return i;
   
}
 
 
void quickSort(int p, int r){
  int q;
  if(p < r){q = partition(p, r);
    //    printf("%c %d\n", card[q].B, card[q].A);
    quickSort(p, q-1) ;
     
    quickSort(q+1, r);
     
  }
}
 
int stateJudge(int r){
  int i;
  for(i = 0; i < r; i++){
     
    if(card[i].A == card[i+1].A){
       
      if(card[i].No > card[i+1].No)
    {
      return 0;
    }   
    }
  }
 return 1;
}

Measured memory_bytes: 1784
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0,nn=(intl)(n);i<nn;++i)
#define Rep1(i,n) for(intl i=1,nn=(intl)(n)+1;i<nn;++i)
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);}
#define Input2(a,b) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);cin>>(b).at(ii);}
#define mp make_pair
#define mt make_tuple
using intl = int64_t;
using vi = vec<intl>;
using vb = vec<bool>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
using si = set<intl>;
using vsi = vec<si>;
using mii = map<intl,intl>;
using vmii = vec<mii>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;



int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  
  intl N;
  cin >>N;
  cout <<( (N%1000)?1000-(N%1000):0 );
}

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

template<typename T>
struct NegativeLoop_on_path{
    const T inf=numeric_limits<T>::max();
    struct edge{
        int u,v; T w;
        edge(int u,int v,T w):u(u),v(v),w(w){}
    };
    int n;
    vector<vector<int>> G;
    vector<T> d;
    vector<int> negative;
    NegativeLoop_on_path(int n):n(n),G(n),d(n,inf),negative(n,0){}
    vector<edge> es;
    void add_edge(int u,int v,T c){
        es.emplace_back(u,v,c);
        G[u].emplace_back(v);
    }
    vector<T> build0(){
        for (int i=0;i<n-1;++i){
            for (auto e:es){
                if (d[e.u]==inf) continue;
                if (d[e.u]+e.w<d[e.v]) d[e.v]=d[e.u]+e.w;
            }
        }
        return d;
    }
    void build1(){
        for (int i=0;i<n;++i){
            for (auto e:es){
                if (d[e.u]==inf) continue;
                if (d[e.u]+e.w<d[e.v]){
                    d[e.v]=d[e.u]+e.w;
                    negative[e.v]=1;
                }
                if (negative[e.u]) negative[e.v]=1;
            }
        }
    }
    T shortest_path(int from,int to,int &neg_loop){
        d[from]=0;
        vector<T> res=build0();
        build1();
        neg_loop=negative[to];
        return res[to];
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    NegativeLoop_on_path<ll> NL(N);
    rep(i,M){
        int a,b; ll c; cin >> a >> b >> c;
        NL.add_edge(--a,--b,-c);
    }
    int ok=0;
    ll ans=NL.shortest_path(0,N-1,ok);
    if (ok) cout << "inf" << endl;
    else cout << -ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

class UnionFind:
    # 初期化
    def __init__(self, n):
        # 根なら-size, 子なら親の頂点
        self.par = [-1] * n
        # 木の高さ
        self.rank = [0] * n

    # 検索
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 異なる集合に属する場合のみ併合
        if x != y:
            # 高い方をxとする。
            if self.rank[x] < self.rank[y]:
                x,y = y,x
            # 同じ高さの時は高さ+1
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            # yの親をxとし、xのサイズにyのサイズを加える
            self.par[x] += self.par[y]
            self.par[y] = x

    # 同集合判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 集合の大きさ
    def size(self, x):
        return -self.par[self.find(x)]

n,m = readints()
u = UnionFind(n)
for i in range(m):
    a,b = readints()
    u.unite(a-1,b-1)

print(sum([1 for x in u.par if x<0])-1)



Measured memory_bytes: 78696
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>

namespace adaptor = boost::adaptors;
namespace mp = boost::multiprecision;

mp::cpp_int digit_sum(mp::cpp_int n){
   if(n < 10)  return n;
   return digit_sum(n / 10) + n % 10;
}

void solve()
{
    std::string N;
    std::cin >> N;
    int64_t size = N.size();
    int64_t digit_sum = 0;
    for (int64_t i = 0; i < size; i++)
    {
        digit_sum += N[i] - '0';
    }

    std::string ans = digit_sum % 9 == 0 ? "Yes" : "No";
    std::cout << ans << std::endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}


Measured memory_bytes: 3796
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long

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

    int a = 0, b = 0, ab = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {

        string s;
        cin >> s;

        if (s[0] == 'B' && s[s.length() - 1] == 'A')
            ab++;
        else if (s[0] == 'B')
            b++;
        else if (s[s.length() - 1] == 'A')
            a++;

        for (int k = 0; k < s.length() - 1; k++) {
            if (s[k] == 'A' && s[k + 1] == 'B') {
                k++;
                ans++;
            }
        }

        //cout << "ans " << ans << endl;
    }

    //cout << "a " << a << " b " << b << " ab " << ab << endl;

    if (a == 0 && b == 0 && ab != 0) {
        ans += ab - 1;
    } else {
        ans += min(a + ab, b + ab);
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
static const int N = 100000;
static const int INFTY =(1<<21);
struct edge {int to,cost;};
vector<edge> G[100000];
int d[N],p[N];
int c;
int n,m;

void bfs(int s){
  queue<int> q;
  q.push(s);
  d[s]=0;
  p[s]=0;
  int u;
  while(!q.empty()){
    u = q.front(); q.pop();
    for (int v=0;v<G[u].size();v++){
      if((p[G[u][v].to]!=INFTY)&&(p[G[u][v].to]!=p[u]+G[u][v].cost)){
        c=1;
        break;
      }
      p[G[u][v].to]=p[u]+G[u][v].cost;
      if(d[G[u][v].to]!= INFTY)continue;
      d[G[u][v].to]=d[u]+1;
      q.push(G[u][v].to);
    }
  }
}

int main(){

cin >> n >> m;

for(int i=0;i<m;i++){
  int l,r,d;
  cin >> l >> r >> d;
  G[l-1].push_back((edge){r-1,d});
  G[r-1].push_back((edge){l-1,-d});
}
for(int i=0;i<n;i++)d[i]=INFTY;
for(int j=0;j<n;j++)p[j]=INFTY;
for(int k=0;k<n;k++){
  if(d[k]==INFTY)bfs(k);
}
if(c==1){
  cout<<"No"<<endl;
}
else{
  cout<<"Yes"<<endl;
}
return 0;
}


Measured memory_bytes: 9728
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll MAX=200000;
vector<ll> F(MAX,1);
 
void fact(){
    for(ll i=1;i<MAX;i++){
    F[i]=F[i-1]*i%MOD;
    }
return;
}


// mod. m での a の逆元 a^{-1} を計算する
//ただしmとaが互いにその時のみ
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long comb(long long a, long long b){
    return (((F[a]*modinv(F[b],MOD))%MOD)*modinv(F[a-b],MOD))%MOD;
}

//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓
//↓↓↓↓↓↓fact()ってちゃんとつける！！！！！！！！！！！↓↓↓↓↓↓

map<ll, ll> prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(){
    fact();
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    Map A=prime_factor(M);
    ll ans=1;
    for(auto p: A){
        ans*=comb(N-1+p.second,p.second);
        ans%=MOD;
    }
    print(ans)


    return 0;
}

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

using namespace std;

int main() {
  int p;
 cin >> p;
 if(p>=10){ 
  // パターン1
  if (p%10 ==3) {
  
      cout << "bon" << endl;
  }

  // パターン2
  else if (p%10==0 ||p%10==1||p%10==6||p%10==8 ) {

 cout << "pon" << endl;
  }
else{
  cout << "hon" << endl;
}

 }
  else{
   // パターン1
  if (p ==3) {
  
      cout << "bon" << endl;
  }

  // パターン2
  else if (p==0 ||p==1||p==6||p==8 ) {

 cout << "pon" << endl;
  }
else{
  cout << "hon" << endl;
}   
    
    
  }
   
   
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(){
  char s[10];
  char t[10];
  scanf("%s%s",s,t);
  
  int ans=0;
  for(int i=0;i<3;i++)
  {
    if(s[i]==t[i]) ans++;
  }
  printf("%d\n",ans);
}

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

int main() {
    int H,W,K;
    cin >> H >> W >> K;
    vector<vector<char>> c(H,vector<char>(W));
    vector<vector<int>> d(H,vector<int>(W));
    vector<vector<int>> e(H,vector<int>(W));
    bool HFlag = false;
    bool WFlag = false;
    int a = 0;
    int cnt =0;
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            cin >> c.at(i).at(j); 
        }
    }
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(c.at(i).at(j)=='.') {
                d.at(i).at(j) = 0;
            }else{
                d.at(i).at(j) = 1;
            }
        }
    }

    for(int i=0;i<pow(2,H)*pow(2,W);i++) {
        e = d;
        a = 0;
        bitset<12> value(i);

        for(int j=0;j<H;j++) {
            if (value[(H+W-1)-j] == 1) { //このときその行をすべて塗りつぶす
                HFlag = true;
            }
            for(int k=0;k<W;k++) {
                if (HFlag == true) {
                    e.at(j).at(k) = 0;
                }
            }
            HFlag = false;
        }
        for(int j=0;j<W;j++) {
            if(value[(W-1)-j] == 1) {
                WFlag = true;
            }
            for(int k=0;k<H;k++) {
                if (WFlag == true) {
                    e.at(k).at(j) = 0;
                }
            }
            WFlag = false;            
        }

        for(int j=0;j<e.size();j++) {
            a += accumulate(e.at(j).begin(),e.at(j).end(),0);
        }
        if (a == K) {
            cnt++;
        }
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 4084
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;

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

    priority_queue<ll> kind[N];
    for(int i = 0; i < N; i++){
        int t;
        ll d;
        cin >> t >> d;
        kind[t - 1].push(d);
    }

    priority_queue<ll> best, remain;
    //best: 各種類で一番美味しいやつを集めたもの
    //remain: bestの余り
    for(int i = 0; i < N; i++){
        if(!kind[i].empty()){
            best.push(kind[i].top());
            kind[i].pop();

            while(!kind[i].empty()){
                remain.push(kind[i].top());
                kind[i].pop();
            }
        }
    }

    vector<ll> bsum = {0};
    // bestの累積和 (bsum[i] = bestの先頭からi個の総和)
    while(!best.empty()){
        bsum.push_back(bsum.back() + best.top());
        best.pop();
    }

    vector<ll> rsum = {0};
    // remainの累積和
    while(!remain.empty()){
        rsum.push_back(rsum.back() + remain.top());
        remain.pop();
    }

    ll ans = 0;
    for(ll x = 1; x <= K; x++){
        //種類が多すぎるケース
        if(x >= bsum.size()) break;

        //種類が少なすぎて、余り物が足りないケース
        if(K - x >= rsum.size()) continue;

        // bestからx個、remainからK-x個貪欲に選ぶ
        ans = max(ans, bsum[x] + rsum[K-x] + x*x);
    }

    cout << ans << endl;

    return 0;
}

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

#define MOD 1000000007
int main(void){
    int n;
    long long ans = 1,c[10005],t;
    cin >> n;
    for(int i=2; i<=n; i++){
        t = i;
        for(int j=2; t > 1; j++){
            while(t % j == 0){
                t = t / j;
                c[j]++;
            }
        }
    }

    for(int i=2; i<=n; i++){
        ans = ans * (c[i] +1) % MOD;
    }

    cout << ans <<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<queue>

using namespace std;

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

#define f first
#define s second

class E{
	public:
	int a,b,v;
	E(int a,int b,int v):a(a),b(b),v(v){}
	bool operator<(const E&a)const{
		return v<a.v;
	}
};


class T{
	public:
	int bef;
	vector<int> ko;
};

T uf[111];


void ufto(int a,int b){
	uf[b].bef = a;
	uf[a].ko.push_back(b);
	
	rep(i,uf[b].ko.size()){
		ufto(a,uf[b].ko[i]);
	}
	uf[b].ko.clear();
}

int find(int a){
	return uf[a].bef;
}
void unit(int a,int b){
	ufto(find(a),find(b));
}
int check(int a,int b){
	return find(a)==find(b);
}

int main(){
	while(1){
		rep(i,111){
			uf[i].bef=i;
			uf[i].ko.clear();
		}
		int n,m;
		cin>>n>>m;
		
		if(n==0)break;
		
		vector<E> ed;
		
		rep(i,m){
			int a,b,c;
			cin>>a>>b>>c;
			
			ed.push_back(E(a,b,c));
		}
		
		
		sort(ed.begin(),ed.end());
		
		
		int ans=0;
		rep(i,m){
			if(check(ed[i].a,ed[i].b)==0){
				ans+=ed[i].v;
				unit(ed[i].a,ed[i].b);
			}
		}
		
		printf("%d\n",ans);
	}
}
/*
5 6
0 2 1
2 1 3
2 3 8
1 3 2
3 4 5
1 4 4

*/

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;
 
ll POW(ll m,ll n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  return m*POW(m,n-1)%MOD;
}
 
ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
 
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a, ll m) {
    ll x, y;
    extGCD(a, m, x, y);
    return mod(x, m);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return m%MOD*COM(m-1,n)%MOD*modinv(m-n,MOD)%MOD;
}

map<int, int> prime_factors(int n) {
    map<int, int> res;
    if(n == 1) { 
        res[n] = 1;
        return res;
    }
    for(int i = 2, _n = n; i*i <= _n; ++i) {
        while(n % i == 0) {
            ++res[i]; 
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}

 
int main()
{
  ll n,m,b,c[100000],ans;
  ans=1;
  b=0;
  cin >> n >> m;
  map<int, int> res = prime_factors(m);
    for(map<int, int>::iterator it = res.begin(), end = res.end(); it != end; ++it) {
        c[b]=it->second;
      b++;
    }
  rep(i,15)ans=ans*COM(c[i]+n-1,n-1)%MOD;
  if(m!=1)printf("%lld",ans);
  else printf("1");
  
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 2005;
int N, K;

int dp[2*MAX_N][2*MAX_N];

class Combination {
public:
    Combination(int N) {
        setFact(N);
    }

    long long getC(int a, int b) {
        return (((fact[a] * revFact[b]) % mod ) * revFact[a-b]) % mod;
    }

    static long long powmod(long long a, long long b) 
    {
        long long ret = 1;
        long long tmp = a;
        while(b) {
            if(b&1) {
                ret *= tmp;
                ret %= mod;
            }
            b /= 2;
            tmp *= tmp;
            tmp %= mod;
        }

        return ret;
    }

    void setFact(int N)
    {
        fact.clear();
        revFact.clear();

        fact.resize(N);
        fact[0] = 1;

        for(int i = 1; i < N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }
    
        revFact.resize(N);

        for(int i = N-1; i >= 0; i--) {
            revFact[i] = powmod(fact[i], mod - 2);
        }
    }
private:
    vector<long long> fact;
    vector<long long> revFact;
    static const long long mod = 1000000007;
};

Combination comb(2*MAX_N);

signed main()
{
  cin >> N >> K;

  REP(n,2*MAX_N) {
    dp[n][n] = 1;
    FOR(m,n+1,2*MAX_N) {
      dp[n][m] = comb.getC(m-1,n-1);
    }
  }

  FOR(k,1,K+1) {
    int ans = 0;
    if(k==1) {
      cout << N-K+1 << endl;
      continue;
    } else {
      REP(n,N+1) {
        if(k-1 <= N-K-n) {
          int tmp = (dp[k][K] * dp[k-1][N-K-n]) % MOD;
          ans += (tmp * (int)(n+1)) % MOD;
          ans %= MOD;
        } else {
          break;
        }
      }
      cout << ans << endl;
    }
    
  }

  return 0;
}


Measured memory_bytes: 125312
#include <cstdio>
int a;
char s[20];
int main ()
{
	scanf ("%s",s);
	for (a=0;s[a];a=s[a]=='A'&&s[a+1]=='C'?10:a+1) ;
	printf ("%s\n",a==10?"Yes":"No");
	return 0;
}


Measured memory_bytes: 128
// https://atcoder.jp/contests/abc063/tasks/arc075_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    v.push_back(0);
    sort(ALL(v));
    int sum = accumulate(ALL(v), 0);
    bool flag = false;
    for (int i = 0; i < n; i++) {
        if ((sum - v[i]) % 10 != 0) {
            sum -= v[i];
            flag = true;
            break;
        }
    }
    if (flag) {
        cout << sum << "\n";
    } else {
        cout << "0\n";
    }
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    m = II()
    ans = ["I", "L", "M", "U"]
    nu = 0
    stack = []
    bf = int(s[0])
    for num,si in enumerate(s):
        if si == "+":
            bf += int(s[num+1])
        elif si == "*":
            bf *= int(s[num + 1])
    if bf == m:
        nu += 1
    stack = []
    bf = 0
    for num, si in enumerate(s):
        if si == "*":
            s[num + 1] = int(s[num + 1]) * int(s[num - 1])
            s[num - 1] = 0
    for si in s:
        if si != "*" and si != "+":
            bf += int(si)
    if bf == m:
        nu += 2
    print(ans[nu])    

    return

#B
def B():
    n, m = LI()
    cd = LIR(m)
    dp = [0 for i in range(n+1)]
    for c, d in cd:
        dp[c] += 1
        dp[d] -= 1
    for i in range(n):
        dp[i + 1] += dp[i]
    ans = 0
    flg = 0
    for i in range(n):
        
        if dp[i]:
            ans += 3

        elif flg:
            flg = 0
            ans += 3

        else:
            ans += 1
    
    print(ans+1)
        
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()



Measured memory_bytes: 8296
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]

Tsum = sum(T)
for i in range(M):
  sa = T[PX[i][0]-1] - PX[i][1]
  print(Tsum - sa)


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

int main() {
	int n,i,j,x=0;
	cin>>n;
	string s;
	cin>>s;
	if(n%2!=0)
	cout<<"No";
	else
	{
	j=n/2;
	for(i=0;i<n/2;i++)
	{
	    if(s[i]!=s[j])
	    {
	        x=1;
	        break;
	    }
	    j++;
	}
	if(x==1)
	cout<<"No";
	else
	cout<<"Yes";
	}
	return 0;
}

Measured memory_bytes: 256
L, R = map(int, input().split())
N = 2019

if R-L>N:
	print(0)
else:
	while L>N:
		R -= N
		L -= N
	Ans = N - 1
	for i in range(L, R):
		for j in range(i+1, R+1):
			ans = i*j%N
			Ans = min(Ans, ans)

	print(Ans)

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

int main()
{
    ll a, b;
    cin >> a >> b;
    ll mx = max(a + b, a - b);
    mx = max(mx, a * b);
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    string s;
    char c;
    cin>>n ;
    
    
    if(n%1000==0)
    cout<<0;
    else
    cout<<1000- n%1000 ;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
const   double eps = 1e-12;
const long double pi = acos(-1.0);
using namespace std;


void solve(){
    int n;
    ll x, ans = 0;
    cin >> n >> x;
    vector <ll> a(n + 2);
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 2; i <= n; i++){
        if (a[i] + a[i - 1] > x){
            ll raz = a[i] + a[i - 1] - x;
            a[i] = max(0ll, a[i] - raz);
            ans += raz;
        }
    }
    cout << ans << endl;
}       
int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(3);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int step;
    step = 1;
    //cin >> step;
    for (int i = 1; i <= step; i++){
         solve();
    }
}

Measured memory_bytes: 4000
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin>>n;
  int ans=0,ma=0;
  rep(i,n){
    int x;
    cin>>x;
    ans+=(x>=ma);
    ma=max(x,ma);
    }
  cout<<ans<<endl;

    return 0;
}


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

int main(){
  char ss[51],t[51],s[51];
  int i,flag[50]={},flag1=0,j,k;
  scanf("%s",ss);
  scanf("%s",t);
  for(i=strlen(ss)-strlen(t);i>=0;i--){
    for(j=0;j<strlen(t);j++){
      if(ss[i+j]!=t[j]&&ss[i+j]!='?'){
        break;
      }
      else if(j==strlen(t)-1){
        for(k=0;k<strlen(t);k++){
          ss[i+k]=t[k];
        }
        for(k=0;k<strlen(ss);k++){
          if(ss[k]=='?')
            ss[k]='a';
        }
        printf("%s\n",ss);
        return 0;
      }
    }
  }
   printf("UNRESTORABLE\n");
}

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

int main()
{
    int n, W;
    cin>>n>>W;
    long long int dp[W+1] = {0};
    for(int i=0; i<n; i++)
    {
        int w, v;
        cin>>w>>v;
        for(int j=W-w; j>=0; j--)
        {
            dp[j+w] = max(dp[j+w], dp[j]+v);
        }
    }
    cout<<*max_element(dp, dp+W+1);
    return 0;
}

Measured memory_bytes: 1024
input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i

arr = [a, b, c]

input = gets
k = input.to_i

max_index = arr.index(arr.max)

max = arr[max_index]
sum = max

k.times do |i|
  sum += max
  max *= 2
end

arr.delete_at(max_index)

arr.each do |i|
  sum += i
end

p sum


Measured memory_bytes: 1788
n,m = gets.split.map(&:to_i)
min = -1
max = -1
m.times do
  l,r=gets.split.map(&:to_i)
  if min == -1 && max == -1
  	min,max = l,r
  else
    min = l if min < l
  	max = r if max > r
  end
end
result = max - min + 1
puts result < 0 ? 0 : result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define mk make_pair
#define f first
#define s second

using namespace std;

const int N = 1005, mod = 1e9 + 7;

char a[N][N];
int dp[N][N];

int32_t main()
{
    ios::sync_with_stdio(false);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n,m;
    cin >> n >> m;
    for(int i = 0;i < n; ++i)
    {
        for(int j = 0;j < m; ++j)
        {
            cin >> a[i][j];
            if(a[i][j] == '#')
                dp[i][j] = -1;
        }
    }
    dp[0][0] = 1;
    for(int i = 0;i < n; ++i)
    {
        for(int j = 0;j < m; ++j)
        {
            if(a[i][j] == '#' || i == 0 && j == 0)
                continue;
            if(i == 0)
            {
                if(a[i][j-1] != '#')
                {
                    dp[i][j] += dp[i][j-1];
                }
            }
            if(j == 0)
            {
                if(a[i-1][j] != '#')
                    dp[i][j] += dp[i-1][j];
            }
            else if(i > 0 && j > 0)
            {
                if(a[i][j-1] != '#')
                    dp[i][j] += dp[i][j-1];

                if(a[i-1][j] != '#')
                    dp[i][j] += dp[i-1][j];
            }
            dp[i][j] %= mod;
        }
    }
    cout << dp[n-1][m-1];
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for(int i = 1; i < n; ++i){
    int a;
    cin >> a;
    ++v[a-1];
  }
  for(auto& i : v){
    cout << i << endl;
  }
  return 0;
}

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


class Magatro
{
    static int N, M;
    const int INF = 100000000;
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        N = int.Parse(s[0]);
        M = int.Parse(s[1]);
        int[,] Dist = new int[N, N];
        int[,] Root = new int[N, N];
        bool[,,]P= new bool[N, N, M];
        for(int i = 0; i < N; i++)
        {
            for(int j = 0; j < N; j++)
            {
                Root[i, j] = INF;
            }
        }
        for(int i = 0; i < M; i++)
        {
            string[] ss = Console.ReadLine().Split(' ');
            int a = int.Parse(ss[0]);
            int b = int.Parse(ss[1]);
            int c = int.Parse(ss[2]);
            Root[a - 1, b - 1] = c;
            Root[b - 1, a - 1] = c;
            P[a - 1, b - 1, i] = true;
            P[b - 1, a - 1, i] = true;
        }
        for (int i = 0; i < N; i++)
        {
            for (int j = i; j < N; j++)
            {
                if (i == j) Dist[i, j] = 0;
                if (Root[i, j] != INF)
                {
                    Dist[i, j] = Root[i, j];
                    Dist[j, i] = Root[i, j];
                }
                else
                {
                    Dist[i, j] = INF;
                    Dist[j, i] = INF;
                }
            }
        }
        for (int k = 0; k < N; k++)
        {
            for(int i = 0; i < N; i++)
            {
                for(int j = 0; j < N; j++)
                {
                    if (Dist[i, j] > Dist[i, k] + Dist[k, j])
                    {
                        Dist[i, j] = Dist[i, k] + Dist[k, j];
                        for(int l = 0; l < M; l++)
                        {
                            P[i, j, l] = P[i, k, l] || P[k, j, l];
                        }
                    }
                }
            }
        }
        bool[] ans = new bool[M];
        for(int i = 0; i < N; i++)
        {
            for(int j = 0; j < N; j++)
            {
                for(int k = 0; k < M; k++)
                {
                    ans[k] |= P[i, j, k];
                }

            }
        }
        int cnt = 0;
        for(int i = 0; i < M; i++)
        {
            if (!ans[i]) cnt++;
        }
        Console.WriteLine(cnt);

    }
}


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

// 参考資料：https://hiramekun.hatenablog.com/entry/2019/07/21/082628

#define N 100000
#define INF ((1<<31)-1)

multiset<int> setMaxNum;       // 色ごとに仕分けされた集合の最大値を格納

int main() {
    // 入力
    int n;
    vector<int> a;
    cin >> n;
    for (int i = 0; i < n; i++){
        int aTmp;
        cin >> aTmp;
        a.push_back(aTmp);
    }
    
    // 
    for (int i = 0; i < n; i++){
        auto itr = setMaxNum.lower_bound(a[i]);
        if (itr != setMaxNum.begin()){          // 入力値 a[i] より小さい setMaxNum がある場合、その集合と同じ色で塗れる
            setMaxNum.erase(--itr);             // 同じ色で塗られてる集合の最大値が変わるため、元の最大値を削除する
        }
        setMaxNum.insert(a[i]);
    }

    cout << setMaxNum.size() << endl;

    return 0;
}


Measured memory_bytes: 8224