akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int n;
int a[200005],b[200005];
int d[200005];
int main()
{
	read(n);
	for(int i=0;i<n;i++)
		read(a[i]);
	for(int i=0;i<n;i++)
		read(b[i]);
	int ans=0;
	for(int bi=0;bi<=28;bi++)
	{
		long long cnt1=0;
		long long cnt2=0;
		for(int i=0;i<n;i++)
			cnt1+=((a[i]>>bi)&1);
		for(int i=0;i<n;i++)
			cnt2+=((b[i]>>bi)&1);
		long long sum=cnt1*(n-cnt2)+cnt2*(n-cnt1);
		for(int i=0;i<n;i++)
		{
			int now=a[i]&((1<<bi)-1);
			int ned=(1<<bi)-now-1;
			int pos=upper_bound(d,d+n,ned)-d;
		//	cout<<d[0]<<' '<<d[1]<<endl;
			sum+=n-pos;
		}//cout<<sum<<endl;
		for(int i=0;i<n;i++)
			d[i]=(b[i]&((1<<(bi+1))-1));
		sort(d,d+n);
		if(sum&1)	ans|=(1<<bi);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D, N;
  cin >> D >> N;
  
  int A;
  
  if (N != 100) {
    A = N*pow(100,D);
  }
  else {
    A = 101*pow(100,D); 
  }
  
  cout << A << endl;
}
  
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> G[100010];
int D[2][100010] = {};
void dfs(int,int,int);
int main(){
    ll N; cin >> N;
    ll a[N],b[N];
    for(int i = 0; i < N - 1; i++){
        cin >> a[i] >> b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    dfs(1,0,1);
    dfs(N,1,1);
    int f=0,s=0;
    for(int i = 1; i <= N; i++){
        if(D[0][i] <= D[1][i])
            f++;
        else s++;
    }
    if(f > s) cout << "Fennec" << "\n";
    else cout << "Snuke" << "\n";
    return 0;
}
void dfs(int s,int T,int depth){
    D[T][s] = depth;
    for(auto to:G[s])
        if(D[T][to] == 0)
            dfs(to,T,depth+1);
}

Measured memory_bytes: 12800
<?php
$N = int();
for($i = 2; $i <= $N; $i++){
  $A[$i] = int();  
}
for($i = 1; $i <= $N; $i++){
  $map[$i] = 0;
  $depthArray[$i] = [];
  $depth[$i] = 0;
}
foreach($A as $i => $a){
  $map[$a]++;
}
//o($map);
$queue = [];;
for($i = 1; $i <= $N; $i++){
  if($map[$i] == 0){
      $queue[] = $i;
  }
}
for($i = 0; $i < $N-1; $i++){
    $t = $queue[$i];
    $map[$A[$t]]--;
    $depthArray[$A[$t]][] = $depth[$t];
    if($map[$A[$t]] == 0){
        rsort($depthArray[$A[$t]]);
        for($j = 0; $j < count($depthArray[$A[$t]]); $j++){
            $depthArray[$A[$t]][$j]+=$j+1;
        }
        $depth[$A[$t]] = max($depthArray[$A[$t]]);
        $queue[] = $A[$t];
    }
}
echo $depth[1];

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}


Measured memory_bytes: 63080
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int a;
	cin>>a;
	cout<<(a/2)*((a+1)/2)<<endl;
}







Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;


void solve() {
	int n, k; cin >> n >> k;
	cout << n - k + 1 << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)

#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}


inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/
int a[1234];

int main() {

  DRI(n);
  REP(i,n)RI(a[i]);

  int k = 0;
  ll mn = 1LL<<50;

  for(int i = -100; i <= 100; i++ ){
    ll sum = 0;
    REP(j,n){
       sum+= (i-a[j])*(i-a[j]);
    }
    if(sum < mn){
        mn = sum;
        k = i;
    }

  }

  cout << mn << endl;


  return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

ll modpow(ll a, ll x)
{
    ll res = 1;
    while(x > 0)
    {
        if(x & 1) res = res * a % MOD;
        a = a * a % MOD;
        x >>= 1;
    }
    return res % MOD;
}

ll modinv(ll a)
{
    return modpow(a, MOD-2);
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll fact[3000];
    fact[0] = 1;
    for(ll i = 1; i < 3000; i++)
    {
        fact[i] = fact[i-1] * i;
        fact[i] %= MOD;
    }

    ll S; cin >> S;
    ll n = S / 3;
    ll ans = 0;
    REPS(i, n)
    {
        ll x = S - i*3;
        ans += fact[x+i-1] * modinv(fact[x]) % MOD * modinv(fact[i-1]) % MOD;
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;


int main() {
    int X = 0;
    int Y = 0;
    cin >> X >> Y;
    for (int i = 0; i <= X; i++) {
        for (int j = 0; j <= X; j++) {
            if ((2 * i + 4 * j) == Y) {
                if ((i + j) == X) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }

    }

    cout << "No";
    return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define emp emplace

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 110, K = 100010, MOD = 1000 * 1000 * 1000 + 7;
int pd[2][K];
int a[N];

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", a+i);
	
	int cur = 1, prv = 0;
	for (int i = 0; i < K; i++)
		pd[0][i] = 1;
	
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j <= k; j++)
		{
			int l = max(0, j - a[i]);
			if (l)
				pd[cur][j] = (MOD + pd[prv][j] - pd[prv][l-1])%MOD;
			else
				pd[cur][j] = pd[prv][j];
			if (j)
			{
				pd[cur][j] += pd[cur][j-1];
				pd[cur][j] %= MOD;
			}
		}
		swap(prv, cur);
	}
	int ans = pd[prv][k];
	if (k) ans = (MOD + ans - pd[prv][k-1])%MOD;
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S;
	LL K;
	cin >> K;
	cin >> S;
	if (S.size() <= K)cout << S << "\n";
	else cout << S.substr(0, K) << "...\n";
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
const int INF=2e9+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<pair<int,int>> Z;
    for (int i=0;i<N;++i){
        int H,P; cin >> H >> P;
        Z.emplace_back(H+P,P);
    }
    sort(Z.begin(),Z.end());
    vector<vector<int>> dp(N+1,vector<int>(N+1,INF));
    dp[0][0]=0;
    for (int i=0;i<N;++i){
        int H=Z[i].first-Z[i].second,P=Z[i].second;
        for (int j=0;j<=N;++j){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            if (j+1<=N&&dp[i][j]<=H) dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+P);
        }
    }
    int ans=0;
    for (int j=0;j<=N;++j) if (dp[N][j]!=INF) ans=j;
    cout << ans << '\n';
}

Measured memory_bytes: 98176
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=1e5;
typedef ll fuko[yuzu|10];
int n=read();ll c;
fuko x,v,a,b,d,e;
int main(){
int i;
read(c);
for (i=1;i<=n;++i){
  read(x[i]),read(v[i]);
  } 
for (i=1;i<=n;++i){
  a[i]=a[i-1]+x[i-1]-x[i]+v[i];
  }
x[n+1]=c;
for (i=n;i;--i){
  b[i]=b[i+1]-x[i+1]+x[i]+v[i];
  }
for (i=2;i<=n;++i) a[i]=max(a[i],a[i-1]);
for (i=n-1;i;--i) b[i]=max(b[i],b[i+1]);
ll ans=0;
for (i=1;i<=n;++i){
  ans=max(ans,max(a[i],max(b[i],max(a[i]-x[i]+b[i+1],b[i]-c+x[i]+a[i-1]))));
  }
write(ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

int main() {
    int N, M; cin >> N >> M;
    ll ans = 0;
    priority_queue<int> p;
    vector<vector<int>> jobs(M+1); 
    for (int i = 0; i < N; i++) {
        int A, B; cin >> A >> B;
        if (A <= M) jobs[A].push_back(B);
    }
    for (int i = 1; i <= M; i++) {
        for (int x : jobs[i]) {
            p.push(x);
        }
        if (!p.empty()) {
            ans += p.top();
            p.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5632
import java.util.Scanner;

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

        int[] arr = new int[5];
        int min = 10;
        int minIdx = 0;
        for (int i = 0; i < 5; i++) {
            arr[i] = sc.nextInt();
            if (min > arr[i] % 10 && arr[i] % 10 != 0) {
                min = arr[i] % 10;
                minIdx = i;
            }
        }
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            if (i == minIdx) {
                sum += arr[i];
            } else {
                sum += Math.ceil(arr[i] / 10.0) * 10;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)


#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

typedef long long ll;

const ll INF = 1e9+7;

using namespace std;

int main(){
  
  ll L,R;
  cin>>L>>R;
  
  ll ans = INF;
  int nowmin = INF;
  for(ll i = L;i <= R;++i){
  	ll tmp = i % 2019; 
    if(tmp == 0){ans = 0;break;}
    
	for(ll j = i + 1;j <= R;++j){
      
      ll tmp2 = j % 2019;
      if(tmp2 == 0){ans = 0;break;}
      ans = min(ans,((tmp*tmp2) % 2019));
      if(ans == 0)break;
    }
  }

  print(ans)
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i, m, n) for (ll(i) = (ll)(m); i < (ll)(n); ++i)
#define REP2(i, m, n) for (ll(i) = (ll)(n)-1; i >= (ll)(m); --i)
#define rep(i, n) REP(i, 0, n)
#define rep2(i, n) REP2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
template <class T> inline void print(T x) { cout << x << '\n'; }
template <class T> bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// v ector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
// vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(w + 1, vector<int>(k+1, 0)));

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,a,b;
    cin >> n >> a >> b;
    ll mx = min(a,b);
    ll mn = max(max(a,b)+min(a,b)-n,0LL);
    cout << mx << ' ' << mn << endl;

    return 0;
}


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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define sz size()

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);} 
#define traceloop(x,a) { cerr<<#a<<": "; for(ll ix=0;ix<x;ix++) cerr<<a[ix]<<" "; cerr<<endl; }

int main()
{

	int i, j, k, n;

	cin>>n;
	double dp[n+1];
	memset(dp, 0, sizeof dp);
	
	dp[0] = 1;

	double ans = 0;
	for(i=1;i<=n;++i)
	{
		double temp;
		cin>>temp;
		for(j=i;j>=0;--j)
		{
			dp[j] = ( j > 0 ? dp[j-1] * temp : 0 ) + dp[j] * (1-temp);

			if(i == n and j > (n/2))
				ans = ans + dp[j];
		}
	}

	cout << fixed << setprecision(10) << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

a = list(set(s))

ans = 0
for i in range(len(a)):
    count = 0
    for j in range(n):
        if s[j] == a[i]:
            count += 1
    for j in range(m):
        if t[j] == a[i]:
            count -= 1
    if count > ans:
        ans = count
print(ans)

Measured memory_bytes: 3064
#![allow(unused_imports)]
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}
impl<T: Iterator> IteratorExt for T {}

fn main() {
    let a = read!(char);
    if 'a' <= a && a <= 'z' {
        println!("a");
    } else {
        println!("A");
    }
}



Measured memory_bytes: 2144
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int h,n,sum;
        sum=0;
        h=scan.nextInt();
        n=scan.nextInt();
        if(h%n!=0){
            sum=1;
        }
        System.out.println(h/n+sum);
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
const ll MOD = 1e9 + 7;
 
int main() {
  int N, x;
  cin >> N >> x;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  ll ans = 0;
  for (int i = 1; i < N; i++) {
    if (a[i] + a[i-1] > x) {
      int tmp = (a[i] + a[i-1]) - x;
      ans += tmp;
      a[i] = max(0, a[i] - tmp);
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll D;
  cin >> D;
  vector<ll> c(26);
  rep(i,26) cin >> c[i];
  vector<vector<ll>> s(D,vector<ll>(26));
  rep(i,D)
  {
    rep(j,26)
    {
      cin >> s[i][j];
    }
  }
  vector<int> t(D);
  rep(i,D)
  {
    ll M = 0;
    ll m = 0;
    rep(j,26)
    {
      M = max(M,s[i][j]);
      if(M!=m)
      {
        t[i] = j;
      }
      m = M;
    } 
  }
  vector<int> lastday(26);
  rep(i,26) lastday[i] = -1;
  ll satisfy = 0;
  rep(i,D)
  {
    ll dissatisfy = 0;
    satisfy += s[i][t[i]];
    lastday[t[i]] = i;
    rep(j,26)
    {
      dissatisfy += c[j] * (i-lastday[j]);
    }
    satisfy -= dissatisfy;
    cout << 17 << endl;
  }
  return 0;
}


Measured memory_bytes: 3724
<?php

(new Main)->execute();


class Rectangle
{
    private $height;
    private $width;
    private $style;

    private $rectangle = [];

    public function __construct($height, $width, $style)
    {
        $this->height = $height;
        $this->width  = $width;
        $this->style  = $style;

        $this->rectangle = $this->make();
    }

    private function make()
    {
        $rectangle = [];
        for ($height = 0; $height < $this->height; $height++) {
            $rectangle[$height] = str_repeat($this->style, $this->width);
        }
        return $rectangle;
    }

    private function setColsInnerFrame($thickness, $style)
    {
        foreach ($this->rectangle as $height => $_) {
            for ($width = 0; $width < $thickness; $width++) {
                $this->rectangle[$height][$width]                = $style;
                $this->rectangle[$height][$this->width - $width - 1] = $style;
            }
        }
    }

    private function setRowsInnerFrame($thickness, $style)
    {
        foreach ($this->rectangle as $height => $_) {
            if ($height >= $thickness) { return; }

            $this->rectangle[$height]                 = str_repeat($style, $this->width);
            $this->rectangle[$this->height - $height - 1] = str_repeat($style, $this->width);
        }
    }

    public function setInnerFrame($thickness = 1, $style = '#')
    {
        if ($thickness > $this->width) {
            $thickness = $this->width;
        }

        $this->setRowsInnerFrame($thickness, $style);
        $this->setColsInnerFrame($thickness, $style);

        return $this;
    }

    public function get()
    {
        return implode(PHP_EOL, $this->rectangle).PHP_EOL;
    }
}

class Main
{
    public function execute()
    {
        while (true) {
            list($height, $width) = $this->getStdinExplodedBy(' ');
            if ($this->invalid($height, $width)) { return; }

            $rectangle = (new Rectangle($height, $width, '.'))
                ->setInnerFrame()
                ->get();

            $this->draw($rectangle);
        }
    }

    private function getStdinExplodedBy($delimiter)
    {
        return explode($delimiter, trim(fgets(STDIN)));
    }

    private function invalid($height, $width)
    {
        return $height == 0 && $width == 0;
    }

    public function draw($shape)
    {
        echo $shape, PHP_EOL;
    }
}

Measured memory_bytes: 15464
InStr = input()
InList = InStr.split()
N = int(InList[0])
T = int(InList[1])
ccalist = []
for i in range(N):
    InStr = input()
    InList = InStr.split()
    cc = int(InList[0])
    ct = int(InList[1])
    if ct <= T:
        ccalist.append(cc)
if ccalist == []:
    print("TLE")
else:
    ccalist.sort()
    print(ccalist[0])


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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  int r, c;
  cin >> r >> c;
  int a[r+1][c+1];
  REP(i, r)REP(j, c)cin >> a[i][j];
  REP(i, r+1) a[i][c] = 0;
  REP(i, c+1) a[r][i] = 0;
  REP(i, r){
    REP(j, c){
      a[r][j] += a[i][j];
      a[i][c] += a[i][j];
      a[r][c] += a[i][j];
    }
  }
  REP(i, r+1){
    REP(j, c+1){
      cout << a[i][j];
      if(j == c) cout << endl;
      else cout << " ";
    }
  }
  return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;

vector<bool> seen;
vector<int> d;
vector<int> f;
#define pi 3.141592653589793

vector<pair<int64_t,int64_t>> soinsuu(int64_t n){
    vector<pair<int64_t,int64_t>> ret;
    for(int64_t i=2;i*i<=n;i++){
        if(n%i !=0) continue;
        int64_t ex=0;
        while(n%i ==0){
            ex++;
            n /= i; //n変更することで、それ以降の約数で割り切れることはない
        }
        ret.push_back(make_pair(i,ex));
    }
    //nが素数だった場合
    if(n!=1) ret.push_back(make_pair(n,1));
    return ret;
}

int main(int argc,char **argv){
  /*int h,w; cin>>h>>w;
  int n; cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];*/

  int64_t n,p; cin>>n>>p;
  vector<pair<int64_t,int64_t>> soi=soinsuu(p);

  int64_t ans=1;

  for(auto pp:soi){
    ans *= pow(pp.first,(pp.second/n));
  }

  cout<<ans<<endl;

  }

Measured memory_bytes: 256
N, X, Y = map(int, input().split())

ans = dict()
for k in range(1, N):
    ans[k] = 0
for i in range(1, N):
    for k in range(i+1, N+1):
        dif1 = k - i
        dif2 = abs(X-i) + 1 + abs(Y-k)
        dif = min([dif1, dif2])
        ans[dif] += 1
for k, v in ans.items():
    print(v)

Measured memory_bytes: 3572
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, K = LI()
H = LI()

dp = [mod for i in range(N)]
dp[0] = 0
for i in range(N):
    for j in range(min(K + 1, N - i)):
        # print(i, j)
        dp[i+j] = min(dp[i] + abs(H[i] - H[i + j]), dp[i+j])

print(dp[-1])

Measured memory_bytes: 82740
import java.util.*;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	private static int[] counter=new int[26];
	private static ArrayList<String> str=new ArrayList<String>();
	public static void main(String[] args){
		try{
			while(true){
				str.add(sc.next());
			}
		}catch(NoSuchElementException e){}
		for(int i=0;i<str.size();i++){
			getchar(str.get(i));
		}
		show();
	}
	private static void getchar(String s){
		for(int i=0;i<s.length();i++){
			countup(s.charAt(i));
		}
	}
	private static void countup(char c){
		if(Character.isLowerCase(c)){
			int num=c-'a';
			counter[num]++;
		}
		if(Character.isUpperCase(c)){
			char ch=Character.toLowerCase(c);
			int num=ch-'a';
			counter[num]++;
		}
	}
	private static void show(){
		for(int i=0;i<26;i++){
			System.out.println((char)(i+'a')+" : "+counter[i]);
		}
	}
}

Measured memory_bytes: 26112
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    vector<pair<int, int> > t(n);
    for(int i=0; i<n; ++i)
        cin >> t[i].second >> t[i].first;
    sort(t.begin(), t.end());

    int sum = 0;
    priority_queue<int> select;
    for(int i=0; i<n; ++i){
        select.push(t[i].second);
        sum += t[i].second;
        if(sum > t[i].first){
            sum -= select.top();
            select.pop();
        }
    }

    cout << select.size() << endl;
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  rep(i,N) cin>>A[i];
  rep(i,N) A[i]=-A[i];
  rep(i,N) B[i]=1000000010;
  rep(i,N) *upper_bound(all(B),A[i])=A[i];
  cout<<lower_bound(all(B),1000000010)-B.begin()<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n,l[100],lmax,nonum;cin>>n;
    for(int i=0;i<n;i++)
        cin>>l[i];
        
        
    for(int i=0;i<n;i++){
        if(lmax<l[i]){
        lmax=l[i];
        nonum=i;
        }
    }
    int sum=0;
    for(int i=0;i<n;i++){
        if(i==nonum)
            continue;
        sum+=l[i];
    }
    if(sum>lmax)
        cout<<"Yes";
    
    else
    cout<<"No";
    
}


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


using namespace std;

class stack
{
	public:
	int s[10000];
	int t,temp;

public:
	void initialize();
	void push(int x);
	int pop();
};

void stack::initialize()
{
	t = 0;
}

void stack::push(int x)
{
	t++;
	s[t] = x;
}

int stack::pop()
{
	temp = s[t];
	t--;
	return temp;
}



int main()
{
	stack Lake_right;
	queue<int> Lake;
	int depth = 0,A=0,i=0,last=0,n=0,k=0;
	double S=0;
	string str;


	Lake_right.initialize();

	getline(cin,str);
	n = str.length();

	while(i != n)
	{
		if (str[i] == '\\')
		{
			S += 0.5 + depth;
			depth++;

		}else if (S != 0 && str[i] == '/')
		{
			depth--;
			S += 0.5 + depth;
		}else if (S != 0 && str[i] == '_')
		{
			S += depth;
		}

		if (S != 0 && depth == 0 )
		{
			Lake.push((int)S);
			A += (int)S;
			S = 0;
			last = i;
			k++;
		}

		i++;
	}

	S = 0;
	depth = 0;

	i = n-1;

	while(i != last-1)
	{
		if (str[i] == '/')
		{
			S += 0.5 + depth;
			depth++;

		}else if (S != 0 && str[i] == '\\')
		{
			depth--;
			S += 0.5 + depth;
		}else if (S != 0 && str[i] == '_')
		{
			S += depth;
		}

		if (S != 0 && depth == 0 )
		{
			Lake_right.push((int)S);
			A += (int)S;
			S = 0;
			k++;
		}

		i--;
	}

	while(Lake_right.t != 0)
	{
		Lake.push(Lake_right.pop());
	}

	printf("%d\n", A);
	printf("%d", k);

	while(!Lake.empty())
	{
		printf(" %d", Lake.front());
		Lake.pop();
	}

	printf("\n");

	return 0;
}
	

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

int main(){
	int n; cin >>n;
    vector<long> ans(n,0);
    int tmp;
    for(int i=1;i<n;i++){
    	cin>>tmp;
        ans[tmp-1]++;
    }
    for (int i=0;i<n;i++) cout <<ans[i] <<endl;
}

Measured memory_bytes: 4844
#include <cstdio>
#include <cstring>

using namespace std;

const int MAXN = 100000;
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define abs(x) ((x) > 0 ? (x) : (-(x)))

int f[MAXN + 5], h[MAXN + 5];
int main() {
	memset(f, 0x3f, sizeof (f));
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) {
		scanf("%d", &h[i]);
	}
	f[1] = 0;
	for (int i = 1; i <= n; ++ i) {
		f[i + 1] = min(f[i] + abs(h[i + 1] - h[i]), f[i + 1]);
		f[i + 2] = min(f[i] + abs(h[i + 2] - h[i]), f[i + 2]);
	}
	printf("%d\n", f[n]);
	return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2 * n - 1) {
        cout << "No"
             << "\n";
        return 0;
    }
    if (n == 2) {
        cout << "Yes"
             << "\n";
        cout << 1 << "\n";
        cout << 2 << "\n";
        cout << 3 << "\n";
        return 0;
    }
    vi ret(2 * n - 1, 0);
    set<int> usedidx;
    set<int> usednum;
    if (x == 2 * n - 2) {
        ret[n - 1] = x;
        ret[n - 2] = x - 1;
        ret[n]     = x + 1;
        ret[n + 1] = x - 2;
        usedidx    = {n - 1, n - 2, n, n + 1};
        usednum    = {x, x - 1, x + 1, x - 2};
    } else {
        ret[n - 1] = x;
        ret[n - 2] = x + 1;
        ret[n]     = x - 1;
        ret[n + 1] = x + 2;
        usedidx    = {n - 1, n - 2, n, n + 1};
        usednum    = {x, x - 1, x + 1, x + 2};
    }
    int curr = 1;
    for (int i = 0; i < 2 * n - 1; ++i) {
        while (usednum.count(curr) == 1)
            curr++;
        if (usedidx.count(i) == 1)
            continue;
        ret[i] = curr;
        curr++;
    }
    cout << "Yes"
         << "\n";
    for (auto &r : ret) {
        cout << r << "\n";
    }
    return 0;
}

Measured memory_bytes: 2304
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    val all = modPow(10L, n)
    var ex = modSub(modAdd(modPow(9L, n), modPow(9L, n)), modPow(8L, n))
    if (ex < 0) ex += mod
    var ans = modSub(all, ex)
    if (ans < 0) ans += mod
    println(ans)
}

const val mod = 1000000007L
fun modAdd(a: Long, b:Long):Long = (a + b) % mod
fun modSub(a: Long, b:Long):Long = (a - b) % mod
fun modPow(a: Long, b:Long):Long =
    when {
        b == 0L -> 1L
        b == 1L -> a
        b % 2L == 0L -> modPow(a, b / 2L).let { (it * it) % mod }
        else -> (a * modPow(a, b - 1)) % mod
    }



Measured memory_bytes: 34568
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename H> void print(H head) { std::cout << head << std::endl; }
template <typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, M;
  std::cin >> N >> M;
  std::vector< std::pair<ll, ll> > vab(N);
  for (ll i = 0; i < N; i++) {
    std::cin >> vab[i].first >> vab[i].second;
  }

  std::vector< std::pair<ll, ll> > vcd(M);
  for (ll i = 0; i < M; i++) {
    std::cin >> vcd[i].first >> vcd[i].second;
  }

  for (ll i = 0; i < N; i++) {
    ll min_dist = INF;
    ll ans = 0LL;
    for (ll j = 0; j < M; j++) {
      ll dist = std::fabs(vab[i].first - vcd[j].first) + std::fabs(vab[i].second - vcd[j].second);
      if (dist < min_dist) {
	min_dist = dist;
	ans = j + 1;
      }
    }
    print(ans);
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;




int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    ll sz=s.size();
    map<int,int> mp;
    rep(i,sz){
        if(s[i]=='N') mp[0]++;
        else if(s[i]=='S') mp[1]++;
        else if(s[i]=='E') mp[2]++;
        else mp[3]++;
    }
    if(mp[0] ==0&&mp[1]==0&&mp[2]>0 &&mp[3]>0){
        cout<<"Yes"<<endl;
        return 0;
    }
    else if(mp[2] ==0&&mp[3]==0&&mp[0]>0 &&mp[1]>0){
        cout<<"Yes"<<endl;
        return 0;
    }
    rep(i,4){
        if(mp[i]==0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

using namespace std;

int main()
{
    std::vector<int> ans{1, 2, 3};
    int a, b;
    std::cin >> a >> b;
    ans.erase(std::remove(ans.begin(), ans.end(), a), ans.end());
    ans.erase(std::remove(ans.begin(), ans.end(), b), ans.end());
    std::cout << ans[0];
    return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    char a , b;
    cin >> a >> b;
    if (a > b) cout << ">" << endl;
    else if (a < b) cout << "<" << endl;
    else cout << "=" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
ll a[10];
signed main() {
	ll cnt = 0, inf = -1e9;
	string s;
	cin >> s;
	rep(i, 10)a[i] = 0;
	rep(i, s.size()) {
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')a[i] = 1;
	}
	rep(i, 9) {
		if (a[i] == 1 && a[i + 1] == 1)cnt++;
		else cnt = 0;
		inf = max(inf, cnt);
	}
	if (a[s.size() - 1] == 1 && inf == 0)cout << 1 << endl;
	else if (inf == 0)cout << 0 << endl;
	else cout << inf + 1 << endl;
	ggr
}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int a, b, x;
    cin >> a >> b >> x;
    if(a<=x&&a+b>=x)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp(int i,int sum);
int n,s;
int w[109],v[109];
ll memo[109][100009];

int main(){
  memset(memo,-1,sizeof(memo));
  cin>>n>>s;
  for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
  }
  cout<<dp(0,0)<<endl;
  return(0);
}

ll dp(int i,int sum){
  ll rec;
  if(memo[i][sum]!=-1)return memo[i][sum];
  if(i==n)return 0;
  rec=dp(i+1,sum);
  if(sum+w[i]<=s){
    rec=max(rec,dp(i+1,sum+w[i])+v[i]);
  }
  return memo[i][sum]=rec;
}


Measured memory_bytes: 86012
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	rep(i,n){
		int dx,dy;
		int x=0,y=0;
		int mx=0,my=0,ma=0;
		while(cin>>dx>>dy,dx||dy){
			x+=dx;
			y+=dy;
			if(x*x+y*y>ma){
				mx=x;my=y;
				ma=x*x+y*y;
			}else if(x*x+y*y==ma){
				if(mx<x){
					mx=x;my=y;
				}
			}
		}
		cout<<mx<<" "<<my<<endl;
	}
}

Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

//INT_MAX = 2^31 - 1
//LLONG_MAX = 2^63 - 1
#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

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

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

	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);

	cout << a[1]-a[0] + a[2]-a[1] << endl;

	rtn 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  int N; cin>>N;
  int L[2*N];
  FOR(i,0,2*N) cin>>L[i];
  sort(L,L+2*N);
  int ans = 0;
  FOR(i,0,2*N)
  {
    if(i%2==0) ans += L[i];
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
  double a,b;
  cin >> a >> b;
  cout << ceil((b-1)/(a-1));
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include<iomanip>
#define PI 3.14159265
using namespace std;

int main()
{
    double a,b,c,C;
    cin>>a>>b>>c;
    cout<<fixed<<setprecision(8)<<a*b*sin(c/180*PI)/2<<endl;
    cout<<fixed<<setprecision(8)<<a+b+sqrt(a*a+b*b-2*a*b*cos(c/180*PI))<<endl;
    cout<<fixed<<setprecision(8)<<b*sin(c/180*PI)<<endl;
    return 0;
}



Measured memory_bytes: 3464
a = int(input())
li = list(map(int, input().split()))

cnt = 0
for i in range(a):
#  print(li[i] ,  i + 1)
  if li[i] != i + 1:
    cnt += 1
    
if cnt == 0 or cnt == 2:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 2940