akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)));
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N,A,B;
char S[100010];
int x , y;

int main(){
	scanf("%d%d%d" , &N , &A , &B);
	scanf(" %s" , S);
	repp(i,0,N){
		if(S[i] == 'a'){
			if(x < A + B){
				printf("Yes\n");
				++x;
			} else {
				printf("No\n");
			}
		} else if(S[i] == 'b'){
			if(x < A + B && y < B){
				printf("Yes\n");
				++x;
				++y;
			} else {
				printf("No\n");
			}
		} else {
			printf("No\n");
		}
	}
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
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 namespace std;


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

int main(){
    int A[100],N,sw;
    cin>>N;
    for(int i=0; i<N; ++i) cin>>A[i];
    
    sw=bubbleSort(A,N);
    
    for(int i=0; i<N; ++i){
        if(i) cout<<" ";
        cout<<A[i];
    }
    
    cout<<endl;
    cout<<sw<<endl;
    
    return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
string s,t;
int p[2020202];
int main()
{
	memset(p,-1,sizeof(p));
	getline(cin,s);
	getline(cin,t);
	string x="";
	while(x.size()<s.size()+t.size())
	{
		x+=t;
	}
	string y="";
	while(y.size()<s.size()+t.size()*2)
	{
		y+=s;
	}
	int n=x.size(),j=-1;
	for(int i=0;i<n;i++)
	{
		while(j>=0 && x[i]!=x[j])
		{
			j=p[j];
		}
		j++;
		p[i+1]=j;
	}/*
	for(int i=0;i<=n;i++)
	{
		cout<<p[i]<<' ';
	}
	cout<<endl;*/
	int now=0,ans=0;
	for(int i=0;i<y.size();i++)
	{
		char c=y[i];
		while(now==n || (now>=0 && x[now]!=y[i]))
		{
			now=p[now];
		}
		now++;
//		cout<<now<<endl;
		ans=max(ans,now);
	}
	if(ans>=s.size()+t.size())
	{
		ans=-1;
	}
	else
	{
		ans/=t.size();
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 13512
program prob2
    implicit none
    integer(16)::n,a,b,c
    read(*,*) n,a,b

    c = a+b

    if(mod(n,c) > a) then
        write(*,*)  n/c * a + a
    else
        write(*,*)  n - n/c * b
    end if

    stop
end program

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

const int maxn = 0;
int n;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	ll x;
	cin >> x;
	ll ans = x / 11;
	ans = ans * 2;
	ll left = x % 11;
	if(left > 0) ans++;
	if(left > 6) ans++;
	cout << ans; 	
}

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

// 数学的考察の問題。自力で思いつけなかった。図を見て初めて分かった
int main() {
  int n;
  cin >> n;

  bool enable = false;
  int k = 1;
  while (true) {
    if (k * (k - 1) / 2 > n) break;
    if (k * (k - 1) / 2 == n) {enable = true; break;}
    k++;
  }

  if (enable) {
    cout << "Yes" << endl;
    k--;
    vector<vector<int> > ans(k + 1);
    for (int i = 1; i <= k; i++) {
      for (int j = 1; j <= i; j++) {
        ans[i - 1].push_back(i * (i - 1) / 2 + j);
      }
      for (int j = 1; j <= k - i; j++) {
        ans[i - 1].push_back((i + j - 1) * (i + j) / 2 + i);
      }
    }
    for (int i = 1; i <= k; i++) ans[k].push_back(i * (i + 1) / 2);

    cout << k + 1 << endl;
    rep(i, k + 1) {
      cout << ans[i].size() << ' ';
      int size = ans[i].size();
      rep(j, size ) {
        cout << ans[i][j];
        if (j != size - 1) {
          cout << ' ';
        } else {
          cout << endl;
        }
      }
    }

  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3980
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i).sort
b = gets.chomp.split(" ").map(&:to_i).sort
c = gets.chomp.split(" ").map(&:to_i).sort

ab = Array.new(n)

j = 0
for i in 0..n-1 do
    while(j < n && a[j] < b[i])
        j += 1
    end
    ab[i] = j
end

j = 0
cba = Array.new(n,0)
n.times do |i|
    cba[i] = cba[i-1] if i > 0
    while(j < n && b[j] < c[i])
        cba[i] += ab[j]
        j += 1
    end
end

puts cba.inject(:+)

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

struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
#define int long long

signed main() {
    int n, a;
    cin >> n >> a;
    cout << (n % 500 <= a ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,r) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

ll cou[5];
int main(void) {
  cin >> s;
  n = s.length();
  rep(i, n) cou[s[i] - 'a']++;
  mi = inf;
  rep(i, 3) mi = min(mi, cou[i]);
  ok = true;
  rep(i, 3) if (cou[i] - mi > 1) ok = false;
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 512
import math
import collections


def main():
    a, b, c, d = input_list()
    while True:
        c -= b
        if c <= 0:
            print('Yes')
            exit(0)
        a -= d
        if a <= 0:
            print('No')
            exit(0)


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


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if __name__ == '__main__':
    main()


Measured memory_bytes: 65076
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define rev(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;






int main() {

    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    int mn = a[0];
    int mx = a[0];
    rep(i,3) {
        mn = min(mn, a[i]);
        mx = max(mx, a[i]);
    }
    int ans = mx - mn;

    out(ans);

    return 0;
}




//              g++ -std=c++1z






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

using namespace std;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;

	cin >> s;


	for(int i=0;i<s.length()-1;i++)
	{
		if(s[i]==s[i+1])
		{
			cout << i+1 << ' ' << i+2 << '\n';
			return 0;
		}
	}

	for(int i=0;i<s.length()-2;i++)
	{
		if(s[i]==s[i+2])
		{
			cout << i+1 << ' ' << i+3 << '\n';
			return 0;
		}
	}

	cout << -1 << ' ' << -1 << '\n';
	return 0;
}

Measured memory_bytes: 512
import math
k = int(input())
if k==1:
  print(1)
  print(1)
  exit()
n = math.ceil(k/4)*2
ans = []
for i in range(n):
  tmp = []
  for j in range(n):
    if i%2 == 0:
      tmp.append((i+j)%n+1)
    else:
      tmp.append(n+(i+j)%n+1)
  ans.append(tmp)
kazu = n*2
while kazu != k:
  for i in range(n):
    for j in range(n):
      if ans[i][j] == kazu:
        ans[i][j]-=n
  kazu-=1
print(n)
for i in range(n):
  print(*ans[i])

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

int main() {
  const int64_t mod = 1000000007;
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++) cin >> a.at(i);
  vector<vector<int64_t>> dp(h + 1, vector<int64_t>(w + 1));
  dp.at(1).at(1) = 1;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a.at(i).at(j) == '#') continue;
      dp.at(i + 1).at(j + 1) += dp.at(i).at(j + 1) + dp.at(i + 1).at(j);
      dp.at(i + 1).at(j + 1) %= mod;
    }
  }
  cout << dp.at(h).at(w) << endl;
}


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

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

    int n, ans = 0;
    cin >> n;
    char s[n][n] = {};
    rep(i, n) rep(j, n) cin >> s[i][j];

    rep(q, n)
    {
        rep(i, n) rep(j, n)
        {
            if (s[(q + i) % n][(j + n - q) % n] != s[j % n][i % n])
                goto enl;
        }
        ans++;
    enl:
        continue;
    }

    cout << ans * n << endl;

    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    
    static Scanner cin = new Scanner();
    static void Main() {
        int H = cin.Int();
        int W = cin.Int();
        var S = Enumerable.Repeat(0, H).Select(x => Console.ReadLine()).ToArray();

        int cnt = 0; //'#'の個数
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (S[i][j] == '#') cnt++;
            }
        }

        Console.WriteLine(cnt == H + W - 1 ? "Possible" : "Impossible");
        Console.ReadLine();
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
using namespace std;
typedef long long ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
string s;
//-------------------関数----------------------//

ll putstr(ll star, ll en) {
	for (ll i = star; i < en; i++)
	{
		s[i] = '#';
	}
	return 0;
}

ll sear(string b,ll nagasa) {
	while (1) {
		ll point = s.find(b);
		if (point == string::npos) { break; }
		putstr(point, point + nagasa);
	}
	return 0;
}

int main() {
	cin >> s;
	sear("eraser",6);
	sear("erase",5);
	sear("dreamer",7);
	sear("dream",5);

	REP(i, s.size()) {
		if (s[i] != '#') {
			cout << "NO" << endl; return 0;
		}
	}
	cout << "YES" << endl; return 0;

	return 0;
}

Measured memory_bytes: 512
from collections import defaultdict

N = input()
nums = list(map(int, input().split()))

nums_dict = defaultdict(int)
sum_nums = sum(nums)

for num in nums:
    nums_dict[num] += 1

M = int(input())

for i in range(M):
    original, replaced = map(int, input().split())

    if original not in nums_dict:
        print(sum_nums)
        continue

    total_change = (replaced - original) * nums_dict[original]
    sum_nums += total_change

    print(sum_nums)

    nums_dict[replaced] += nums_dict[original]
    del nums_dict[original]

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

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    p = LI_()
    r = 0
    m = inf
    for c in p:
        if m >= c:
            m = c
            r += 1

    return r


print(main())





Measured memory_bytes: 28228
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int64_t s=0;
  cin >> n;
  int a[100001]={0}, tmp;
  for (int i = 0; i < n; i++){
    cin >> tmp;
    a[tmp]++;
  }
  for(int i=0; i<100001; i++)
    s+=i*a[i];
  int q;
  cin >> q;
  int b, c;
  for (int i = 0; i < q; i++){
    cin >> b >> c;
    s+=(c-b)*a[b];
    cout << s << endl;
    a[c]+=a[b];
    a[b]=0;
  }
  return 0;
}


Measured memory_bytes: 3932
n = int(input())

X = [int(el) for el in input().split(' ')]

Y = sorted(X)
p = Y[n // 2 - 1]
q = Y[n // 2 ]

for i in range(0, n):
	if X[i] <= p:
		print(q)
	else:
		print(p)

Measured memory_bytes: 25228
import java.util.ArrayList

data class Edge(val from: Int, val to: Int, val weight: Long) {
    constructor(from: Long, to: Long, weight: Long) : this(from.toInt(), to.toInt(), weight)
}

class Graph(val n: Int) {
    val edges = Array(n) { ArrayList<Edge>() }
}

val INF = 1e+15.toLong()

fun bellmanFord(g: Graph, s: Int): Triple<Array<Long>, Array<Int>, Array<Boolean>> {
    val N = g.n
    val dist = Array(N) {INF}
    val prev = Array(N) {-1}

    dist[0] = 0

    for (k in 1 .. N) {
        for (v in 0 until N) {
            for (e in g.edges[v]) {
                if (dist[e.from] != INF && dist[e.to] > dist[e.from] + e.weight) {
                    dist[e.to] = dist[e.from] + e.weight
                    prev[e.to] = e.from
                }
            }
        }
    }

    val dist2 = dist.copyOf()
    for (k in 1 .. 3 * N) {
        for (v in 0 until N) {
            for (e in g.edges[v]) {
                if (dist2[e.from] != INF && dist2[e.to] > dist2[e.from] + e.weight) {
                    dist2[e.to] = dist2[e.from] + e.weight
                }
            }
        }
    }

    val affectedByNegativeLoop = Array(N) { idx -> dist[idx] != dist2[idx] }

    return Triple(dist, prev, affectedByNegativeLoop)
}

fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { s -> s.toInt() }
    val g = Graph(N)

    for (i in 1 .. M) {
        val (a, b, c) = readLine()!!.split(" ").map {s -> s.toLong()}
        g.edges[(a - 1).toInt()].add(Edge(a - 1, b - 1, -c))
    }

    val (dist, prev, affectedByNegativeLoop) = bellmanFord(g, 0)

    if (affectedByNegativeLoop[N - 1]) {
        println("inf")
    } else {
        println(-dist[N - 1])
    }
}

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

int main(){
    int a,b;
    cin >> a>>b;
    cout << a * b << endl;
    return 0;
}


Measured memory_bytes: 3676
import math
import sys
S=int(input())

a=math.sqrt(S)
b=math.ceil(a)
diff = -(S-b**2)
diffs=[]
if diff ==0:
  print(0,0,int(b),0,0,int(b))
  sys.exit()

for i in range(1,math.ceil(math.sqrt(b))+1):
  if diff%i!=0:
    continue
  else:
    diffs.append([i,int(diff/i)])
  if len(diffs)>2:
    if diffs[-2][1]==diffs[-1][0]:
      print(0,0,int(b),int(diffs[-1][0]),int(diffs[-1][1]),int(b))
      sys.exit()
      
print(0,0,int(b),int(diffs[-1][0]),int(diffs[-1][1]),int(b))

Measured memory_bytes: 3064
#include <set>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

set<int> S;

int A[300005], B[300005];
int tree[3 * 400005];

int get_max(int left, int right, int L, int R, int root)
{
    if(left>right || left>R || right<L)
        return 0;
    
    if(left>=L && right<=R)
        return tree[root];
    
    int mid = (left+right)/2;
    
    return max(get_max(left, mid, L, R, root*2), get_max(mid+1, right, L, R, root*2+1));
}

void update(int left, int right, int x, int val, int root)
{
    if(left>right || left>x || right<x)
        return;
    
    if(left==right && right==x)
    {
        tree[root] = val;
        return;
    }
    
    int mid = (left+right)/2;
    
    update(left, mid, x, val, root*2);
    update(mid+1, right, x, val, root*2+1);
    
    tree[root] = max(tree[root*2], tree[root*2+1]);
}

int main() {
    
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int N, K;
    cin >> N >> K;
    
    for(int i=1; i<=N; i++)
    {
        cin >> A[i];
        S.insert(A[i]);
    }
    
    int k = 1;
    
    for(set<int>::iterator it=S.begin(); it!=S.end(); it++)
        B[k++] = *it;
    
    k--;
    int ans = 0;
    
    for(int i=1; i<=N; i++)
    {
        int x = lower_bound(B+1, B+1+k, A[i]) - B;
        int y = lower_bound(B+1, B+1+k, A[i]-K) - B;
        int z = upper_bound(B+1, B+1+k, A[i]+K) - B - 1;
        
        int new_ans = get_max(1, N, y, z, 1) + 1;
        ans = max(ans, new_ans);
        
        update(1, N, x, new_ans, 1);
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 17052
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = min(a)+min(b)

for i in range(M):
    x,y,c = map(int,input().split())
    x,y = x-1,y-1
    ans = min(ans,a[x]+b[y]-c)

print(ans)


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

int main(){
    int a, b, c, t;
    cin >> a >> b >> c;
    
    if( a > b ) { t = a; a = b; b = t; }
    if( b > c ) { t = b; b = c; c = t; }
    if( a > b ) { t = a; a = b; b = t; }
    
    cout << a <<  " "  << b <<  " " << c << endl;
    
    return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;
using llong = long long;
using ullong = unsigned long long;

bool is_tri(int a,int b,int c){
  return (a < b + c) && (b < c + a) && (c < a + b);
}

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for(auto &l:L) cin >> l;
  sort(L.begin(),L.end());
  int num = 0;

  for(int i=0;i<N;++i){
    for(int j=i+1;j<N;++j){
      for(int k=j+1;k<N;++k){
        if(L[k] >= L[i]+L[j]) break;
        if(is_tri(L[i],L[j],L[k])) num++;
      }
    }
  }

  cout << num << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int ans;
  int k = n%1000;
  if(k==0)
  {
    ans =0;
  }
  else
  {
    ans = 1000-k;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int k = Integer.parseInt(in.nextLine());
		String s = in.nextLine();
		if(s.length() > k) {
			String mod_s = s.substring(0,k) + "...";
			System.out.println(mod_s);
		} else {
			System.out.println(s);
		}
	}
}

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

class BipartiteMatching {
private:
  struct edge {
    int to, cap, rev;
  };
  int U, V;
  vector<vector<edge>> G;
  vector<int> level;
  vector<int> iter;
public:
  BipartiteMatching(int u, int v) : U(u), V(v), G(U + V + 2) {
    for (int i = 0; i < U; i++) {
      init_edge(0, i + 1);
    }
    for (int i = 0; i < V; i++) {
      init_edge(U + i + 1, U + V + 1);
    }
  }
  void init_edge(int from, int to) {
    G.at(from).push_back((edge) {to, 1, (int) G.at(to).size()});
    G.at(to).push_back((edge) {from, 0, (int) G.at(from).size() - 1});
  }
  void add_edge(int from, int to) {
    from += 1, to += U + 1;
    G.at(from).push_back((edge) {to, 1, (int) G.at(to).size()});
    G.at(to).push_back((edge) {from, 0, (int) G.at(from).size() - 1});
  }
  void bfs(int s) {
    fill(level.begin(), level.end(), -1);
    queue<int> que;
    level.at(s) = 0;
    que.push(s);
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (auto &e : G.at(v)) {
        if (e.cap > 0 && level.at(e.to) < 0) {
          level.at(e.to) = level.at(v) + 1;
          que.push(e.to);
        }
      }
    }
  }
  int dfs(int v, int t, int f) {
    if (v == t) {
      return f;
    }
    for (int &i = iter.at(v); i < (int) G.at(v).size(); i++) {
      edge &e = G.at(v).at(i);
      if (e.cap > 0 && level.at(v) < level.at(e.to)) {
        int d = dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          G.at(e.to).at(e.rev).cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int solve() {
    level.resize(U + V + 2),  iter.resize(U + V + 2);
    int flow = 0;
    int s = 0, t = U + V + 1;
    for (;;) {
      bfs(s);
      if (level.at(t) < 0) return flow;
      fill(iter.begin(), iter.end(), 0);
      int f;
      while ((f = dfs(s, t, numeric_limits<int>::max())) > 0) {
        flow += f;
      }
    }
  }
  vector<int> allocate() {
    vector<int> res(U, -1);
    for (int i = 0; i < U; i++) {
      for (auto &e : G.at(i + 1)) {
        if (e.cap == 0 && e.to != 0) {
          res.at(i) = e.to - U - 1;
          break;
        }
      }
    }
    return res;
  }
};

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> R(N), B(N);
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    R.at(i) = {a, b};
  }
  for (int i = 0; i < N; i++) {
    int c, d;
    cin >> c >> d;
    B.at(i) = {c, d};
  }
  BipartiteMatching BM(N, N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (R.at(i).first < B.at(j).first && R.at(i).second < B.at(j).second) BM.add_edge(i,j);
    }
  }
  cout << BM.solve() << "\n";
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int C = sc.nextInt();
    
    int[] B = new int[M];
    int[][] A = new int[N][M];
    for (int i = 0; i < M; i++) {
      B[i] = sc.nextInt();
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < M; j++) {
        A[i][j] = sc.nextInt();
      }
    }

    //
    int ans = 0;
    for (int i = 0; i < N; i++) {
      int sum = 0;
      for (int j = 0; j < M; j++) {
        sum += A[i][j] * B[j];
      }
      if (sum + C > 0) {
        ans++;
      }
    }
    
    System.out.println(ans);
  }
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  cout << min(A,B)+min(C,D) << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
    	int K = sc.nextInt();
      	int counter = 0;
      	for(int i = 2; i <= K; i += 2) {
        	for(int j = 1; j <= K; j += 2) {
           		counter++;
            }
        }
      	System.out.println(counter);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define SaveTime ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1e9+7
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PI 4*atan(1)

using namespace std;

int main()
{
   int n; cin >> n;
   int num[n];
   ll ans = 0;
   for (int i = 0; i < n; i++) {
      cin >> num[i];
   }
   for (int i = 1; i < n; i++) {
      if (num[i] > num[i-1])
         continue;
      ans+= num[i-1]-num[i];
      num[i] = num[i-1];
   }
   cout << ans;
}

Measured memory_bytes: 4376
#include <stdio.h>


int main(){

    int n;
    int a, b;

    scanf("%d %d %d", &n, &a, &b);
    int ans = 0;

    for (int i = 0; i < 10; i++){
        for (int j = 0; j < 10; j++){
            for (int k = 0; k < 10; k++){
                for (int l = 0; l < 10; l++){
                    if(i*1000 + j*100 + k * 10 + l > n ) break;
                    if(a <= i + j + k + l && b >= i + j + k + l) ans+= i*1000 + j*100 + k * 10 + l;
                }
            }
        }
    }

    if(n  == 10000) ans+= 10000;

    printf("%d\n", ans);

    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

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

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n;
    cin >> n;
    
    vi dd;
    
    for(int i=1;i*i<=n;i++)
        if(n%i==0)
    {
        dd.pb(i);
        
        if((i*i) != n) dd.pb(n/i);
    }
    
    set<int> st;
    
    for(auto x : dd)
    {
        if(x == 1) continue;
        
        int temp  = n;
        
        while( temp > 0 && temp%x==0) temp/=x;
        
        if(temp == 0) st.insert(x);
        else if(temp%x == 1) st.insert(x);
        
    }
    
    int nn = n-1;
    
    for(int i=1;i*i<=nn;i++)
    if(nn%i == 0)
    {
        st.insert(i);
        st.insert(nn/i);
    }
    
    
    cout << (int)st.size()-1;
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;

int main() {
	int n;
	int a;
	double ans = 0.0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		ans += (double)1 / a;
	}
	ans = 1 / ans;
	printf("%.10lf\n", ans);
	return 0;
}


Measured memory_bytes: 256
/*input
12 3 7
*/
 

#include <bits/stdc++.h>

using namespace std;

#define ld long double
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<long long int, long long int> mpi;
typedef set<long long int> seti;
typedef multiset<long long int> mseti;
typedef priority_queue<long long int> pq;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define PI 3.14159265
#define dbg(x) cerr << "\n" << (#x) << " = " << (x) << endl ;
//#define cerr if(false)cerr
 
#define mod 998244353
 
struct node{
    ll val;
};
struct Interval {int start, end;};
bool compare(struct node n1, struct node n2) {
    return (n1.val < n2.val);
}

 
 
 
int main() 
{
	ll a,b,c; cin>>b>>a>>c;
	ll fila = b-a;
	ll used = min(fila,c);
	cout<<max(0LL,c-fila)<<endl;
	return 0;  
}






Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N;
    cin >> N;
    VI a(N);
    REP(i, N) {
        cin >> a[i];
    }

    map<int, int> mp;
    REP(i, N) {
        auto itr = mp.lower_bound(a[i]);
        if (itr != begin(mp)) {
            itr = prev(itr);
            if (itr->first < a[i]) {
                if (--itr->second == 0) {
                    mp.erase(itr);
                }
            }
        }
        mp[a[i]]++;
    }

    int ans = 0;
    FORE(e, mp) ans += e.second;
    cout << ans << endl;
}


Measured memory_bytes: 5248
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        long A = scanner.nextLong();
        long B = scanner.nextLong();

        System.out.println(lcm(A, B));

    }

    static long lcm(long a, long b) {
        long temp;
        long c = a;
        c *= b;
        while ((temp = a % b) != 0) {
            a = b;
            b = temp;
        }
        return c / b;
    }
}

Measured memory_bytes: 21972
from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))

result = [-1 for _ in range(n)]
tree = [[] for _ in range(n)]
for _i in range(n-1):
    u, v = map(int, input().split())
    u, v = u-1, v-1
    tree[u].append(v)
    tree[v].append(u)
INF = float('inf')
dp = [INF for _i in range(n+1)]


def dfs(p, x):
    i = bisect_left(dp, a[p])
    old = dp[i]
    dp[i] = a[p]
    result[p] = bisect_left(dp, INF)
    for j in tree[p]:
        if j != x:
            dfs(j, p)
    dp[i] = old
    

dfs(0, -1)

for i in result:
    print(i)

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

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

	string ans = "";

	for (auto &&c : s)
	{
		if (c == 'B' && !ans.empty())
		{
			ans.pop_back();
		}
		else if (c == '0' || c == '1')
		{
			ans.push_back(c);
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int ans = 1e9;
    for (int n = 0; n <= 2 * max(X, Y); n += 2) {
        int temp = A * max(0, X - n / 2) + B * max(0, Y - n / 2) + C * n;
        if (temp < ans) ans = temp;
    }
    cout << ans << endl;
}

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

int N;
int A[210];         // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

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

    int res = 0;

    // 操作が行える限り操作を繰り返す
    while (true) {
        bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらフラグを立てる
        }

        if (exist_odd) break;  // 奇数があったら break

        // 操作を行えるなら操作を実際に行う
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // 操作回数をインクリメント
    }

    cout << res << endl;
}


Measured memory_bytes: 256
/* ex 7_1
   Sagzar1993 */

#include <stdio.h>

//頂点を表す構造体
typedef struct point{
    int x_elem;
    int y_elem;
} point;

//頂点を引数の分だけ移動した先の頂点を返す
point pointMove(point pnt, int x_move, int y_move){
    point pntMoved;
    pntMoved.x_elem = pnt.x_elem + x_move; //pntをx方向にx_moveだけ移動
    pntMoved.y_elem = pnt.y_elem + y_move; //pntをy方向にy_moveだけ移動
    return pntMoved;
}

int main(void){
    int delta_x, delta_y;
    point pnt1, pnt2, pnt3, pnt4; //正方形の各頂点
    //頂点１、頂点２の座標を入力
    scanf("%d %d %d %d", &pnt1.x_elem, &pnt1.y_elem, &pnt2.x_elem, &pnt2.y_elem);

    delta_x = pnt2.x_elem - pnt1.x_elem; //頂点２と頂点１のx座標の差
    delta_y = pnt2.y_elem - pnt1.y_elem; //頂点２と頂点１のy座標の差

    //頂点３は、頂点２からx方向に-delta_y, y方向にdelta_xだけ移動させた点
    pnt3 = pointMove(pnt2, -delta_y, delta_x);
    //頂点４は、頂点１からx方向に-delta_y, y方向にdelta_xだけ移動させた点
    pnt4 = pointMove(pnt1, -delta_y, delta_x);

    printf("%d %d %d %d\n", pnt3.x_elem, pnt3.y_elem, pnt4.x_elem, pnt4.y_elem); //出力

    return 0;
}

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

typedef long long ll;


int main(){
	
    ll n;
    cin>>n;
    string mp[27]={"","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"};
    if(n>=1 && n<=26)
    cout<<mp[n]<<endl;
    else{
   
    string ans="";
	
	
		
    	while(n>0){
		
    	 
    	 int s=(n%26);
    	 if(s==0)
    	 {
		 s=s+26;
		 n=n/26;
		 n--;
		 }
		 else 
		 n=n/26;
    	 ans=mp[s]+ans;
    	 
    	 
    }
    cout<<ans<<endl;
    
	}
    
	
    
    
    
    return 0;
}




Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
// vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();

    int d, t, s;
    cin >> d >> t >> s;
    if (s * t >= d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	int x;
	x = 0;
	for (a; a <= b; a++) {
		int a1, a2, a3, a4, a5;
		a5 = a % 10;
		a4 = (a % 100) / 10;
		a3 = (a % 1000) / 100;
		a2 = (a % 10000) / 1000;
		a1 = (a % 100000) / 10000;
		if (a1 == a5 && a2 == a4) {
			x++;
		}
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    ll ans = 0;
    rep(i,n){
        a[i]--;
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef pair<int,pi> ti;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<ti> vti;
int ans[2000];

set<int> found;

vi edges[2000];
int n,x,y;

void bfs(int p){
    vti q;
    q.push_back({0,{p,-1}});
    int ptr = 0;
    while(ptr < n){
//        cerr << "hi" << endl;
        int child,depth,parent; depth = q[ptr].f;
        child = q[ptr].s.f;
        parent = q[ptr++].s.s;
        ans[depth]++;
        for(auto &a : edges[child]){
            if(a == parent || found.count(a)) continue;
            else{
                found.insert(a); q.push_back({depth+1,{a,child}});
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> x >> y;
    F0R(i,1,n-1){
        edges[i].push_back(i-1);
        edges[i-1].push_back(i);
    }
    edges[x-1].push_back(y-1);
    edges[y-1].push_back(x-1);
    FOR(i,n){
        found.clear();
        found.insert(i);
        bfs(i);
    }
    F0R(i,1,n-1) cout << ans[i]/2 << endl;
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
         int x;
         cin >> x;
         long long ans = 0;
         for(int i = 1; i <= x; i++)
         {       
                 if(i % 3 != 0 && i % 5 != 0)
                 {       
                         ans += i;
                 }
         }
         cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,k,q;
  cin >> n >> k >> q;
  int a[n];
  rep(i,n){
    cin >> a[i];
  }
  int ans=INT_MAX;
  rep(i,n){
    vector<int> ans_can;
    int x=a[i];
    vector<int> t;
    rep(j,n){
      if(j==i && j!=n-1){
	t.pb(a[j]);
      }
      else if(a[j]>=a[i] && j!=n-1) t.pb(a[j]);
      else{
	if(j==n-1 && a[j]>=a[i]) t.pb(a[j]);
	sort(t.begin(),t.end());
	rep(l,t.size()){
	  if(t.size()-1-l+1<k) break;
	  ans_can.pb(t[l]);
	}
	t.clear();
      }
    }
    if(!ans_can.empty()){
      sort(ans_can.begin(),ans_can.end());
      //      rep(i,ans_can.size()) cout << ans_can[i] << endl;
      if(ans_can.size()>=q) ans=min(ans_can[q-1]-x,ans);
    }
    //cout << ans << endl;
  }
  cout << ans << endl;


  
  return 0;
    

}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " : " << x << " " << endl
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
int n,m,k,q,ok;

signed main()
{
	cin>>n>>m;
	int ans = 0;
	while(n)
	{
		n /= m;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
void bubbleSort(int A[],int N);
int main(void){
	int N;
	scanf("%d",&N);
	int A[N];
	for(int i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	
	bubbleSort(A,N);
	
	return 0;
}

void bubbleSort(int A[],int N){
	int count=0,tmp,j;
	int sum;
	for(int i=0;i<N*N;i++){
		for(j=N-1;j>=1;j--){
				if(A[j]<A[j-1]){
					tmp=A[j];
					A[j]=A[j-1];
					A[j-1]=tmp;
					count++;
				}
			}
	}
	for(j=0;j<N;j++){
		if(j>0)printf(" ");
		printf("%d",A[j]);
	}
	printf("\n");
	printf("%d\n",count);
}


Measured memory_bytes: 2092