akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (c >= min(a, b) && c <= max(a, b))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}



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

int main(void){
    int h,w; cin >> h >> w;
    vector<string>s(h);
    for(int i=0;i<h;i++) cin >> s[i];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int cnt=0;
            if(s[i][j]=='.'){
                if(0<=i-1 && s[i-1][j]=='#')cnt++;
                if(i+1<h && s[i+1][j]=='#')cnt++;
                if(0<=i-1 && 0<=j-1 && s[i-1][j-1]=='#')cnt++;
                if(0<=i-1 && j+1<w && s[i-1][j+1]=='#')cnt++;
                if(0<=j-1 && s[i][j-1]=='#')cnt++;
                if(j+1<w && s[i][j+1]=='#')cnt++;
                if(i+1<h && 0<=j-1 && s[i+1][j-1]=='#')cnt++;
                if(i+1<h && j+1<w && s[i+1][j+1]=='#')cnt++;
                cout << cnt;
            }else{
                cout << s[i][j];
            }
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  long A, B, C, D;
  cin >> A >> B >> C >> D;

  long long g = C/gcd(C,D)*D;

  long count1 = B/C + B/D - B/g;
  long count2 = (A-1)/C + (A-1)/D - (A-1)/g;

  output(B - A  + 1 - (count1 - count2));

  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
a = h[0]
m = 0
ans = 0
for i in range(1,n):
    if a >= h[i]:
        m += 1
    else:
        ans = max(ans,m)
        m = 0
    a = h[i]
print(max(ans,m))

Measured memory_bytes: 20600
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll N, K;
  cin >> N >> K;
  vector<long long> a(N);
  rep(i, N) cin >> a[i];
  vector<long long> data;

  /* 連続する部分列の和を全列挙 */
  for(int i = 0; i < N; i++){
    long long sum = 0;
    for(int j = i; j < N; j++){
      sum += a[j];
      data.push_back(sum);
    }
  }

  /* 最大bitの位置を計算 */
  long long bit = 1;
  while(10000000000000LL >= (2LL<<bit)){
    bit++;
  };

  
  while(bit != -1){
    /* 変数bitの位置に立っている数字をhitに代入していく */
    vector<long long> hit;
    for(auto &x : data){
      if(x&(2LL<<bit)) hit.push_back(x);
    }

    /* もしhitに代入された数がKを超えていたらdataにコピーする */
    if(K<=hit.size()){
      data.resize(hit.size());
      copy(all(hit), data.begin());
    }
    bit--;
  }

  /* 論理積を計算する */
  long long ans = LLONG_MAX;
  for(auto &x : data)if(x)ans = ans & x;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6260
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - gacha
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int MAX_L = 16;

/* typedef */

/* global variables */

string ss[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    char s[MAX_L];
    scanf("%s", s);
    ss[i] = string(s);
  }
  sort(ss, ss + n);

  int m = unique(ss, ss + n) - ss;
  printf("%d\n", m);
  return 0;
}


Measured memory_bytes: 7920
#include <stdio.h>
int main(){
    int n,m,x,y,dir,dx[4]={0,1,0,-1},dy[4]={-1,0,1,0},k;
    char c[100];
    while(1){
        scanf("%d%d",&n,&m);
        if(n==0&&m==0)return 0;
        dir=x=y=1;
        while(1){
            scanf("%s",c);
            if(c[0]=='S')break;
            else if(c[0]=='F'){
                scanf("%d",&k);
                if(x+dx[dir]*k>m)x=m;
                else if(x+dx[dir]*k<1)x=1;
                else x+=dx[dir]*k;
                if(y+dy[dir]*k>n)y=n;
                else if(y+dy[dir]*k<1)y=1;
                else y+=dy[dir]*k;
            }
            else if(c[0]=='B'){
                scanf("%d",&k);
                k=-k;
                if(x+dx[dir]*k>m)x=m;
                else if(x+dx[dir]*k<1)x=1;
                else x+=dx[dir]*k;
                if(y+dy[dir]*k>n)y=n;
                else if(y+dy[dir]*k<1)y=1;
                else y+=dy[dir]*k;
            }
            else if(c[0]=='R'){
                dir++;
                dir%=4;
            }
            else if(c[0]=='L'){
                dir+=3;
                dir%=4;
            }
        }
        printf("%d %d\n",y,x);
    }
}

Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
int n,ans,a[100005];
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; i++){
		scanf("%d",&a[i]);
	}
	ans=a[1];
	for (int i=2; i<=n; i++){
		ans^=a[i];
	}
	if (ans==0){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
		
	fast;
	string s; cin >> s;
	int start = 0 ,end = s.size()-1;
	int cnt = 0;
	
	while(start<=end){
		if(s[start]!=s[end]){
			cnt++;
		}
		start++;
		end--;
	}
	
	cout << cnt << '\n';
	return 0;
}


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

int main() {
    int a,b;
    string mark = "";
    cin >> a >> b;

    if(a < b) mark = "a < b";
    if(a > b) mark = "a > b";
    if(a == b) mark = "a == b";
    cout << mark << endl;
    return 0;
}


Measured memory_bytes: 3196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] args) throws IOException {
		// Scanner???.nextLine()??§???????°????null???????´?????????????
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String str = input.readLine();
		int[] alphabet = new int[26];
		int check;
		while(str != null) {
			str = str.toLowerCase();
			for (int i = 0; i < str.length(); i++) {
				check = Character.getNumericValue(str.charAt(i));
				if (check - 10 >= 0 && check - 10 <= 25) {
					alphabet[check - 10] += 1;
				}
			}
			str = input.readLine();
		}
		char[] ch;
		String str2;
		for (int i = 0; i < 26; i++) {
			ch = Character.toChars(i + 0x61);
			str2 = new String(ch);
			System.out.println(str2 + " : " + alphabet[i]);
		}
	}

}

Measured memory_bytes: 24032
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   string s;
   cin >> s;
   string year = s.substr(0,4);
   string month = s.substr(5,2);
   string day = s.substr(8,2);
   int i_year = stoi(year);
   int i_month = stoi(month);
   int i_day = stoi(day);
   if(i_year <= 2019){
      if(i_month <= 4){
         if(i_day <= 30){
            cout << "Heisei" << endl;
         }
         else{
            cout << "TBD" << endl;
         }
      }else{
         cout << "TBD" << endl;
      }
   }else{
      cout << "TBD" << endl;
   }

   return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    double PI=acos(-1);
    double rad=c*PI/180;
    cout<<fixed<<setprecision(5);
    cout<<a*b*sin(rad)/2<<endl<<a+b+sqrt(a*a+b*b-2*a*b*cos(rad))<<endl<<b*sin(rad)<<endl;
}


Measured memory_bytes: 3520
//
// Created by Myabu on 2020/01/24.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


int main(void){
    int N;
    cin>>N;
    
    cout<<N/3<<endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int h[] = new int[n];
        int count = 0;
        int max = 0;
        
        for(int i = 0; i < n; i++){
            h[i] = stdIn.nextInt();
        }
        
        for(int i = 0; i < n - 1; i++){
            for(int j = i; j < n - 1; j++){
                if(h[j] >= h[j + 1]){
                    count++;
                }else{
                    break;
                }
            }
            
            if(max < count){
                max = count;
            }
            i += count;
            count = 0;
        }

        
        System.out.println(max);
    }
}


Measured memory_bytes: 50400
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
    
    // INPUT 
    
    // double input seems slow on CF
    void re(double& x) { string t; cin >> t; x = stod(t); } 
    void re(ld& x) { string t; cin >> t; x = stold(t); }
    template<class T> void re(T& x) { cin >> x; }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) { 
        re(first); 
        re(rest...); 
    }
    template<class T1, class T2> istream& operator>>(istream& is, pair<T1,T2>& p) {
        is >> p.f >> p.s;
        return is;
    }
    template<class T> istream& operator>>(istream& is, vector<T>& a) {
        F0R(i,sz(a)) is >> a[i];
        return is;
    }
    
    // OUTPUT 
    
    template<class T> void pr(T& x) { cout << x; }
    template<class Arg, class... Args> void pr(Arg& first, Args&... rest) { 
        pr(first); 
        cout << ' ';
        pr(rest...); 
    }
    template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) {
        os << '{' << a.f << ", " << a.s << '}';
        return os;
    }
    template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
        os << '{';
        F0R(i,sz(a)) {
            if (i) os << ", ";
            os << a[i];
        }
        os << '}';
        return os;
    }
}

using namespace io;

int N,x;

int main() {
    setIO(); re(N,x);
    vi a(N); re(a); sort(all(a));
    int ind = 0; ll sum = 0;
    while (ind < N && sum+a[ind] <= x) sum += a[ind++];
    if (ind == N) {
        if (sum == x) cout << N;
        else cout << N-1;
    } else cout << ind;
}
/* 
* (Actually read this pls)
    * Rlly bad errors: int overflow, array bounds
    * Less bad errors: special cases (n=1?), set tle
    * Common sense: do smth instead of nothing
*/

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

int main() {

	string res = "No";

	int N; cin >> N;

	for (int i = 0; i * 4 <=  N; i++) if ((N - i * 4) % 7 == 0) res = "Yes";

	cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL rou(LL a,LL d){if((a*10/d)%10<5)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}

int main(){
  LL N,K,S,i,inf=1000000000,ans=0;
  scanf("%lld%lld%lld",&N,&K,&S);
  LL A[N];
  if(S==1000000000)inf=1;
  FOR(i,0,N){
    if(i>=K)A[i]=inf;
    else A[i]=S;
  }

  FOR(i,0,N)printf("%lld ",A[i]);
	return 0;
}


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

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

    vector<long long> A(N);
    long long sum = 0;
    long long without_one = 0;
    for (long long i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        if (i % 2 == 0)
        {
            without_one += A[i];
        }
    }
    without_one -= A.back();
    without_one *= 2;
    long long current = sum - without_one;
    vector<long long> ans(N);
    for (long long i = N - 1; i >= 0; i--)
    {
        ans[i] = current;
        if (i > 0)
        {
            current = 2 * A[i - 1] - current;
        }
    }

    for (auto a : ans)
    {
        cout << a << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>

using namespace std;

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

    int cake = 4;
    int donut = 7;

    string ans = "No";
    for (int i = 0; i <= n/cake; i++){
        for (int j = 0; j <= n/donut; j++){
            if (i*cake + j*donut == n){
                ans = "Yes";
                break;
            }
        }
    }

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

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

int main(){
	int N,K;
	cin >> N >> K;
	double ans=0.0;
	
	for(int i=1;i<=N;i++){
		double tmp=1.0;
		tmp/=(double)N;
		
		int cur=i;
		
		while(cur<K){
			cur*=2;
			tmp/=2.0;
		}
		
		ans+=tmp;
	}
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
import collections

h, w = map(int, input().split(" "))
sr, sc = map(int, input().split(" "))
er, ec = map(int, input().split(" "))

board=[['' for i in range(w)] for j in range(h)]
for i in range(h):
    s=input()
    for j in range(w):
        board[i][j]= s[j]
rs,cs=collections.deque([sr-1]),collections.deque([sc-1])
magic=[[1e6 for i in range(w)] for j in range(h)]
dr=[-1,1,0,0]
dc=[0,0,-1,1]
magic[sr-1][sc-1]=0
while len(rs)>0:
    r,c=rs.popleft(),cs.popleft()
    for i in range(4):
        nr,nc= r+dr[i],c+dc[i]
        if nr < 0 or nr >= h or nc < 0 or nc >= w or board[nr][nc] == '#':
            continue
        if magic[nr][nc]>magic[r][c]:
            magic[nr][nc]= magic[r][c]
            rs.appendleft(nr)
            cs.appendleft(nc)
    #wizard
    for nr in range(r-2,r+3):
        for nc in range(c-2,c+3):
            if nr < 0 or nr >= h or nc < 0 or nc >= w or board[nr][nc] == '#':
                continue
            if magic[nr][nc] > magic[r][c]+1:
                    magic[nr][nc] = magic[r][c]+1
                    rs.append(nr)
                    cs.append(nc)
print(magic[er-1][ec-1] if magic[er-1][ec-1]<1e6 else -1)

Measured memory_bytes: 144156
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, j, n) for (int i = j; i < (n); ++i)
#define SORT(a) sort(a.begin(), a.end())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

int main(){
    int n;
    string s1,s2;
    cin >> n;
    cin >> s1;
    cin >> s2;
    string ans = "";
    rep(i,n){
        ans +=s1[i];
        ans +=s2[i];
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    
    while(cin >> a >> b, a!=0 || b!=0){
        
        if(a <=b)cout << a << " " << b << endl;
        
        else if(b < a) cout << b << " " << a << endl;

    }







    /*if(a <= b && b <= c)cout << a << " " << b << " "<< c << endl;
    else if(b <= a && a <= c) cout << b<< " " << a<< " " << c << endl;
    else if(a <= c && c <= b) cout << a<< " " << c<< " " << b << endl;
    else if(b <= c && c <= a) cout << b<< " " << c<< " " << a << endl;
    else if(c <= b && b <= a) cout << c<< " " << b<< " " << a << endl;
    else if(c <= a && a <= b) cout << c<< " " << a << " " <<b << endl;*/
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9
#define mod 1000000007

using namespace std;
vector< ll > cache;

ll solve(ll t)
{
    if(t==0)
    {
        return 1;
    }
    else if(t<=2)
    {
        return 0;
    }
    else if(cache[t]!=-1)
        return cache[t];
    else
    {
        ll tot=0;
        for(int i=3; i<=t; i++)
        {
            tot = (tot + solve(t-i))%mod;
        }
        cache[t] = tot;
        return cache[t];
    }
}

int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    cin>>n;

    cache.resize(n+1,-1);

    cout<<solve(n)<<endl;


}


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

using namespace std;

void Main()
{
    int a, b;
    cin >> a >> b;
    int ret = -1;
    vector<int> n = {1, 2, 3};
    for (int i = 0; i < 3; ++i)
    {
        if (a != n[i] && b != n[i])
        {
            ret = n[i];
        }
    }

    cout << ret;
}

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

    std::cout << std::fixed << std::setprecision(10);

#ifdef DEBUG_BUILD
    while (true)
    {
        Main();
        cout << std::endl;
    }
#endif

    Main();
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if((a+b)>(c+d))
		cout<<"Left";
	if((a+b)==(c+d))
		cout<<"Balanced";
	if((a+b)<(c+d))
		cout<<"Right";
	return 0;		
}

Measured memory_bytes: 256
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


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

	ll n;
	cin >> n;
	bool flag = false;
	for (int i = 1; i <= 9;i++) {
		for (int j = 1; j <= 9;j++) {
			if (i * j == n) {
				flag = true;
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
(let* ((n (read))
       (q (read))
       (s (read-line))
       (ll (loop :repeat q :collect (cons (1- (read)) (1- (read)))))
       (ss (map 'vector (lambda (x) x)
                (cons 0 (loop :for k :from 1 :upto (1- n)
                              :with j = 0
                              :if (and (char= (aref s (1- k)) #\A)
                                       (char= (aref s k) #\C))
                                :do (incf j) :end
                              :collect j)))))
  (loop :for (x . y) :in ll
        :do (format t "~A~%" (- (aref ss y) (aref ss x)))))

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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int a, b, c;

signed main()
{
    cin >> a >> b >> c;

    int temp = a - b;

    if (temp >= c)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << c - temp << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define x first
#define y second
#define pb push_back
#define len(x) x.size()
#define all(x) x.begin(), x.end()

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll N, K;
	cin >> N >> K;
	int dist[N];
	int to[N];
	for (int i = 0; i < N; i++) {
		dist[i] = -1;
		cin >> to[i];
		to[i]--;
	}

	ll cycle_length;
	ll cycle_tail;
	int curr = 0;
	int d = 0;
	int cycle_start = 0;
	while (true) {
		dist[curr] = d;
		int next = to[curr];
		if (dist[next] != -1) {
			cycle_start = next;
			cycle_length = dist[curr] - dist[next] + 1;
			cycle_tail = dist[next];
			break;
		}
		curr = next;
		d++;
	}

	if (K <= cycle_tail) {
		int curr = 0;
		for (int i = 0; i < K; i++) {
			curr = to[curr];
		}
		cout << curr+1 << endl;
	} else {
		K -= cycle_tail; 	
		K %= cycle_length;
		curr = cycle_start;
		for (int i = 0; i < K; i++) {
			curr = to[curr];
		}
		cout << curr+1 << endl;
	}
}


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

int main(){
  string a,b;
  string res;
  cin >> a >> b;
  if(a.size()>b.size()){
     res="GREATER";
  }else if(a.size()<b.size()){
     res="LESS";
  }else if(a.size()==b.size()){
     res="EQUAL";
   for(int i=0;i<min(a.size(),b.size());i++){
     if(a[i]<b[i]){
      res="LESS";
       break;
     }else if(a[i]>b[i]){
      res="GREATER";
       break;
     }
   }
  }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

const int syousuu_table[7]={
	78125,156250,312500,625000,1250000,2500000,5000000
};

int main(void) {
	int Q,nowquery;
	unsigned int s;
	int fugou,seisuu,syousuu;
	int i,syousuu2;
	scanf("%d",&Q);
	for(nowquery=0;nowquery<Q;nowquery++) {
		scanf("%x",&s);
		fugou=s>>31;
		seisuu=(s>>7)&0xFFFFFF;
		syousuu=s&0x7F;
		for(i=syousuu2=0;i<7;i++) {
			if((syousuu>>i)&1)syousuu2+=syousuu_table[i];
		}
		
		if(fugou)putchar('-');
		printf("%d.",seisuu);
		if(syousuu2==0)puts("0");
		else {
			for(;syousuu2<1000000;syousuu2*=10)putchar('0');
			while(syousuu2%10==0 && syousuu2>0)syousuu2/=10;
			printf("%d\n",syousuu2);
		}
	}
	return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
vector<pii>l_list[22];
int main(){
	int l;
	scanf("%d",&l);
	int p;
	for(p=0;(1<<p)<=l;p++);
	for(int i=0;i<p-1;i++){
		l_list[i+1].pb({i+2,0});
		l_list[i+1].pb({i+2,(1<<i)});
	}
	int cnt=1<<(p-1);
	for(int i=p-2;i>=0;i--){
		if(l&(1<<i)){
			l_list[i+1].pb({p,cnt});
			cnt+=(1<<i);
		}
	}
	cnt=0;
	for(int i=1;i<=p;i++)cnt+=l_list[i].size();
	printf("%d %d\n",p,cnt);
	for(int i=1;i<=p;i++)for(auto &p:l_list[i])printf("%d %d %d\n",i,p.F,p.S);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;
int ans=0;

void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        // cout << 2 << " ";  
        ans=1;
        n = n/2;

    }  

    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i*i <= (n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        int f=0;
        while (n % i == 0)  
        {  
            // cout << i << " ";
            if(f==0){  
                f=1;
                ans++;
            }
            n = n/i;  
        }  
    }  

    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  {
        ans++;
        // cout << n << " ";  
    }
}  

int32_t main(){
    ios::sync_with_stdio(false);
    int A, B;
    cin>>A>>B;
    int C=__gcd(A,B);
    primeFactors(C);
    ans++;
    cout<<ans<<"\n";



    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int H = sc.NextInt();
        int W = sc.NextInt();
        int h = sc.NextInt();
        int w = sc.NextInt();

        if (H % h == 0 && W % w == 0)
        {
            Console.WriteLine("No");
            return;
        }

        // pppp
        // pppp
        // pppm

        int p = (1000000000 - 1) / (h * w - 1);
        int m = -(p * (h * w - 1) + 1);
        var sb = new StringBuilder();
        sb.AppendLine("Yes");
        for (int i = 0; i < H; i++)
        {
            int[] ans = new int[W];
            for (int j = 0; j < W; j++)
            {
                if (i % h == h - 1 && j % w == w - 1)
                {
                    ans[j] = m;
                }
                else
                {
                    ans[j] = p;
                }
            }

            sb.AppendLine(string.Join(" ", ans));
        }
        Console.Write(sb.ToString());
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 42196
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  string s,t,u;
  int a,b;
  cin >> s >> t >> a >> b >> u;
  if(s == u)a--;
  else if(t == u)b--;
  cout << a << " " << b << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputDataList = new ArrayList<String>();
        String input = null;

        try {
            while ((input = in.readLine()) != null) {
                inputDataList.add(input);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        for (String inputData : inputDataList) {
            String[] inputDataArray = inputData.split(" ");
            int n = Integer.parseInt(inputDataArray[0]);
            boolean[] useNum = new boolean[10];

            int answer = cntNumber(n, Integer.parseInt(inputDataArray[1]),
                    useNum, 0);

            System.out.println(answer);
        }
    }

    private static int cntNumber(int n, int s, boolean[] useNum, int cnt) {

        if (n == 1) {
            if (s < 10 && !useNum[s]) {
                return 1;
            } else {
                return 0;
            }
        }

        int answer = 0;

        // 最大値をs/nにすることで計算結果がマイナスにならないよう調整
        for (int i = 0; i <= s / n && i < 10; i++) {

            // 番号使用中ならばスキップ
            if (useNum[i]) {
                continue;
            }

            // 番号使用中に設定
            useNum[i] = true;
            answer = answer + cntNumber(n - 1, s - i * n, useNum, cnt + 1);

            // 番号未使用に設定
            useNum[i] = false;
        }

        return answer;
    }
}

Measured memory_bytes: 19052
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (ll i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (ll i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;

template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
    for (int i = 0; i < v.size(); ++i)
    {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    for (int i = 0; i < v.size() - 1; ++i)
    {
        os << v[i] << " ";
    }
    if (v.size() > 0)
    {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    REP(i, s.length()){
        s[i] += n;
        if (s[i] > 'Z'){
            s[i] -= 26;
        }
    }
    cout << s << endl;
}

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

int main() {
	string x;
	cin >> x;
	bool flag = true;
	for(int i = 0; i < x.size(); i++) {
		if((i + 1) % 2 == 1) {
			if(x[i] == 'L') {
				flag = false;
				break;
			}
		}
		else {
			if(x[i] == 'R') {
				flag = false;
				break;
			}
		}
	}
	if(flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#include <cctype>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)

#define AAA (1000000007) 


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairII;


ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll powD(ll a, ll b) {
	ll ans = 1;
	a %= AAA;
	for (int i = 0; i < b; i++)
	{
		ans *= a;
		ans %= AAA;
	}
	return ans;
}

int primeNumber(const int n) {
	//上から確認する
	for (int N = n; N >= 1; N--) {

		bool isPrime = true;
		//素数判定 i < sqrt(N)+1
		for (int i = 2; i * i <= N; i++) {
			if (N % i == 0) {
				isPrime = false;
				break;
			}
		}
		//もし素数なら
		if (isPrime) {
			return N;
		}
	}
}


int main() {
	int i, j, k;

	int N, M, K;

	cin >> N;
	vector<int> A(N);
	rep(i, 0, N) {
		cin >> A[i];
	}
	sort(A.rbegin(), A.rend());

	ll sum = 0;
	priority_queue<int> Q;
	Q.push(A[0]);

	rep(i, 1, N) {
		int a = Q.top();
		Q.pop();
		sum += a;
		Q.push(A[i]);
		Q.push(A[i]);
	}

	cout << sum;
	return 0;
}


Measured memory_bytes: 5104
N,M = [int(i) for i in input().split()]

Lmin = 0
Rmax = N
for i in range(M) :
    L,R = [int(i) for i in input().split()]
    if (Lmin < L) :
        Lmin = L
    
    if (Rmax > R) :
        Rmax = R

if (Rmax-Lmin >= 0) :
    print(Rmax-Lmin+1)
else :
    print(0)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			a[i] = sc.nextInt() - 1;
		}
		sc.close();

		int[] d = new int[4];
		d[1] = w;
		d[3] = h;
		for (int i = 0; i < n; i++) {
			if (a[i] == 0) {
				d[a[i]] = Math.max(d[a[i]], x[i]);
			} else if (a[i] == 1) {
				d[a[i]] = Math.min(d[a[i]], x[i]);
			} else if (a[i] == 2) {
				d[a[i]] = Math.max(d[a[i]], y[i]);
			} else if (a[i] == 3) {
				d[a[i]] = Math.min(d[a[i]], y[i]);
			}
		}
		System.out.println(Math.max(d[1] - d[0], 0) * Math.max(d[3] - d[2], 0));
	}
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
template <typename T>
inline void read(T &x) {
	x = 0;
	bool sign = false;
	char ch = getchar();
	while (ch < '0' || '9' < ch) {
		sign |= ch == '-';
		ch = getchar();
	}
	while ('0' <= ch && ch <='9') {
		x = (x << 3) + (x << 1) + (ch ^ 48);
		ch = getchar();
	}
	x = sign ? -x : x;
}
template <typename T>
inline void print(T x) {
	static char outp[128];
	int tot = 0;
	if (!x) {
		putchar('0');
		return;
	} else if (x < 0) {
		x = -x;
		putchar('-');
	}
	while (x) { outp[tot++] = x % 10, x /= 10; }
	while (tot) { putchar(outp[--tot] + 48); }
}
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define newline putchar('\n')
#define leave_space putchar(' ')
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
const int INF = 2e9;
const int MAXN = 2e5 + 10;
const int MAXV = (1 << 20) + 10;
int n, ary[MAXN], whe[MAXN];
struct Segment_tree {
	#define lson (root << 1)
	#define rson (root << 1 | 1)
	#define mid ((tree[root].stdl + tree[root].stdr) >> 1)
	int flag;
	struct Node {
		int val;
		int stdl, stdr;
	}	tree[MAXV];
	inline void buildtree(int root, int l, int r) {
		tree[root].stdl = l;
		tree[root].stdr = r;
		if (l == r) {
			tree[root].val = (l & 1) == flag ? ary[l] : INF;
			return;
		}
		buildtree(lson, l, mid);
		buildtree(rson, mid + 1, r);
		tree[root].val = min(tree[lson].val, tree[rson].val);
	}
	inline void build(int N, int F) {
		flag = F;
		buildtree(1, 1, N);
	}
	inline int query(int root, int l, int r) {
		if (l <= tree[root].stdl && tree[root].stdr <= r) {
			return tree[root].val;
		}
		int ret = INF;
		if (l <= mid) ret = min(ret, query(lson, l, r));
		if (r > mid) ret = min(ret, query(rson, l, r));
		return ret;
	}
}	Tree[2];
#define X fst.fst
#define Y fst.sed
#define LL sed.fst
#define RR sed.sed
#define SEG(a, b, c, d) mp(mp(a, b), mp(c, d))
typedef pair<pii, pii> seg;
priority_queue<seg, vector<seg>, greater<seg> > que;
inline seg data(int l, int r) {
	int OO = (l & 1) ^ 1;
	int L = whe[Tree[OO].query(1, l, r)];
	int R = whe[Tree[OO ^ 1].query(1, L, r)];
	return SEG(ary[L], ary[R], l, r);
}
int main() {
	read(n);
	rep (i, 1, n) {
		read(ary[i]);
		whe[ary[i]] = i;
	}
	Tree[0].build(n, 1);
	Tree[1].build(n, 0);
	int L = whe[Tree[0].query(1, 1, n)];
	int R = whe[Tree[1].query(1, L, n)];
	que.push(SEG(ary[L], ary[R], 1, n));
	while (!que.empty()) {
		seg ft = que.top();
		que.pop();
		print(ft.X);
		leave_space;
		print(ft.Y);
		leave_space;
		L = whe[ft.X];
		R = whe[ft.Y];
		if (R - L > 1) que.push(data(L + 1, R - 1));
		if (L != ft.LL) que.push(data(ft.LL, L - 1));
		if (R != ft.RR) que.push(data(R + 1, ft.RR));
	}	newline;
	return 0;
}

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

int main(){
  string S;
  cin >>S;
  if(S=="SUN")
    cout<<7<<endl;
  if(S=="MON")
    cout<<6<<endl;
  if(S=="TUE")
    cout<<5<<endl;
  if(S=="WED")
    cout<<4<<endl;
  if(S=="THU")
    cout<<3<<endl;
  if(S=="FRI")
    cout<<2<<endl;
  if(S=="SAT")
    cout<<1<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#define INFINI 100000001
int main(){
char integer[4];
scanf("%s",integer);
bool valide=false;
int i,j;
for(i=0;i<2;i++)
{
    if(integer[i]==integer[i+1]&&integer[i]==integer[i+2])
        valide=true;

}
if(valide)printf("Yes\n");
else printf("No\n");





return 0;
}


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

int main() { 
    int A, B, T;
    cin >> A >> B >> T;

    int ct = 0;
    int t = A;
    float limit = (float)T + 0.5;

    while(true) {
        if (t > limit) break;

        ct += B;
        t += A;
    }

    cout << ct << endl;
    
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 110000;
int p[N], x[N], y[N];
const int mod = 998244353;
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt",  "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    p[0] = 1;
    for (int i = 1; i <= n; i++){
        p[i] = (p[i - 1] + p[i - 1]) % mod;
    }
    for (int i = 1; i <= n; i++){
        cin >> x[i] >> y[i];
    }
    int ans = 0;
    for (int i = 1; i <= n; i++){
        for (int j = i + 1; j <= n; j++){
            int k = 0;
            for (int l = j + 1; l <= n; l++){
                if ((x[l] - x[j]) * (y[j] - y[i]) == (x[j] - x[i]) * (y[l] - y[j])) k++;
            }
            ans = (ans + p[k]) % mod;
        }
    }
    ans = (p[n] - ans + mod - n - 1 + mod) % mod;
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.HS5", "r", stdin );
	int n, r;
	while (cin >> n >> r && n && r ){
		vector <vector <P> > before (r, vector <P> (3 ) );
		vector <vector <P> > after  (r, vector <P> (3 ) );
		int cnt = 0;
		rep (i, r ){
			int p, c;
			cin >> p >> c;
			if (p == 1 ) continue;
			before[cnt][0] = P (1, p - 1 );
			before[cnt][1] = P (p, p + c - 1 );
			before[cnt][2] = P (p+c, n );
			after[cnt][0] = before[cnt][1];
			after[cnt][1] = before[cnt][0];
			after[cnt][2] = before[cnt][2];
			cnt++;
		} // end rep
		int curr = after[cnt-1][0].first;
#if DEBUG
		cout << "curr: " << curr << endl;
		rep (i, cnt ){
			rep (j, 3 ){
				cout << '(' << before[i][j].first << ',' << before[i][j].second << ')';
			} // end rep
			cout << endl;
			rep (j, 3 ){
				cout << '(' << after[i][j].first << ',' << after[i][j].second << ')';
			} // end rep
			cout << endl;
 		} // end rep
#endif
		for (int i = cnt - 2; i >= 0; i-- ){
			// ÇÌRÌ½ÔÚ©ðTõ
			int prev = 0;
			rep (j, 3 ){
				int cn = after[i][j].second - after[i][j].first + 1; // j ÌRÌJ[hÌ
#if DEBUG
				cout << "cn: " << cn << endl;
#endif
				if (prev < curr && curr <= prev + cn ){ // ±ÌRÉJ[hª é
					curr = after[i][j].first + curr - 1 - prev;
#if DEBUG
					cout << "prev: " << prev << endl;
					cout << "curr: " << curr << endl;
#endif
					break;
				} // end if
				prev += cn;
			} // end rep
		} // end for
#if DEBUG
		cout << "curr: " << curr << endl;
#endif
		int res = n - curr + 1;
		cout << res << endl;	
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0