akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define f first
const ll N=1e5+5;
ll bexpo(ll x,ll n){
    if(n==0)return 1;
    else if(n%2==0)return bexpo(x*x,n/2);
    else return x*bexpo(x*x,(n-1)/2);
}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);} 
int Arr[N];
void initialize()
{
    for(int i = 0;i<N;i++)
    Arr[ i ] = i ;
}
int root(int i)
{
    while(Arr[ i ] != i)       
    {
     i = Arr[ i ];
    }
    return i;
}

void unio(int A ,int B)
{
    int root_A = root(A);       
    int root_B = root(B);  
    if(root_A<root_B)
        Arr[ root_A ] = root_B ;    
    else
        Arr[root_B]=root_A;
}
bool find(int A,int B)
{
    if( root(A)==root(B) )    
    return true;
    else
    return false;
} 
int main() {
FIO;
  ll n;
  cin>>n;
  ll a[n],b[n],c[n];
  ll i;
  for(i=0;i<n;i++)
  {
     cin>>a[i]>>b[i]>>c[i];
  }
  ll dp[n+1][3];
  dp[1][0]=a[0];
  dp[1][1]=b[0];
  dp[1][2]=c[0];
  for(i=2;i<=n;i++)
  {
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i-1];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i-1];
    dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i-1];
  }
  ll mx=max(dp[n][0],max(dp[n][1],dp[n][2]));
  cout<<mx;

}

Measured memory_bytes: 8296
n, m = map(int, input().split())
h = list(map(int, input().split()))

ans = [0]*n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] < h[b-1]:
        ans[a-1] += 1
    elif h[a-1] > h[b-1]:
        ans[b-1] += 1
    else:
        ans[a-1] += 1
        ans[b-1] += 1

print(ans.count(0))

Measured memory_bytes: 20060
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <cstdio> 
#include <iostream> 
#include <cmath> 
#include <string> 
#include <list> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <utility> 
#include <set> 
#include <map> 
#include <complex> 
#include <queue> 
#include <stack> 
#include <cstdlib> 
#include <ctime> 
#include <cstring> 
#include <string.h> 
#include <unordered_set>
#include <unordered_map>
#include <cassert>

using namespace std; 

typedef unsigned int uint; 
typedef long long int64; 
typedef unsigned long long uint64; 
typedef unsigned short ushort; 
typedef unsigned char uchar; 
typedef pair<int,int> ipair; 
typedef vector<int> VI; 
typedef vector<string> VS; 
typedef vector<double> VD; 
#define SIZE(A) ((int)(A.size()))
#define LENGTH(A) ((int)(A.length()))
#define MP(A,B) make_pair(A,B)
const double pi=acos(-1.0); 
const double eps=1e-11; 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(a) (a).begin(),(a).end()

template<class T> T sqr(const T &x) { return x*x; } 
template<class T> T lowbit(const T &x) { return (x^(x-1))&x; } 
template<class T> int countbit(const T &n) { return (n==0)?0:(1+countbit(n&(n-1))); } 
template<class T> void ckmin(T &a,const T &b) { if (b<a) a=b; } 
template<class T> void ckmax(T &a,const T &b) { if (b>a) a=b; } 

int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios_base::sync_with_stdio(false);
	int n;
	int r=0;
	int last=0;
	cin>>n;
	REP(i,n)
	{
		int d;
		cin>>d;
		--d;
		if (d==i)
		{
			if (last) last=0;
			else ++r,last=1;
		}
		else
			last=0;
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
using namespace std;
const int maxx=6400;
int h,w,dp[85][85][6405<<1],a[85][85],b[85][85],ans=1e9;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
		if(ch=='-')
			f=-1;
		ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
    }
    return x*f;
}
inline void write(int a)
{
    if(a<0)
    {
		char a='-',b='1';
		putchar(a);
		putchar(b);
    }
    else
    {
		if(a>=10)
			write(a/10);
		putchar(a%10+'0');
    }
}

int main()
{
    h=read(),w=read();
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
			a[i][j]=read();
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
			b[i][j]=read();
	dp[1][1][a[1][1]-b[1][1]+maxx]=1;
	dp[1][1][b[1][1]-a[1][1]+maxx]=1;
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
		{
			if(i>1)
			{
				for(int k=0;k<=12800;++k)
				{
					if(k+a[i][j]-b[i][j]>=0&&k+a[i][j]-b[i][j]<=12800)
						dp[i][j][k]|=dp[i-1][j][k+a[i][j]-b[i][j]];
					if(k-a[i][j]+b[i][j]>=0&&k-a[i][j]+b[i][j]<=12800)
						dp[i][j][k]|=dp[i-1][j][k-a[i][j]+b[i][j]];
				}
			}
			if(j>1)
			{
				for(int k=0;k<=12800;++k)
				{
					if(k+a[i][j]-b[i][j]>=0&&k+a[i][j]-b[i][j]<=12800)
						dp[i][j][k]|=dp[i][j-1][k+a[i][j]-b[i][j]];
					if(k-a[i][j]+b[i][j]>=0&&k-a[i][j]+b[i][j]<=12800)
						dp[i][j][k]|=dp[i][j-1][k-a[i][j]+b[i][j]];
				}
			}
		}
	for(int i=0;i<=12800;++i)
		if(dp[h][w][i])
			ans=min(ans,abs(maxx-i));
	write(ans);
    return 0;
}


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

using ll = long long;

constexpr ll B = 29LL;
constexpr ll M = 1e9+7;

class rolling_hash {
public:
    rolling_hash(std::string const& s)
        : n(s.size())
    {
        hs.assign(n+1, 0);
        p.assign(n+1, 1);
        for(int j=0; j<n; ++j) {
            hs[j+1] = (hs[j] * B + s[j]) % M;
            p[j+1] = p[j] * B % M;
        }
    }

    ll query(int l, int r) {
        return ((hs[r] - hs[l]*p[r-l]) % M + M) % M;
    }

private:
    int n;
    std::vector<ll> hs;
    std::vector<ll> p;
};


int main() {
    int n, m;
    while(cin >> n >> m, n) {
        vector<string> e(n);
        for(int i = 0; i < n; ++i) {
            cin >> e[i];
        }
        string s;
        for(int i = 0; i < m; ++i) {
            string t;
            cin >> t;
            s += t;
        }

        vector<ll> e_hash(n);
        for(int i = 0; i < n; ++i) {
            ll hs = 0;
            for(int j = 0; j < e[i].size(); ++j) {
                hs = (hs * B + e[i][j]) % M;
            }
            e_hash[i] = hs;
        }
        rolling_hash rh(s);
        int length = s.size();

        vector<vector<char>> dp(length + 1, vector<char>(1 << n));
        for(int i = 0; i <= length; ++i) {
            dp[i][0] = true;
        }
        for(int i = 0; i < length; ++i) {
            for(int S = 0; S < (1 << n); ++S) {
                if(!dp[i][S]) {
                    continue;
                }
                for(int j = 0; j < n; ++j) {
                    if((S >> j) & 1) {
                        continue;
                    }
                    if(i + e[j].size() > length) {
                        continue;
                    }
                    dp[i + e[j].size()][S | (1 << j)] |= rh.query(i, i + e[j].size()) == e_hash[j];
                }
            }
        }
        int res = 0;
        for(int i = 0; i <= length; ++i) {
            res += dp[i][(1 << n) - 1];
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 23232
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[200000];
int main(){
  int i;
  int k = 1;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(i=(0);i<(N);i++){
    if(A[i]==k){
      k++;
    }
  }
  if(k==1){
    wt_L(-1);
    wt_L('\n');
  }
  else{
    wt_L(N-k+1);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// int N, A[2d5];
// {
//   int k = 1;
//   rd(N,A(N));
//   rep(i,N) if(A[i]==k) k++;
//   wt(if[k==1, -1, N-k+1]);
// }


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String h = scan.nextLine();
    boolean f = true;

    for(int i = 0; i < h.length(); i++){
      char s = h.charAt(i);
      if(i % 2 == 0){
        if(s == 'R' || s == 'U' || s == 'D'){
        }else{
          f = false;
        }

      } else {
        if(s == 'L' || s == 'U' || s == 'D'){
        }else{
          f = false;
        }
      }

      if(!f){
        System.out.println("No");
        return;
      }
    }

    System.out.println("Yes");
  }
}


Measured memory_bytes: 21844
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            pass System Test!
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) {
  if (!v.empty()) {
    out << '[';
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}

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

  int N, M;
  cin >> N >> M;
  set<int> a;
  for (int i = 0; i < M; ++i) {
    int b;
    cin >> b;
    b--;
    a.insert(b);
  }

  int ma = 0;
  for (int i = 0; i < N; ++i) {
    if (i >= *(a.rbegin())) {
      ma = max(ma, i - *(a.rbegin()));
      continue;
    }

    auto it = a.lower_bound(i);
    int mi = N;
    mi = min(mi, *it - i);
    if (it != a.begin()) {
      it--;
      mi = min(mi, i - *it);
    }
    // cerr << mi << endl;
    ma = max(ma, mi);
  }
  cout << ma << endl;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
 
const ll MOD=1e9+7;
const ll INF=1e18;
 
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int moto[10][12][2];

int main(){
    int n,moto_m;
    while(true){
        cin >> n;
        if(n == 0)break;
        cin >> moto_m;
        for(int i = 0;i < moto_m;i++){ // 0
            cin >> moto[0][i][0] >> moto[0][i][1];
        }
        for(int i = 1;i < moto_m;i++){
            moto[0][i][0] -= moto[0][0][0];
            moto[0][i][1] -= moto[0][0][1];
        }
        moto[0][0][0] = 0; moto[0][0][1] = 0;
        for(int i = 0;i < moto_m;i++){ // 1
            moto[1][i][0] = moto[0][i][1];
            moto[1][i][1] = -moto[0][i][0];
        }
        for(int i = 0;i < moto_m;i++){ // 2
            moto[2][i][0] = -moto[0][i][0];
            moto[2][i][1] = -moto[0][i][1];
        }
        for(int i = 0;i < moto_m;i++){ // 3
            moto[3][i][0] = -moto[0][i][1];
            moto[3][i][1] = moto[0][i][0];
        }
        for(int i = 0;i < moto_m;i++){ // 4
            moto[4][i][0] = moto[0][moto_m-i-1][0] - moto[0][moto_m-1][0];
            moto[4][i][1] = moto[0][moto_m-i-1][1] - moto[0][moto_m-1][1];
        }
        for(int i = 0;i < moto_m;i++){ // 5
            moto[5][i][0] = moto[4][i][1];
            moto[5][i][1] = -moto[4][i][0];
        }
        for(int i = 0;i < moto_m;i++){ // 6
            moto[6][i][0] = -moto[4][i][0];
            moto[6][i][1] = -moto[4][i][1];
        }
        for(int i = 0;i < moto_m;i++){ // 7
            moto[7][i][0] = -moto[4][i][1];
            moto[7][i][1] = moto[4][i][0];
        }
        for(int ii = 1;ii <= n;ii++){
            int m,line[12][2];
            cin >> m;
            for(int i = 0;i < m;i++) cin >> line[i][0] >> line[i][1];
            for(int i = 1;i < m;i++){
                line[i][0] -= line[0][0];
                line[i][1] -= line[0][1];
            }
            line[0][0] = 0; line[0][1] = 0;
            if(moto_m != m) continue;
            for(int k = 0;k < 8;k++){
                if(line[m-1][0] != moto[k][m-1][0] || line[m-1][1] != moto[k][m-1][1]) continue;
                int flag = 0;
                for(int i = 0;i < m;i++){
                    if(line[i][0] != moto[k][i][0] || line[i][1] != moto[k][i][1]){
                        flag = 1;
                        break;
                    }
                }
                if(flag == 0){
                    cout << ii << endl;
                    break;
                }
            }
        }
        cout << "+++++" << endl;

    }
}


Measured memory_bytes: 3008
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    ll x;cin>>x;
    ll n=1001;
    rep(i,n){
        rep(j,n){
            if(pow(i,5)-pow(j,5)==x) {print2(i,j);return;}
            if(pow(-i,5)-pow(j,5)==x) {print2(-i,j);return;}
            if(pow(-i,5)-pow(-j,5)==x) {print2(-i,-j);return;}
            if(pow(i,5)-pow(-j,5)==x) {print2(i,-j);return;}
        }
    }
    cout<<-x;
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 4060
import java.util.*;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		double s =  (Math.log(h)/Math.log(2));
		//System.out.println((long)s);
		if(h==1) {
			System.out.println(h);
		}
		else {
			int n = (int)s;
			long h1 = 2*(power(2,n)-1);
			System.out.println(h1+1);
			
		}
		
	}
	static long power(int x, int y) 
    { 
        if (y == 0) 
            return 1; 
        else if (y % 2 == 0) 
            return power(x, y / 2) * power(x, y / 2); 
        else
            return x * power(x, y / 2) * power(x, y / 2); 
    } 

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

string S, T;

int main () {
  cin >> S >> T;

  vector<string> cands;

  for(int i = 0; i < S.size(); i++) {
    string s = string(S);
    int j;
    for(j = 0; j < T.size() && i + j < S.size(); j++) {
      if(S[i+j] != '?' && S[i+j] != T[j]) break;
      s[i+j] = T[j];
    }
    if(j == T.size()) {
      for(int k = 0; k < S.size(); k++) {
        if(s[k] == '?') s[k] = 'a';
      }
      cands.push_back(s);
    }
  }
  sort(all(cands));

  cout << (cands.size() == 0 ? "UNRESTORABLE" : cands[0]) << endl;

  return 0;
}


Measured memory_bytes: 256
x[]={1,0,0};main(t){char a,b;for(;~scanf(" %c,%c",&a,&b);x[b]=t)a-=65,b-=65,t=x[a],x[a]=x[b];for(t=0;t<3;t++)x[t]&&printf("%c\n",65+t);exit(0);      }

Measured memory_bytes: 0
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

#[doc = " [l, r)"]
pub fn binary_search_by<F>(mut l: usize, mut r: usize, f: &F) -> usize
where
    F: Fn(usize) -> bool,
{
    assert!(l <= r);
    while r != l {
        let m = l + (r - l) / 2;
        if f(m) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    r
}


fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      aa: [u64; n],
    }

    let mut q = vec![];
    for a in aa {
        let idx = binary_search_by(0, q.len(), &|mid| q[mid] < a);
        if idx == q.len() {
            q.push(a);
        } else {
            q[idx] = a;
        }
    }
    puts!("{}\n", q.len());
}


Measured memory_bytes: 6396
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		if(a>8||b>8) {
			System.out.println(":(");
		}
		else {
			System.out.println("Yay!");
		}
	}
}

Measured memory_bytes: 22608
import std.stdio;
import std.string;

void main()
{
    string S = readln.chomp;

    ulong len = S.length;
    ulong ans = 0;
    foreach (i; 0..len){
        if (S[i] != '0' + (i % 2)) ans++;
    }

    if ((len - ans) < ans) ans = len - ans;

    writeln(ans);
}



Measured memory_bytes: 2556
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
if((a==b && c==d) || (a==c && b==d) || (a==d && b==c))cout<<"yes"<<endl;
 else cout<<"no"<<endl;
return 0;
}



Measured memory_bytes: 3100
#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 >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll mod = 1000000007;

void solve()
{
	int n; cin >> n;
	vector<ll> a(n),d(n-1);
	rep(i, n) cin >> a[i];
	rep(i,n-1)d[i] = a[i+1]-a[i];	
	int ans = 1;
	ll last = d[0];
	rep(i, n-1)
	{
		if(d[i])
		{
			if(last * d[i] < 0)
			{
				ans++;
				i++;
				last = (i < n-1)?d[i]:0;
			}
			else last = d[i];
		}
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long x = sc.nextLong();
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		Arrays.sort(arr);
		long sum = 0;
		int count = 0;
		for (int i = 0; i < n; i++) {
			sum += arr[i];
			if (sum <= x) {
				count++;
			}
			if (sum >= x) {
				break;
			}
		}
		if (sum < x) {
			count--;
		}
		System.out.println(count);
	}
}


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

int main()
{
  int K, S;
  cin >> K >> S;
  int ans = 0;
  rep(i, K + 1)
  {
    rep(j, K + 1)
    {
      if (i + j > S)
      {
        break;
      }
      if (S - i - j <= K)
      {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

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

#define N 4000000

void buildmaxheap(int *);
void maxHeapify(int *,int);

int left(int);
int right(int);
int n;

int main(){
    int i;
    int A[N];
    
    scanf("%d",&n);
    
    for(i = 1;i <= n;i++){
        scanf("%d",&A[i]);
    }
    
    buildmaxheap(A);
    
    for(i = 1;i <= n;i++){
        printf(" %d",A[i]);
    }
    
    printf("\n");
    
    return 0;
}

void buildmaxheap(int *A){
    int i;
    
    for(i = n / 2;i >= 1;i--){
        maxHeapify(A,i);
    }
}

void maxHeapify(int *A,int i){
    int l,r,temp,largest;
    
    l = left(i);
    r = right(i);
    
    if((l <= n) && (A[l] > A[i])){
        largest = l;
    }
    else{
        largest = i;
    }
    if((r <= n) && (A[r] > A[largest])){
        largest = r;
    }
    
    if(largest != i){
        temp = A[i];
        A[i] = A[largest];
        A[largest] = temp;
        maxHeapify(A,largest);
    }
}

int left(int id){
    int lid;
    
    lid = 2 * id;
    
    return lid;
}

int right(int id){
    int rid;
    
    rid = 2 * id + 1;
    
    return rid;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=1e5+3;
int a[N];
int main()
{
    ft
    int i,j,n,k,m=INT_MAX;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0,j=k-1;j<n;i++,j++)
    {
        m=min(m,(a[j]-a[i]));
    }
    cout<<m<<"\n";
    return 0;
}



Measured memory_bytes: 640
//j
#include <stdio.h>

int main ()
{
	int step= 0;
	int a, b, c; 
	
	scanf ("%d %d %d", &a, &b, &c);
	
	if (a<b)
	{
	for (int i=1; i <= a; i++)
		{
			if (b*i >= c)
			{
			printf ("%d", i);
			return 0;
			}
		}
	}
	
	if (b<a)
	{
	for (int j=1; j <= b; j++)
		{
			if (a*j >= c)
			{
			printf ("%d", j);
			return 0;
			}
		}
	}
	
	if (b=a)
	{
	for (int k=1; k <= b; k++)
		{
			if (a*k >= c)
			{
			printf ("%d",k);
			return 0;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1716
#include <bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	ll x; cin >> x;
	ll ans = 1000 * (x/500);
	x %= 500;
	ans += 5*(x/5);
	cout << ans;
}

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

using namespace std;

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

	int coverArea = 2 * d + 1;
	int answer = 0;

	if (n % coverArea == 0)
		answer = (n / coverArea);
	else
		answer = (n / coverArea) + 1;

	cout << answer;

	return 0;
}


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

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

const ll mod =  1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976

int main()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    int r = 0, l = 0;
    vector<int> v;
    rep(i,n){
        if(s[i] == 'R'){
            r++;
            if(i == n-1){
                v.push_back(r);
            }
            if(s[i+1] == 'L'){
                v.push_back(r);
                r = 0;
            }
        }else{
            l++;
            if(i == n -1){
                v.push_back(l);
            }
            if(s[i+1] == 'R'){
                v.push_back(l);
                l = 0;
            }
        }
    }
    if(2 * k + 1 >= v.size()){
        cout << n-1 << endl;
    }else{
        int len = 2*k + 1;
        int in[v.size() - len + 1];
        int out[v.size() - len + 1];
        rep(i,v.size() - len + 1){
            in[i] = 0;
            out[i] = 0;
        }
      
      
        rep(i,v.size() - len){
            out[0] += (v[len+i] - 1);
        }
        rep(i,len){
            in[0] += v[i];
        }
        rep(i,v.size()-len){
            out[i+1] = out[0];
            in[i+1] = in[0];
        }
      
        rep(i,v.size() - len){
            out[i+1] += (v[i]-1);
            out[i+1] -= (v[len+i]-1);
        }
        rep(i,v.size() - len){
            in[i+1] -= v[i];
            in[i+1] += v[len+i];
        }

        int ans = 0;
        rep(i,v.size() - len+1){
            ans = max(ans,in[i]+out[i]-1);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 1656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long[] X = new long[N];
        for (int i = 0; i < N; i++) {
            X[i] = scanner.nextInt();
        }
        long ans = 0;
        for (int i = 0; i < N - 1; i++) {
            if (A * (X[i + 1] - X[i]) < B) {
                ans += A * (X[i + 1] - X[i]);
            } else {
                ans += B;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 50620
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;
int main(void){
    int R[MAX],n;
    cin >> n;
    for(int i=0;i<n;i++)cin >> R[i];
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1;i<n;i++){
        maxv = max(maxv,R[i]-minv);
        minv = min(minv,R[i]);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3884
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0&&c>0){
		c-=b;
		if(c<=0){
			cout<<"Yes";
			return 0;
		}
		a-=d;
		if(a<=0){
			cout<<"No";
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(x) cout << fixed << setprecision(x);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll n,p; cin >> n >> p; ll gcdmax = (pow(p,1.0/n)/1) + 1;
  ll ans = 1;
  
  for(ll i=gcdmax; i > 1; i--){
    if((p % ll(pow(i,n))) == 0){
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;
}

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

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

using namespace std;

int main(){
	map<string,int> f;
	int n; cin>>n;
	rep(i,n){ string s; cin>>s; ++f[s]; }
	int m; cin>>m;
	rep(i,m){ string s; cin>>s; --f[s]; }

	int ans=0;
	for(auto x:f) ans=max(ans,x.second);
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  string s;
  cin >> s;
  string s1 = s.substr(0, 2);
  string s2 = s.substr(2, 2);
  int former = stoi(s1);
  int latter = stoi(s2);
//   cout << former << latter << endl;
  
  string ans;
  if ((former >= 13 && latter >= 13) ||
      (former == 0 && latter == 0) ||
      (former == 0 && latter >= 13) ||
      (former >= 13 && latter == 0))
  {
      /* code */
      ans = "NA";
  }
  else if (former <= 12 && former >= 1 &&
           latter >= 1 && latter <= 12)
  {
      /* code */
      ans = "AMBIGUOUS";
  }
  else if ((former <= 12 && latter >= 13)||
           (former <= 12 && latter == 0))
  {
      /* code */
      ans = "MMYY";
  }
  else if ((former >= 13 && latter <= 12) ||
           (former == 0 && latter <= 12))
  {
      /* code */
      ans = "YYMM";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
const int mod = 1000000007;
ll RepeatSquaring(ll N, ll P, ll M)
{
	if (P == 0)	return 1;
	if (P % 2 == 0) {
		ll t = RepeatSquaring(N, P/2, M);
		return t * t % M;
	}
	return (N * RepeatSquaring(N, P - 1, M)) % M;
}
int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	long long ans = RepeatSquaring(2, n, mod);
	ans--;

	long long anum;
	long long x, y, yy;
	x = y = 1;
	for (int i = 0; i < a; i++) {
		x = x * (ll(n) - ll(i));
		x %= mod;
		y = y * (ll(a) - ll(i));
		y %= mod;
	}
	yy = RepeatSquaring(y, mod - 2, mod);
	yy %= mod;
	anum = (x * yy) % mod;

	long long bnum;
	x = y = 1;
	for (int i = 0; i < b; i++) {
		x = x * (ll(n) - ll(i));
		x %= mod;
		y = y * (ll(b) - ll(i));
		y %= mod;
	}
	yy = RepeatSquaring(y, mod - 2, mod);
	yy %= mod;
	bnum = (ll(x) * ll(yy));
	bnum %= mod;
	
	ans -= anum;
	if (ans < 0)	ans += mod;
	ans -= bnum;
	if (ans < 0)	ans += mod;
	
	cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

n, m = map(int, input().split())
a = list(map(int, input().split()))

d = defaultdict(int)
def cumsum(a):
    r = [0]
    for v in a:
        r.append(r[-1] + v)
    return r

ans = 0
c_sum = cumsum(a)
for v in c_sum:
    ans += d[(m + (v % m)) % m]
    d[v%m] += 1
print(ans)

Measured memory_bytes: 18220
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n,m;
int a[505][505];
vector<pair<pair<int,int>,pair<int,int> > >ans; 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0); 
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(i==n&&j==m)break;
			if(a[i][j]&1){
				if(j==m){
					ans.push_back(make_pair(make_pair(i,j),make_pair(i+1,j)));
					a[i][j]--;a[i+1][j]++; 
				}else{
					ans.push_back(make_pair(make_pair(i,j),make_pair(i,j+1)));
					a[i][j]--;a[i][j+1]++;
				}
			}
		}
	}
	cout<<ans.size()<<endl;
	for(auto p:ans){
		cout<<p.first.first<<" "<<p.first.second<<" "<<p.second.first<<" "<<p.second.second<<endl;
	}
	return 0;
}

Measured memory_bytes: 5232
{-# LANGUAGE OverloadedStrings #-} 
import Data.Text.Lazy as T
import Data.Text.Lazy.IO as TIO
import Data.Monoid
import Data.List

main = do
  input <- TIO.getContents
  let ls = T.lines input 
      n = ls !! 0
      l :: [Int]
      l =   fmap ( read .T.unpack) $ T.words $ ls !! 1      
      (s0,s2,s4) = Prelude.foldl f (0,0,0) l
        where f  (s0,s2,s4) a  | (a `mod` 4) == 0 = (s0, s2, s4 + 1)
                               | (a `mod` 2 ) == 0 =  (s0, s2 + 1, s4)
                               | otherwise =  (s0 + 1, s2 , s4)
      getR (s0,s2,s4) | (s0<=s4) || ( s0 == s4+1 && s2 == 0 ) = "Yes"  
                      | otherwise = "No"
  Prelude.putStr $  getR (s0,s2,s4)


Measured memory_bytes: 7804
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a;
	cin >> n >> a;
	int x[n + 1];
	for (int i = 1; i <= n; i++)
	{
		cin >> x[i];
	}
	ll dp[n + 1][2501][n + 1];
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= 2500; j++)
		{
			for (int num = 0; num <= n; num++)
			{
				dp[i][j][num] = 0;
			}
		}
	}
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= 2500; j++)
		{
			for (int num = 0; num < n; num++)
			{
				dp[i][j][num] += dp[i - 1][j][num];
				if (j + x[i] <= 2500)
				{
					dp[i][j + x[i]][num + 1] += dp[i - 1][j][num];
				}
			}
		}
	}
	ll ans = 0;
	for (int j = 1; j <= 2500; j++)
	{
		if (j % a == 0 && j / a <= n)
		{
			ans += dp[n][j][j / a];
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;



int main() {
	speed;
	cout << fixed << setprecision(6);
	/*start*/
	int n;
	cin >> n;
	vector<int>d(n);
	rep(i, n) {
		cin >> d[i];
	}
	int sum = 0;
	rep(i, n) {
		ffor(j, i+1, n) {
			sum += d[i] * d[j];
		}
	}
	c(sum);
	ed;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x,y,z;
    cin >> x >> y >> z;
    vector<vector<int> > A(x,vector<int>(y));
    vector<vector<int> > B(y,vector<int>(z));
    vector<vector<int64_t> > C(x,vector<int64_t>(z,0));
    for(int i = 0; i < x; i++) {
        for(int j = 0; j < y; j++) {
            cin >> A.at(i).at(j);
        }
    }
    for(int i = 0; i < y; i++) {
        for(int j = 0; j < z; j++) {
            cin >> B.at(i).at(j);
        }
    }
    for(int i = 0; i < x; i++) {
        for(int j = 0; j < z; j++) {
            for(int k = 0; k < y; k++) {
                C.at(i).at(j) += A.at(i).at(k) * B.at(k).at(j);
            }
            if(j == z-1) {
                cout << C.at(i).at(j) << endl;
            }
            else {
                cout << C.at(i).at(j) << " ";
            }
        }
    }
}


Measured memory_bytes: 3292
fn main(){
    let mut b = String::new();
    std::io::stdin().read_line(&mut b).unwrap();
    //println!("{}", b.chars().count());

    let buf : i32 = b.trim().parse::<i32>().unwrap();
    if buf == 25 {
        println!("Christmas\n");

    }
    else if buf == 24{
        println!("Christmas Eve\n");    
    }
    else if buf == 23{
        println!("Christmas Eve Eve\n");
    }
    else if buf == 22{
        println!("Christmas Eve Eve Eve\n");
    }
}

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



class LazySegmentTreeRSQ{
private:
    std::vector<long long> node, lazy;
    int size;
public:
    LazySegmentTreeRSQ(int n){
        init(n);
    }
    void init(int n){
        size = 1;
        while(size < n)size *= 2;
        lazy = std::vector<long long>(2 * size - 1, 0);
        node = std::vector<long long>(2 * size - 1, 0);
    }
    void eval(int k, int l, int r){
        node[k] += lazy[k];

        if(r - l >= 2){
            lazy[2 * k + 1] += lazy[k] / 2;
            lazy[2 * k + 2] += lazy[k] / 2;
        }

        lazy[k] = 0;
    }
    void add(int a, int b, long long x, int k = 0, int l = 0, int r = -1){
        if(r < 0)r = size;

        eval(k, l, r);

        if(r <= a || b <= l)return;
        
        if(a <= l && r <= b){
            lazy[k] += x * (r - l);
            eval(k, l, r);
        }else{
            add(a, b, x, 2 * k + 1, l, (l + r) / 2);
            add(a, b, x, 2 * k + 2, (l + r) / 2, r);
            node[k] = node[2 * k + 1] + node[2 * k + 2];
        }
    }
    long long query(int a, int b, int k = 0, int l = 0, int r = -1){
        if(r < 0)r = size;
        if(r <= a || b <= l)return 0;

        eval(k, l, r);

        if(a <= l && r <= b){
            return node[k];
        }else{
            long long result_left = query(a, b, 2 * k + 1, l, (l + r) / 2);
            long long result_right = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return result_left + result_right;
        }
    }
};

int main(){
    int n,q;std::cin >>  n >> q;
    LazySegmentTreeRSQ Seg(n);
    while(q--){
        int a;std::cin >> a;
        if(a == 0){
            int s,t,x;
            std::cin >> s >> t >> x;
            Seg.add(s - 1, t, x);
        }else{
            int s,t;
            std::cin >> s >> t;
            std::cout<<Seg.query(s - 1, t)<<std::endl;;
        }
    }
}


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

using namespace std;

#define int long long
#define tie() ios_base :: sync_with_stdio(0); cin.tie(0) ; cout.tie(0)
#define err(x) cerr << #x << " is : " << x << endl
#define mem(a , v)   memset(a , v , sizeof a)
#define all(v) v.begin() , v.end()

const int N = 1e5 + 20;
const int mod = 1e9 + 7;

int32_t main()
{
      tie();
      int t = 1;
      //cin >> t;
      while(t--)
      {
            int n , m;
            cin >> n >> m;
            int a[n], sum = 0;
            for(int i = 0 ; i < n ; i++)
            {
                  cin >> a[i];
                  sum += a[i];
            }

            double mn = (double)sum / (4*m);
            for(int i = 0 ; i < n ; i++)
            {
                  if(a[i] >= mn)
                        m--;
            }


            cout << ((m <= 0) ? "Yes" : "No") << endl;
      }
      return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int a = scan.nextInt();
        int b = scan.nextInt();
        double x = (double) (a+b) / 2;
        System.out.println((int) Math.ceil(x));
    }
}


Measured memory_bytes: 21844
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
 return rt;
}
int lb(int l,int r,int n,int *d){
  int m=(l+r)/2;
  if(l==r)return m;
  return n<=d[m]?lb(l,m,n,d):lb(m+1,r,n,d);
}
int main(){
  int a[3][100010],n,i,j;
  long long d[3][100010],s=0,b[3][100010]={};
  scanf("%d",&n);
  for(i=0;i<3;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a[i][j]);
      hin(a[i][j]);
    }
    for(j=0;j<n;j++)a[i][j]=N[hout()];
    //for(j=0;j<n;j++)printf("%d ",a[i][j]);printf("\n");
    R=C=1;
  }
  for(i=1;i<3;i++){
    for(j=0;j<n;j++)d[i][j]=lb(0,n,a[i][j],a[i-1]);
    for(j=0;j<n;j++){
      b[i][j]+=d[i][j];
      b[i][j+1]+=b[i][j];
    }
    // for(j=0;j<n;j++)printf("!%lld\n",b[i][j]);
    //for(j=0;j<n;j++)printf("%lld ",d[i][j]);printf("\n");
  }
  for(i=s=0;i<n;i++)s+=b[1][d[2][i]-1];
  printf("%lld\n",s);
  return 0;
}


Measured memory_bytes: 10496
def main():
    from collections import defaultdict
    from collections import deque
    import sys
    input = sys.stdin.readline
    dd = defaultdict(list)
    pq = defaultdict(int)

    N, Q = map(int, input().split())

    for _ in range(N-1):
        a,b = map(int, input().split())
        dd[a].append(b)
        dd[b].append(a)

    for _ in range(Q):
        p,q = map(int, input().split())
        pq[p] += q
    
    answer = [0]*N
    queue = deque()
    visited = {}
    visited[1] = 1
    queue.append(1)

    while queue != deque():
        tmp = queue.popleft()
        answer[tmp-1] += pq[tmp]
        for i in dd[tmp]:
            if not i in visited:
                visited[i] = 1
                queue.append(i)
                answer[i-1] += answer[tmp-1]
            
    print(*answer)

if __name__ == '__main__':
    main()

Measured memory_bytes: 130372
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back 
 
using LL = long long int;
using VL = vector<LL>;
using VI = vector<int>;
using VVL = vector<VL>;
using PLL = pair<LL,LL>;
using PII = pair<int ,int>;
 
#ifdef DEBUG
void _print()
{
  cout << endl;
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
  cout << first_elem << " ";
  _print(args...);
}
#else
void _print()
{
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
}
#endif
 
 
// NOTE: Please dont implement _print() as function in your program. It is reserved
// for debug purpose.

int main()
{
    ios::sync_with_stdio(false);
    LL n;
    cin >> n;
    LL a[n][2];
    bool ans = false;
    for (int i = 0; i < n; i++) {
        cin >> a[i][0] >> a[i][1];
    }
    for (int i = 0; i < n && ans == false; i++) {
        if (i >= 2) {
            ans = true;
            for (int j = 0; j <= 2; j++) {
                if (a[i - j][0] != a[i - j][1]) {
                    ans = false;
                }
            }
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

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

const long long MOD = 1000000007;

int main(){
  int a,p;
  cin>>a>>p;
  cout<<(a*3+p)/2<<endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def is_bipartite(graph, s):
    """二部グラフ判定する"""
    n = len(graph)
    col = [-1] * n
    col[s] = 0
    stack = [s]
    used[s] = True
    while stack:
        v = stack.pop()
        for nxt_v in graph[v]:
            used[nxt_v] = True
            if col[nxt_v] == -1:
                col[nxt_v] = col[v] ^ 1
                stack.append(nxt_v)
            elif col[nxt_v] ^ col[v] == 0:
                return False
    return True

def color_bipartite(graph, s):
    """二部グラフを彩色する"""
    n = len(graph)
    col = [-1] * n
    col[s] = 0
    stack = [s]
    while stack:
        v = stack.pop()
        for nxt_v in graph[v]:
            if col[nxt_v] == -1:
                col[nxt_v] = col[v] ^ 1
                stack.append(nxt_v)
    return col


n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]

graph = [set() for i in range(n)]
for a, b in info:
    a -= 1
    b -= 1
    graph[a].add(b)
    graph[b].add(a)

comp_graph = [[] for i in range(n)]
for a in range(n):
    for b in range(n):
        if b in graph[a] or a == b:
            continue
        comp_graph[a].append(b)
        

cnt0 = []
cnt1 = []
used = [False] * n
for i in range(n):
    if used[i]:
        continue
    used[i] = True
    if not is_bipartite(comp_graph, i):
        print(-1)
        exit()
    col = color_bipartite(comp_graph, i)
    cnt0.append(col.count(0))
    cnt1.append(col.count(1))

dp = [[False] * (n + 1) for i in range(len(cnt0) + 1)]
dp[0][0] = True
for i in range(len(cnt0)):
    wei0 = cnt0[i]
    wei1 = cnt1[i]
    for w in range(n + 1):
        if w + wei0 < n + 1:
            dp[i + 1][w + wei0] = (dp[i][w] or dp[i + 1][w + wei0])
        if w + wei1 < n + 1:
            dp[i + 1][w + wei1] = (dp[i][w] or dp[i + 1][w + wei1])

ans = 10 ** 18
for num in range(n + 1):
    if dp[-1][num]:
        c0 = num
        c1 = n - num
        res = c0 * (c0 - 1) // 2 + c1 * (c1 - 1) // 2
        ans = min(ans, res)
print(ans)

Measured memory_bytes: 114780
#include <iostream>
using namespace std;
int main()
{
	int x[] = {1,2,3,4,5};
 
	cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
	for (int i = 0; i < 5; ++i)
	{
		if(x[i]==0){
			cout << i+1;
			break;
		}
	}
}

Measured memory_bytes: 3636
#include<stdio.h>
   char a[5];
   int main()
   {
   while(scanf("%s",&a)!=EOF)
      {
      int t=0,y=0;	
      for(int i=0;i<4;i++)
	     {
         for(int j=i+1;j<4;j++)
		    {
		    if(a[i]==a[j])
			t++;
			if(a[i]!=a[j])
			y++;	
		    } 
	     }
	  if(y!=0&&t==2)
	  printf("Yes\n");
	  else
	  printf("No\n");	
      }	
   return 0;   
   }

Measured memory_bytes: 256
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

n=I()
ac=0
wa=0
tle=0
re=0
for i in range(n):
    s=S()
    if s=='AC':
        ac+=1
    if s=='WA':
        wa+=1
    if s=='TLE':
        tle+=1
    if s=='RE':
        re+=1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))

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

int main(){
	int n, i, ans=0, tmp=0;
	int a[10][110];
	cin>>n;
	for(i=0; i<n; i++) cin>>a[0][i];
	tmp+=a[0][0];
	for(i=0; i<n; i++){
		cin>>a[1][i];
		tmp+=a[1][i];
	}
	if(n==1){
		cout<<tmp<<endl;
		return 0;
	}
	ans=tmp;
	for(i=1; i<n; i++){
		tmp=tmp+a[0][i]-a[1][i-1];
		ans=max(ans, tmp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=1e18,MOD=1e9+7,MAX=2e3+5;
int n,dp[MAX];

int sol(int cur){
    if(cur==0)
        return 1;
    if(cur<0)
        return 0;
    int &ret=dp[cur];
    if(~ret)
        return ret;
    ret=0;
    lp(i,3,cur+1)
        ret+=sol(cur-i),ret%=MOD;
    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS
    cin>>n;
    memset(dp,-1,sizeof(dp));
    cout<<sol(n);
}

Measured memory_bytes: 3664
#import numpy as np
N=int(input())
A=list(input())
B=list(input())
C=list(input())
def judge(a,b,c):
    if a==b and b==c:
        return 0
    elif (a==b or b==c or c==a):
        return 1
    else:
        return 2
counter=0
for i in range(N):
    counter+=judge(A[i],B[i],C[i])
print(counter)


Measured memory_bytes: 3060