akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

template<int mod=1000000007>
class ModInt {
  int x;
public:
  ModInt() : x(0) {}
  ModInt(const ModInt &y): x(y.x) {}
  ModInt(int64_t y){ x = y % mod; if(x < 0) x += mod; }
  ModInt &operator += (const ModInt &p){ x += p.x; if(x >= mod) x -= mod; return *this; }
  ModInt &operator -= (const ModInt &p){ x -= p.x; if(x < 0) x += mod; return *this; }
  ModInt &operator *= (const ModInt &p){ x = (int) (1LL * x * p.x % mod); return *this; }
  ModInt &operator /= (const ModInt &p){ *this *= p.inverse(); return *this; }
  ModInt operator -() const { return ModInt(-x); }
  ModInt operator + (const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator - (const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator * (const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator / (const ModInt &p) const { return ModInt(*this) /= p; }
  ModInt operator ^ (const int64_t y) const { return pow(y); }
  bool operator == (const ModInt &p) const { return x == p.x; }
  bool operator != (const ModInt &p) const { return x != p.x; }
  ModInt operator = (const int64_t y) { return *this = ModInt(y); }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0){
      t = a/b; a -= t*b; swap(a, b);
      u -= t*v; swap(u, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t y) const {
    if(x==0) return ModInt(0);
    int64_t r = 1, t = x;
    while(y > 0){
      if(y&1) r = r*t%mod;
      t = t*t%mod; y >>= 1;
    }
    return ModInt(r);
  }
  friend ostream &operator << (ostream &os, const ModInt<mod> &p) { return os<<p.x; }
  friend istream &operator >> (istream &is, ModInt<mod> &a) { int64_t x; is>>x; a = ModInt<mod>(x); return is; }
};
using Int = ModInt<>;

vector<int> g[100005];

Int memo[100005][2];
// W B

Int solve(int v, int par = -1){
  for(auto to : g[v]) if(to != par) solve(to, v);

  memo[v][0] = 1;
  memo[v][1] = 1;
  for(auto to : g[v]) if(to != par){
    memo[v][0] *= memo[to][0] + memo[to][1];
    memo[v][1] *= memo[to][0];
  }
  return memo[v][0] + memo[v][1];
}

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

  rep(i,n-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }

  cout << solve(0) << endl;

  return 0;
}


Measured memory_bytes: 14848
#include<stdio.h>
typedef long long LL;
int C=200000;
int a[200005],s[200005],next[200005];
LL d[200005];
LL MX=1e9+7;

int main()
{
    int n,i;
    scanf("%d", &n);
    for(i=1;i<=n;i++){
        scanf("%d", &a[i]);
        next[s[a[i]]]=i;
        s[a[i]]=i;
    }
    for(i=1;i<=C;i++)next[s[i]]=n+1;
    d[n+1]=1;
    for(i=n;i>=1;i--){
        if(next[i]==i+1||next[i]==n+1)d[i]=d[i+1];
        else d[i]=d[next[i]]+d[i+1];
        d[i]%=MX;
    }
    printf("%lld", d[1]);
    return 0;
}


Measured memory_bytes: 4096
fun main(){
    val a = listOf(1, 3, 5, 7, 8, 10, 12)
    val b = listOf(4, 6, 9, 11)
    var flag = 0
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }
    for (i in a){
        if (x == i){
            for (j in a){
                if (y == j){
                    flag = 1
                }
            }
        }
    }
    for (i in b){
        if (x == i){
            for (j in b){
                if (y == j){
                    flag = 1
                }
            }
        }
    }
    if (x == y) flag = 1
    if (flag == 1){
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 39016
S = list(input())

pattern_01 = 0
pattern_10 = 0

for idx, s in enumerate(S):
    if idx % 2 == 0 and s == "1":
        pattern_01 += 1
    elif idx % 2 == 0 and s == "0":
        pattern_10 += 1
    elif idx % 2 == 1 and s == "1":
        pattern_10 += 1
    elif idx % 2 == 1 and s == "0":
        pattern_01 += 1

print(min(pattern_01, pattern_10))


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int main()
{
    int64_t N;
    cin >> N;
    vector<int64_t> vec(N);
    for (int64_t i=0; i<N; i++) {
        cin >> vec.at(i);
    }

    int64_t count = 0;
    for (int64_t i=0; i<N-2; i++) {
        int64_t num = vec[i];
        for (int64_t j=i+1; j<N-1; j++) {
            int64_t b = vec[j];
            for (int64_t k=j+1; k<N; k++) {
                int64_t c = vec[k];

                if (num == b || num == c || b == c)
                {
                    continue;
                }

                vector<int64_t> kouho = {num, b, c};
                sort(kouho.begin(), kouho.end(), greater<int64_t>());
                if (kouho[1] + kouho[2] > kouho[0])
                {
                    count += 1;
                }
            }
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.*;
public class Main {
  public static void main(String ... args) {
  	Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int m = in.nextInt();
    int temp = n%2==0 ? n/2 : n/2 + 1;
    if(m>temp) System.out.println("NO");
    else System.out.println("YES");
  }
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(2 * a - 1, 2 * b - 1)) << endl;

    return 0;
}

Measured memory_bytes: 256
//Max heap

#include<stdio.h>
#define MAX 500001

int n,arr[MAX];

/*int parent(int i)
{
  i /= 2;
  return i;
}

int left(int i)
{
  i *= 2;
  return i;
}

int right(int i)
{
  i = 2 * i + 1;
  return i;
  }*/


void maxheap(int arr[],int i)
{
  int swit = 0,largest = 0;
  int l = 2 * i;
  int r = 2 * i + 1;

  if(l <= n && arr[l] > arr[i])
    {
      largest = l;
    }
  else largest = i;

  if(r <= n && arr[r] > arr[largest])
    {
      largest = r;
    }

  if(largest != i)
    {
      swit = arr[largest];
      arr[largest] = arr[i];
      arr[i] = swit;
      maxheap(arr,largest);
    }
}

void build(int arr[])
{
  for(int i = n/2; i > 0; i--)
    {
      maxheap(arr,i);
    }
}

int main()
{
  int i;

  //input data
  scanf("%d",&n);
  for(i = 1; i <= n; i++)
    {
      scanf("%d",&arr[i]);
    }

  build(arr);

  //printf("%d",arr[1]);
  for(i = 1; i <= n; i++)
    {
      printf(" %d",arr[i]);
    }

  printf("\n");

  return 0;
  }





Measured memory_bytes: 3664
use std::io;
use std::collections::HashSet;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s:Vec<char> = buf.trim().chars().collect();
	let mut set = HashSet::new();
	let mut flag = true;
	for i in s {
		if !set.insert(i) {
			flag = false;
			println!("no");
			break;
		}
	}
	if flag {
		println!("yes");
	}
}

Measured memory_bytes: 4352
/*....
     
 "Be not afraid of GROWING slowly, be afraid only of STANDING Still"
                                                                     
....*/
#include<bits/stdc++.h>
#define Abhi_921 ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ld long double
#define fi(i,j,n) for(int i=j;i<n;i++)
#define fd(i,j,n) for(int i=j;i>n;i--)
#define print(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define inp(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define printe(v) for(auto &i:v){cout<<i<<' ';}cout<<endl;
#define deb(n1) cout<<n1<<endl;
#define pb push_back
#define eb emplace_back
#define vi vector<ll>
#define vll vector<pair<ll,ll>>
#define umap unordered_map<ll,ll>
using namespace std;
const long long mod=1e9+7;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
Abhi_921;
int t;
t=1;
while(t--){
string s;
cin>>s;
ll sum=0;
ll n=s.length();
fi(i,0,n){
  sum+=(s[i]-'0');
}
if(sum%9==0) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF 1000000000001
using namespace std;


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,w;
  cin>>n>>w;
  vector<pair<ll,ll>>v;
  for(ll i=1;i<=n;i++)
  {
    ll a,b;
    cin>>a>>b;
    v.pb({a,b});
  }
  //sort(v.begin(),v.end());
  ll dp[n+1][w+1];
  for(ll i=1;i<=n;i++)
  {
    dp[i][0]=0;
  }
  for(ll j=1;j<=w;j++)
  {
    if(j<v[0].first)
    {
      dp[1][j]=0;
    }
    else
    {
      dp[1][j]=v[0].second;
    }
  }
  for(ll i=2;i<=n;i++)
  {
    for(ll j=1;j<=w;j++)
    {
      if(j < v[i-1].first)
      {
        dp[i][j]=dp[i-1][j];
      }
      else
      {
        dp[i][j]=max(dp[i-1][j],dp[i-1][j-v[i-1].first]+v[i-1].second);
      }
    }
  }
  cout<<dp[n][w];

}


Measured memory_bytes: 78336
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
p = []
q = []
i = 0
while i < N:
  p.append(x[i]+y[i])
  q.append(x[i]-y[i])
  i += 1
print(max(max(p)-min(p),max(q)-min(q)))

Measured memory_bytes: 130284
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;


public class Main
{
	public static void main( String[] args ) throws IOException
	{
		Reader.init(System.in);
		int n = Reader.nextInt();
		int k = Reader.nextInt();
		int[] arey = new int[n];
		for ( int i2 = 0 ; i2 < n ; i2++ )
		{
			arey[i2] = Reader.nextInt();
		}
		Arrays.sort(arey);
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( map.containsKey(arey[i]) )
			{
				map.put(arey[i], map.get(arey[i])+1);
			}
			else
			{
				map.put(arey[i],1);
			}
		}

        Map<Integer, Integer> result2 = new LinkedHashMap<>();
        map.entrySet().stream()
                .sorted(Map.Entry.<Integer, Integer>comparingByValue())
                .forEachOrdered(x -> result2.put(x.getKey(), x.getValue()));

/*        for ( Entry<Integer, Integer> entry : result2.entrySet())
        {
        	Integer key = entry.getKey();
            Integer value = (Integer) entry.getValue();
            System.out.println(key+"  "+value);
        }*/

        int size = result2.size();
        if ( size <= k )
        {
        	System.out.println("0");
        }
        else
        {
        	int actual = size - k;
	        int count = 0;
	        int k2 = 0;
	        for ( Entry<Integer, Integer> entry : result2.entrySet())
	        {
	            Integer value = (Integer) entry.getValue();
	            count = count + value;
	            k2++;
	            if ( k2 == actual )
	            {
	            	break;
	            }
	        }
	        System.out.println(count);
        }
	}
}

/** Class for buffered reading int and double values */
class Reader
{
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input)
    {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() )
        {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}

Measured memory_bytes: 58820
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    string s;cin >> s;
    int N=s.length();
    vector<int> a,b;
    for (int i = 0; i < N; i++) {
        if(s[i]=='0'){
            a.pb(i);
            a.pb(i);
        }
        else if(s[i]=='1'){
            a.pb(i);
            b.pb(i);
        }
        else{
            b.pb(i);
            b.pb(i);
        }
    }
    vector<vector<LL>> dp(2*N+1,vector<LL>(2*N+1,0));
    dp[0][0]=1;
    for (int i = 0; i < 2*N; i++) {
        for (int j = 0; j < 2*N; j++) {
            int k=i+j;
            if(i<a.size()&&a[i]<=k) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
            if(j<b.size()&&b[j]<=k) dp[i][j+1]=(dp[i][j+1]+dp[i][j])%mod;

        }
    }
    cout << dp[a.size()][b.size()] << endl;
    return 0;
}



Measured memory_bytes: 125568
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

vector<vector<int>> edge(201);
int n;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;
  int res=0;

  rep(i,n)rep(j,n)
  {
    char t;
    cin>>t;
    if(t=='1')
    {
      edge[i].push_back(j);
    }
  }
  rep(i,n)
  {
    vector<int>used(n,-1);
    queue<int>que;
    que.push(i);used[i]=1;

    while(!que.empty())
    {
      int ti=que.front();que.pop();
      for(auto t:edge[ti])
      {
        if(used[t]==-1){que.push(t);used[t]=1+used[ti];}
        if(used[t]%2==used[ti]%2){cout<<-1<<endl;return 0;}
      }
    }
    rep(i,n)chmax(res,used[i]);
    //cout<<edge[0][0]<<endl;
  //  rep(i,n)cout<<used[i]<<" ";cout<<endl;

  }
  cout<<res<<endl;
  
  return 0;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n) scanf("%d", &a[i]);

	ll temp = 0;

	//+-
	ll pm = 0;
	rep(i, n) {
		temp = temp + a[i];
		if(i % 2 == 0) {
			if(temp <= 0) {
				pm = pm + 1 - temp;
				temp = 1;
			}
		}
		else {
			if(temp >= 0) {
				pm = pm + 1 + temp;
				temp = -1;
			}
		}
	}

	//-+
	ll mp = 0;
	temp = 0;
	rep(i, n) {
		temp = temp + a[i];
		if(i % 2 == 1) {
			if(temp <= 0) {
				mp = mp + 1 - temp;
				temp = 1;
			}
		}
		else {
			if(temp >= 0) {
				mp = mp + 1 + temp;
				temp = -1;
			}
		}
	}

	printf("%lld\n", min(pm, mp));
	return 0;
}

Measured memory_bytes: 3860
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int inv[200010];
int n, a, b;

inline int quickmul(int x, int y) {
    int ret = 1, mul = x;
    while (y) {
        if (y & 1) {
            ret = (LL)ret * mul % mod;
        }
        mul = (LL)mul * mul % mod;
        y >>= 1;
    }
    return ret;
}

inline int C(int n, int k) {
    int ans = 1;
    for (int i = k; i >= 1; --i) {
        ans = (LL)ans * (n - k + i) % mod;
        ans = (LL)ans * inv[i] % mod;
    }
    return ans;
}

inline void init() {
    inv[0] = 1;
    for (int i = 1; i <= max(a, b); ++i) {
        inv[i] = quickmul(i, mod - 2) % mod;
    }
}

inline void work() {
    cin >> n >> a >> b;
    init();
    cout << ((quickmul(2, n) - C(n, a) - C(n, b) - 1) % mod + mod) % mod << "\n";
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;

int main(){
	int a,v,b,w,T;
	cin>>a>>v>>b>>w>>T;
	if (a==b) puts("YES");
	else{
		a=abs(a-b);
		if (1ll*(v-w)*T>=a) puts("YES");
		else puts("NO");
	}
} 

Measured memory_bytes: 3636
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    n,k = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    for i in range(n-k):
        if a[i] < a[i+k]:
            print("Yes")
        else:
            print("No")

    return None

if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, n, m) for(int i = n; i < (int)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18

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

ll MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<int> x(N + 1);
    FOR(n, 2, N+1) {
        int num = n; // 素因数分解する変数num

        for (int i = 2; i <= n; i++) {
            while (num%i == 0) { // 素数で割り切れなくなるまで割っていく
                x[i]++;
                num /= i;
            }
        }
    }
    ll cnt3 = 0;
    ll cnt5 = 0;
    ll cnt15 = 0;
    ll cnt25 = 0;
    ll cnt75 = 0;
    REP(i, N+1)
    {
        if (x[i]+1 >= 3) cnt3++;
        if (x[i]+1 >= 5) cnt5++;
        if (x[i]+1 >= 15) cnt15++;
        if (x[i]+1 >= 25) cnt25++;
        if (x[i]+1 >= 75) cnt75++;
    }

    ll ans = 0;
    ans += cnt75;
    ans += cnt25 * max(0LL, (cnt3-1));
    ans += cnt15 * max(0LL, cnt5-1);
    ans += (cnt5 * (cnt5-1))/2 * max(0LL, (cnt3-2));
    PRINT(ans);
    return 0;
}


Measured memory_bytes: 256
n,x = map(int,input().split())
li = list(map(int,input().split()))
li.sort()
count = 0
for l in li:
    x -= l
    if x >= 0:
        count += 1
    else:
        break
if x > 0:
    count -= 1
    print(max(0,count))
else:
    print(count)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for(int i = 0; i < m; ++i) cin >> b[i];

  int ans = 0;
  for(int i = 0; i < n; ++i) 
  {
    int score = 0;
    int a;
    for(int j = 0; j < m; ++j)
    {
      cin >> a;
      score += b[j] * a;
    }
    ans += score + c > 0;
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main(){
	int a[101][101],b[101],ans[101];
	int n,m;
	scanf("%d %d",&n,&m);
	int i,j;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}
	for(i=0;i<n;i++){
		ans[i]=0;
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			ans[i]+=a[i][j]*b[j];
		}
	printf("%d\n",ans[i]);
	}
}



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

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
// a^{-1} mod を計算する
ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
 
const int MAX = 3000000;
const int MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll X, Y;
    cin >> X >> Y;
    if ((2 * X - Y) % 3 != 0 || ((2 * Y - X) % 3 != 0)) {
        cout << "0\n";
        return 0;
    }
    ll a = (2 * X - Y) / 3;
    ll b = (2 * Y - X) / 3;
    ll mod = pow(10, 9) + 7;
    ll ans = 1;
    for (ll i = a + 1; i <= a + b; i++) {
        ans = (ans * i) % mod;
    }
    COMinit();
    cout << COM(a + b, a) << "\n";
    return 0;
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
#define SIZE(v) int(v.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N, M;
	cin >> N >> M;
	vector<int> A(N), sum(N + 1);
	REP(i, N) {
		cin >> A[i];
		sum[i + 1] = sum[i] + A[i];
	}
	SORT(A);
	REV(A);
	string res = "Yes";
	if (sum[N] % (4 * M)) {
		if (A[M - 1] <= sum[N] / (4 * M)) res = "No";
	}
	else {
		if (A[M - 1] < sum[N] / (4 * M)) res = "No";
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(vecto) vecto.begin(),vecto.end()
typedef long long ll;

int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n << endl;
    }
    else
        cout << n * 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int L;
    cin >> L;
    long double a = (long double)L / (long double)3.0;
    cout << fixed << setprecision(15);
    cout << a * a * a << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    char C;
    cin >> C;
    cout << ++C << endl;
    return 0;
}


Measured memory_bytes: 3596
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<double> B(N);
    double b = 1;
    ll ans = 1;
    rep(0, i, N)
    {
        ll a;
        cin >> a;
        if (a == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        B.at(i) = a;
        ans *= a;
        b *= B.at(i);
    }
    if (b > 1e18 || ans > 1000000000000000000)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define debug(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

///----------------------------------------------
char str[100];
int main() {
	
	///read
	scanf(" %s",str);
	int len = strlen(str);

	///work
	vector<char> vu;
	rep(i,0,len) {
		if (str[i]=='B') {
			if (sz(vu)) vu.pop_back();
		}
		else vu.push_back(str[i]);
	}

	///print
	rep(i,0,sz(vu)) putchar(vu[i]);




}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
import math
def check(a,mid,k):
	cnt = 0
	for x in a:
		cur_cnt = (x+mid-1)//mid - 1
		cnt+=cur_cnt
		if cnt > k:
			return False
	return True

def solve():
	n , k= map(int, input().strip().split())
	a= [int(x) for x in input().strip().split()]
	l = 0
	r = 10**9+20
	while r-l > 1:
		mid = (r+l)//2
		if check(a,mid,k):
			r = mid
		else:
			l = mid
	return l+1
 
print(solve())

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

typedef long long int ll; 
#define MOD 1000000007
#define ON 200000
#define rep(i,n) fp(i,0,n)  
#define fp(i,a,b) for(ll i=(a);i<(b);++i)
#define fn(i,a,b) for(ll i=(a);i>(b);i--)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define FF first
#define SS second
typedef pair<ll, ll> pll; 
typedef vector<pll> vpll;
typedef vector<ll> vll;
#define rs(t) string t;cin>>t
#define ri(t) int t;cin>>t
#define rll(t) long long int t;cin>>t
#define MK make_pair
#define PB push_back
#define PO pop_back
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
///// This part below is only for debug, not used /////
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
///// END /////



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  rll(n);
  vll v(n+1,0);

  for(int i=0;i<n-1;i++){
  	rll(val);
  	v[val]++;
  }

  for(int i=1;i<=n;i++){
  	cout << v[i] << endl;
  }
  return 0;
  
}

Measured memory_bytes: 4760
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;



namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public long poison(long x, long y)
        {
            var ans = Min(x, y);
            if (x < y) ans++;
            return ans;
        }
        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadLong;
            var b = cin.ReadLong;
            var c = cin.ReadLong;

            var ans = poison(a + b, c) + b;

            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReadDoubleArray(long N) { var ret = new double[N]; for (long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}



Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int H;
  cin>>H;
  int W;
  cin>>W;
  vector<string>str(H);
  for(int i=0;i<H;i++){
  	cin>>str.at(i);
  }
  vector<bool>row(H,false);
  vector<bool>col(W,false);
  for(int i=0;i<H;i++){
  	for(int j=0;j<W;j++){
    	if(str.at(i).at(j)=='#'){
        	row.at(i)=true;
          	col.at(j)=true;
        }
    }	
  }
  for(int i=0;i<H;i++){
  	if(row.at(i)){
    	for(int j=0;j<W;j++){
        	if(col.at(j)){
            	cout<<str.at(i).at(j);
            }
        }
      cout<<endl;
    }
  }
 
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          String topping = sc.next();
          String[] top = topping.split("");
          int count = 0;
          for(int i = 0; i < top.length; i++) {
            if("o".equals(top[i])){
              count++;
            }
          }
          System.out.println(700 + (count * 100));
      }
    }

Measured memory_bytes: 20692
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    use std::collections::BTreeSet;
    let n: u32 = read();
    let a: BTreeSet<u32> = (0..n).map(|_| read()).collect();
    println!("{}", a.len());

}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0){
				break;
			}
			int[] array = new int[n];
			for(int i=0;i<n;i++){
				array[i] = sc.nextInt();
			}
			java.util.Arrays.sort(array);
			
			double average = 0;
			for(int i=1;i<n-1;i++){
				average += (double)array[i]/(n-2);
			}
			System.out.println((int)average);
		}
		
	}

}

Measured memory_bytes: 28800
#include <iostream>

int main() {
    int a, b, c;
    std::cin >> a >> b >> c;

    int x = std::abs(a - b);
    int y = std::abs(b - c);
    int z = std::abs(c - a);

    int max = std::max(x, std::max(y, z));
    int sum = x + y + z - max;

    std::cout << sum << std::endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = 0, r = s.size() - 1;
    int cnt = 0;
    while (l < r) {
        if (s[l] == s[r]) {
            l++, r--;
        } else if (s[l] == 'x') {
            l++;
            cnt++;
        } else if (s[r] == 'x') {
            r--;
            cnt++;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<vector<int>> vec(N+1, vector<int>(3)); 
  vec.at(0).at(0) = 0;
  vec.at(0).at(1) = 0;
  vec.at(0).at(2) = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i+1).at(0) >> vec.at(i+1).at(1) >> vec.at(i+1).at(2);
  }
  
  bool can = true;
  int dist, time;
  for (int i = 0; i < N; i++) {
    dist = abs(vec.at(i + 1).at(1) - vec.at(i).at(1)) + abs(vec.at(i + 1).at(2) - vec.at(i).at(2));
    time = vec.at(i + 1).at(0) - vec.at(i).at(0);
    
    if (dist > time || (time - dist) % 2 != 0) {
      can = false;
    }   
  } 
  
  if (can) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

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

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 29; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

	vector<vector<int>> as(n, vector<int>(60));

	rep(i, n) {
		ll a;
		cin >> a;

		rep(j, 60) {
		  as[i][j] = a & 1;
			a >>= 1;
		}
	}

	ll ans = 0;
	rep(i, 60) {
		int cnt0 = 0, cnt1 = 0;
		rep(j, n) {
			if (as[j][i]) cnt1++; 
			else cnt0++;
		}
		ans += (ll) cnt0*cnt1 % MOD * ((ll) pow(2,i) % MOD) % MOD;
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 82304
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e7+5;
int n,x,ans,t[N+5],p[1000005],b[205][205],d1[205],d2[205],s[205];
bool bz[N+5],v[205];
bool dg(int x)
{
	for (int i=1;i<=d2[0];i++)
	if (b[x][i] && !v[i])
	{
		v[i]=1;
		if (!s[i] || dg(s[i]))
		{
			s[i]=x;
			return 1;
		}
	}
	return 0;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x),bz[x]=1;
	for (int i=1;i<=N;i++) 
	if (bz[i]^bz[i-1]) 
	{
		if (i&1) d1[++d1[0]]=i; 
			else d2[++d2[0]]=i;
	}
	memset(bz,0,sizeof(bz));
	bz[1]=1;
	for (int i=2;i<=N;i++)
	{
		if (!bz[i]) p[++p[0]]=i;
		for (int j=1;j<=p[0] && i*p[j]<=N;j++)
		{
			bz[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	bz[2]=1;
	for (int i=1;i<=d1[0];i++)
		for (int j=1;j<=d2[0];j++)
		if (!bz[abs(d1[i]-d2[j])]) b[i][j]=1;
	for (int i=1;i<=d1[0];i++)
	{
		memset(v,0,sizeof(v));
		if (dg(i)) ans++;
	}
	d1[0]-=ans,d2[0]-=ans;
	ans+=d1[0]/2*2+d2[0]/2*2+d1[0]%2*3;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 14464
#include<iostream>
#include<vector>
#include<algorithm>

long long llmax(long long a, long long b){
	if(a>b)
		return a;
	else
		return b;
}

long long llmin(long long a, long long b){
	if(a<b)
		return a; 
	else
		return b;
}

int main(){
	long long a, b;
	long long length;
	int idx= 41;
	std::cin>>a>>b;
	length= b+1 -a;

	std::vector<long long> exp2(idx+1, 1);
	std::vector<bool> bitFlag(idx, false);

	for(int i=1; i<idx+1; i++)
		exp2[i]= exp2[i-1]*2;

	if(length%2 == 0)
		bitFlag[0]= (length/2 %2 ==1);
	else
		bitFlag[0]= ((length/2 + a%2) %2==1);

	for(int i=1; i<idx; i++){
		long long lower= llmin(exp2[i+1]-(a%exp2[i+1]), exp2[i]);
		long long upper= llmax((b+1)%exp2[i+1]- exp2[i], 0);

		bitFlag[i]= ((lower+upper)%2==1);
	}

	long long ans=0;
	for(int i=0; i<idx; i++)
		if(bitFlag[i])
			ans+= exp2[i];

	std::cout<<ans<<std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,l,n,sum = 0,i;
    cin>>n;
    for(i = 0;i < n;i++)
    {
        cin>>m>>l;
        sum += abs(m-l)+1;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	
	int plus, minus, mul, result;
	
	scanf("%d", &a);
	scanf("%d", &b);
	
	plus = a + b;
	minus = a - b;
	mul = a * b;
	
	if (plus > minus) {
		if (plus > mul) {
			printf("%d", plus);
		}
		else {
			printf("%d", mul);
		}
	}
	else {
		if (minus > mul) {
			printf("%d", minus);
		}
		else {
			printf("%d", mul);
		}
	}
	return (0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	ll a[n];
	for(ll i=0; i<n; i++){
		cin >> a[i];
	}
	
	ll ans = 0;
	for(ll i=1; i<n; i++){
		if(a[i-1]>a[i]){
			ans += (a[i-1]-a[i]);
			a[i] += (a[i-1]-a[i]);
		}
	}
	cout << ans;
}

Measured memory_bytes: 5144
#include <cstdio>

char c1[200],c2[200],c3[200];
int i,n,s;

int main()
{
	scanf("%d",&n);
	scanf("%s",c1+1);
	scanf("%s",c2+1);
	scanf("%s",c3+1);
	for (i=1;i<=n;i++)
		if ((c1[i]==c2[i]) && (c1[i]==c3[i]))
			s=s+3;
		else
			if ((c1[i]==c2[i]) || (c1[i]==c3[i]) || (c2[i]==c3[i]))
				s=s+2;
			else
				s=s+1;
	printf("%d",3*n-s);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  int n;
  cin >> n;
  if (n < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
}


Measured memory_bytes: 256
N,W = map(int,input().split())
list0 = []
list1 = []
list2 = []
list3 = []
for i in range(N):
    w,v = map(int,input().split())
    if i == 0:
        w1 = w
    if w == w1:
        list0.append(v)
    if w == w1 + 1:
        list1.append(v)
    if w == w1 + 2:
        list2.append(v)
    if w == w1 + 3:
        list3.append(v)
list0.sort(reverse = True)
list1.sort(reverse = True)
list2.sort(reverse = True)
list3.sort(reverse = True)
l0 = len(list0)
l1 = len(list1)
l2 = len(list2)
l3 = len(list3)
ans = 0
for i in range(min(l0,W//w1)+1):
    curw1 = W - w1*i
    for j in range(min(l1,curw1//(w1+1))+1):
        curw2 = curw1-(w1+1)*j
        for k in range(min(l2,curw2//(w1+2))+1):
            curw3 = curw2- (w1+2)*k
            l = min(l3,curw3//(w1+3))
            value = 0
            for a in range(i):
                value += list0[a]
            for a in range(j):
                value += list1[a]
            for a in range(k):
                value += list2[a]
            for a in range(l):
                value += list3[a]
            ans = max(ans,value)
print(ans)

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

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}

signed main(){
	int n,m,x=1;
	string s,t;
	cin>>n>>m>>s>>t;
	x=gcd(n,m);
	for(int i=0;i*(n/x)<n;i++){
		if(s[i*(n/x)]!=t[i*(m/x)]){
			cout<<"-1"<<endl;
			return 0;
		}
	}
	cout<<n*m/x<<endl;
	return 0;
}


Measured memory_bytes: 512
class Main
{
	public static void main(String[] args) {
		java.io.BufferedReader reader = null;
		try {
			reader = new java.io.BufferedReader(
				new java.io.InputStreamReader(System.in)
				);
			String[] inputs = reader.readLine().split(" ");
			int a = Integer.parseInt(inputs[0]);
			int b = Integer.parseInt(inputs[1]);
			int c = Integer.parseInt(inputs[2]);
			if ((a < b) && (b < c)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} catch (java.io.IOException e ) {
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (java.io.IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}

Measured memory_bytes: 17056
#include <iostream>
#include <string>
#include <vector>
#include <atcoder/string>
using namespace std;
using namespace atcoder;

int main() {
	string s;
	cin >> s;
	vector<int> sa = suffix_array(s);
	vector<int> lcp = lcp_array(s, sa);
	
	//missisippi
	/*for (int i = 0; i < s.length(); i++) {
		cout << sa[i] << ", " << lcp[i] << ", " << s.substr(sa[i]) << endl;
	}*/
	
	long long answer = 1LL * s.size() * (s.size() + 1) / 2;
	for (auto x : lcp) {
		answer -= x;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 15588
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    char pre = s[0];
    int ans = 1;
    for(int i = 1; i < n; i++){
        if(s[i] != pre){
            ans++;
        }
        pre = s[i];
    }
    cout << ans << endl;
    return 0;
}

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

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

    set<char> values;
    for (int i = 0; i < S.size(); i++) {
        values.insert(S.at(i));
    }

    if (values.size() == 26) {
        cout << "None" << endl;
        return 0;
    }

    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < alphabet.size(); i++) {
        if (!values.count(alphabet.at(i))) {
            cout << alphabet.at(i) << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;

char next(char now, char prev, char stat){
  if(now == 'S'){
    if((prev=='S' && stat=='o') || (prev=='W' && stat=='x')) return 'S';
    return 'W';
  }
  if((prev=='S' && stat=='x') || (prev=='W' && stat=='o')) return 'S';
  return 'W';
}

int main(){
  int n; string s; cin >> n >> s;
  string init[4] = {"SS", "SW", "WS", "WW"};
  rep(i, 4){
    string ans = init[i];
    For(j, 1, n-1) ans += next(ans[j], ans[j-1], s[j]);
    if(ans[0]==next(ans[n-1], ans[n-2], s[n-1]) && ans[1]==next(ans[0], ans[n-1], s[0])){
      cout << ans << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 776