akhauriyash/Code-Regression huggingface dataset:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    X = intinput()

    n = X // 500
    X = X - 500 * n
    nn = X // 5
    print(1000*n+5*nn)



Measured memory_bytes: 5164
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 10**18
R = 998244353

def ddprint(x):
  if DBG:
    print(x)


class Segtree:
    # modify UNIT and oper depending on the reduce operation

    #UNIT = 0  # sum/or:0 and:fff..f min:BIG max:-BIG gcd:0 lcm:1 ..

    #@classmethod
    #def oper(c,x,y):
    #    return x|y  # sum:+ or/and/min/max/gcd/lcm:(same)

    # call like this: sgt = Segtree(n, 0, lambda x,y: max(x,y))

    def __init__(s,l,unit,oper):
        s.unit = unit
        s.oper = oper
        s.n = 1
        while s.n<l:
            s.n *= 2
        s.ary = [s.unit for i in range(2*s.n-1)]

    def get(s,i):
        return s.ary[i+s.n-1]

    def set(s,i,v):
        k = i+s.n-1
        s.ary[k] = v
        while k>0:
            k = (k-1)//2
            s.ary[k] = max( \
                        s.ary[2*k+1], s.ary[2*k+2])

    def setary(s,a):
        for i,v in enumerate(a):
            s.ary[i+s.n-1] = v
        for k in range(s.n-2,-1,-1):
            s.ary[k] = max( \
                        s.ary[2*k+1], s.ary[2*k+2])

    def query(s,x,y):
        l = x+s.n-1
        r = y+s.n-1
        res = s.unit
        while l<r:
            if not l%2:
                res = s.oper(res,s.ary[l])
                l += 1
            if not r%2:
                r -= 1
                res = s.oper(res,s.ary[r])
            l >>= 1
            r >>= 1
        return res


    def query2(s,x,y):
        return s.querycore(x,y,0,0,s.n)

    # x,y: from query  k: suffix at focus l,r: range for k
    # right ends (y,r) not included

    def querycore(s,x,y,k,l,r):
        if r<=x or y<=l:
            return s.unit
        if x<=l and r<=y:
            return s.ary[k]
        vl = s.querycore(x,y,2*k+1,l,(l+r)//2)
        vr = s.querycore(x,y,2*k+2,(l+r)//2,r)
        return max(vl, vr)

# # # #
from bisect import bisect_left
n = inn()
xd = []
for i in range(n):
    xx,dd = inm()
    xd.append((xx,dd))
xd.sort()
x = [xd[i][0] for i in range(n)]

#ddprint(xd)
#ddprint(x)

r = [i for i in range(n)]
sgt = Segtree(n,0,lambda x,y: max(x,y))
sgt.setary(r)
f = [0]*(n+1)
f[n] = 1
f[n-1] = 2
for i in range(n-2,-1,-1):
    xx,dd = xd[i]
    j = bisect_left(x,xx+dd)
    k = sgt.query(i,j)
    sgt.set(i,k)
    f[i] = (f[i+1] + f[k+1])%R
    #ddprint(f"i {i} x {xx} d {dd} j {j}")

#ddprint(f)
print(f[0])


Measured memory_bytes: 108068
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
map<long long,map<long long,long long> > cnt;
vector<pair<long long, long long> > inp;
signed main(){
	long long n;
	cin >> n;
	for(int i=0;i<n;i++){
		long long x,y;
		cin >> x >> y;
		inp.push_back({x,y});
	}
	long long ans=0;
	for(int i=0;i<inp.size();i++){
		for(int j=0;j<inp.size();j++){
			if(i==j){
				continue;
			}
			long long p=inp[j].fi - inp[i].fi;
			long long q=inp[j].se - inp[i].se;
			cnt[p][q]++;
			if(cnt[p][q]>ans){
				ans=cnt[p][q];
			}
		}
	}
	cout << (n-ans);
}

Measured memory_bytes: 640
#include<cstdio>
#include<vector>

using namespace std;

#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)

struct rsqsegtree{
  vector<int> t;
  int re;
  int n;
  void use(int N){
    re = 0; n = N;
    int i, j;
    for(i = 0;;++i)if((1 << i) >= n)break;
    ++i; t.resize(1 << i); t[0] = 1 << i;
    for(i = 1;i < t[0];++i)t[i] = re;
    t[0] >>= 1;
    return;
  }
  void update(int at, int data){
    t[t[0] + at] += data;
    int tmp;
    for(int x = t[0] + at;x >= 2;x >>= 1)
    t[x >> 1] = (t[(x >> 1) << 1] + t[((x >> 1) << 1) + 1]);
    return;
  }
  int query(int l, int r, int k, int kl, int kr){
    if(k >= t.size())return re;
    if(kl >= r || kr <= l)return re;
    if(l <= kl && kr <= r)return t[k];
    return query(l, r, k * 2, kl, (kl + kr) >> 1) + query(l, r, k * 2 + 1, (kl + kr) >> 1, kr);
  }
  int getsum(int l, int r){ return query(l, r, 1, 0, t[0]); }
  void deb(void){
    int x = 1;
    t[0] *= 2;
    printf("t[0] : %d\n", t[0]);
    for(int i = 1;i < t[0];++i){
      printf("%11d", t[i]);
      if(i == (1 << x) - 1){ puts(""); ++x; }
    }
    t[0] /= 2;
    return;
  }
};

rsqsegtree ST;

signed main(void){
  int2(n, q);
  ST.use(n);
  for(;q--;){
    int3(z, x, y);
    if(z == 0)ST.update(x - 1, y);
    else printf("%d\n", ST.getsum(x - 1, y));
  }

  return 0;
}

Measured memory_bytes: 3404
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <cassert>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 998244353;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    long x, y;
    cin >> x >> y;
    
    if (x == y) {
        cout << 0 << endl;
        return 0;
    }
    if (x == -y) {
        cout << 1 << endl;
        return 0;
    }
    if (x == 0) {
        if (y >= 0) {
            cout << y << endl;
            return 0;
        } else {
            cout << -y + 1 << endl;
            return 0;
        }
    }
    if (y == 0) {
        if (x <= 0) {
            cout << -x << endl;
            return 0;
        } else {
            cout << x + 1 << endl;
            return 0;
        }
    }
    // 8 cases
    if (y >= 0) {
        if (x >= 0 && x <= y) {
            cout << y - x << endl;
            return 0;
        }
        if (x >= y) {
            cout << x - y + 2 << endl;
            return 0;
        }
        if (x <= 0 && -x <= y) {
            cout << y - (-x) + 1 << endl;
            return 0;
        }
        assert(x <= 0 && -x >= y);
        cout << -x - y + 1 << endl;
        return 0;
    }
    if (y <= 0) {
        if (x <= y) {
            cout << y - x << endl;
            return 0;
        }
        if (y <= x && x <= 0) {
            cout << -y - (-x) + 2 << endl;
            return 0;
        }
        if (x >= 0 && x >= -y) {
            cout << x - (-y) + 1 << endl;
            return 0;
        }
        assert(x >= 0 && x <= -y);
        cout << -y - x + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int p=0;
int q[2000001];

void chg(int a,int b){
  int x;
  x=q[a];
  q[a]=q[b];
  q[b]=x;
}

int max(int a,int b){
  if(q[a]>q[b]) return a;
  else return b;
}

int extract(){
  int r=q[1];
  int i;
  int x;
  int M;
  q[1]=q[p];
  p--;
  i=1;
  while(i*2 <= p ){
    if(i*2+1 <= p)
      M=max(i*2,i*2+1);
    else M=i*2;
    if(max(M,i)==M){chg(M,i);i=M;}
    else break;

  }
  return r;
}



void insert(int k){
  int x;
  int i,j;
  p++;
  q[p]=k;
  i=p;
  while(q[i]>q[i/2] && i>1){
    chg(i,i/2);
    i=i/2;
  }
}

int main(){
  char c[10];
  int i,j,k;

  while(1){
    scanf("%s",c);

    if(c[0]=='i'){
      scanf("%d",&k);
      insert(k);
    }

    if(c[0]=='e'){

      if(c[1]=='x')
	printf("%d\n",extract());

      if(c[1]=='n') break;
    }
  }
  return 0;
}



Measured memory_bytes: 5608
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

const int MAX = 100000000;

int main()
{
	while (true) {
		int N;
		cin >> N;

		if (N == 0) {
			break;
		}

		int dp_size = 1 << N;
		vector<int> dp(dp_size, MAX);
		dp[0] = 0;

		vector<vector<int>> t(N, vector<int>(N + 1));

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N + 1; j++) {
				cin >> t[i][j];
			}
		}

		for (int i = 0; i < dp_size; i++) {
			for (int j = 0; j < N; j++) {
				if ((i >> j) % 2 == 0) {
					int mintime = t[j][0];

					for (int k = 0; k < N; k++) {
						if ((i >> k) % 2 == 1) {
							mintime = min(mintime, t[j][k + 1]);
						}
					}

					dp[i + (1 << j)] = min(dp[i + (1 << j)], dp[i] + mintime);
				}
			}
		}

		cout << dp[dp_size - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 3392
#include<iostream>
#include<algorithm>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<cctype>
#include<cmath>
#include<vector>
#include<climits>
#include<queue>

using namespace std;

int main()
{
    long long i,j;
    char S[100005];
    //string S;
    //cin >> S;
    scanf("%s",S);
    long long  a=strlen(S);
    long long N = a, MOD = 1000000007;
    long long dp[100010][4] = {};
    for(i = N; i >= 0; --i)
    {
        for(j = 3; j >= 0; --j)
        {
            if(i == N)
            {
                dp[i][j] = (j == 3 ? 1 : 0);
            }
            else
            {
                dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3: 1);
                if(j < 3 && (S[i] == '?' || S[i] == "ABC"[j]))
                {
                    dp[i][j] += dp[i+1][j+1];
                }
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[0][0] << endl;
}



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

int main() {
  int N = 0;
  cin >> N;
  
  long long int num = 1;
  for (int i = 1; i <= N; i++) {
    num *= i;
    if (num > 1000000007) num %= 1000000007;
  }
  
  cout << num << endl;
}

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

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

  long long n, m;
  cin >> n >> m;
  long long res = 0;
  if (n >= m / 2) res = m / 2;
  else {
    res = n;
    m -= n * 2;
    res += m / 4;
  }
  cout << res << '\n';
  return 0;
}

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

n = int(input())
l=[[]]
nn = []
for _ in range(n+1):
    l.append([])

for i in range(n-1):
    a,b = map(int,input().split())
    l[a].append(b)
    l[b].append(a)
    nn.append(b)

ml = list(map(len,l)) 
m = max(ml)
co = []
for i in range(n+1):
    co.append( set(range(1,ml[i]+1) ))

col = [0]*(n+1)
col[1] = 1

for i in range(1,n+1):
    for la in l[i]:
        if col[la] ==0:
            col[la] = co[i].pop()
            co[la].discard(col[la])
print(m)
for i in range(n-1):
    print(col[nn[i]])


Measured memory_bytes: 120916
#include <iostream>

using namespace std;

int main(void)
{
    int N, K, ans=1, i;

    cin >> N >> K;

    for(i=1; i<=N; i++){
        if(ans*2 < ans+K){
            ans *= 2;
        }

        else{
            ans += K;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
  int a,b,c;
  cin >> a>> b>> c;
  int d = max(max(a,b),c);
  cout << a+b+c+d*9 << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
otoshidama = []
otoshidama_sum = 0
for i in range(N):
    otoshidama.append(input().split())
for i in range(N):
    otoshidama[i][0] = float(otoshidama[i][0])
    if otoshidama[i][1] == 'BTC':
        otoshidama[i][0] = otoshidama[i][0]*380000
    otoshidama_sum += otoshidama[i][0]
print(otoshidama_sum)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes\n"
            ; return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
n,m,q = map(int,input().split())
l = []
res = 0
for _ in range(q):
    l.append(tuple(map(int,input().split())))
    
def pt(a):
    r = 0
    for il in l:
        if a[il[1]-1] - a[il[0]-1] == il[2]:
            r += il[3]
    return r

def g(a):
    if len(a) == 0:
        for i in range(1,m+1):
            g(a+[i])
    elif len(a) < n:
        for i in range(a[-1],m+1):
            g(a+[i])
    else:
        global res
        res = max(res, pt(a))

g([])

print(res)

Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0): d(n, - 1) {}
  int find(int x) {
    if(d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) {return -d[find(x)];}
};

int main(){
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i, m){
    int x, y, z;
    cin >> x >> y >> z;
    --x; --y;
    uf.unite(x, y);
  }
  int ans = 0;
  vector<int> used(n, false);
  rep(i, n){
    int x = uf.find(i);
    if(!used[x]){
      ans++;
      used[x] = true;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 1024
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
#define X real()
#define Y imag()
#define EPS (1e-10)
#define INF (1e9)
typedef complex<double> P;
typedef pair<P, P> L;

namespace std{
  bool operator<(const P& a, const P& b){
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

double dot(P a, P b){
  return a.X*b.X + a.Y*b.Y;
}

double cross(P a, P b){
  return a.X*b.Y - a.Y*b.X;
}

int ccw(P a, P b, P c){
  if(cross(b-a,c-a) > EPS) return 1;
  if(cross(b-a,c-a) < -EPS) return -1;
  if(dot(b-a,c-a) < EPS) return 2;
  if(abs(b-a) + EPS < abs(c-a)) return -2;
  return 0;
}

bool is_cross(L a, L b){
  if(ccw(a.first,a.second,b.first)*ccw(a.first,a.second,b.second) <= 0 &&
     ccw(b.first,b.second,a.first)*ccw(b.first,b.second,a.second) <= 0) return true;
  return false;
}

double p_to_s_dist(P a, L s){
  if(dot(s.second-s.first,a-s.first) >= 0 && dot(s.first-s.second,a-s.second) >= 0){
    return abs(cross(s.first-s.second,a-s.second))/abs(s.first-s.second);
  }
  return min(abs(a-s.first), abs(a-s.second));
}

double s_to_s_dist(L a, L b){
  if(is_cross(a,b)) return 0;
  return min(min(p_to_s_dist(a.first,b),p_to_s_dist(a.second,b)),
	     min(p_to_s_dist(b.first,a),p_to_s_dist(b.second,a)));
}

int main(){
  int N;
  double h, d, x[2], y[2];
  while(cin >> N, N){
    vector<P> V;
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    P s = P(x[0],y[0]), e = P(x[1],y[1]);
    L c = L(s,e);
    for(int i = 0; i < N; ++i){
      cin >> x[0] >> y[0] >> x[1] >> y[1] >> h;
      L edge[4];
      for(int j = 0; j < 4; ++j){
	edge[j] = L(P(x[j/2],y[j%2]),P(x[((j+1)/2)%2],y[(j+1)%2]));
      }
      d = 100000;
      for(int j = 0; j < 4; ++j){
	d = min(d, s_to_s_dist(c, edge[j]));
      }
      V.push_back(P(d,h));
    }
    sort(V.begin(), V.end());
    double ub = 100000, lb = 0, r = ub/2;
    for(int t = 0; t < 10000; ++t){
      r = (ub+lb)/2;
      bool f = true;
      for(int i = 0; i < N; ++i){
	if((V[i].X < EPS) || ((r > norm(V[i])/2/V[i].Y || V[i].Y > r) && (r > V[i].X))){
	  f = false;
	  break;
	}
      }
      if(f) lb = r;
      else ub = r;
    }
    printf("%.4lf\n", r);
  }
  return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
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 <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const ll INF = 1e18;
// const int MOD = 1e9 + 7;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = -INF;
    chmax(ans, a * c);
    chmax(ans, a * d);
    chmax(ans, b * c);
    chmax(ans, b * d);
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <set>
#include <cstdio>
using namespace std;

const int N = 1 << 20;
int n;
int a[N];
multiset <int> st;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++ i) {
		scanf("%d", &a[i]);
		st.insert(a[i]);
	}
	int ans = 0;
	while (!st.empty()) {
		int x = *st.rbegin();
		st.erase(-- st.end());
		for (int i = 30; i; -- i) {
			int y = (1 << i) - x;
			if (st.find(y) != st.end()) {
				multiset <int> :: iterator it = st.lower_bound(y);
				st.erase(it);
				++ ans;
				break;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10368
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    char s[11],y[12],d[11];
    cin>>s>>y;
    int len=strlen(s);
    strncpy(d,y,len);
    d[len]='\0';
    //cout<<s<<endl<<y<<endl<<d<<endl;
    if(!strcmp(d,s))
        cout <<"Yes"<< endl;
    else
        cout <<"No"<< endl;
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int n,i,a,min,max;
	long sum;

	scanf("%d %d",&n,&min);
	max=min;
	sum=min;
	for(i=1;i<n;i++){
		scanf("%d",&a);
		if(min>a){
			min=a;
		}
		if(max<a){
			max=a;
		}
		sum+=a;
	}
	printf("%d %d %ld\n",min,max,sum);

	return 0;
}

Measured memory_bytes: 600
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if b >= a:
    a_2 = t * v + a
    b_2 = t * w + b

    if a_2 >= b_2:
        print("YES")
    else:
        print("NO")
elif a > b:
    a_2 = a - t * v
    b_2 = b - t * w

    if a_2 <= b_2:
        print("YES")
    else:
        print("NO")
    


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

int main ()
{

    ios::sync_with_stdio (false) ;
    int a ,b,c ,x,y;
    while (cin>>a>>b>>c>>x>> y)
    {
        int ans = 0;
        if (a+b>2*c)
        {
            int t = min (x,y) ;
            ans+=2*c*t;
            x-=t;
            y-=t;
        }

        if (a<2*c)
        ans+=x*a;
        else ans+=2*c*x;
        if (b<2*c)
        ans+=b*y;
        else ans+=y*2*c;
    cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left
n, Q = [int(x) for x in input().split()]
stx = [[int(x) for x in input().split()] for i in range(n)]
q = [int(input()) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]

for (s, t, x) in stx:
  begin = bisect_left(q, s-x)
  end = bisect_left(q, t-x)
  while begin<end:
    if skip[begin]==-1:
      ans[begin] = x
      skip[begin] = end
      begin += 1
    else:
      begin = skip[begin]
for e in ans:
  print(e)

Measured memory_bytes: 61716
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,suu[4],s[3],s2[3];
void func(int,int);
int main(void)
{
	char ss[3]="-+";
	scanf("%d",&n);
	suu[3]=n%10;
	n=n/10;
	suu[2]=n%10;
	n=n/10;
	suu[1]=n%10;
	suu[0]=n/10;
	func(0,suu[0]);
	printf("%d%c%d%c%d%c%d=7\n",suu[0],ss[s2[0]],suu[1],ss[s2[1]],suu[2],ss[s2[2]],suu[3]);
	return 0;
}
void func(int nn,int sum)
{
	int i;
	if(nn==3){
		if(sum==7){
			for(i=0;i<3;i++){
				s2[i]=s[i];
			}
		}
	}
	else {
		s[nn]=0;
		func(nn+1,sum-suu[nn+1]);
		s[nn]=1;
		func(nn+1,sum+suu[nn+1]);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
const int inf=0x3f3f3f3f;

int N,M,d[1010];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N>>M;
    for(int i=0;i<N;i++) cin>>d[i];
    double sum=0;
	for(int i=0;i<N;i++) sum+=(double)d[i];
	sum/=(double)4*M;
	int cnt=0;
	for(int i=0;i<N;i++) if(double(d[i])>=sum) cnt++;
	if(cnt>=M) cout<<"Yes";
	else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
k,n=map(int,input().split())
a=list(map(int,input().split()))
delta=[]
for i in range(n):
	if i==0:
		delta.append(k-a[-1]+a[i])

	else:
		delta.append(a[i]-a[i-1])
print(sum(delta)-max(delta))

Measured memory_bytes: 26444
program registration
  implicit none
  character(11) :: s, t
  integer :: n
  read(*,*) s
  read(*,*) t
  n = len_trim(s)
  if (s(1:n) == t(1:n)) then
    write(*,'(a)') "Yes"
  else
    write(*,'(a)') "No"
  end if
end program registration

Measured memory_bytes: 2924
def call(n):
    i = x = 1
    mode = 0

    while i <= n :
        if mode == 0:
            x = i
            if x % 3 == 0:
                print(" "+ str(i) ,end="")
            else:
                mode = 1
                continue
        else:
            if x % 10 == 3:
                print(" " + str(i) ,end="")
            else:
                x = x // 10
                if x :
                    continue

        mode = 0
        i+=1

    print()

call(int(input())) 


Measured memory_bytes: 5880
#include<stdio.h>
int main(void){
    int m,f,r;
    while(1){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1 && f==-1 && r==-1){
            break;
        }else if(m==-1 ||f==-1){
            printf("F\n");
        }else if(m+f>=80){
            printf("A\n");
        }else if(m+f>=65 && m+f<80){
            printf("B\n");
        }else if(m+f>=50 && m+f<65){
            printf("C\n");
        }else if(m+f>=30 && m+f<50){
            if(r>=50){
                printf("C\n");
            }else{
                printf("D\n");
            }
        }else if(m+f<30){
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2100
import java.util.Scanner;

class Main {  
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int num = in.nextInt();
    
    int Taro = 0;
    int Hanako = 0;
    
    while (num != 0) {
      String taro = in.next();
      String hanako = in.next();
      if      (taro.compareTo(hanako) < 0) {Hanako += 3; }
      else if (taro.compareTo(hanako) > 0) {Taro += 3; }
      else                                 {Taro += 1; Hanako += 1;}
      num--;
    }
    System.out.println(Taro + " " + Hanako);
  }
}

Measured memory_bytes: 20988
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string N;
  cin >> N;
  bool exist = false;
  for (int i = 0; i < N.size(); i++)
    if (N[i] == '9')
      exist = true;
  if (exist)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3592
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N, M;
    scan(N, M);
    auto X = aryread();
    if (M <= N)
    {
        writeln(0);
        return;
    }
    X.sort();
    auto D = new long[](M - 1);
    foreach (i; 0 .. M - 1)
        D[i] = X[i + 1] - X[i];
    D.sort!"b<a"();
    long ans = X[$ - 1] - X[0];
    // writeln(ans);
    foreach (d; D.take(N - 1))
        ans -= d;
    writeln(ans);
}


Measured memory_bytes: 4424
# C - Guess The Number
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

ans = [0,0,0]

# 条件だけで不適がわかるものは弾く
for i in range(M):
    for j in range(i+1,M):
        if (SC[i][0] == SC[j][0]) and (SC[i][1] != SC[j][1]):
            print(-1)
            quit()

# 各桁を指定をする
for k in range(M):
    ans[SC[k][0]-(N-2)] = str(SC[k][1])

# 頭の桁が0で指定されると不適(str型かどうかで判定する)
if (ans[3-N] == "0") and (N == 1):
    print(0)
    quit()
elif ans[3-N] == "0":
    print(-1)
    quit()

# N桁の文字列にする
ans = [str(ans[i]) for i in range(3)]
res = "".join(ans)
res = res[(3-N):4]

# 頭の桁が指定無しの0だったら1に変える
if (res[0] == "0") and (N == 1):
    res = "0"
elif res[0] == "0":
    ref = list(res)
    ref[0] = "1"
    res = "".join(ref)

print(res)


Measured memory_bytes: 9244
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a > b){
            System.out.println(a - 1);
        }else{
            System.out.println(a);
        }
    }
}
 

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


int main(){
  int N;
  cin>>N;
  vector<int> a(9,0);
  for(int i=0;i<N;i++){
    int A;
    cin>>A;
    if(A<400)a.at(0)=1;
    else if(A<800)a.at(1)=1;
    else if(A<1200)a.at(2)=1;
    else if(A<1600)a.at(3)=1;
    else if(A<2000)a.at(4)=1;
    else if(A<2400)a.at(5)=1;
    else if(A<2800)a.at(6)=1;
    else if(A<3200)a.at(7)=1;
    else if(A>=3200)a.at(8)++;
  }
  int min_ans =0;
  for(int i=0;i<8;i++){
    min_ans+=a.at(i);
  }
  int max_ans = min_ans+a.at(8);
  if(min_ans == 0)min_ans = 1;
  cout<<min_ans<<" "<<max_ans<<endl;

}


Measured memory_bytes: 256
N, Q = map(int, input().split())
T = [[] for i in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


ans = [None] * N
V = [0] * N
for q in range(Q):
    p, x = map(int, input().split())
    p -= 1
    V[p] += x


stack = [[0, V[0]]]
while stack:
    n, v = stack.pop()
    ans[n] = v

    for to in T[n]:
        if ans[to] is not None:
            continue

        stack.append([to, v + V[to]])


print(*ans, sep=' ')

Measured memory_bytes: 70700
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	while(scan.hasNext())
	    {
	double t,v,y;
	int n;
	v=scan.nextDouble();
	t=v/9.8;
	y=4.9*(Math.pow(t,2));
	n=(int)(y+5)/5;
	if(((y+5)%5)>0)n++;
	System.out.println(n);
	    }
    }
}

Measured memory_bytes: 18608
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    ll N,K;
    cin >> N >> K;
    vector<int> A(N);
    vector<int> spot(N,-1);
    vector<vector<int>> data(2e5+1);
    // data[i][j] := iがj番目に出現する時の座標 (0-indexed);

    // spot[i] := i番目の数と同じ数が次に出現する時の座標(0-indexd);

    rep(i,N){
        cin >> A[i];
        data[A[i]].push_back(i);
    }
    rep(i,N){
        //i番目の数と同じ数が次に出現する座標を求めていく
        int now = A[i];
        for(auto x:data[now]){
            if(x>i){
                spot[i] = x;
                break;
            }
        }
        if(spot[i]==-1){
            //右側にi番目の数と同じ数が出現しない場合は左側で1番最初に出現した数にする
            for(auto x:data[now]){
                spot[i] = x;
                break;
            }
        }
        if(spot[i]==-1){
            //左側にも右側にも出現しない場合は1周させる
            spot[i] = i;
        }
    }
    //どれだけの数を進んだら、sが空で開始地点が0になるかを調べる
    ll dis = 0;
    ll X = 0;
    while(1){
        ll next;
        //現在地点はXで次にXと同じ数が出現する座標はspot[X]にある
        if(spot[X]>X){
            //もしも右側にXと同じ数があった場合は
            next = spot[X];
            dis += next - X + 1;
            X = next;
        }else if(spot[X]<=X){
            //左側にXと同じ数があった場合は
            next = (spot[X] + N);
            dis += next - X + 1;
            X = next;
        }
        X++;
        X%=N;
        if(X==0)break;
    }
    ll length = ((N*K)%dis)/N;
    vector<int> ans;
    if(length==0)cout << "" << endl;
    else{
        
        length = length * N;
        for(ll i=0;i<length;i++){
            ll next = spot[i%N] + (i/N)*N;
            if(next%N<=i%N)next += N;
            if(next < length)i = next;
            else{
                ans.push_back(A[i%N]);
            }
        }
    }
    for(auto x:ans)cout << x << " ";
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e2 + 10;
const int mod = 1e9 + 7;


map<int,int> mp;

int32_t main(){
	boost;

	int n;
	cin >> n;
	int a[n];

	set<int> s;
	priority_queue<pair<int,int>> q;
	int temp;
	for(int i = 0 ; i < n ; ++i){
		cin >> a[i];
		mp[a[i]]++;
		s.insert(a[i]);
	}

	for(auto i : s){
		q.push({mp[i] , i});
	}

	pair<int,int> hell = {0,0} , hav = {0,0}, hah = {0,0};
	while(true){

		if(q.top().first == 1) break;

		hell = q.top();
		q.pop();

		if(hell.first >= 3){
			q.push({hell.first - 2 , hell.second});
		}
		else if(q.size() > 2){

			hav = q.top();
			q.pop();
			if(hav.first + hell.first >= 3){
				if(hell.first == 2){
					q.push({hell.first-1 , hell.second});
					if(hav.first > 1){
						q.push({hav.first-1 , hav.second});
					}
				}
				else{
					q.push({hav.first-1, hav.second});
				}
			}
			else{

				cout << hell.first << " " << hav.first << " " << hah.first << "\n";
				hah = q.top();
				q.pop();
				q.push({hav.first , hav.second});
				if(hah.first > 1){
					q.push({hah.first-1 , hah.second});
				}
			}
		}
		else{
			break;
		}
	}

	cout << q.size();
	return 0;
}

Measured memory_bytes: 14196
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	cout<<min(B/A,C)<<endl;
}

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


int main(){
  int n;
  cin >> n;
  vector<int> v(0);
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    if(i % 2 == 0){v.push_back(a);}
    else{v.insert(v.begin() + 0, a);}
  }
  if(n % 2 == 1){
    reverse(v.begin(), v.end());
  }
  cout << v[0];
  for(int i = 1; i < n; i++){
    cout << " " << v[i];
  }
  cout << endl;
}    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,lim,a,r,ans=0;cin>>n;
  lvector A(n);rep(i,n) cin>>A[i];
  sort(ALL(A));
  vector<bool> v(1e6+1,false);
  rep(i,n) {
    a=A[i];
    if(v[a]) continue;
    if(A[i]!=A[i+1]) ans++;
    while(a<=1000000) {
      v[a]=true;
      a+=A[i];
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 5096
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

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


const int BIG_NUM = 1e8;
const ll INF = 1000000000000000000;

int main() {
	int x, n;
	cin >> x >> n;
	set<int> s;

	for (int i = 0; i < n; i++) {
		int p;
		cin >> p;

		s.insert(p);
	}

	
	int ans = 0;

	for (int i = -200; i <= 200; i++) {
		if (s.find(i) != s.end()) {
			continue;
		}

		if (abs(x - i) < abs(x - ans)) {
			ans = i;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3640
N = int(input())
seq = list(map(int, input().split()))

M, m = max(seq), min(seq)
for i in range(N):
    if seq[i] == M:
        x = i
    if seq[i] == m:
        y = i
print(2 * N - 1)
if M + m >= 0:
    for i in range(N):
        print(x + 1, i + 1)
    for i in range(N - 1):
        print(i + 1, i + 2)
else:
    for i in range(N):
        print(y + 1, i + 1)
    for i in range(N - 1, 0, -1):
        print(i + 1, i)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n, angka[1000000],ans;

ll cmp (ll a, ll b){
	return a>b;
}

int main(){

	cin>>n;
	ll tmp = 3*n;
	for(int x=1;x<=tmp;x++){
		cin>>angka[x];
	}
	sort(angka+1,angka+1+tmp,cmp);
	ll cnt = 0;
	for(int x=2;x<=tmp;x+=2){
		if(cnt==n){
			break;
		}
		ans+=angka[x];
		cnt++;
	}
	cout << ans << endl;



	return 0;
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        N,M,L,K,A,H = LI()
        if N == 0:
            break
        S = set()
        if L > 0:
            S = set(LI())
        else:
            input()
        e = collections.defaultdict(list)
        for _ in range(K):
            a,b,d = LI()
            e[a].append((b,d))
            e[b].append((a,d))

        def search(s):
            d = collections.defaultdict(lambda: inf)
            d[(-M,s)] = 0
            q = []
            heapq.heappush(q, (0, -M, s))
            v = collections.defaultdict(bool)
            while len(q):
                k, m, u = heapq.heappop(q)
                if v[(m,u)]:
                    continue
                for mm in range(m,1):
                    v[(mm,u)] = True

                for uv, ud in e[u]:
                    if ud > -m or v[(m+ud,uv)]:
                        continue
                    vd = k + ud
                    vm = m+ud
                    if uv in S:
                        vm = -M
                    if d[(vm,uv)] > vd:
                        d[(vm,uv)] = vd
                        heapq.heappush(q, (vd, vm, uv))

            return d

        d = search(A)
        r = inf
        for k in list(d.keys()):
            if k[1] == H and r > d[k]:
                r = d[k]
        if r == inf:
            rr.append('Help!')
        elif r <= M:
            rr.append(r)
        else:
            rr.append(r*2-M)

    return '\n'.join(map(str,rr))


print(main())




Measured memory_bytes: 10648
package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scan(&x, &y)
	var ans string
	for i := 0; i < y+2; i++ {
		ans += "#"
	}
	ans += "\n"
	for i := 0; i < x; i++ {
		var tmp string
		fmt.Scan(&tmp)
		ans += "#" + tmp + "#"
		ans += "\n"
	}
	for i := 0; i < y+2; i++ {
		ans += "#"
	}
	fmt.Println(ans)
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#define inver(a) power(a, mod - 2)

using namespace std;

inline char nc()
{
	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x)
{
	x=0; int f=1,ch=nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x*=f;
}

typedef long long ll;

const int mod = 998244353;
const int MAXK = 2000 + 5;
const int MAXN = 2000 + 5;
int K, N;

inline int add(int x) {return x >= mod ? x - mod : x;}
ll power(ll x, ll y)
{
	ll re = 1;
	while(y)
	{
		if(y & 1) re = re * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return re;
}

const int maxn = MAXN + MAXK;
int fac[maxn];
int inv[maxn];
void init_binom(int n)
{
	fac[0] = 1;
	for(int i = 1; i <= n; ++i)
	{
		fac[i] = (ll)fac[i - 1] * i % mod;
	}
	inv[n] = inver(fac[n]);
	for(int i = n; i >= 1; --i)
	{
		inv[i - 1] = (ll)inv[i] * i % mod;
	}
}
int binom(int x, int y)
{
	if(x < y) return 0;
	return (ll)fac[x] * inv[y] % mod * inv[x - y] % mod;
}
int F(int x, int y)
{
	if(x == 0 && y == 0) return 1;
	return binom(x + y - 1, x);
}

int sol(int k, int n, int m)
{
	int an = 0;
	for(int j = 0, p = 1; j <= m && j <= n; ++j)
	{
		an = (an + (ll)binom(m, j) * F(n - j, k - 2 * m + j) % mod * p) % mod;
		p = add(p << 1);
	}
	return an;
}

int main()
{
	read(K), read(N);
	init_binom(K + N);
	for(int i = 2; i <= 2 * K; ++i)
	{
		int m = 0;
		for(int a = 1, b = i - 1; a < b; ++a, --b)
		{
			if(b <= K) ++m;
		}
		if(i & 1) printf("%d\n", sol(K, N, m));
		else printf("%d\n", add(sol(K - 1, N, m) + sol(K - 1, N - 1, m)));
	}
	return 0;
} 

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

using namespace std;

int main(void)
{
    int H, W, A, B;
    cin >> H >> W >> A >> B;

    int map[1000][1000] = {0};
    for(int i = 0; i < B; i++){
        for(int j = 0; j < A; j++){
            map[i][j] = 1;
        }
    }

    for(int i = B; i < H; i++){
        for(int j = A; j < W; j++){
            map[i][j] = 1;
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << map[i][j];
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}

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

int main(void){
  int waseda[11],keiou[11],sumW=0,sumK=0;

  for( int i = 0 ; i < 10 ; i++ ) cin >> waseda[i];

  for( int i = 0 ; i < 10 ; i++ ) cin >> keiou[i]; 

  sort( waseda , waseda+10 );
  sort( keiou , keiou+10 );

    sumW = waseda[9]+waseda[8]+waseda[7];
    sumK = keiou[9]+keiou[8]+keiou[7];
  

    cout << sumW << " " << sumK << endl;

  return 0;
}

Measured memory_bytes: 1180
import Foundation

extension String {
    var argi: [Int] { return self.characters.split(" ").map { Int(String($0))! } }
}

let inp=readLine()!.argi

let a=inp[0]
let b=inp[1]
let c=inp[2]

if (b-a)==(c-b){
    print("YES")
}
else{
    print("NO")
}


Measured memory_bytes: 6888
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>



using namespace std;

int main()
{
	const int BUFF_SIZE = 100;
	char buff[BUFF_SIZE];
	int y = 100000;

	string s;
	getline(cin, s);
	
	long n;
	sscanf(s.c_str(), "%ld", &n);
	
//	printf("%d\n", n);
	
	for (int i = 0; i < n; i++)
	{
		double z = y;
		z *= 1.05;
		y = (int)z;
		
		sprintf(buff, "%d", y);
		
	
		string t = buff;
		string u = t.substr(t.length() - 3);
		int aa;
		sscanf(u.c_str(), "%ld", &aa);
		
		y /= 1000;
		y *= 1000;
		if (0 < aa)
		{
			y += 1000;
		}
	}
	
	printf("%d\n", y);

	return 0;
}

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

using namespace std;

const int maxn=2e5+5;
typedef long long ll;

char s[maxn];

int main(){
	int n;
	scanf("%d",&n);
	double ans=1;
	double sum=0;
	for(int i=0;i<n;i++){
		double x;
		scanf("%lf",&x);
		sum+=1/x;
	}
	printf("%.6lf",ans/sum);
	return 0;
} 

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;

long euclid( int a, int b )
{
  long temp;

  if( a < b ) { temp = a; a = b; b = temp; }
  if( b < 1 ) return -1;
  
  if( a % b == 0 ) return b;
  
  return euclid( b, a % b );
}


int main(){
  long n, x;

  cin >> n >> x;
  long list[n + 1];
  for(int i=0; i < n; i++){
    long tmp;
    cin >> tmp;
    if(tmp > x)
      list[i] = tmp - x;
    else
      list[i] = x - tmp;
  }


  long ans = 0;
  long tmp = 0;

  if(n == 1){
    ans = list[0];
    goto finish;
  }
  
  tmp = euclid(list[0], list[1]);
  for(int i=2; i < n; i++)
    tmp = euclid(tmp, list[i]);

  ans = tmp;

 finish:
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

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

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

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


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class C3Or2 {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        vi A(n);
        in >> A;
        int res = 0;
        trav(x, A) {
            res += __builtin_ctz(x);
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    C3Or2 solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256