akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer N = scanner.nextInt();
        Integer M = scanner.nextInt();
        Integer[] inputList = new Integer[N];
        Integer sum = 0;

        for (Integer i = 0; i < N; i++) {
            Integer vote = scanner.nextInt();
            inputList[i] = vote;
            sum += vote;
        }

        Arrays.sort(inputList, Collections.reverseOrder());
        if (inputList[M - 1] * 4 * M >= sum) {
            System.out.println("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<stack>
using namespace std;
stack<int> stk;
string s;
int main()
{
    cin>>s;
    int len=s.length();
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='S') stk.push(s[i]);
        if(s[i]=='T')
        {
            if(stk.empty()) continue;
            stk.pop();
            len-=2;
        }
    }
    cout<<len<<endl;
    return 0;
}

Measured memory_bytes: 900
(defun check (n lst)
  (length (set-difference (loop for i from 1 to n
                                collect i)
                          (remove-duplicates (apply #'append lst)))))

(let* ((n (read))
       (k (read))
       (lst (loop for i below k
                  collect (loop repeat (read)
                           collect (read)))))
     (format t "~A" (check n lst)))

Measured memory_bytes: 30396
n = gets.to_i
c = n/15
m = n%15
arr = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14]
p 60*(c**2) + (m+1).times.map{|i| arr[i]!=0 ? (c*15+i) : 0}.sum


Measured memory_bytes: 14244
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;

typedef long long ll;


ll tairyoku(ll x,ll p){
    return (x-p)*(x-p);
}

int main() {
    ll N;
    cin >> N;
    vector<ll> X(N);
    for(ll i=0;i<N;i++){
        cin >> X[i];
    }

    ll sum=0,result=LLONG_MAX;

    for(ll P=1;P<=100;P++){
        sum=0;
        for(ll i=0;i<N;i++){
            sum += tairyoku(X[i],P);
        }
        result = min(result,sum);
    }

    cout << result << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
	lli n;
  cin>>n;
  lli arr[n];
  for(lli i=0;i<n;++i)
    cin>>arr[i];
  sort(arr,arr+n);
  lli flag=0;
  for(lli i=0;i<n-1;++i)
    if(arr[i]==arr[i+1])
      flag=1;
  if(flag)
    cout<<"NO"<<endl;
  else
    cout<<"YES"<<endl;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

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

//最大公約数
ll gcd(ll m, ll n) {
 if (n == 0)return m;
 return gcd(n, m % n);
}//gcd

//最小公倍数
ll lcm(ll m, ll n) {
 return m / gcd(m, n) * n;
}

void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    a--;

    ll l=lcm(c,d);

    ll ans=b-a;
    ans -= b/c-a/c;
    ans -= b/d-a/d;
    ans += b/l-a/l;
    cout<<ans<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}

Measured memory_bytes: 256
def resolve():
    import sys
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

    # 入力を整数に変換して受け取る
    def input_int():
        return int(input())

    def map_int_input():
        return map(int, input())

    MII = map_int_input

    def MII_split():
        return map(int, input().split())

    def MII_to_index():
        return map(to_index, input())

    def MII_split_to_index():
        return map(to_index, input().split())

    # 入力全てを整数に変換したものの配列を受け取る
    def list_int_inputs():
        return list(map(int, input()))

    LII = list_int_inputs

    def LII_split():
        return list(map(int, input().split()))

    # 2次元リスト化
    def LII_2D(rows_number):
        return [LII() for _ in range(rows_number)]

    def LII_split_2D(rows_number):
        return [LII_split() for _ in range(rows_number)]

    L, R, d = MII_split()
    ans = 0
    # print(list(range(L, R)))
    for i in range(L, R + 1):

        if i % d == 0:
            ans += 1

    # amari = (R - L) % d
    # ans = (R - L) / d
    # if L % d + amari >= d or d == 1:
    #     ans += 1

    print(int(ans))
resolve()

Measured memory_bytes: 9240
#include<iostream>
using namespace std;
bool vis[100005];
int num[100005];

inline int read() {
	int x=0;
	char c = getchar();
	while(c<'0' || c>'9') {c=getchar();}
	while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x;
}

int main()
{
	int N, M, i, a, b, ans=1;
	vis[1] = 1;
	N=read(),M=read();
	for(i=1;i<=N;i++) num[i]=1;
	for(i=0;i<M;i++) {
		a = read();
		b = read();
		num[a]--;
		num[b]++;
		if(!vis[a]) continue;
		if(num[a]==0 && !vis[b]) {
			vis[b] = 1;
			vis[a] = 0;
		}
		else if(num[a]==0 && vis[b]) {
			ans--;
			vis[a] = 0;
			continue;
		}
		else if(num[a]>0 && !vis[b]) {
			vis[b] = 1;
			ans++;
		}
		else if(num[a]>0 && vis[b]) {
			continue;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],sum;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++) {
		if(a[i]==i) sum++,swap(a[i],a[i+1]);
		
	}
	cout<<sum;
}

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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


ll q(ll a ,ll p){

	if(p==0){
		return 1;
	}

	if(p%2 ==0){
		ll n =q(a,p/2)%1000000007;

		return(n*n)%1000000007;
	}
	return (a*q(a,p-1))%1000000007;

}


ll cnb( ll n, ll b){
	ll k=1,c=1;
	for(ll i=0; i<b; i++){
	k = k*(n-i);k%=1000000007;
	c = c*(i+1);c%=1000000007;

	}

	ll res =q(c,1000000005)%1000000007;

	return (k*res)%1000000007;

}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans = q(2,n)-1;
	ll x = cnb(n,a)+ cnb(n,b);
	x %=1000000000+7;
	cout<<(ans-x+1000000007)%1000000007<<endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>

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

ll powmod(ll a, ll b) {
    a %= MOD;
    ll res = 1;
    while (b > 0) {
        if (b % 2 == 1)res = res * a % MOD;
        a = a * a % MOD;
        b /= 2;
    }
    return res;
}
P make(ll x, ll y){
    ll a, b;
    if (y == 0) a = INF, b = 0;
    else if(x == 0)
        a = 0, b = 1;
    else {
        a = x, b = y;
        if(b < 0){
            a *= -1;
            b *= -1;
        }
        ll now = gcd(abs(a), abs(b));
        a /= now;
        b /= now;
    }
    return P(a, b);
};
map<P, ll> a1, a2, used;
ll cntaj, cntzz;
ll ans = 1;
vector<P> v;
int main(){
    ll n;
    cin >> n;
    vector<P> s;
    vector<P> x, y;
    REP(i, n){
        ll a, b;
        cin >> a >> b;
        s.push_back(P(a, b));
        x.push_back(make(a, b));
        y.push_back(make(-b, a));
    }
    REPR(i, n - 1){
        ll cnt = n - 1 - i;
        ll a = s[i].first, b = s[i].second;
        if(a == 0 and b == 0){
            cnt += 0;
            cntzz++;
            continue;
        }
        a1[x[i]]++;
    }
    REP(i, n){
        ll a = s[i].first, b = s[i].second;
        if (a == 0 and b == 0) continue;
        if (used[x[i]]) continue;
        used[x[i]]++;
        used[y[i]]++;
        v.push_back(P(a1[x[i]], a1[y[i]]));
    }
    REP(i, v.size()){
        ll now = (powmod(2, v[i].first) + powmod(2, v[i].second) - 1 + MOD) % MOD;
        ans *= now;
        ans %= MOD;
    }
    cout << (ans - 1 + cntzz + MOD) % MOD<< endl;
}



Measured memory_bytes: 65680
s = input()
Q = int(input())
r = -1
head = ''
tail = ''
for i in range(Q):
    t = input()
    if t[0] == '1':
        r *= -1
    else:
        if t[2] == '1':
            if r == 1:
                tail += t[4]
            else:
                head = t[4] + head
        else:
            if r == 1:
                head = t[4] + head
            else:
                tail += t[4]
if r == 1:
    print(tail[::-1] + s[::-1] + head[::-1])
else:
    print(head + s + tail)

Measured memory_bytes: 4448
# -*- coding: utf-8 -*-
import numpy as np
import math
a, b, x = map(int, input().split())

org_volume = a ** 2 * b
if x < org_volume / 2:
    y = (2 * x) / (a * b)
    z = np.sqrt(b ** 2 + y ** 2)
    cos = (y ** 2 + z ** 2 - b ** 2) / (2 * y * z)
    print(math.degrees(math.acos(cos)))
else:
    y = b - ((2 * (x - org_volume / 2)) / (a ** 2))
    z = np.sqrt(a ** 2 + y ** 2)
    cos = (a ** 2 + z ** 2 - y ** 2) / (2 * a * z)
    print(math.degrees(math.acos(cos)))
    

Measured memory_bytes: 12516
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  int ga,sa,ba,gb,sb,bb;cin>>ga>>sa>>ba>>gb>>sb>>bb;
  int ans=0;
  if(ga<=gb&&sa<=sb&&ba<=bb){
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int M=N;
        M-=i*ga+j*sa;
        if(M<0)break;
        int k=M/ba;
        M-=ba*k;
        M+=gb*i;
        M+=sb*j;
        M+=bb*k;
        ans=max(ans,M);
      }
    }
    cout<<ans<<endl;return 0;
  }
  if(ga>=gb&&sa<=sb&&ba<=bb){
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int M=N;
        M-=i*ba+j*sa;
        if(M<0)break;
        M+=i*bb;M+=j*sb;
        int k=M/gb;M-=k*gb;
        M+=k*ga;
        ans=max(ans,M);
      }
    }
    cout<<ans<<endl;return 0;
  }
  if(ga<=gb&&sa>=sb&&ba<=bb){
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int M=N;
        M-=i*ba+j*ga;
        if(M<0)break;
        M+=i*bb;M+=j*gb;
        int k=M/sb;M-=k*sb;
        M+=k*sa;
        ans=max(ans,M);
      }
    }
    cout<<ans<<endl;return 0;
  }
  if(ga<=gb&&sa<=sb&&ba>=bb){
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int M=N;
        M-=i*ga+j*sa;
        if(M<0)break;
        M+=i*gb;M+=j*sb;
        int k=M/bb;M-=k*bb;
        M+=k*ba;
        ans=max(ans,M);
      }
    }
    cout<<ans<<endl;return 0;
  }
  if(ga>=gb&&sa>=sb&&ba>=bb){
    swap(ga,gb);swap(sa,sb);swap(ba,bb);
    for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
        int M=N;
        M-=i*ga+j*sa;
        if(M<0)break;
        int k=M/ba;
        M-=ba*k;
        M+=gb*i;
        M+=sb*j;
        M+=bb*k;
        ans=max(ans,M);
      }
    }
    cout<<ans<<endl;return 0;
  }
  if(ga<=gb&&sa>=sb&&ba>=bb){
    int M=N;
    int i=M/ga;M-=ga*i;
    M+=gb*i;
    int MC=M;
    for(int j=0;j*sb<=MC;j++){
      M=MC;
      M-=j*sb;
      int k=M/bb;M-=k*bb;
      M+=j*sa;M+=k*ba;
      ans=max(ans,M);
    }
    cout<<ans<<endl;return 0;
  }
  if(ga>=gb&&sa<=sb&&ba>=bb){
    swap(ga,sa);swap(gb,sb);
    int M=N;
    int i=M/ga;M-=ga*i;
    M+=gb*i;
    int MC=M;
    for(int j=0;j*sb<=MC;j++){
      M=MC;
      M-=j*sb;
      int k=M/bb;M-=k*bb;
      M+=j*sa;M+=k*ba;
      ans=max(ans,M);
    }
    cout<<ans<<endl;return 0;
  }
  if(ga>=gb&&sa>=sb&&ba<=bb){
    swap(ga,ba);swap(gb,bb);
    int M=N;
    int i=M/ga;M-=ga*i;
    M+=gb*i;
    int MC=M;
    for(int j=0;j*sb<=MC;j++){
      M=MC;
      M-=j*sb;
      int k=M/bb;M-=k*bb;
      M+=j*sa;M+=k*ba;
      ans=max(ans,M);
    }
    cout<<ans<<endl;return 0;
  }
}


Measured memory_bytes: 256
a, b = map(int, input().split())

counter = 1
while True:
    val_a = 0.5 * counter * (counter + 1) - a
    val_b = 0.5 * (counter + 1) * (counter + 2) - b
    if val_a == val_b:
        counter = int(val_a)
        break
    counter += 1
print(counter)


Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	llint n;
	cin >> n;
	llint x = log2(n);
	//2のi乗の答えを記録する
	vllint a(x + 1, 0);
	a[0] = 1;
	rep(i, x) {
		a[i + 1] = (llint)a[i] * 2 + 1;
	}
	cout << a[x] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
    fastIO;
    string n;
    cin >> n;
    for (auto ch : n) {
        if (ch == '9')
            cout << 1;
        else if (ch == '1')
            cout << 9;
        else
            cout << ch;
    }
}

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

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

long long i,j,k,l,m,n,p,q;
while(cin>>p){
    p/=100;
    cout<<10-(p/2)<<endl;
}
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
   int n;
   cin>>n;
  
  vector<tuple<string,int,int>>a;
  
  for(int i=0;i<n;i++)
  {
      string s;
      int p;
      int id = i+1;
    
    cin>>s>>p;
    p=-p;
    a.push_back(tie(s,p,id));
   
    
  }
    
  sort(a.begin(),a.end());
  
  for(tuple<string,int,int> i:a)
  {
      string ss;
      int pp;
      int iid;
       tie(ss,pp,iid) = i;
       cout<<iid<<endl;
  }
  
}

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

#include <atcoder/segtree>
int op(int a, int b){ return max(a,b); } // 処理
int e(){ return 0; } // 単位元
using MONOID = int;
using SEG_T = atcoder::segtree<MONOID, op, e>;
#define SEGT_MAX 300001

int main(){
	int n, k; cin>>n>>k;
	SEG_T seg(SEGT_MAX);
	int ans = 0;
	for(int i=0; i<n; ++i){
		int a; cin>>a;
		int l = max(0, a - k);
		int r = min(a + k + 1, SEGT_MAX);
		int longest = seg.prod(l, r); // [l,r)
		seg.set(a, longest + 1);
		ans = max(ans, longest + 1);
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 8464
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
typedef long long ll;
const  double PI = 3.141592654;
#define rep(i,x) for(int(i)=0;(i)<(ll)(x);(i)++)
#define all(s)      (s).begin(),(s).end()
#define allv(v)      (v).begin(),(v).end()
#define allvr(v)      (v).rbegin(),(v).rend()
#define pb          push_back
#define sz          s.size()
#define ssz          ss.size()
#define vz          v.size()
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int dx[] = { 0, 0, -1, 1, -1, 1, -1, 1 };
int dy[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
//x = atoill(s.c_str())
void fast()
{
#ifndef ONLINE_JUDGE
	/*

	**    ** ** **    *********   ** ** **
	**    **          **     **   **
	**    **          *********   **
	**    **          **          **
	**    ** ** **    **          ** ** **
	*/
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(NULL), cout.tie(NULL);
}
int x, y;
bool valid(int i, int j)
{
	return(i < x && i >= 0 && j < y && j >= 0);
}
int main()
{
	fast();
	char arr[51][51];
	cin >> x >> y;
	rep(i, x)
	{
		rep(j, y)
			cin >> arr[i][j];
	}
	rep(i, x)
	{
		rep(j, y)
		{
			int c = 0;
			if (arr[i][j] == '#')
			{
				bool t = 0;
				for (int k = 0; k < 4; k++)
				{
					int tox = i + dx[k];
					int toy = j + dy[k];
					if (valid(tox, toy))
					{
						if (arr[tox][toy] == '#')
							t = 1;
					}
				}
				if (t == 0)
				{
					cout << "No";
					return 0;
				}
			}
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
	return a if b==0 else gcd(b,a%b)
	
while 1:
	a1,m1,a2,m2,a3,m3=map(int,raw_input().split())
	if a1==0:break
	x,y,z=a1%m1,a2%m2,a3%m3
	cx=cy=cz=1
	while x!=1:
		x=a1*x%m1
		cx+=1
	while y!=1:
		y=a2*y%m2
		cy+=1
	while z!=1:
		z=a3*z%m3
		cz+=1
	lcd=cx*cy/gcd(cx,cy)
	lcd=lcd*cz/gcd(lcd,cz)
	print lcd

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 405;

int a[N][N], used[N][N];
int H, W, w, b;

int good(int i, int j) {
    return i >= 0 && i < H && j >= 0 && j < W && !used[i][j];
}

void dfs(int i, int j) {
    used[i][j] = 1;

    w += a[i][j];
    b += !a[i][j];

    REP(dx, -1, 2) {
        REP(dy, -1, 2) {
            int xx = i + dx;
            int yy = j + dy;
            if(dx*dx + dy*dy == 1) {
                if(good(xx, yy) && a[xx][yy] != a[i][j])
                    dfs(xx, yy);
            }
        }
    }
} 

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> H >> W;
    REP(i, 0, H) {
        REP(j, 0, W) {
            char c;
            cin >> c;
            a[i][j] = c == '#';
        }
    }

    ll res = 0;
    REP(i, 0, H) {
        REP(j, 0, W) {
            if(a[i][j] && !used[i][j]) {
                w = b = 0;
                dfs(i, j);
                res += 1ll * w * b;
            }
        }
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 19776
n, m, l = map(int, input().split())
ar = []
br = []
cr = [[0 for _ in range(l)] for _ in range(n)]

i = 0
while n > i:
    ar.append([int(s) for s in input().split()])
    i += 1

i = 0
while m > i:
    br.append([int(s) for s in input().split()])
    i += 1

i, j , k= 0, 0, 0
while n > i:
    while l > j:
        while m > k:
            cr[i][j] += (ar[i][k] * br[k][j])
            k += 1
        k = 0
        j += 1
    j = 0
    i += 1

i, j = 0, 0
while n > i:
    while l > j:
        if l != j + 1:
            print("{} ".format(cr[i][j]), end="")
        elif l == j + 1:
            print(cr[i][j])
        j += 1
    j = 0
    i += 1



Measured memory_bytes: 7064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  ll N,M;
  cin >> N >> M;
  if(N>=2&&M>=2) cout << (N-2)*(M-2) << endl;
  else if(N==1&&M==1) cout << 1 << endl;
  else cout << max(N-2,M-2) << endl;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


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

    int cpos = s.find('C');
    int fpos = s.rfind('F');

    if(cpos == string::npos || fpos == string::npos) pl("No")
    else if(cpos < fpos) pl("Yes")
    else pl("No")

    return 0;
}

Measured memory_bytes: 256
using System;

class main{
	static void Main(){
		int A = int.Parse(Console.ReadLine());
		int B = int.Parse(Console.ReadLine());
		int C = int.Parse(Console.ReadLine());
		int D = int.Parse(Console.ReadLine());
		Console.WriteLine(Math.Min(A, B) + Math.Min(C, D));
	}
}

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

int main() {
  int n;
  cin>>n;
  ll vec[n];
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>vec[i];
    sum+=vec[i];
  }
  ll sumb=vec[0];
  ll ans=abs(sum-sumb-sumb);
  for(int i=1;i<n-1;i++){
    sumb+=vec[i];
    ans=min(ans,abs(sum-sumb-sumb));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
import java.lang.Math.*;

public class Main{

    static void sho(int x,int y,int[][] inku){
    for(int i=x-1;i<x+2;i++)
	if(i<10&&i>-1)
	    inku[i][y]++;
    for(int i=y-1;i<y+2;i++)
	if(i<10&&i>-1)
	    inku[x][i]++;
    inku[x][y]--;
}

static void chu(int x, int y,int[][] inku){
    for(int i=x-1;i<x+2;i++)
	for(int j=y-1;j<y+2;j++)
	    if(i<10&&i>-1&&j<10&&j>-1)
		inku[i][j]++;
}
static void dai(int x,int y,int[][] inku){
    chu(x,y,inku);
    if(x+2<10&&x+2>-1)
	inku[x+2][y]++;
    if(x-2<10&&x-2>-1)
	inku[x-2][y]++;
    if(y+2<10&&y+2>-1)
	inku[x][y+2]++;
    if(y-2<10&&y-2>-1)
	inku[x][y-2]++;
}


    
    public static void main(String[] args)throws IOException{
	InputStreamReader isr = new InputStreamReader(System.in);
	BufferedReader br = new BufferedReader(isr);
	int[][] inku = new int[10][10];
	String line ;
	int cnt=0,max=0;
	while((line=br.readLine())!=null){
	    StringTokenizer st = new StringTokenizer(line,",");
	    int x=Integer.parseInt(st.nextToken());
	    int y =Integer.parseInt(st.nextToken());
	    int size = Integer.parseInt(st.nextToken());
	    if(size==1)
		sho(x,y,inku);
	    if(size==2)
		chu(x,y,inku);
	    if(size==3)
		dai(x,y,inku);
	}
	for(int i=0;i<10;i++){
	    for(int j=0;j<10;j++){
		if(inku[i][j]==0)
		    cnt++;
		if(inku[i][j]>max)
		    max=inku[i][j];
	    }
	}
	System.out.println(cnt);
	System.out.println(max);
    }
}
    

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

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

  int count[30] = {0};
  for(int i=0; i<S.size(); i++) count[S[i]-97]++;

  int i;
  for(i=0; i<26; i++)
    if(count[i]==0) {
      cout<<(char)(i+97)<<endl;
      break;
    }
  if(i==26) cout<<"None"<<endl;
}


Measured memory_bytes: 512
#include<stdio.h>

int main(){
  int N,i,j,k,A[100],a,min,count=0;
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);
  for(i=0;i<N;i++){
    min=i;
    
    for(j=i;j<N;j++){
      if(A[j]<A[min]) min=j;	
    }
       
    if(min!=i){
      a=A[i];
      A[i]=A[min];
      A[min]=a;
      count++;
    }
  }
 
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1) printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5+10;
char s[maxn];
int e[maxn], w[maxn];
int getw(int x, int n) {
	if (x==0) return 0;
	return 0;
}
int main() {
	int n = 0;
	scanf("%d", &n);
	scanf("%s", s);
	w[0] = (s[0] == 'W'); 
	for(int i=1;i<n;i++) {
		w[i] = w[i-1] + (s[i] == 'W'); 
	}
	e[n] = 0;
	for(int i=n-1;i>=0;i--) {
		e[i] = e[i+1] + (s[i] == 'E');
	}
	int res = 0;
	res = e[1];
	for(int i=1;i<n;i++) {
		//printf("%d %d\n" , w[i-1] , e[i+1]);
		res = min(res, w[i-1] + e[i+1]);
	}
	printf("%d", res);
	
}


Measured memory_bytes: 2944
n = gets.to_i
	
	n.times{
	
	date = gets
	date = date.split
	
	date[0] = date[0].to_i
	date[1] = date[1].to_i
	date[2] = date[2].to_i
	
	if (date[0]**2) == (date[1]**2)+(date[2]**2) then puts "YES"
	elsif  (date[1]**2) == (date[0]**2)+(date[2]**2) then puts "YES"
	elsif (date[2]**2) == (date[1]**2)+(date[0]**2) then puts "YES"
	else puts "NO" end
	}

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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

const long long MAX = 110000;
long long N;
vector<long long> x, y;

long long solve() {
    UnionFind uf(MAX * 2);
    x.resize(N); y.resize(N);
    for (int i = 0; i < N; ++i) cin >> x[i] >> y[i], uf.merge(x[i], y[i] + MAX);

    // 連結成分ごとに、左ノードと右ノードの個数を数える
    map<int, long long> mx, my;
    for (int i = 0; i < MAX; ++i) mx[uf.root(i)]++;
    for (int i = MAX; i < MAX*2; ++i) my[uf.root(i)]++;
    long long res = 0;
    for (int r = 0; r < MAX*2; ++r) res += mx[r] * my[r];
    return res - N;
}

int main() {
    cin >> N;
    cout << solve() << endl;
}

Measured memory_bytes: 30208
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<iterator>
#include<set>
#include<queue>

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

using namespace std;


int main(){
	string s; cin >> s;
	rep(i,12){
		cout << s[i];
		if(i == 3)
			cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
N=int(input().strip())
xyh=[]
for i in range(N):
    xi,yi,hi = map(int, input().split(' '))
    xyh.append([xi,yi,hi])
    if hi>=1:
        xyhset=[xi,yi,hi]
        
for nx in range(101):
    for ny in range(101):
        He = xyhset[2]+abs(xyhset[0]-nx)+abs(xyhset[1]-ny)
        He=max(0,He)
        flag=True
        for i in range(N):
            h=He-abs(xyh[i][0]-nx)-abs(xyh[i][1]-ny)
            h=max(0,h)
            if xyh[i][2]!=h:
                flag=False
        if flag:
            ax=nx
            ay=ny
            ah=He

print("{} {} {}".format(ax,ay,ah))

Measured memory_bytes: 3064
import math

n = int(input())
tl = list(int(input()) for _ in range(n))

if n == 1:
    print(tl[0])
else:
    ans = tl[0]
    for i in range(1, n):
        ans = ans//math.gcd(ans, tl[i])*tl[i]

    print(ans)

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(void){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; ++i){
    cin >> a[i];
  }
  sort(a, a + N, greater<int>());
  int ans = 0;
  for(int i = 0; i < N; ++i){
    ans += pow(-1, i)*a[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.awt.List;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	void solve()
	{
			out.println(Math.round((ni()+ni())/2.0));
		
	}
	
	
	
	
	
	
				
	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception 
	{ new Main().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try 
			{ lenbuf = is.read(inbuf); } 
			catch (IOException e) 
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip() 
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() 
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private static void tr(Object... o) 
	{ System.out.println(Arrays.deepToString(o)); }
}


Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string str;
int main() {
	int sol = 0;
	int length = 0;
	cin >> str;
	for (char ch : str) {
		if (ch == 'A' || ch == 'T' || ch == 'C' || ch == 'G') {
			length++;
			sol = max(length, sol);
		}
		else {
			length = 0;
		}
	}
	cout << sol << endl;
}

Measured memory_bytes: 256
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
x, y = map(int, input().split())
if x == y:
    print("Yes")
elif a.count(x) > 0 and a.count(y) > 0:
    print("Yes")
elif b.count(x) > 0 and b.count(y) > 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
import java.util.*;

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

		int n = Integer.parseInt(sc.nextLine());
		long m = (long)Math.pow(10,9)+7;

		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[Integer.parseInt(sc.next())] += 1;
		}

		if (n%2==0){
			for (int i = 0; i < n; i++) {
				if ((i%2== 1 && a[i] != 2) || (i%2== 0 && a[i] != 0)){
					System.out.println(0);
					return;
				}
			}
			int ans = 1;
			for (int i=0; i<n/2; i++){
				ans *= 2;
				ans %= m;
			}
			System.out.println(ans);


		}else {
			if (a[0] != 1){
				System.out.println(0);
				return;
			}
			for (int i = 1; i < n; i++) {
				if ((i%2== 0 && a[i] != 2) || (i%2== 1 && a[i] != 0)){
					System.out.println(0);
					return;
				}
			}
			int ans = 1;
			for (int i=0; i<(n-1)/2; i++){
				ans *= 2;
				ans %= m;
			}
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 49036
#include<stdio.h>

int main()
  {
    int a1, a2, a3;
  scanf("%d %d %d", &a1, &a2, &a3);
  
  if(a1+a2+a3 >= 22)
    printf("bust");
  else
    printf("win");
  
  return 0;
}

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

int main()
{
    int s;
    int count = 0, i;
    
    cin >> s;
    
    for(i = 0; i < 3; i++) {
        if((s % 10) == 1) {
            count++;
        }
        s = s / 10;
    }
    
    cout << count << "\n";
    
    return 0;
}

Measured memory_bytes: 256
/**
  @file c.cpp
  @title D - Megalomania
  @brief https://atcoder.jp/contests/abc131/tasks/abc131_d
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()

template <class T>
void show(vector<T>& v) {
  for (uint i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << "\n";
}

template <class T1, class T2>
void show(vector<pair<T1, T2>>& v, int x) {
  if (x == 1) {
    for (uint i = 0; i < v.size(); i++) {
      cout << v[i].first << "\t";
    }
  } else if (x == 2) {
    for (uint i = 0; i < v.size(); i++) {
      cout << v[i].second << "\t";
    }
  } else {
    cout << "Wrong Argument";
  }
  cout << "\n";
}

bool compare_by_second(pair<LL, LL> a, pair<LL, LL> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

int main() {
  int N;
  cin >> N;
  vector<pair<LL, LL>> AB(N);
  LL tmpA, tmpB;
  for (int i = 0; i < N; i++) {
    cin >> tmpA >> tmpB;
    AB[i] = make_pair(tmpB, tmpA);
  }

  // for debug
  // cout << "Before Sort" << endl;
  // show(AB, 1);
  // show(AB, 2);
  // cout << endl;

  sort(ALL(AB));

  // for debug
  // cout << "After Sort" << endl;
  // show(AB, 1);
  // show(AB, 2);

  LL time = 0;
  for (int i = 0; i < N; i++) {
    time += AB[i].second;
    if (time > AB[i].first) {
      cout << "No" << endl;
      exit(0);
    } else {
      //do nothing
      // cout << i << " "; // for debug
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3328
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();

        Set<Integer> set = new HashSet<Integer>();
        for (int i = 2; i * i <= X; ++i) set.add(i);

        int max = 1;
        for (Integer i : set) {
            for (int j = i * i; j <= X; j *= i) {
                max = Math.max(max, j);
            }
        }

        System.out.println(max);

        return;
    }

}


Measured memory_bytes: 23892
#include<stdio.h>
#define MAX 2000000

int main(){
  
  int n;
  int i;
  int A[MAX];


  scanf("%d", &n);

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

  for ( i = 1; i <= n; i++ ) {
    
    printf("node %d: key = %d, ", i, A[i]);
    
    if ( i / 2 >= 1 )printf("parent key = %d, ", A[i/2]);
    if ( i*2 <= n ) printf("left key = %d, ", A[i*2]);
    if ( i*2+1 <= n ) printf("right key = %d, ", A[i*2+1]);

    printf("\n");
  }
  
  return 0;
}

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

int main(void){
    int n,m;
    cin >> n >> m;
    vector<int> vec(n,-1);   //k桁目をvec[k-1]に格納
    for(int i=0;i<m;i++){
        int s,c;
        cin >> s >> c;
        if(vec[s-1]!=-1 && vec[s-1]!=c){
            cout << -1 << endl;
            return 0;
        }else{
            vec[s-1] = c;
        }
    }


    if(vec[0]==0 && n!=1){cout<<-1<<endl; return 0;}

    if(vec[0]==-1){
        if(n==1) vec[0] = 0;
        else vec[0] = 1;
    }
    int ans = vec[0];
    for(int i=1;i<n;i++){
        if(vec[i]==-1) vec[i] = 0;
        ans *= 10;
        ans += vec[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
}

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int solve(){
    if(N==2){cout << 1 << endl; return 0;}
    auto div = divisor(N);
    DBG(div)
    int ans=0;
    for(auto p:div) {
        ll x=N;
        while(x%p==0) {x/=p;}
        if(x%p==1) {ans++;DBG(p)}
        }
    auto div2 = divisor(N-1);
    DBG(div2)
    ans += div2.size();
    ans += 2;
    cout << ans << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define inf std::numeric_limits<int>().max()

int main() {
	string s;
	int k;
	cin >> k >> s;
	if (s.size() <= k) cout << s << endl;
	else {
		string t;
		for(int j=0; j<k; j++) t += s[j];
		t += "...";
		cout << t << endl;
	}

}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;


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


const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

using ll=long long;
const ll inf=1LL<<40;

int R,C;

ll weight[200010];
int visited[200010];


using edge=struct{int to;ll cost;};
using G=vector<vector<edge>>;

//Appropriately Changed
void add_edge(G &graph,int from,int to,ll cost){ 
	graph[from].push_back({to,cost});
	graph[to].push_back({from,cost});
}

using state=tuple<int,ll>;

ll r[100010],c[100010],a[100010];

bool ok=true;

void dfs(const G& graph,int v,int val,int com){
	weight[v]=val;
	visited[v]=com;
	for(auto &e:graph[v]){
		if(visited[e.to]!=-1) 
			ok&=(weight[e.to]==e.cost-val);
		else
			dfs(graph,e.to,e.cost-val,com);
	}
}

ll rmin[200010],cmin[200010];

signed  main(void){
	cin >> R >> C;
	
	G graph(R+C);

	int n;
	cin >> n;
	rep(i,n){
		cin >> r[i] >> c[i] >> a[i];
		r[i]--,c[i]--;
		add_edge(graph,r[i],R+c[i],a[i]);		
	}



	fill(visited,visited+R+C,-1);
	int k=0;

	//cout << "OK" << endl;
	rep(v,R+C) if(visited[v]==-1) dfs(graph,v,0,k++);	
	//cout << "OK" << endl;

	rep(i,k) rmin[i]=cmin[i]=inf;

	rep(v,R+C){
		int com=visited[v];
		if(v<R)
			chmin(rmin[com],weight[v]);
		else
			chmin(cmin[com],weight[v]);
	}

	rep(i,k) if(rmin[i]+cmin[i]<0) ok=false;

	if(ok)
		puts("Yes");
	else
		puts("No");

	return 0;
}

Measured memory_bytes: 22656
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    r = 0

    if a[-1] > t[-1] or a[0] < t[0]:
        return 0

    for i in range(1,n):
        if (t[i-1] < t[i] and t[i] > a[i]) or t[i] < t[i-1]:
            return 0

    for i in range(n-2,-1,-1):
        if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
            return 0

    r = 1
    for i in range(1,n-1):
        if t[i] != t[i-1] or a[i] != a[i+1]:
            continue
        if t[i] < a[i]:
            r = r * t[i] % mod
        else:
            r = r * a[i] % mod

    return r


print(f())


Measured memory_bytes: 21628