akhauriyash/Code-Regression huggingface dataset:
//problem:agc034_e
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

/*  ------  by:duyi  ------  */ // myt天下第一
const int MAXN=2000,INF=1e9;
int n,s[MAXN+5],num[MAXN+5],f[MAXN+5];
char str[MAXN+5];
vector<int>G[MAXN+5];
void dfs(int u,int fa){
	int son=0;
	s[u]=0;num[u]=(str[u]=='1');
	for(int i=0;i<(int)G[u].size();++i){
		int v=G[u][i];
		if(v==fa)continue;
		dfs(v,u);
		num[u]+=num[v];
		s[v]+=num[v];
		s[u]+=s[v];
		if(!son||s[v]>s[son]){
			son=v;
		}
	}
	if(!son){f[u]=0;return;}
	
	if(s[son]<=s[u]-s[son]){
		f[u]=s[u]/2;
	}
	else{
		f[u]=s[u]-s[son]+min(f[son],(s[u]-(s[u]-s[son]))/2);
	}
}
int main() {
	scanf("%d%s",&n,str+1);
	for(int i=1,u,v;i<n;++i)scanf("%d%d",&u,&v),G[u].pb(v),G[v].pb(u);
	int ans=INF;
	for(int rt=1;rt<=n;++rt){
		dfs(rt,0);
		if(s[rt]&1)continue;
		if(f[rt]>=s[rt]/2){
			ans=min(ans,s[rt]/2);
		}
	}
	if(ans==INF)puts("-1");
	else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int n;
vector<string> s;

int dfs(int &i, int lev) {
    if (isdigit(s[i][lev])) {
        return s[i++][lev] - '0';
    } else if (s[i][lev] == '+') {
        ++i;
        int res = 0;
        while (i < n && s[i].size() == lev + 2) {
            res += dfs(i, lev + 1);
        }
        return res;
    } else {
        ++i;
        int res = 1;
        while (i < n && s[i].size() == lev + 2) {
            res *= dfs(i, lev + 1);
        }
        return res;
    }
}

void _main() {
    while (cin >> n, n) {
        s.resize(n);
        REP (i, n) cin >> s[i];
        int i = 0;
        cout << dfs(i, 0) << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


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

def gcd(x, y):
    if x < y:
        x, y = y, x
    if x % y == 0:
        return y
    else:
        return gcd(y, x%y)

def prime(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    else:
        for i in range(2, int(n**(1/2))+1):
            if n % i == 0:
                return i
        return n

def div(n):
    divs = []
    tmp = n
    while True:
        if tmp == 1:
            return divs
        ret = prime(tmp)
        if ret != 0:
            divs.append(ret)
            tmp = tmp // ret
        else:
            divs.append(ret)
            break

g = gcd(a, b)
print(len(set(div(g)))+1)

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

int main(){
	int r;
  	cin >> r;
  	cout << 3*r*r << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
class segment_():
    def __init__(self,n,ide_ele,segfunc):
        self.ide_ele = ide_ele
        self.num = 1 << n.bit_length()
        self.seg = [self.ide_ele] * 2 * self.num
        self.segfunc = segfunc

    def update1(self, k):
        k += self.num
        self.seg[k] += 1
        while k:
            k >>= 1
            self.seg[k] = self.segfunc(self.seg[k * 2], self.seg[k * 2 + 1])

    def query(self, p, q):
        if q < p:
            return self.ide_ele
        p += self.num;
        q += self.num
        res = self.ide_ele
        while p < q:
            if p & 1 == 1:
                res = self.segfunc(res, self.seg[p])
                p += 1
            if q & 1 == 1:
                q -= 1
                res = self.segfunc(res, self.seg[q])
            p >>= 1;
            q >>= 1
        return res
      
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter

N,M,Q = map(int,readline().split())
S = segment_(N,0,lambda a, b: a+b)
chk = []
for i in range(M):
  L,R = map(int,readline().split())
  chk.append((1,L,R,i))
for i in range(Q):
  l,r = map(int,readline().split())
  chk.append((2,l,r,i))
  
chk.sort(key=itemgetter(2))
ans = [0]*Q
for a,l,r,i in chk:
  if a == 1:
    S.update1(l)
  else:
    ans[i] = S.query(l,r+1)
    
for i in ans:
  print(i)

Measured memory_bytes: 53416
let to_array s =
  Str.split (Str.regexp_string " ") s
  |> List.map int_of_string;;

let _ = read_int () and
    s = read_line () |> to_array and
    _ = read_int () and
    t = read_line () |> to_array in
    let count = List.fold_left (fun x y -> x + (if (List.exists (fun i -> if i = y then true else false) s) then 1 else 0) ) 0 t in
    Printf.printf "%d\n" count
;;

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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	for (int i = 0; i < (tx - sx); i++) {
		cout << "R";
	}
	for (int i = 0; i < (ty - sy); i++) {
		cout << "U";
	}
	for (int i = 0; i < (tx - sx); i++) {
		cout << "L";
	}
	for (int i = 0; i < (ty - sy); i++) {
		cout << "D";
	}
	cout << "D";
	for (int i = 0; i <= (tx - sx); i++) {
		cout << "R";
	}
	for (int i = 0; i <= (ty - sy); i++) {
		cout << "U";
	}
	cout << "LU";
	for (int i = 0; i <= (tx - sx); i++) {
		cout << "L";
	}
	for (int i = 0; i <= (ty - sy); i++) {
		cout << "D";
	}
	cout << "R";
	return 0;
}

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

int main (void){
  int a,b,c,ans;

  cin >> a >> b >> c;

  if(b/a > c){
    ans = c;
  }else{
    ans = b/a;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3632
def f_lcs(S, T):
    """
    文字列s, tが与えられる。sの部分列かつtの部分列であるような文字列のうち、
    最長のものを1つ求めよ。文字列xの部分列とは、xから0個以上の文字を除いたあと、
    残りの文字を元の順序で連結して得られる文字列のことである。
    """
    # 参考: https://qiita.com/drken/items/03c7db44ccd27820ea0d
    from itertools import product

    # dp[i+1][j+1]: sのi文字目までとtのj文字目まで見たときにできる
    # Longest Common Subsequence (LCS) の長さ
    dp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
    for i, j in product(range(len(S)), range(len(T))):
        # もし s_i = t_j なら、dp[i][j] から作れるLCSに対し、 s_i(t_jも同じ) を
        # 加えることで、それまでより長いLCSを作りうる
        if S[i] == T[j]:
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
        else:
            # dp[i+1][j] に対して、tのj文字目を見てもLCSの長さは不変。
            # なぜなら、もし、sのi文字目とtのj-1文字目が等しいなら、それらを
            # LCSに加えてしまっているのでsのi文字目とtのj文字目とではLCSの候補にできない。
            # つまり、 dp[i+1][j+1]=dp[i+1][j] である。
            # 逆に、等しくないなら、 sのi文字目とtのj文字目から新たなLCSを作りうるが、これは単に
            # dp[i+1][j+1] の値である。結局、配列の2つの要素のうち小さくない方を選べばいい。
            # 同じく、 dp[i][j+1] に対して、sのi文字目を見てもLCSの長さは不変。
            # これらの事実を反映したのが下の式。
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j], dp[i][j + 1])

    ans = ''
    # DPテーブルから、現時点で見ているノードがどのノードから遷移してきたかを
    # 特定することでLCSの文字列を復元する
    i, j = len(S), len(T)
    while i > 0 and j > 0:
        if dp[i][j] == dp[i - 1][j]:
            i -= 1  # (i-1, j) -> (i, j) と遷移していた
        elif dp[i][j] == dp[i][j - 1]:
            j -= 1  # (i, j-1) -> (i, j) と遷移していた
        else:
            # (i-1, j-1) -> (i, j) と遷移していた
            ans += S[i - 1]  # T[j-1]でも(同じ文字なので)構わない
            i -= 1
            j -= 1
    return ans[::-1]  # DPテーブルの末尾から走査する都合上、解が逆さになる

S = input()
T = input()
print(f_lcs(S, T))

Measured memory_bytes: 112860
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7

d = [0]*(n+1)
for x in a:
    d[x] += 1
ans = 1
if n%2 == 0:
    sw = 1
    for i,x in enumerate(d):
        if i%2 != 0:
            if x == 2:
                ans *= 2
                ans %= mod
            else:
                sw = 0
                break
        else:
            if x != 0:
                sw = 0
                break
else:
    sw = 1
    for i,x in enumerate(d):
        if i%2 == 0:
            if i == 0:
                if x != 1:
                    sw = 0
                    break
            else:
                if x == 2:
                    ans *= 2
                    ans %= mod
                else:
                    sw = 0
                    break
        else:
            if x != 0:
                sw = 0
                break
if sw == 0:
    ans = 0
print(ans)
        

Measured memory_bytes: 20376
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <sstream>
#include <numeric>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi>
#define vs vector<string>
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define fs first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
int main() {
    ll N,W;
    cin>>N>>W;
    vvi dp(N+1,vi(W+1));
    vi wt(N);
    vi val(N);
    for(ll i=0;i<N;i++){
        cin>>wt[i]>>val[i];
    }
    for(ll i=0;i<=N;i++){
        for(ll j=0;j<=W;j++){
            if(i==0 || j==0){
                dp[i][j] = 0;
            }
            else if(wt[i-1]<=j){
                dp[i][j] = max(dp[i-1][j-wt[i-1]]+val[i-1],dp[i-1][j]);
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout<<dp[N][W]<<endl;

}




Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

ll dp[200010] = {};

signed main()
{
    ll n;
    cin >> n;
    vector<vector<ll>> v(200010, vector<ll>(0));
    vector<PL> k(0);
    rep(i, n)
    {
        ll x;
        cin >> x;
        v[x].pb(i);
    }

    repi(i, 1, 200001)
    {
        rep(j, siz(v[i]) - 1)
        {
            if (v[i][j + 1] - v[i][j] > 1)
            {
                k.emplace_back(v[i][j], v[i][j + 1]);
            }
        }
    }

    sort(all(k));

    dp[0] = 1;

    ll ind=0;
    rep(i, n)
    {
        while(ind <siz(k) && k[ind].fi<=i){
            dp[k[ind].se]+=dp[k[ind].fi];
            dp[k[ind].se]%=mod;
            ind++;
        }
        dp[i+1]+=dp[i];
        dp[i+1]%=mod;
        
    }

    cout<<dp[n-1]%mod<<endl;
}

Measured memory_bytes: 14836
#include <iostream>
#include <algorithm>

using namespace std;

int n, sum = 0, big = -1, i;

int main(){
    cin >> n;
    int arr[n];
    for(i = 0; i < n; i++){
        cin >> arr[i];
        if(arr[i] > big){
            big = arr[i];
        }
    }
    sort(arr, arr+n);
    for(i = 0; i < n-1; i++){
        sum += arr[i];
    }

    if(arr[n-1] < sum){
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int x = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(Math.abs(x - a) < Math.abs(x - b) ? "A" : "B");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 21332
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  ll n;cin >> n;
  ll ans = 1,a;

  rep(i,n)
  {
    cin >> a;
    if(a % 2 == 1)
    {
      ans = ans * 1;
    }
    else
    {
      ans = ans * 2;
    }
  }

  cout << pow(3,n) - ans << endl;



  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int A[101];
int swap_cnt = 0;

void bubbleSort(int A[], int N) {
    bool flag = 1;
    while(flag) {
        flag = 0;
        for(int j = N-1; j >= 1; j--) {
            if(A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                swap_cnt++;
                flag = 1;
            }
        }
    }
}

int main() {
    int N; cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    bubbleSort(A, N);

    for(int i = 0; i < N; i++) {
        if(i < N-1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }

    cout << swap_cnt << endl;

}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    lint n, x;
    cin >> n >> x;

    vector<lint> a(n);
    rep(i, n){
        cin >> a[i];
    }

    lint ans = 0;
    REP(i, 1, n){
        if(a[i] + a[i - 1] > x){
            lint t = a[i] + a[i - 1] - x;
            ans += t;
            if(a[i] >= t){
                a[i] -= t;
            }else{
                a[i] = 0;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import combinations
    from operator import itemgetter
    n, k = map(int, readline().split())
    points = [list(map(int, readline().split())) for _ in range(n)]

    points.sort(key=itemgetter(0))
    for i in range(n):
        points[i].append(i)
    points.sort(key=itemgetter(1))
    for i in range(n):
        points[i].append(i)

    points.sort(key=itemgetter(2))

    ans = INF

    for first, last in combinations(range(n), 2):
        if (last - first + 1) < k:
            continue
        for p, q in combinations(range(first, last + 1), 2):
            gn = max(points[p][3],points[q][3])
            ln = min(points[p][3],points[q][3])
            count = 0

            for x, y, xn, yn in points:
                if first <= xn <= last and ln <= yn <= gn:
                    count += 1
            if count >= k:
                width = abs(points[last][0] - points[first][0])
                height = abs(points[p][1] - points[q][1])
                area = width * height
                ans = min(ans, area)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 69264
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(all(a));
    int sum = a[0], ans = 1;
    for(int i = 1; i < n; ++i) {
        if(2 * sum >= a[i]) {
            ++ ans;
            sum += a[i];
        } else {
            ans = 1;
            sum += a[i];
        }
        //cerr << ans << " " << sum << endl;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	int F=0;
	int A0, A1;
	int S=1;
	cin >>A0;
	for (int i=1; i<N; i++) {
		cin >>A1;
		if (0==F) {
			if (A1>A0)
				F=1;
			else if (A1<A0)
				F=-1;
			else
				F=0;
		} else if (1==F) {
			if (A1<A0) {
				F=0;
				S++;
			}
		} else if (-1==F) {
			if (A1>A0) {
				F=0;
				S++;
			}
		}
		A0=A1;
	}
	cout << S << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int x, a, b;
  cin >> x >> a >> b;
  if(b - a <= 0) cout << "delicious" << endl;
  if(b - a >= x + 1) cout << "dangerous" << endl;
  if(0 < b - a and b - a <= x) cout << "safe" << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	s := sc.Text()
	x, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}
	return x
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		x := nextInt(sc)
		as[i] = x
	}
	var gs []int
	for i := n; i > 0; i = i / 2 {
		g := 3*i + 1
		if g <= n {
			gs = append(gs, 3*i+1)
		}
	}
	gs = append(gs, 1)
	fmt.Println(len(gs))
	printArray(gs)
	for _, g := range gs {
		insertionSort(as, n, g)
	}
	fmt.Println(cnt)
	for _, a := range as {
		fmt.Println(a)
	}
}

func printArray(as []int) {
	fmt.Println(strings.Trim(fmt.Sprint(as), "[]"))
}

var cnt = 0

func insertionSort(as []int, n int, g int) {
	//fmt.Printf("insertionSort n=%d, g=%d\n", n, g)
	for i := g; i < n; i++ {
		v := as[i]
		j := i - g
		for j >= 0 && as[j] > v {
			as[j+g] = as[j]
			j = j - g
			cnt++
		}
		as[j+g] = v
	}
}



Measured memory_bytes: 17464
/*
  author:@bhaskar_8998
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef vector<i64> vi;
typedef pair<int,int>ii;
typedef vector<ii> vii;
typedef map<int,int> mi;
#define all(A) (A).begin(),(A).end()
#define pb push_back
#define MOD 1000000007
#define ff first
#define ss second
#define deb(x) cerr<<#x<<" "<<x<<"\n";
#define fastio() {ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    fastio();
    clock_t beg=clock();
    int t=1;
    // cin>>t;
    while(t--){
      int n;
      cin>>n;
      map<string,int> m;
      m.clear();
      for(int i=0;i<n;i++){
        string s;
        cin>>s;
        m[s]+=1;
      }

      cout<<"AC x "<<m["AC"]<<"\nWA x "<<m["WA"]<<"\nTLE x "<<m["TLE"]<<"\nRE x "<<m["RE"];

        
    }
    clock_t end=clock(); 
    fprintf(stderr, "\n%lf sec\n", (double)(end-beg)/(CLOCKS_PER_SEC));
    return 0;
}


  

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

main(){
  int n;
  cin >> n;
  if((n-n%100)/100==1)cout << 9;
  else if((n-n%100)/100==9)cout << 1;
  else cout << (n-n%100)/100;
  n%=100;
  if(n/10==1)cout << 9;
  else if(n/10==9)cout << 1;
  else cout << n/10;
  n%=10;
  if(n==1)cout << 9;
  else if(n==9)cout << 1;
  else cout << n;
  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 9223372036854775807
int main(){
  int A,B;
  cin >> A >> B;
  for(int i=1 ;i<=1000;i++){
    int temp1 = i*0.08;
    int temp2 = i*0.1;
    if(temp1==A && temp2==B){
      cout << i;
      return 0;
    }
  }
  cout << -1;
}

Measured memory_bytes: 256
use std::cmp::min;

fn main() {
    let input_line: Vec<u32> = read_vec();
    let n = input_line[0];
    let a = input_line[1];
    let b = input_line[2];
    let c = input_line[3];
    let d = input_line[4];

    let mut n_x = n / a;
    let mut n_y = n / c;
    let r_x = n - n_x * a;
    let r_y = n - n_y * c;
    if r_x != 0 {
        n_x = n_x + 1;
    }
    if r_y != 0 {
        n_y = n_y + 1;
    }
    println!("{}", min(n_x * b, n_y * d));
}

// https://qiita.com/penguinshunya/items/cd96803b74635aebefd6
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


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

int dp[100001];

int solve(int k, int a[], int n) {
	if(k < a[0]) return 0;
	if(dp[k] != -1) return dp[k];
	int res = 1;
	for(int i = 0; i < n; ++i) {
		if(a[i] > k) break;
		res = res & solve(k - a[i], a, n);
	}	
	return dp[k] = 1 ^ res;
}

int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n, k;
	cin >> n >> k;
	int a[n];
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n);
	memset(dp, -1, sizeof dp);
	if(solve(k, a, n)) {
		cout << "First";
	}
	else {
		cout<<"Second";
	}
	return 0;
}

Measured memory_bytes: 10216
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

const int INF = 100000000;
const double EPS = 1e-10;

int main(){
	while(1){
		int n, h;
		cin >> n >> h;
		if(!n && !h) break;
		set<pair<int, P> > hole; //x, y, z
		rep(i, h){
			string s;
			cin >> s;
			if(s == "xy"){
				int x, y;
				cin >> x >> y;
				for(int j = 1; j <= n; j++){
					hole.insert(MP(x,MP(y,j)));
				}
			}
			else if(s == "xz"){
				int x, z;
				cin >> x >> z;
				for(int j = 1; j <= n; j++){
					hole.insert(MP(x,MP(j,z)));
				}
			}
			else if(s == "yz"){
				int y, z;
				cin >> y >> z;
				for(int j = 1; j <= n; j++){
					hole.insert(MP(j,MP(y,z)));
				}
			}
		}
		int cnt = n*n*n - hole.size();
		cout << cnt << endl;
	}

	return 0;
}

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

using namespace std;

class BIT {
    int N;
    vector<int> data;
public:
    BIT(const int n) {
        N = n;
        data = vector<int>(n + 1);
    };

    void add(int i, int x) {
        while (i <= N) {
            data[i] += x;
            i += i & -i;
        }
    };

    int sum(int i) {
        int s = 0;
        while (i > 0) {
            s += data[i];
            i -= i & -i;
        }
        return s;
    }
};

int main() {
    int N, Q;
    string S;
    cin >> N;
    cin >> S;
    cin >> Q;
    string q1, q2, q3;
    vector<BIT> bits = vector<BIT>();
    for (char c = 'a'; c <= 'z'; c++){
        bits.push_back(BIT(N));
    };
    for (int i = 0; i < N; i++){
        bits[S[i] - 'a'].add(i + 1, 1);
    }

    for (int i = 0; i < Q; i++){
        cin >> q1 >> q2 >> q3;
        if (q1 == "1"){
            int i = stoi(q2);
            char c = q3[0];
            bits[S[i-1] - 'a'].add(i, -1);
            bits[c - 'a'].add(i, 1);
            S[i-1] = c;
        }else {
            int ans = 0;
            int l = stoi(q2);
            int r = stoi(q3);
            for (char c = 'a'; c <= 'z'; c++) {
                if (bits[c - 'a'].sum(r) - bits[c - 'a'].sum(l - 1) > 0) {
                    ans += 1;
                }
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 51716
#include <iostream>
#include <iomanip>
#include <cmath>


using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1e-9;


struct Vector {
    double x, y;
    Vector() {}
    Vector(double x, double y): x(x), y(y) {}
};

bool equal(double x, double y) {
    return abs(y - x) < EPS;
}

double cross(double x1, double y1, double x2, double y2) {
    return x1 * y2 - x2 * y1;
}
double cross(Vector& a, Vector& b) {
    return a.x * b.y - b.x * a.y;
}

double dot(double x1, double y1, double x2, double y2) {
    return x1 * x2 + y1 * y2;
}
double dot(Vector& a, Vector& b) {
    return a.x * b.x + a.y * b.y;
}

double dist(double x1, double y1, double x2, double y2) {
    return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
double dist(Vector& a, Vector& b) {
    return sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));
}
double dist2(Vector& a, Vector& b) {
    return (b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y);
}


double distance_between_segment_and_point(Vector& p1, Vector& p2, Vector& q) {
    Vector pp, pq;
    pp.x = p2.x - p1.x; pp.y = p2.y - p1.y;
    pq.x = q.x - p1.x; pq.y = q.y - p1.y;
    double dotpq = dot(pp, pq);
    double lenp = dist(p1, p2);
    double lenpq = dist(p1, q);
    if (dotpq <= 0.0) {
        return lenpq;
    }
    else if (dotpq < dot(pp, pp)) {
        double dpr = dotpq / lenp;
        return sqrt(lenpq * lenpq - dpr * dpr);
    }
    return dist(p2, q);
}

double distance_between_2_line_segments(Vector& p1, Vector& p2, Vector& q1, Vector& q2) {
    double lenp, lenq;
    lenp = dist(p1, p2);
    lenq = dist(q1, q2);

    // some segments have 0 length
    if (equal(lenp, 0) && equal(lenq, 0)) {
        return dist(p1, q1);
    }
    else if (equal(lenp, 0)) {
        return distance_between_segment_and_point(q1, q2, p1);
    }
    else if (equal(lenq, 0)) {
        return distance_between_segment_and_point(p1, p2, q1);
    }

    // if two segments is crossing..
    Vector pp(p2.x - p1.x, p2.y - p1.y), qq(q2.x - q1.x, q2.y - q1.y);
    double crossq, crossp;
    crossq = cross(pp.x, pp.y, q1.x - p1.x, q1.y - p1.y) * cross(pp.x, pp.y, q2.x - p1.x, q2.y - p1.y);
    crossp = cross(qq.x, qq.y, p1.x - q1.x, p1.y - q1.y) * cross(qq.x, qq.y, p2.x - q1.x, p2.y - q1.y);
    if (crossq < 0 && crossp < 0) {
        return 0.0;
    }

    double d1, d2, d3, d4;
    d1 = distance_between_segment_and_point(p1, p2, q1);
    d2 = distance_between_segment_and_point(p1, p2, q2);
    d3 = distance_between_segment_and_point(q1, q2, p1);
    d4 = distance_between_segment_and_point(q1, q2, p2);

    return min(min(d1, d2), min(d3, d4));
}


int main() {
    int N;
    Vector p1, p2, q1, q2;
    cin >> N;
    cout << fixed << setprecision(10);

    for (int i = 0; i < N; i++) {
        cin >> p1.x >> p1.y >> p2.x >> p2.y >> q1.x >> q1.y >> q2.x >> q2.y;
        cout << distance_between_2_line_segments(p1, p2, q1, q2) << endl;
    }

    return 0;
}

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

int a[1001], cnt, sum;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    double judge = sum * (1 / (4 * m));
    for(int i = 0; i < n; i++){
        if(a[i] >= judge)    cnt++;
    }
    if(cnt >= m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }




    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	string S;
	cin >> S;
	int Z = S.size();
	if (Z < 4) {
		cout << "No" << endl;
	}
	else if (S[0] == 'Y' && S[1] == 'A' && S[2] == 'K' && S[3] == 'I') {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <limits>
#include <cmath>

using namespace std;

int main() {
	int A, B, C,X,Y;

	cin >> A >> B >> C >> X >> Y;
	
	int ans = numeric_limits<int>::max();
	int x, y, z = 0;
	while (X >= z/2 || Y >= z/2) {
		x = max(X - z / 2, 0);
		y = max(Y - z / 2, 0);
		ans = min(ans, A *x + B * y + C * z);
		z += 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}

static const ULLONG UL_HUGE_DIVIDER = 1000000007LLU;
static const LLONG LL_HUGE_DIVIDER = 1000000007LL;

//static void ABC111D_RobotArms();
static void ABC112B_TLE();

#if 1
int main()
{
	//ABC111D_RobotArms();
	ABC112B_TLE();
	fflush(stdout);
	return 0;
}
#endif

static void ABC112B_TLE()
{
	int N, T;
	scanf(" %d %d", &N, &T);

	std::vector<std::pair<int, int>> route(N);
	for (int i = 0; i < N; i++) {
		scanf(" %d %d", &route[i].first, &route[i].second);
	}

	int ans = 0;
	std::sort(route.begin(), route.end());
	for (auto it = route.begin(); it != route.end(); it++) {
		if (it->second <= T) {
			ans = it->first;
			break;
		}
	}

	if (!ans) printf("TLE\n");
	else printf("%d\n", ans);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextDouble();
		double b=sc.nextDouble();
		double n=sc.nextDouble();
		
		
		double x=Math.min(b-1,n);
		
		
		System.out.println((long)(Math.floor((a*x)/b)-a*Math.floor(x/b)));
		
		

		
	}
	
}


Measured memory_bytes: 37324
use std::cmp::Reverse;
use std::collections::BTreeMap;
use whiteread::parse_line;

fn main() {
    let n: u32 = parse_line().unwrap();
    let mut dic: BTreeMap<String, Vec<(u32, u32)>> = BTreeMap::new();

    for i in 1..=n {
        let (s, p): (String, u32) = parse_line().unwrap();
        dic.entry(s)
            .and_modify(|x| x.push((i, p)))
            .or_insert(vec![(i, p)]);
    }
    for (_, v) in dic.iter() {
        let mut v = v.clone();
        v.sort_by_key(|x| Reverse(x.1));
        let mut iter = v.iter();
        while let Some((i, _)) = iter.next() {
            println!("{}", i);
        }
    }
}


Measured memory_bytes: 2144
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int main()
{
	int n;
	scanf("%d", &n);
	
	int r = n % 1000;
	if (r == 0) {
		printf("0\n");
	} else {
		printf("%d\n", 1000 - r);
	}
	return 0;
}



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

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

using namespace std;

int main() {
	
	vector<int> DATA(5);
	cin >> DATA[0] >> DATA[1] >> DATA[2];
	SINT32 ans = 0;
	
	if (DATA[0] > DATA[1]) {
		if (DATA[0] > DATA[2]) {
			ans = DATA[0]* 10 + DATA[1] +DATA[2];
		} else {
			ans = DATA[2]* 10 + DATA[1] +DATA[0];
		}
	} else {
		if (DATA[1] > DATA[2]) {
			ans = DATA[1]* 10 + DATA[0] +DATA[2];
		} else {
			ans = DATA[2]* 10 + DATA[1] +DATA[0];
		}

	}

	

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

Measured memory_bytes: 256
num = int(input())
tmp = input()
A = int(tmp.split(' ')[0])
B = int(tmp.split(' ')[1])
ans_list = [0,0,0]

list = input().split(' ')

for i in list:
    if int(i)<=A:
        ans_list[0]+=1
    elif int(i)<=B:
        ans_list[1] += 1
    else:
        ans_list[2] += 1

print(min(ans_list))

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  ll dp[110][4][4][4];
  rep(i,4){
    rep(j,4){
      rep(k,4){
        dp[3][i][j][k]=1;
      }
    }
  }
  dp[3][0][1][2]=0;dp[3][0][2][1]=0;dp[3][1][0][2]=0;
  if(n==3){
    cout<<61<<endl;
    return 0;
  }
  for(ll s=3;s<=n-1;s++){
    rep(i,4){
      rep(j,4){
        rep(k,4){
          rep(l,4){
            if(j==0&&k==1&&l==2)continue;
            if(j==0&&k==2&&l==1)continue;
            if(j==1&&k==0&&l==2)continue;
            if(i==0&&k==1&&l==2)continue;
            if(i==0&&j==1&&l==2)continue;
            dp[s+1][j][k][l]+=dp[s][i][j][k];
            dp[s+1][j][k][l]%=MOD;
          }
        }
      }
    }
  }
  ll ans=0;
  rep(i,4){
    rep(j,4){
      rep(k,4){
        ans+=dp[n][i][j][k];
        ans%=MOD;
      }
    }
  }
  cout<<ans<<endl;
}
    

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    As = set([int(input()) for _ in range(m)])
    mod = 1000000007

    dp = [0] * (n + 1)
    dp[0] = 1
    if 1 not in As:
        dp[1] = 1

    for i in range(2, n+1):
        if i in As:
            continue
        dp[i] = dp[i-1] + dp[i-2]

    ans = dp[n] % mod
    print(ans)


if __name__ == "__main__":
    main()


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

int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	int ans=A[0];
	rep(i,N-1) ans=gcd(ans,A[i+1]);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3736
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/

/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&b==c) cout << 1 << endl;
    else if(a==b||b==c||c==a) cout << 2 << endl;
    else cout << 3 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
 
    public static void main(String[] args) {
         
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){ //??\??????????????????????????? ???????????£???????????????
        	int a=sc.nextInt();
        	int b=sc.nextInt();

        	int c=a+b;
        	int i = 1;
        	for(;;i++){
        		int d=c/10;
        		if(d==0)break;
        		c=d;
        
        	}
        	System.out.println(i); //?????????????????????
      
  
        } //???????????????????????£????????¨
    }
}

Measured memory_bytes: 20448
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

mod = 10**9 + 7
r1, c1, r2, c2 = map(int, input().split())
r2 += 1
c2 += 1
a1 = combination(r1+c1, r1)
a2 = combination(r2+c2, r2)
a3 = combination(r1+c2, r1)
a4 = combination(r2+c1, r2)
print((a1+a2-a3-a4)%mod)


Measured memory_bytes: 8980
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int w=nxt(),a=nxt(),b=nxt();
    if(a>=b&&a<=b+w||b>=a&&b<=a+w){
        cout<<"0\n";
        return 0;
    }
    if(b<a)
    swap(a,b);
    cout<<b-a-w<<endl;
    
    
    
    return 0;   
}




 
 


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

using namespace std;

int main() {
	int n; 
	while (cin >> n && n) {
		double ave = 0;
		vector<int> a(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
			ave += a[i];
		}
		ave /= ( double) n;
		int ans = 0;
		for (int i = 0; i < n; ++i)
			if (ave >= a[i]) ans++;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3116
// RAM RAM

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define mp make_pair
using namespace std;


set<int> v;
bool hai(int n){
	if(v.find(n)!=v.end()){
		return false;
	}
	return true;
}

bool valid(int n){
	while(n){
		if(!(hai(n%10))){
			return false;
		}
		n/=10;
	}
	return true;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	
	
	int n,k;cin>>n>>k;
	for(int i=0;i<k;i++){
		int temp;cin>>temp;
		v.insert(temp);
	}

	for(int i=n;;i++){
		if(valid(i)){
			cout<<i<<endl;
			break;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll a,b;
  cin>>a>>b;
  if(a<=0&&b>=0) cout<<"Zero"<<endl;
  else if(a>0) cout<<"Positive"<<endl;
  else if(b<0&&(b-a)%2==1) cout<<"Positive"<<endl;
  else cout<<"Negative"<<endl;
  
}


Measured memory_bytes: 3604
using System;
public class Hello{
    public static void Main(){
        string input = Console.ReadLine();
        string ans = "";
        
        for(int x = 0;x < input.Length;x++){
            if(x % 2 == 0){
                ans = ans + input.Substring(x,1);
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 34772
input_d21 = list(map(int, input().split()))
input_d22 = list(map(int, input().split()))

N = input_d21[0]
M = input_d21[1]

A = input_d22

sohyo = sum(A)
zyoken = float(sohyo) / float(4 * M)


A = sorted(A, reverse=True)

if A[M-1] >= zyoken:
    print('Yes')
    
else:
    print('No')

Measured memory_bytes: 3064
n, k = map(int, input().split())
s = input()
happy_counter = 0
for count in range(1, n):
    if s[count] == s[count - 1]:
        happy_counter += 1
happy_counter += k * 2
if happy_counter > n - 1:
    happy_counter = n - 1

print(happy_counter)

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

#define MAXN 80
#define DIFF 32*1000
#define OFFSET 16*1000

bitset<DIFF> dp[MAXN][MAXN];
int a[MAXN][MAXN], b[MAXN][MAXN];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> b[i][j];
		}
	}

	int y = a[0][0] - b[0][0];
	dp[0][0][OFFSET + y] = 1;
	dp[0][0][OFFSET - y] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			if(!i && !j) continue;
			int x = abs(a[i][j] - b[i][j]);
			if(i > 0) {
				dp[i][j] |= (dp[i-1][j]>>x) | (dp[i-1][j]<<x);
			}

			if(j > 0) {
				dp[i][j] |= (dp[i][j-1]>>x) | (dp[i][j-1]<<x);
			}
		}
	}
	
	int ans = 1000*1000;
	for(int i = 0; i < DIFF; i++) {
		if(dp[n-1][m-1][i]) {
			ans = min(ans, abs(OFFSET - i));
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 25344
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 1 ; i <=(n) ; i ++ )
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;

int main() {
  ll n;
  cin>>n;
  ll maxdiv1=1,maxdiv2=n;
  rep(i,sqrt(n)){
    if(n%i==0){
      maxdiv1=i;
      maxdiv2=n/i;
    }
  }
  cout<<maxdiv1+maxdiv2-2<<endl;
  
  
  
  
}

Measured memory_bytes: 256