akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

/*bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}*/
/*ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/
/*ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}*/
/*ll modpow(ll x, ll y, ll mod) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}*/
/*ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}*/
//printf("%.10f\n", n);

signed main() {
	string s;
	ll n, m, k, a, b, c, cnt = 0, ans = 0;
	cin >> n >> m >> k;
	cout << (n + m - 1) / m * k << endl;
	return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> arr(n);
    for(auto &x : arr){
        cin>>x;
    }
    vector<int> dp(n+1,0);
    dp[0] = 0;
    dp[1] = abs(arr[1]-arr[0]);
    for(int i = 2; i < n; i++){
        dp[i] = min(dp[i-1] + abs(arr[i]-arr[i-1]),dp[i-2] + abs(arr[i-2]-arr[i]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 4064
#include <cstdio>

int main()
{
	long long X;
	scanf("%lld", &X);

	long long money = 100;
	int year = 0;

	while(money < X) {
		money *= 1.01;
		year++;
	}
	// printf("%lld", X);
	printf("%d", year);

	return 0;
}

Measured memory_bytes: 1732
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcount((unsigned int)x);};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vvl G(N);
    rep(i, M){
        ll u, v; cin >> u >> v; u--; v--;
        G[u].pb(v);
    }
    ll s, t; cin >> s >> t; s--; t--;

    queue<PL> q;
    vvl dist(N, vl(3, LINF));
    dist[s][0] = 0;
    q.push({s, 0});
    while(!q.empty()){
        ll now = q.front().ff, now_d = q.front().ss; q.pop();
        ll cur_mod = now_d%3;
        if(dist[now][cur_mod] < now_d) continue;
        ll nx_mod = (now_d+1)%3;
        for(ll nx : G[now]){
            if(dist[nx][nx_mod] > now_d + 1){
                dist[nx][nx_mod] = now_d + 1;
                q.push({nx, dist[nx][nx_mod]});
            }
        }
    }
    cout << (dist[t][0] == LINF ? -1 : dist[t][0]/3) << endstr;
    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  for(int R0, W0, C, R; cin >> R0 >> W0 >> C >> R && (R0!=0&&W0!=0);) {
    rep(X, 114514810) {
      if((R0 + X * R) >= C * W0) {
        cout << X << endl;
        break;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=998244353;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    ll n=s.size();
    ll i,j,k;
    ll f=0;
        for(i=0;i<n;i++)
    {
        for(j=0;j<(n-i);j++)
        {
            string ss="";
            ss+=s.substr(0,i);
            ss+=s.substr(i+j,n-i-j);
            if(ss=="keyence")
                f=1;
        }
    }
    if(f)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


vec parent;
vec cost;


int find(int x)
{
	if (parent[x] == x)return x;
	int y = find(parent[x]);
	cost[x] += cost[parent[x]];
	return parent[x] = y;
}


bool unite(int L, int R, int D)
{
	int x = find(L);
	int y = find(R);

	if (x == y)
	{
		return cost[R] - cost[L] == D;
	}

	if (cost[L] + D > cost[R])
	{
		parent[y] = x;
		cost[y] = cost[L] + D - cost[R];
	}
	else
	{
		parent[x] = y;
		cost[x] = cost[R] - D - cost[L];
	}
	return true;
}


int main()
{
	int N, M;
	cin >> N >> M;

	parent = move(vec(N));
	cost   = move(vec(N, 0));
	
	for (int i = 0; i < N; ++i)
	{
		parent[i] = i;
	}

	bool ans = true;

	for(int i=0;i<M;++i)
	{
		int L, R, D;
		cin >> L >> R >> D;
		--L; --R;
		if (!unite(L, R, D))ans = false;
	}
	
	for (int i = 0; i < N; ++i)
	{
		//printf("%d %d %d\n", i+1, find(i)+1, cost[i]);
		find(i);
		if (cost[i] > 1000000000)ans = false;
	}
	


	cout << (ans ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a; cin >> a;
    int min = 3000000,cnt = 0;
    int n;
    for(int i=0;i<a;i++){
        cin >> n;
        if(n < min){
            min = n;
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n; cin>>n;
    ll sum=0;
    for(int i=1; i<=1e7; i++){
        sum+=i;
        if(n<sum){
            for(int j=1; j<=i; j++){
                if(j==sum-n) continue;
                cout << j << endl;
            }
            return 0;
        }
    }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main(){
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var N, K int
	fmt.Fscan(r, &N, &K)
	A := make([]int, N)
	m := map[int]int{}
	for i:=0; i < N; i++{
		fmt.Fscan(r, &A[i])
		m[A[i]]++
	}
	cnt := len(m)
	rank:= []int{}
	for _, v := range m{
		rank = append(rank, v)
	}
	sort.Slice(rank, func(i, j int) bool {return rank[i] < rank[j]})
	ans := 0
	for i:=0; i < cnt - K; i++{
		ans += rank[i]
	}
	fmt.Fprintln(w, ans)


}

Measured memory_bytes: 19560
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		int in = 0;
		int out = 0;
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == 'a') {
				if (in + out < a + b) {
					System.out.println("Yes");
					in++;
				} else {
					System.out.println("No");
				}
			} else if (s.charAt(i) == 'b') {
				if (in + out < a + b && out < b) {
					System.out.println("Yes");
					out++;
				} else {
					System.out.println("No");
				}
			} else {
				System.out.println("No");
			}
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

int main() {
    int r = 1;
    vector<int> color(3);
    for (int i = 0; i < 3; i++) {
      cin >> color.at(i);
    }
    sort(color.begin(), color.end());
    if (color.at(0) != color.at(1)) {
      r++;
    }
    if (color.at(1) != color.at(2)) {
      r++;
    }
    cout << r << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define rep2(i) for(int i=0; i<2; i++)
using namespace std;

int give_rest(int &num){
  int rest = num%10;
  num /= 10;
  return rest;
}

int cal_ans(int numbers[4], int i, int j, int k){
  int pm_operator[2] = {+1, -1};
  int ans = numbers[0] + pm_operator[i]*numbers[1]
            	       + pm_operator[j]*numbers[2]
                       + pm_operator[k]*numbers[3];
  return ans;
}

int main(){
  int ABCD; cin >> ABCD;
  int numbers[4];
  for(int i=0; i<4; i++) numbers[3-i] = give_rest(ABCD); 
  
  string char_pm = "+-";
  rep2(i){
    rep2(j){
      rep2(k){
        int ans = cal_ans(numbers, i, j, k);
        if(ans==7){
          cout << numbers[0]
               << char_pm[i] << numbers[1]
               << char_pm[j] << numbers[2]
               << char_pm[k] << numbers[3] << "=7" << endl;
          return 0;
        }
      }
    }
  }
}

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

long long a, b, k;

int main()
{
    cin >> a >> b >> k;
    if (a >= k)
    {
        a -= k;
        k = 0;
    }
    else
    {
        k -= a;
        a = 0;
    }
    b = max(0LL, b - k);
    cout << a << ' ' << b << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
#define chmax(a,b) if(b>a) a = b
#define chmin(a,b) if(b<a) a = b
typedef long long ll;

using namespace std;

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

map< ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      ll a,b; cin >> a >> b;
      ll gc = __gcd(a,b);
      auto mp = prime_factor(gc);
      cout << mp.size() + 1 << endl;
      return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a==b and b==c)or (a!=b and b!= c and c!=a)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
n,m,k=map(int,input().split())
fri=[0 for _ in range(n)]
blo=[0 for _ in range(n)]

par=[i for i in range(n)]
size=[1 for _ in range(n)]
rank=[0 for _ in range(n)]
 
def find(x):#木の根を求める
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
    
def merge(x,y):#併合
    x=find(x)
    y=find(y)
    if x==y:
        return
    if rank[x]>rank[y]:
        par[y]=x
        size[x]+=size[y]
    else:
        par[x]=y
        size[y]+=size[x]
        if rank[x]==rank[y]:
            rank[y]+=1
            
def same(x,y):
    return find(x)==find(y)

for _ in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    merge(a,b)
    fri[a]+=1
    fri[b]+=1
    
for _ in range(k):
    c,d=map(int,input().split())
    c,d=c-1,d-1
    if same(c,d):
        blo[c]+=1
        blo[d]+=1

ans=[size[find(i)]-fri[i]-blo[i]-1 for i in range(n)]
print(*ans)

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

typedef long long ll;

const int mod = 1000000007;
const int Maxn = 100005;

int n, k;
int cnt[Maxn];
int res;

int toPower(int a, int p)
{
    int res = 1;
    while (p) {
        if (p & 1) res = ll(res) * a % mod;
        p >>= 1; a = ll(a) * a % mod;
    }
    return res;
}

int main()
{
    scanf("%d %d", &n, &k);
    for (int i = k; i > 0; i--) {
        cnt[i] = toPower(k / i, n);
        for (int j = i + i; j <= k; j += i)
            cnt[i] = (cnt[i] - cnt[j] + mod) % mod;
        res = (res + ll(cnt[i]) * i) % mod;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 4208
def main():
    """
    1 <= i < j < k <= |T|
    Ti = A
    Tj = B
    Tk = C
    """
    S = input()
    ans2 = dp_simple(S)
    print(ans2)


def dp_simple(S):
    n = len(S)
    MOD = 10 ** 9 + 7
    dp = [[0] * (3+1) for _ in range(n+1)]
    # 組合せ列挙なので掛け算としての単位元
    dp[0][0] = 1

    for i in range(n):
        # i文字目まで
        for j in range(3+1):
            # 0-3文字揃ってる
            m = 1
            if S[i] == "?":
                # 置換できるので3パターン
                m = 3
            dp[i+1][j] += dp[i][j] * m
            dp[i+1][j] %= MOD

            # 3文字揃ってないとき, 対応する文字になるか？
            if j < 3 and (S[i] == "?" or S[i] == "ABC"[j]):
                dp[i+1][j+1] += dp[i][j]
                dp[i+1][j+1] %= MOD

    ans = dp[n][3]
    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 27612
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    if (s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

}
   

Measured memory_bytes: 3628
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define full(x) (bin((x)+1)-1)
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}

	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=3e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or m<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	
	const int N=1e5+10;
	//------------------FIXED------------------
	
	void main()
	{
		ll a=qread();string s;cin>>s;
		ll b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
		write(a*b/100);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s\n",1.0*clock()/CLOCKS_PER_SEC);
}

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

using i64 = int64_t;
i64 INF = 1ll << 60;

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> h(110000);
  for(int i = 0; i < n; i++)
    cin >> h[i];
  
  vector<i64> cost(110000);
  for(int i = 0; i < cost.size(); i++)
    cost[i] = INF;
  cost[0] = 0;
  
  for(int i = 0; i < n; i++){
    for(int j = 1; j <= k; j++)
      chmin(cost[i+j], cost[i]+abs(h[i]-h[i+j]));
  }
  
  cout << cost[n-1] << endl;
  
  return 0;
  
}

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

int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int ans =0;
  for(int i = 0;i<1000;i++){
    int check = 0;
    rep(j,N){
      int x = s.at(j)-'0';
      if(check==0){
        if(x==i/100) check++;
        continue;
      }
       if(check==1){
        if(x==(i%100)/10) check++;
         continue;
      }
       if(check==2){
        if(x==i%10) check++;
      }
    }
    if(check==3) ans++;
  }
  cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
	static String check(int num)
	{
		if(num==3) return "bon";
		else if(num==0 || num==1 || num==6 || num==8) return "pon";
		else return "hon";
	}
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int num = n%10;
		System.out.println(check(num));
	}
}

Measured memory_bytes: 35768
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll, ll>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll sz=1e6+100;
bool mark[sz];
vector<ll> prime;
ll siz;
void seive()
{
    ll i,j,k;
    ll sq=sqrt(sz);
    for(i=3;i<sz;i+=2)
    {
       mark[i]=true;
    }
    prime.pb(2);
    for(i=3;i<=sq;i+=2)
    {
        if(mark[i])
        {
            for(j=i*i;j<sz;j+=2*i) mark[j]=false;
        }
    }
    mark[1]=true;
    mark[2]=true;
    for(i=3;i<sz;i+=2) if(mark[i]) prime.pb(i);
    siz=prime.size();
}
 
ll fact(ll x)
{
      ll ct=0;
      ll i,j,k;
      if(x>0) ++ct;
      ll sq=sqrt(x);
      for(i=0;i<siz && prime[i]<=sq;i++)
      {
          if(x<sz && mark[x]) break;
          if(x%prime[i]==0)
          {
              ++ct;
              while(x%prime[i]==0) x/=prime[i];
              sq=sqrt(x);
          }
          
      }
 
      if(x>1) ++ct;
      return ct;
}
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    seive();
    while(cin>>p>>q)
    {
        n=__gcd(p,q);
        ll ans=fact(n);
        cout<<ans<<endl;
    }
 
}

Measured memory_bytes: 2424
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin >> s; 

    int n = s.length();
    int i = 0; 
    int cot=0;
    
    while(i<=n-1-i){
        if(s[i]!=s[n-1-i]){
            cot++;
        }
        i++;
    }
    cout << cot << endl;
    return 0;
}

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

using namespace std;

const int NMAX = 3000;

long double dp[2][NMAX + 1];

int main() {
    int n;
    long double x;
    cin>>n;
    for( int i = 1; i <= n; i ++ ) {
      cin>>x;
      if( i > 1 ) {
        for( int j = 0; j <= i; j ++ ) {
          dp[i & 1][j] = 0;
          if( j < i )
            dp[i & 1][j] += dp[(i - 1) & 1][j] * (1 - x);
          if( j > 0 )
            dp[i & 1][j] += dp[(i - 1) & 1][j - 1] * x;
        }
      }
      else {
        dp[i & 1][0] = 1 - x;
        dp[i & 1][1] = x;
      }
    }
    x = 0;
    for( int i = (n + 1) / 2; i <= n; i ++ )
      x += dp[n & 1][i];
    cout.precision(17);
    cout << x;
    return 0;
}


Measured memory_bytes: 3252
H,W,D=map(int,input().split())
l=[None]*(H*W+1)
for i in range(H):
    s=tuple(map(int,input().split()))
    for j in range(W):
        l[s[j]]=(i,j)
S=[0]*(H*W+1)
for i in range(D+1,H*W+1):
    S[i]=S[i-D]+abs(l[i][0]-l[i-D][0])+abs(l[i][1]-l[i-D][1])
Q=int(input())
for i in range(Q):
    L,R=map(int,input().split())
    print(S[R]-S[L])

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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

int n, cnt[1000001];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;

    int t;
    while (n--)
        cin >> t, cnt[t]++;

    int ans = 0;
    for (int i = 1; i <= 1000000; i++)
    {
        if (cnt[i] == 1)
            ans++;
        if (cnt[i])
        {
            if (i == 1)
                break;
            for (int j = 1; i * j <= 1000000; j++)
                cnt[i * j] = 0;
        }
    }
    cout << ans << '\n';

    return 0;
}

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

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


Measured memory_bytes: 7572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N;
  int cnt = 0;
  cin >> N;
  rep(i, N) {
    int l,r;
    cin >> l >> r;
    cnt += r - l + 1;

  }
  cout << cnt;
}

Measured memory_bytes: 3568
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;

typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

long long int MOD = 1000000007;
int N;
vi G[114514];
int color[114514]={0};
int main(){
	cin>>N;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	color[0]=1;color[N-1]=2;
	queue<pii> Fen,Sun;
	int cnt=0;
	Fen.push(mp(0,0));
	Sun.push(mp(N-1,0));
	while(Fen.size()+Sun.size()){
		while(!Fen.empty()){
			pii now=Fen.front();
			int v=now.first;
			if(now.second!=cnt)break;
			Fen.pop();
			for(int i=0;i<G[v].size();i++){
				int nex=G[v][i];
				if(color[nex]==0){
					//cout<<nex<<endl;
					color[nex]=1;
					Fen.push(mp(nex,cnt+1));
				}
			}
		}
		
		while(!Sun.empty()){
			pii now=Sun.front();
			int v=now.first;
			if(now.second!=cnt)break;
			Sun.pop();
			for(int i=0;i<G[v].size();i++){
				int nex=G[v][i];
				if(color[nex]==0){
					color[nex]=2;
					Sun.push(mp(nex,cnt+1));
				}
			}
		}
		cnt++;
	}
	int cntF=0,cntS=0;
	rep(i,N){
	   if(color[i]==1)cntF++;
		else if(color[i]==2) cntS++;
		
			   }
	//cout<<cntF<< " "<<cntS<<endl;
	if(cntF>cntS)cout<<"Fennec"<<endl;
	else cout<<"Snuke"<<endl;
	
}

Measured memory_bytes: 6656
#include <stdio.h>

int main(void)
{   int s,m,h;
	scanf ("%d" ,&s);
	m=s/60;
	s=s%60;
	h=m/60;
	m=m%60;
	printf ("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
using vpii = vector<pii>;
using vpll = vector<pll>;

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

  int cnt = 0;

  rep2(i, 2, N){
    if(S[i - 2] == 'A' && S[i - 1] == 'B' && S[i] == 'C'){
      cnt++;
    }
  }

  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    for(ll i=0;i<=n-1;i++){
        ll mi = a + c*i - d*(n-1-i);
        ll ma = a + d*i - c*(n-1-i);
        if(mi<=b&&b<=ma){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b,c,k,n,i,t;
	cin>>a>>b>>c>>k;
	t=0;
	if(k>a)
	{
		t+=a;
		k-=a;
	}else
	{
		cout<<k;
		return 0;
	}
	
	if(k>b)
	{
		k-=b;
	}else
	{
		cout<<t;
		return 0;
	}
	
	
	
		t-=k;
		cout<<t;
		return 0;
	
	
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
   int n,cnt=0;
   cin >> n;
   for(int i=1; i<=n; i++) if(i%2==1) cnt++;
   printf("%.9f\n",(double)cnt/n);
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main(A, N):
    d1 = defaultdict(int)
    d2 = defaultdict(int)

    for i, a in enumerate(A):
        d1[i+a] += 1
    
    for i, a in enumerate(A):
        d2[i-a] += 1

    cnt = 0
    for x in set(list(d1.keys())+list(d2.keys())):
        cnt += d1[x]* d2[x]

    print(cnt)
    pass

if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    main(A, N)


Measured memory_bytes: 174100
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(x--)
#define mp make_pair
#define pb push_back

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

 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__);
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const ld PI = acos(-1.0);
const int MOD = 1000000007;
const int INF = 1e18;
const int N = 1e6+5;


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
  
    int n,ans=0;
    cin>>n;
   for(int i = 1;i<n;i++){
       for(int j = 1; i*j<n;j++)ans++;
   }
    
    cout<<ans<<endl;
    return 0;
}


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

const int N = 200 * 1000 + 20;
bool p[N];

int main() {
	p[1] = true;
 	for (int i = 2; i < N; i++)
      	if (!p[i])
          	for (int j = 2 * i; j < N; j += i)
            	p[j] = true;
 	int n;
  	cin >> n;
  	for (int i = n; i < N; i++)
      	if (!p[i])
          	return cout << i << "\n", 0;
}


Measured memory_bytes: 384
#pragma optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define INS(x) x.begin(),x.end()
#define debug(x) cout<<x;
    
struct Edge
{
    int v;
    int w;
    int next;
}edge[1000005];

priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q;
int head[200005];
int cnt;
bool vis[200005];
unsigned F[200005];
int cot[200005];

void add(int u,int v,int w)
{
    cnt++;
    edge[cnt].v=v;
    edge[cnt].w=w;
    edge[cnt].next=head[u];
    head[u]=cnt;
}

int main()
{
    int n,x,y;
    cin>>n>>x>>y;

    for(int i=1;i<n;i++)
    {
        add(i,i+1,1);
        add(i+1,i,1);
    }

    add(x,y,1);
    add(y,x,1);
    
    for (int i=1;i<n;i++)
    {
        for (int i=1;i<=n;i++) F[i]=INT_MAX;    //初始化
        memset(vis,0,sizeof(vis));
        F[i]=0;
        q.push(make_pair(0,i));
        while (!q.empty())
        {
            int x=q.top().second;
            q.pop();    //在判断之前先pop
            if (vis[x]) continue;
            vis[x]=1;

            for (int j=head[x];j;j=edge[j].next) 
            {
                if(F[edge[j].v]>F[x]+edge[j].w)
                {
                    F[edge[j].v]=F[x]+edge[j].w;
                    q.push(make_pair(F[edge[j].v],edge[j].v));
                }
            }
        }

        for (int j=i+1;j<=n;j++)
            if (F[j]!=INT_MAX)
                cot[F[j]]++;

    }

    for (int i=1;i<n;i++)
        cout<<cot[i]<<'\n';
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define MOD 1000000007
#define all(c) c.begin(), c.end()
#define rep(i, s, e) for (auto i = s; i < e; i++)
#define peek(v)      \
	for (auto i : v) \
		cout << i << ' ';

void solve()
{
	int n;
	cin >> n;
	multiset<int> s;
	int sum = 0;
	while (n--)
	{
		int x;
		cin >> x;
		sum += x;
		s.insert(x);
	}
	if (sum % 10)
		cout << sum;
	else
	{
		multiset<int>::iterator it;
		for (it = s.begin(); it != s.end() && *it % 10 == 0; it++)
			;
		if (it != s.end())
			cout << sum - *it;
		else
			cout << 0;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
	cerr << "\n\n~" << 500 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
using Grid = vector<vector<int>>;
using vi = vector<int>;

int main() {
    int N, Q;
    cin >> N >> Q;
    list<tuple<int, int, int>> eve;
    rep(i, N) {
        int s, t, x;
        cin >> s >> t >> x;
        eve.emplace_back(s - x, 1, x);
        eve.emplace_back(t - x, -1, x);
    }
    eve.sort();
    set<int> ms;
    rep(i, Q) {
        int p;
        cin >> p;
        while (eve.size() > 0 && get<0>(eve.front()) <= p) {
            if (get<1>(eve.front()) == 1)
                ms.insert(get<2>(eve.front()));
            else
                ms.erase(get<2>(eve.front()));
            eve.pop_front();
        }
        cout << (ms.size() == 0 ? -1 : *(ms.begin())) << endl;
    }
}


Measured memory_bytes: 22280
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;

//READ THE PROBLEM!
//ll or int?

//Template contributed by GitHub user bqi343


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

	int n;
	cin >> n;

	int best = 10000;
	for (int i = 0; i < n; i++) {
        int cur;
        cin >> cur;
        int result = 0;
        while (cur % 2 == 0) {
            cur = cur / 2;
            result++;
        }
        best = min(result, best);
	}
	cout << best << endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main {

    public static void playGame(long[] sequence) {
        long[][] dp = new long[sequence.length + 1][sequence.length + 1];

        for(int i=1; i<=sequence.length; i++)
            dp[i][i] = sequence[i-1];

        for(int gap= 1; gap<sequence.length; gap++) {

            for(int start = 1, end = start + gap; start <= sequence.length && end <= sequence.length ; start++, end++) {
                dp[start][end] = Math.max(sequence[start-1] - dp[start+1][end], sequence[end-1] - dp[start][end-1]);
            }

        }

        System.out.println(dp[1][sequence.length]);
    }


    public static void playGameMemo(long[] sequence) {
        long[][] memo = new long[sequence.length][sequence.length];
        for(int i=0; i<sequence.length; i++)
            Arrays.fill(memo[i], -1);
        long maxValueAttainable = playGameMemoHelper(sequence, memo, 0, sequence.length - 1);
        long sum = 0;

        for(int i=0; i<sequence.length; i++)
            sum = sum + sequence[i];
        long Y = sum - maxValueAttainable;
        System.out.println(maxValueAttainable - Y);
    }

    private static long playGameMemoHelper(long[] sequence, long[][] memo, int start, int end) {
        if(start > end) {
            return 0;
        }

        if(start == end) {
            return sequence[start];
        }

        if(start + 1 == end) {
            return memo[start][end] = Math.max(sequence[start], sequence[end]);
        }

        if(memo[start][end] != -1) {
            return memo[start][end];
        }

        long state1 = sequence[start] +  Math.min(playGameMemoHelper(sequence, memo, start+2, end), playGameMemoHelper(sequence, memo, start + 1, end - 1));
        long state2 = sequence[end] + Math.min(playGameMemoHelper(sequence, memo, start + 1, end - 1), playGameMemoHelper(sequence, memo, start, end - 2 ));

        return memo[start][end] = Math.max(state1, state2);
    }

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

        int N = scanner.nextInt();

        long[] sequence = new long[N];

        for(int i=0; i<N; i++) {
            sequence[i] = scanner.nextLong();
        }

        //playGame(sequence);
        playGameMemo(sequence);
    }

}


Measured memory_bytes: 129752
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] blues = new String[n];
		for (int i = 0; i < n; i++) {
			blues[i] = sc.next();
		}
		int m = sc.nextInt();
		String[] reds = new String[m];
		for (int i = 0; i < m; i++) {
			reds[i] = sc.next();
		}
		int max = 0;
		for (int i = 0; i < n; i++) {
			int score = 0;
			for (int j = 0; j < n; j++) {
				if (blues[i].equals(blues[j])) {
					score++;
				}
			}
			for (int j = 0; j < m; j++) {
				if (blues[i].equals(reds[j])) {
					score--;
				}
			}
			if (score > max) {
				max = score;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] a = sc.next().toCharArray();
		char[] b = sc.next().toCharArray();
		
		//System.out.println((a[0] == b[0] ? 1 : 0) + (a[1] == b[1] ? 1 : 0) + (a[2]==b[2] ? 1: 0));
		
		int ans = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i] == b[i]) ans += 1;
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
// AOJ 2187: Card Game
// 2017.11.6 bal4u@uu

#include <stdio.h>
#include <string.h>
#define TM 0
#if TM
#include <time.h>
#endif

#define P9	2.7557319223985890652557319223986e-6	// =1/9!
int g[10], j[10];
int f[10];
int ans;

void rec(int i, int sg, int sj)
{
	int k;
	if (i == 9) { ans += (sg > sj); return; }
	for (k = 0; k < 9; k++) {
		if (f[k]) continue;
		f[k] = 1;
		if (g[i] > j[k]) rec(i+1, sg+g[i]+j[k], sj);
		else             rec(i+1, sg, sj+g[i]+j[k]);
		f[k] = 0;
	}
}

int main()
{
	int t, i;
#if TM
	clock_t start, end;
	start = clock();
#endif
	scanf("%d", &t);
	while (t-- > 0) {
		for (i = 0; i < 9; i++) scanf("%d", g+i);
		for (i = 0; i < 9; i++) scanf("%d", j+i);
		memset(f, 0, sizeof(f));
		ans = 0;
		rec(0, 0, 0);
		printf("%.5lf %.5lf\n", ans*P9, 1-ans*P9);
	}
#if TM
	end = clock();
	printf("time %lf\n", (double)(end-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 1732
import math

def prime_serch(num):
  num_p = int(math.sqrt(num))
  prime = 1
  for n in range(2, num_p):
    if num % n == 0:
      prime = 0
      break
  return prime


num = int(input())
n = 0
while n == 0:
  if prime_serch(num) == 1:
    n = 1
  num += 1
print(num - 1)

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

using namespace std;

template <typename T>
class FenwickTree {
 private:
  std::vector<T> ft;

 public:
  FenwickTree(int sz) : ft(sz + 1, 0) {}

  void add(int idx, T x) {
    for (int i = idx + 1; i < static_cast<int>(ft.size()); i += i & -i) {
      ft[i] += x;
    }
  }

  T operator()(int idx) const {
    T res = 0;
    for (int i = idx + 1; i > 0; i -= i & -i) {
      res += ft[i];
    }
    return res;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  cin >> N >> Q;
  vector<int> C(N);
  for (int i = 0; i < N; i++) {
    cin >> C[i];
    C[i]--;
  }
  vector<vector<pair<int, int>>> L(N);
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    L[r].emplace_back(make_pair(l, i));
  }
  vector<int> res(Q);
  FenwickTree<int> ft(N + 1);
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) {
    if (A[C[i]] > 0) ft.add(A[C[i]], -1);
    ft.add(i + 1, 1);
    A[C[i]] = i + 1;
    for (int j = 0; j < (int)L[i].size(); j++) {
      res[L[i][j].second] = ft(i + 1) - ft(L[i][j].first);
    }
  }
  for (auto r : res) {
    cout << r << '\n';
  }
  return 0;
}


Measured memory_bytes: 33276
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <queue>

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

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
  int a, b, h, res;
  cin >> a >> b >> h;
  res = (a+b)*(h/2);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256