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


//再帰関数による最大公約数
long long gcd(long long x, long long y){
    return y ? gcd(y, x % y) : x;
}

//m*nが型の上限を超えないことが保証されている場合の最小公倍数
long long lcm(long long m, long long n){
    long long ans;
    if (m > n) ans = ( m / (gcd(m, n)) ) * n;
    else ans = (n / (gcd(m, n)) ) * m;

    return ans;
}

int main(){
    int n;
    long long l,m;
    cin >> n;

    cin >> l;
    for (int i = 1; i < n; i++)
    {
        cin >> m;
        l = lcm(l,m);
    }

    cout << l << endl;

}

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

int main(){
  int n;
  cin >> n;

  long long int ans = 1;
  long long int flag = pow(10, 18);
  int f = 1;

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

    if (a == 0){
      cout << "0" << endl;
      return 0;
    } else {
      if (ans <= flag / a){
        ans *= a;
      } else {
        f = 0;
      }
    }
  }

  if (f) cout << ans << endl;
  else cout << "-1" << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, k;
    cin >> n >> k;
    vec h(n);
    rep(i, n) cin >> h[i];

    sort(all(h));

    int res = INF;

    for (int i = 0; i+k-1 < n; i++) {
        res = min(res, h[i+k-1] - h[i]);
    }

    cout << res << endl;
    return 0;
}

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

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef long long ll;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};

#ifdef TESTING
#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG
#define VALUE(x)
#define debug(...)
#endif

#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define FOREACH(a, b) for (auto &(a) : (b))
#define REP(i, n) for (LL i = 1; i <= n; i++)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)



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

// #ifndef ONLINE_JUDGE

//     // for getting inpit from input.txt
//     freopen("input.txt", "r", stdin);
//     //for writing output to output.txt
//     freopen("output1.txt", "w", stdout);
// #endif

    LL n;
    cin >> n;
    vector<LL> a;
    for (LL i = 0; i < n; i++)
    {
        LL x;
        cin >> x;
        a.push_back(x);
    }
    LL cnt = 0;
    for (LL i = 1; i < n; i++)
    {
        if (a[i] - a[i - 1] < 0) {

            cnt += abs(a[i] - a[i - 1]);

            a[i] += abs(a[i] - a[i - 1]);
        }
    }
    cout << cnt << "\n";

    return 0;
}



Measured memory_bytes: 5308
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
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; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

string S;

int main() {
    cin >> S;

    string yyyy = S.substr(0, 4);
    int y = stoi(yyyy);
    string mm = S.substr(5, 2);
    int m = stoi(mm);

    if (y < 2019 || (y == 2019 && m < 5)) {
        write("Heisei");
    }
    else {
        write("TBD");
    }
}

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

void startup()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
}


int main()
{
startup();

char c ;
int sum=0;
while(cin>>c)
{
    sum+=c-'0';
}
if(sum%9==0)
cout<<"Yes\n";
else
cout<<"No\n";
	



	return 0;
}



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

#define ll long long

const int N = 1e6+4;

char c[N] ; 

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	ll int n;
	
	cin >> n;
	
	int cnt = 0;
	for(int i = 1; i<=n; ++i)
	{
		cin >> c[i];
		if(c[i] == 'W')
			cnt++;
	}
	
	int ans = cnt;
//	cout << "current ans: " << ans << "\n";
//	cout << "\n";
	for(int i = n; i>n-cnt; --i)
	{
		if(c[i] == 'W')
			ans--;
//		cout << "every time white is found : " << ans << "\n";
	}
	
	cout << ans << "\n";
		

	
	return 0;
}


Measured memory_bytes: 3816
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long k = sc.nextLong();
        long d = sc.nextLong();

        x = Math.abs(x);
        long s = Math.min(k, x / d);
        k -= s;
        x -= s * d;

        if (k % 2 == 0) {
            System.out.println(x);
        } else {
            System.out.println(d - x);
        }
    }

}


Measured memory_bytes: 35604
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <ctime>
#define fi first
#define se second
#define pii pair<int,int>
//#define ivorysi
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define MAXN 300005
using namespace std;
typedef long long int64;
typedef double db;
typedef unsigned int u32;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9' ) {
		res = res * 10 - '0' + c;
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N;
int dfs(int a,int x) {
	
	if(a < x) return 0;
	if(a % x == 0) return a / x;
	int t = a / x,h = a % x;
	//out(a);space;out(t);space;out(h);enter;
	dfs(a - ((h - 1) / (t + 1) + 1) * (t + 1),x);
}
void Solve() {
	read(N);
	int ans = 0;
	int a,k;
	for(int i = 1 ; i <= N ; ++i) {
		read(a);read(k);
		ans ^= dfs(a,k);
	} 
	if(!ans) puts("Aoki");
	else puts("Takahashi");
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
	return 0;
}

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

int n,m,ans=0;

struct node
{
	int p,cnt;
}a[100005];

bool cmp(node a,node b)
{
	return a.p<b.p;
}

signed main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)  cin>>a[i].p>>a[i].cnt;
	
	sort(a+1,a+n+1,cmp);
	
	for (int i=1;i<=n;i++)
	{
		if (m>=a[i].cnt)
		{
			m-=a[i].cnt;
			ans+=a[i].p*a[i].cnt;
		}
		else
		{
			ans+=a[i].p*m;
			break;
		}
	}
	cout<<ans<<endl;
	
	return 0;	
}

Measured memory_bytes: 1792
// Problem : A - Don't be late
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
	/*
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
	#endif
	*/
fast;
float a,b,c;
cin>>a>>b>>c;
if(a/b <=c) cout<<"Yes";
else cout<<"No";

return 0;
}

Measured memory_bytes: 3740
#include <cstdio>
#include <cstring>
char str[100005];

int main() {
  scanf("%s", str);
  int len = strlen(str);
  int s = -1, e = -1;
  for (int i = 0; i < len; ++i) {
    if (str[i] == str[i + 1]) {
      s = i + 1;
      e = s + 1;
    } else if (str[i] == str[i + 2]) {
      s = i + 1;
      e = s + 2;
    }
    if (s > 0) break;
  }
  printf("%d %d", s, e);
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

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

// 素数判定
bool isPrime(ll n) {
    ll i = 2;
    while (i*i <= n) {
        if(n%i==0) return false;
        i++;
    }
    return true;
}


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

    ll ans = LONG_MAX;
    rep(i, 101) {
        ll tmp = 0;
        rep(j, n) {
            tmp += pow((x[j]-i),2);
        }
        chmin(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int n,a,b,ans=0,p,sum;

    cin >> n>>a>>b;
    for (int i = 1; i <= n; i++){
        p=i;
        sum=0;

        while (p>=1){
            sum += p%10;
            p-=(p%10);p/=10;
        }
        
        if(a<=sum && sum<=b)ans+=i;
    }
    

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[]){

  int N;
  cin >> N;
  int n = sqrt(N);
  printf("%d\n", n*n);
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 2e3 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn], arr[maxn], d[maxn], ans[maxn], ansind;
bool visited[maxn];
pair<int, int> srt[maxn];
vector<int> graph[maxn], adj[maxn];
priority_queue<pair<int, int> > pq;

bool cmp(int A, int B)
{
	return (a[A] < a[B]);
}

void dfs(int u)
{
	static int ind = 0;
	arr[ind++] = u;
	visited[u] = true;
	for (int i : graph[u])
		if (!visited[i])
			dfs(i);
}

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

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (__gcd(a[i], a[j]) != 1)
			{
				graph[i].pb(j);
				graph[j].pb(i);
			}
	for (int i = 0; i < n; i++)
		sort(all(graph[i]), cmp);
	for (int i = 0; i < n; i++)
		srt[i] = mp(a[i], i);
	sort(srt, srt + n);
	for (int i = 0; i < n; i++)
		if (!visited[srt[i].ss])
			dfs(srt[i].ss);

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (__gcd(a[arr[i]], a[arr[j]]) != 1)
				adj[arr[i]].pb(arr[j]), d[arr[j]]++;
	for (int i = 0; i < n; i++)
		if (!d[i])
			pq.push(mp(a[i], i));
	while (!pq.empty())
	{
		pair<int, int> now = pq.top();
		ans[ansind++] = now.ff;
		pq.pop();

		for (int i : adj[now.ss])
		{
			d[i]--;
			if (!d[i])
				pq.push(mp(a[i], i));
		}
	}

	for (int i = 0; i < n; i++)
		cout << ans[i] << ' ';
	cout << endl;
}



Measured memory_bytes: 23168
n, a, b = map(int, raw_input().strip().split(" "))

x = map(int, raw_input().strip().split(" "))
result = 0
for i in range(1, n):
	if a * (x[i] - x[i-1]) > b:
		result += b
	else:
		result += a * (x[i] - x[i-1])
print result


Measured memory_bytes: 11296
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int k=s.size(),flag=0,i;
  for(i==0;i<k;i++)
  {
    if(i%2==0)
    {
      if(s[i]=='L')
      {
        flag=1;
        break;
      }
      else
        flag=0;
    }
    if(i%2==1)
    {
      
      if(s[i]=='R')
      {
        flag=1;
        break;
      }
      else
        flag=0;
    }
  }
  if(flag==1)
    cout<<"No";
  else
    cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF 100000000000000005LL
#define INF (int)1e9+1
#define endl '\n'
#define pb push_back

// debug 도구

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto& x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}\n";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)

// debug 도구 end

using llong = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VPII = vector<pair<int, int>>;
using VLL = vector<long long>;
using PII = pair<int, int>;

int main() {
    int n;
    cin >> n;
    VI a(n);
    int maxx=-INF, minn=INF;
    rep(i, 0, n) {
        cin >> a[i];
        maxx = max(maxx, a[i]);
        minn = min(minn, a[i]);
    }
    cout << maxx - minn;
    return 0;
}

Measured memory_bytes: 3604
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let s = Array.fold_left (+) 0 a_s
let m = Array.fold_left max 0 a_s
let _ = Printf.printf "%d\n" @@ s - m / 2

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> T(N, 0);
    for (auto &t : T) cin >> t;
    int total = accumulate(T.begin(), T.end(), 0);

    int M;
    cin >> M;
    for (int m = 0; m != M; ++m){
        int p, x;
        cin >> p >> x;
        cout << total - T[p - 1] + x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# C - Peaks
def main():
    N, M, *HAB = map(int, open(0).read().split())
    H, AB = [0] + HAB[:N], HAB[N:]
    is_good = [False] + [True] * N
    for a, b in zip(*[iter(AB)] * 2):
        if H[a] >= H[b]:
            is_good[b] = False
        if H[b] >= H[a]:
            is_good[a] = False
    print(sum(is_good))


if __name__ == "__main__":
    main()


Measured memory_bytes: 43956
import sys
from heapq import *
input = sys.stdin.readline

def get_happiness(camels):
    camels.sort(reverse=True)
    N = len(camels)
    ret = 0

    hq = []
    for i in range(1, N + 1):
        while camels and camels[-1][0] == i:
            _, diff = camels.pop()
            heappush(hq, diff)
        while len(hq) > i:
            heappop(hq)

    while camels:
        _, diff = camels.pop()
        ret += diff

    ret += sum(hq)

    return ret


def solution():
    N = int(input())
    left_camels = []
    right_camels = []
    left_sum = 0
    right_sum = 0
    for i in range(N):
        K, L, R = map(int, input().split())
        if L >= R:
            left_sum += R
            left_camels.append((K, L - R))
        else:
            right_sum += L
            if K == N: continue
            right_camels.append((N - K, R - L))
    answer = 0
    answer += left_sum + get_happiness(left_camels)
    answer += right_sum + get_happiness(right_camels)
    print(answer)

if __name__ == "__main__":
    T = int(input())
    for _ in range(T):
        solution()

Measured memory_bytes: 92760
// Created by PRATEEK RANJAN
#include <bits/stdc++.h>
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long
const int mod = 1e9+7;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int X;
    int ans = 1,t=1;
    debug(t);
    cin>>X;
    
    while(ans < X){
        ans += ++t;
        debug(ans,X);
    }
    
    cout<<t;
    return 0;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long int LL;
const int Max_HW(1050);
const int MOD(1000000000 + 7);

constexpr int Mult(int a, int b)
{
	return (a * 1LL) * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

constexpr int Sub(int a, int b)
{
	return a - b < 0 ? a - b + MOD : a - b;
}

int power(int a, LL n)
{
	int Ret(1);
	while (n)
	{
		if (n & 1LL)
			Ret = Mult(Ret, a);
		a = Mult(a, a), n >>= 1LL;
	}
	return Ret;
}

int H, W, X, Y, C, All;
LL K;
char S[Max_HW][Max_HW];

struct Matrix
{
	Matrix() {memset(v, 0, sizeof(v));}
	int v[2][2];
	inline Matrix operator*(const Matrix &b) const
	{
		Matrix c;
		for (int k = 0;k <= 1;++k)
			for (int i = 0;i <= 1;++i)
				for (int j = 0;j <= 1;++j)
					c.v[i][j] = Add(c.v[i][j], Mult(v[i][k], b.v[k][j]));
		return c;
	}
};

/*
考虑一个k + 1(k >= 1)级分形中，连接组成该分形的某2个k级分形之间的边，一定是1级分形中某一行的第1列和W列均是黑色、或某一列的第1行和第H行均是黑色而连成的边
特判掉询问的K = 0和K = 1的情况，设有x个这样的行和y个这样的列，1级分形中有all个黑格，分情况讨论：
(1)x > 0, y > 0。归纳可以证明整个图是一个联通图，答案是1
(2)x = y = 0。容易发现每个1级分形是一个单独的联通块，答案就是all ^ (K - 1) 
(3)x = 0, y > 0。把整个图形翻转，可以变成情况(4)
(4)x > 0, y = 0。把图形中每个1级分形当成点，如果两个1级分形直接联通就连一条边，得到一个图G(K)。显然黑格的联通块数量等于图G的联通块数量
   G(K)中的边一定都是左右连接、不存在上下连接的，所以没有环，G(K)是一个森林，可以用C(K) = V(K) - E(K)来计算联通块数量，V是点数E是边数
   其中V(K)很好计算，显然V(1) = 1   V(K) = V(K - 1) * all
   记在1级分形中，有c对(i, j)和(i, j + 1)满足都是黑格
   E(1) = 0   对于E(K >= 2)，由两部分组成：(a)all个K - 1级分形中的边  (b)新增的边   故E(K) = E(K - 1) * all + c * x^(K - 2)
   直接做即可 
*/

Matrix power(Matrix a, LL n)
{
	Matrix Ret;
	Ret.v[0][0] = Ret.v[1][1] = 1;
	while (n)
	{
		if (n & 1LL)
			Ret = Ret * a;
		a = a * a, n >>= 1LL;
	}
	return Ret;
}

int work()
{
	Matrix zy, start;
	zy.v[0][0] = All, zy.v[1][1] = X, zy.v[1][0] = C;
	start.v[0][0] = 0, start.v[0][1] = 1;
	start = start * power(zy, K - 1LL);
	return start.v[0][0];
}

int main()
{
	scanf("%d%d%lld", &H, &W, &K);
	if (K <= 1LL)
	{
		printf("1");
		return 0;
	}
	for (int i = 1;i <= H;++i)
	{
		scanf("%s", S[i] + 1);
		for (int j = 1;j <= W;++j)
			All += (S[i][j] == '#');
	}
	for (int i = 1;i <= H;++i)
		X += (S[i][1] == '#' && S[i][W] == '#');
	for (int j = 1;j <= W;++j)
		Y += (S[1][j] == '#' && S[H][j] == '#');
	if (X >= 1 && Y >= 1)
	{
		printf("1");
		return 0;
	}
	if (X == 0 && Y == 0)
	{
		printf("%d", power(All, K - 1LL));
		return 0;
	}
	if (X == 0 && Y >= 1)
	{
		swap(X, Y);
		for (int j = 1;j <= W;++j)
			for (int i = 1;i + 1 <= H;++i)
				C += (S[i][j] == '#' && S[i + 1][j] == '#');
	}
	else
		for (int i = 1;i <= H;++i)
			for (int j = 1;j + 1 <= W;++j)
				C += (S[i][j] == '#' && S[i][j + 1] == '#');
	printf("%d", Sub(power(All, K - 1LL), work()));
	return 0;
}

Measured memory_bytes: 1152
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  char first = s[0];
  FOR(i,1,s.size()){
    if(first != s[i]) {
      first = s[i];
      z++;
    }
  }
  OUT(z);
}

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

ll solve() {
    ll N;
    cin >> N;
    auto PrimeFactor = [](ll x) {
        map<ll, ll> pr;
        for ( ll k = 2; k * k <= x; k++ ) {
            while ( x % k == 0 ) {
                pr[k]++;
                x /= k;
            }
        }
        if ( x > 1 ) pr[x]++;
        return pr;
    };
    auto ps = PrimeFactor(N);
    ll ans = 0;
    for ( auto p : ps ) {
        ll m = p.second;
        ll k = 0;
        while ( (k+1) <= m ) {
            m -= (k+1);
            k++;
        }
        ans += k;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define REP(i, N) for (int i = 0; i < N; i++)
#define REP1(i, N) for (int i = 1; i < N; i++)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ANS(a) cout << a << endl;
#define SORT(V) sort(V.begin(), V.end())
#define RSORT(V) sort(V.rbegin(), V.rend())

#define DBG(V) for (auto v : V) cout << v << " "; cout << endl

int
main()
{
  int N; cin >> N;
  vector<int> A;
  for (int i = 0; i < N; i++) { ull tmp; cin >> tmp; A.emplace_back(tmp); }

  ull ans = 0;
  int mini = 1e9+1;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] < 0) ++cnt;
    mini = min(mini, abs(A[i]));
    ans += abs(A[i]);
  }

  if (cnt % 2) ans -= (mini * 2);

  ANS(ans);

  return 0;
}


Measured memory_bytes: 892
#include <cstdio>
#include <algorithm>
using namespace std;
int N, ans, A[100001];
int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; i++) scanf("%d", &A[i]);
  sort(A, A+N);
  for(int i = 0, cnt = 0, pre = 0; i <= N; i++) {
    if(pre == A[i]) cnt++;
    else {ans += cnt%2; cnt = 1;}
    pre = A[i];
  }
  printf("%d", ans);
}

Measured memory_bytes: 512
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(m);
  vector<string> s(m);
  rep(i, m) cin >> p[i] >> s[i];

  map<int, int> wa;
  map<int, bool> ac;

  rep(i, m) {
    if (!ac[p[i]]) {
      if (s[i] == "AC") ac[p[i]] = true;
      else wa[p[i]]++;
    }
  }

  int nac = 0, nwa = 0;
  rep(i, m) {
    if (ac[p[i]]) {
      nac++;
      nwa += wa[p[i]];
      ac[p[i]] = false;
    }
  }
  cout << nac << " " << nwa << endl;




  
  return 0;
}

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

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

#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1

//const int mod=1000000007;
/*int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
*/

/*int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);

}
*/

bool graph[8][8];

int dfs(int v, int n , bool visited[8] )
{


	bool all_visited = true;

	for (int i = 0; i < n; ++i) {
		if (visited[i] == false)
			all_visited = false;
	}

	if (all_visited) {
		return 1;
	}

	int ret = 0;

	for (int i = 0; i < n; ++i) {
		if (graph[v][i] == false) continue;
		if (visited[i]) continue;

		visited[i] = true;
		ret += dfs(i, n, visited);
		visited[i] = false;
	}

	return ret;


}



int main()
{

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);


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

	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{

		int x, y;
		cin >> x >> y;

		graph[x - 1][y - 1] = graph[y - 1][x - 1] = true;

	}

	bool visited[8];

	for (int i = 0; i < n; i++)
		visited[i] = false;


	visited[0] = true;

	cout << dfs(0, n, visited) << endl;


}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=20;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		int r,n;
		cin>>r>>n;
		if(r==0) break;
		vi a(2*M);
		for(int i=0;i<n;i++){
			int l,r,h;
			cin>>l>>r>>h;
			l+=M,r+=M;
			for(int j=l;j<r;j++) a[j]=max(a[j],h);
		}
		double res=inf;
		for(int i=0;i<2*M;i++){
			int d=(i<M?M-i-1:i-M);
			if(r>d){
				res=min(res,r+a[i]-sqrt(r*r-d*d));
			}
		}
		cout<<syosu(9)<<res<<endl;
	}
}


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

using namespace std;

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

    struct request_t: map< int, int >
    {
        void read()
        {
            int a, b; cin >> a >> b; auto it = find( --b );

            if ( it == end() )
                emplace( b, a );
            else
                if ( a > it->second )
                    it->second = a;
        }
    } request;

    struct removed_t: vector< int >
    {
        void satisfy( int u, int v )
        {
            if ( lower_bound( begin(), end(), u ) == end() )
                push_back( v );
        }
    } removed;

    for( int i = 0; i < M; i++ )
        request.read();

    for( auto p: request )
        removed.satisfy( p.second, p.first );

    cout << removed.size();
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);


bool isPrime(ll n){if(n<2)return false;for(ll i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res%mod;}
ll gcd(ll a,ll b){if (a==0)return b;return gcd(b%a,a);}

void fun(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        vi a(11,0);
        int r,d;
        cin>>r>>d>>a[0];
        for(int i=1;i<=10;i++){
            a[i]=r*a[i-1]-d;
        }
        for(int i=1;i<11;i++){
            cout<<a[i]<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 7784
use proconio::{input, fastout};

macro_rules! echo {
  ($val:expr) => {
    println!("{}", $val);
  }
}

#[fastout]
fn main() {
  input!{
    a: i64,
    v: i64,
    b: i64,
    w: i64,
    t: i64
  };
  if a < b && a + v * t >= b + w * t {
    echo!("YES");
  } else if a > b && a - v * t <= b - w * t {
    echo!("YES");
  } else {
    echo!("NO");
  }
}


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

const int N = 1e5+5 , inf = 0x3f3f3f3f;

int n , h[N] , dp[N];

int main(){
  cin >> n;
  for(int i = 2 ; i < N ; i++) dp[i] = inf;
  for(int i = 1 ; i <= n ; i++) cin >> h[i];
  for(int i = 1 ; i < n ; i++){
    dp[min(i+2,n)] = min(dp[min(i+2,n)],dp[i]+abs(h[i]-h[min(i+2,n)]));
    dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
  }
  cout << dp[n] << "\n";
}


Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	int n = s.size();
	int cnt1 = 0, cnt2 = 0;
	rep(i,n){
		if(i % 2){
			if(s.at(i) == '1'){
				cnt2++;
			}
			else{
				cnt1++;
			}
		}
		else{
			if(s.at(i) == '0'){
				cnt2++;
			}
			else{
				cnt1++;
			}
		}
	}
	cout << min(cnt1,cnt2) << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main()	{
  ll n;
  cin >> n;
  unordered_map<ll, ll> freq;
  ll a[n] = {0};
  for (ll i = 0; i < n; i++)	{
    cin >> a[i];
    freq[a[i]]++;
  }
  ll max_freq = 0, smax_freq = 0;
  sort(a, a + n, greater<ll>());
  for (ll i = 0; i < n; i++)	{
    if (freq[a[i]] >= 4 && max_freq == 0 && smax_freq == 0)	{
      max_freq = a[i];
      smax_freq = a[i];
      break;
    }
    else if (freq[a[i]] >=2 && max_freq == 0)	{
      max_freq = a[i];
    }
    else if (freq[a[i]] >= 2 && max_freq != 0 && max_freq != a[i])	{
      smax_freq = a[i];
    }
    if (max_freq != 0 && smax_freq != 0)	{
      break;
    }
  }
  cout << smax_freq * max_freq << endl;
  return 0;
}

Measured memory_bytes: 8160
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
   int n, k;
   cin >> n >> k;
   vector<int> a;
   int temp;
   for (int i = 0; i < n; i++) {
      cin >> temp;
      a.push_back(temp);
   }

   std::sort(a.begin(), a.end());

   int ans = 0;
   for (int i = 0; i < n; i++) {
      k -= a.at(i); 
      if (k < 0) break;
      else ans++;
   }
   if (k > 0) ans--;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int c,a,b;
	cin>>c>>a>>b;
	for(int i=1;i<=b;i++)
	{
		if(c*i>=a&&c*i<=b)
		{
			cout<<"OK";
			return 0; 
		}
	} 
	cout<<"NG";
	return 0;
}




Measured memory_bytes: 3636
// Ala be zekrellah tatmaenolgholoob ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define MP make_pair
const int maxn = 1e5+9;
const ll mod = 1e9+7;

ll gcd (ll a, ll b) {
	if (a < b)
		swap(a, b);
	if (a % b == 0)
		return b;
	return gcd(b, a % b);
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int T;
	cin >> T;
	ll a, b, c, d, g;
	for (; T; T--) {
		cin >> a >> b >> c >> d;
		if (a < b || d < b) {
			cout << "No\n";
			continue;
		}
		if (c >= b) {
			cout << "Yes\n";
			continue;
		}
		a = a % b;
		d = d % b;
		g = b;
		if (a > c) {
			cout << "No\n";
			continue;
		}
		if (d)
			g = gcd(d, b);
		ll f = (c - a) / g * g + a;
		if (f + g < b)
			cout << "No\n";
		else
			cout << "Yes\n";
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    vec a(3), b(3);
    rep(i,3) cin>>a[i];
    rep(i,3) b[i] = a[(i+1)%3] - a[i];
    bool ze = false;
    rep(i,3) ze = ze || b[i] == 0;
    if(!ze || (b[0] == 0 && b[1] == 0)){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 256
N, T = map(int, input().split())
c = [0] * N
t = [0] * N
for i in range(N):
    c[i], t[i] = map(int, input().split())

c_min = 10000

for c_i, t_i in zip(c,t):
   if t_i <= T and c_i <= c_min:
       c_min = c_i

if c_min == 10000:
    print('TLE')

else:
    print(c_min)

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

bool submin(int a, int b, int c) {
    if (a < b && b < c || c < b && b < a) return true;
    else return false;
}

int main() {
    int n;
    cin >> n;
    int p[n];
    int cnt = 0;

    for (int i = 0;i < n;i++) cin >> p[i];
    for (int i = 1;i < n-1;i++) {
        if (submin(p[i-1], p[i], p[i+1])) cnt++;
    }

    cout << cnt << endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());
    ll x = 0;
    ll y = 0;
    ll i = 0;
    while (i < N-1) {
        if (A[i] == A[i + 1]) {
            if (x != 0 && y == 0) {
                y = A[i];
                i++;
            }
            if (x == 0) {
                x = A[i];
                i++;
            }
        }
        i++;
    }
    cout << x * y << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
#define UM unordered_map<int,int>
#define MP map<int,int>
#define mxsize (int)1e6
void fun(){
    int d,t,s;
    cin>>d>>t>>s;
    int time=ceil(1.0*d/s);
    if(time<=t){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("/ATOM/input.txt", "r", stdin);
        freopen("/ATOM/output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--){
        fun();
    }
}   

Measured memory_bytes: 3608
macro_rules! input { (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        y: usize,
    }
    for i in 0..n + 1 {
        if i * 10000 > y {
            break;
        }
        for j in 0..n - i + 1 {
            if i * 10000 + j * 5000 + (n - (i + j)) * 1000 == y {
                println!("{} {} {}", i, j, n - (i + j));
                return;
            }
        }
    }
    println!("-1 -1 -1")
}


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

class TestScore{
private:
    std::vector<int> dataset = {0,0,0,0};
public:
    void setTestScore(int info,int math,int scie,int eng);
    int getTotalScore();
};

void TestScore::setTestScore(int info,int math,int scie,int eng){
    dataset[0] = info;
    dataset[1] = math;
    dataset[2] = scie;
    dataset[3] = eng;
}

int TestScore::getTotalScore(){
    int total_score = 0;
    for(int score : dataset){
        total_score += score; 
    }
    return total_score;
}

int largeScore(int a,int b){
    if(a < b){
        return b;
    }
    return a;
}

int main(){

    TestScore ts1 = TestScore();
    TestScore ts2 = TestScore();

    int a,b,c,d;
    a = 0;
    b = 0;
    c = 0;
    d = 0;
    
    std::cin >> a >> b >> c >> d;
    ts1.setTestScore(a,b,c,d);

    std::cin >> a >> b >> c >> d;
    ts2.setTestScore(a,b,c,d);

    std::cout << largeScore(ts1.getTotalScore(),ts2.getTotalScore()) << std::endl;

    return 0;
}

Measured memory_bytes: 3148
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

if __name__ == "__main__":
    n= int(sys.stdin.readline())
    l= list(map(int, sys.stdin.readline().split()))
    l.sort(reverse=True)
    if l[0] < sum(l[1:n]):
        print("Yes")
    else:
        print("No")



Measured memory_bytes: 5200
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int n;
	cin>>n;
	vi V(n),W(n);
	rep(i,n)cin>>V[i]>>W[i];

	int N=min(n,4000ll);
	vvp d(N);
	d[0].pb({0,0});
	d[0].pb({W[0],V[0]});
	loop(i,1,N){
		int v=V[i],w=W[i];
		int p=(i-1)/2;
		rep(j,d[p].size()){
			d[i].pb({d[p][j].first,d[p][j].second});
			d[i].pb({d[p][j].first+w,d[p][j].second+v});
		}
		sort(all(d[i]));
	}
	rep(i,N)rep(j,d[i].size()-1)cmax(d[i][j+1].second,d[i][j].second);

	int q;
	cin>>q;
	while(q--){
		int v,l;
		cin>>v>>l;
		v--;
		if(v<N){
			int it=upper_bound(all(d[v]),pii(l+1,-1))-d[v].begin();
			if(it==0)cout<<0<<endl;
			else cout<<d[v][it-1].second<<endl;
		}else{
			vp t;
			while(N<=v){
				t.pb({V[v],W[v]});
				v=(v-1)/2;
			}
			int m=t.size();
			int out=0;
			rep(i,1<<m){
				int sv=0,sw=0;
				rep(j,m)if(i&1<<j)sv+=t[j].first,sw+=t[j].second;
				if(sw>l)continue;
				int it=upper_bound(all(d[v]),pii(l-sw+1,-1))-d[v].begin();
				if(it==0)cmax(out,sv);
				else cmax(out,sv+d[v][it-1].second);
			}
			cout<<out<<endl;
		}
	}

}


Measured memory_bytes: 176064
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int n,x,t;
	cin>>n>>x>>t;
	int a;
	if(n%x) a=n/x+1;
	else a=n/x;
	cout<<a*t;
	re 0;
}

Measured memory_bytes: 3612