akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in();
	vector<vector<int>> M(N,vector<int>(N,-1));
	REP(i,N){
		int A=in();
		LOOP(A){
			int X=in(),Y=in();
			M[i][X-1] = Y;
		}
	}

	int ans=0;
	int loop=pow(2,N);
	REP(i,loop){
		vector<int> F(N,0);
		int v=i;
		int index=0;
		int sum=0;
		while(v){
			if(v&1){
				F[index]=1;
				sum++;
			}
			v>>=1;
			index++;
		}
		bool ok=true;
		REP(j,N){
			if(!F[j]) continue;
			REP(k,N){
				if(M[j][k]>=0 && F[k]!=M[j][k]){
					ok =false;
				}
			}
		}
		if(!ok) continue;
		ans = max(ans,sum);
	}
	out(ans);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();

		int totalHappy = 0;
        	totalHappy += (S/500) * 1000;
        	S = S%500;
        	totalHappy += (S/5) * 5;
        	S = S%5;
        	System.out.println(totalHappy);

	}
}

Measured memory_bytes: 21844
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)

"""
3枚以上はそのカードだけで1枚または2枚まで減らせる
偶数なら2枚、奇数なら1枚になる
2枚のカードは他の2枚のカードと組み合わせて1枚のカードになる
もし2枚カードが最後1つになった場合は1枚カードは増えず2枚カードを消す
"""
single = 0
pair = 0

for k,v in c.items():
    if v%2==0:
        pair+=1
    else:
        single+=1

print(single+pair-pair%2)

Measured memory_bytes: 22152
#include <iostream> 
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define ll long long
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()

int main(){
    int N;
    cin >> N;
    int d[N];
    rep(i, N) cin >> d[i];
    sort(d, d + N);
    cout << d[N/2] - d[N/2 - 1] << endl;
    return 0;

}

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

using ll = long long;
int main(int argc, char ** argv)
{
  //
  int n;
  std::cin >> n;
  std::vector<int> x(n);

  for (int i = 0; i < n; i++) {
    std::cin >> x[i];
  }

  int ans = 10e7;
  int i = 0;
  while (true) {
    int tmp = 0;
    for (int j = 0; j < n; j++) {
      tmp += (x[j] - (i + 1)) * (x[j] - (i + 1));
    }
    if (tmp >= ans) {
      break;
    }
    ans = tmp;
    i++;
  }
  std::printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

    
    public static void main(String[] args) {
     
        Scanner entrada=new Scanner(System.in);
       int x[]=new int[2];
       int x2[]=new int[3];
       
        for (int i = 0; i < 2; i++) {
            x[i]=entrada.nextInt();
     }
      
       x2[0]=x[0]+x[0]-1;
       x2[1]=x[0]+x[1];
       x2[2]=x[1]+x[1]-1;
       
      Arrays.sort(x2);
        System.out.println(x2[2]);
    }
    
}


Measured memory_bytes: 23764
# palace
n = input()
T, target = [int(e) for e in input().split()]
H = list(map(int, input().split()))

average_temp = []
min_diff = float('inf')
index = -1

for index, value in enumerate(H):
    average_temp = T - value*0.006
    diff = abs(target - average_temp)
    if min_diff > diff:
        min_diff = diff
        min_index = index+1
print(min_index)

Measured memory_bytes: 3064
// C - HonestOrUnkind2
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int N, A[15], X[15][15], Y[15][15];

int check(bitset<15> bits){
	rp(i, 0, N)
		if(bits[i])
			rp(j, 0, A[i]) if(bits[X[i][j]] != Y[i][j]) return 0;
	return bits.count();
}

int main(){
	cin>>N;
	rp(i, 0, N){ cin>>A[i]; rp(j, 0, A[i]){ cin>>X[i][j]>>Y[i][j]; X[i][j]--; } }
	int ans = 0;
	rp(bits, 1, 1<<N) ans = max(ans, check(bits));
	cout<< ans <<endl;
}

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

int main()
{
	int a;
	string s;
	cin >> a;
	cin >> s;
	if (a >= 3200)
	{
		cout << s << endl;
	}
	else
	{
		cout << "red" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <vector> // vectors
#include <string> // string
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <unordered_map> // hashed by keys
#define _for(i,n) for(int i = 0; i < n; i++)

typedef long long ll; // at least int64 > 9*10^18
typedef unsigned long long ull; // at least uint64

using namespace std;

int main() {
  int n;
  cin >> n;
  string s[n];
  _for(i,n) cin >> s[i];
  int count = 0;
  int A = 0;
  int B = 0;
  int AB = 0;
  vector<pair<int,int>> sufa(n);
  vector<pair<int,int>> preb(n);
  _for(i,n) {
    if (s[i].back()=='A'&&s[i][0]=='B') {
      AB++;
    }
    else if (s[i][0]=='B') B++;
    else if (s[i].back()=='A') A++;
    int lasta = false;
    _for(j,s[i].length()) {
      if (s[i][j]=='A') lasta = true;
      else if (lasta&&s[i][j]=='B') {
        count ++;
        lasta = false;
      } else lasta = false;
    }
  }
  int temp = 0;
  if (AB>0) {
    temp += AB-1;
    if (A>0) {
      temp ++;
      A--;
    }
    if (B>0) {
      temp ++;
      B--;
    }
    temp += min(A,B);
  }
  else {
    temp += min(A,B);
  }
  cout << count + temp << endl;

  return 0;
}

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

#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define MOD 1000000007

const int MAX_M = 100000;


int main(){
  //ll n, l, t;    //n枚,y円
  string s, t;
  cin >> s >> t;

  //vector<ll> a(n);
  //queue<ll> q;
  //map<string,ll> m;

  ll n = s.size();
  bool ok = true;
  rep(i,0,n){
    if(s.at(i) != t.at(i)){
      ok = false;
      break;
    }
  }



  //cout << fixed << setprecision(10);
  cout << ((ok)? "Yes" : "No") << endl;

}


Measured memory_bytes: 3624
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>


using namespace std;
using ll=long long;
using vi=vector<int>;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi a(n);
		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
		}
		sort(a.begin(), a.end(), greater<int>());

		int i=0;
		ll w=0, h=0;
		for(;i+1<n;i++)
		{
			if(a[i]==a[i+1])
			{
				w=a[i];
				i+=2;
				break;
			}
		}
		for(;i+1<n;i++)
		{
			if(a[i]==a[i+1])
			{
				h=a[i];
				break;
			}
		}
		printf("%lld\n", w*h);
	}

	return 0;
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl

const int N = 1000003;
string s;
int n;

int d[N];
int ans = N*10;

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s;

    n = s.length();

    for(int i = 1; i <= n; ++i) {
        d[i] = s[i-1] - '0';
    }

    int i = n;
    while(i > 0) {
        if(d[i] >= 5) {
            d[i] = 10-d[i];
            int len = 1;
            while(i-len > 0 && d[i-len] >= 5) {
                d[i-len] = 9-d[i-len];
                len++;
            }
            if(len > 1 || d[i] < 5)
                d[i-len]++;
            i -= len;
        } else {
            i--;
        }
    }
    
    long long ans = 0LL;
    for(int i = 0; i <= n; ++i) {
        ans += min(d[i], 10-d[i]);
    }

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



Measured memory_bytes: 5276
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/04/04.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC16４4
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
//#define __DBG__


void solve(void){
  
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int s=0;  // 0=T  1=A
  
  while(A>0 && C>0){
    // T
    if(s==0){
      C -= B;
      s=1;
      if(C<=0){
        cout << "Yes" << endl;
        return;
      }
    }
    else
    {
      A -=D;
      s=0;
      if(A<=0){
        cout << "No" << endl;
        return;
      }
    }
  }

  return;
   
}



#define TESTCASES 1

int main() {
  

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

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1<<29;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;


bool IsPrime(int 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;
}



int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    string s; cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;
    
    
    
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    long double N;
    cin >> N;

    for (int64 h=1; h<=3500; h++) {
        for (int64 n=1; n<=3500; n++) {
            long double tmp = 4 * h * n - N * n - N * h;
            if (tmp <= 0) continue;
            long double w = N * h * n / tmp;
            if (ceil(w) == floor(w)) {
                cout << h << " " << n << " " << (int64)w << endl;
                return 0;
            }
        }
    }
}
/*
 * 4/N = 1/h + 1/n + 1/w
 * 4/N - 1/h - 1/n = 1/w
 * 4/N - 1/h - 1/n = 1/w
 * 4h/Nh - N/Nh
 * 4h-N/Nh - 1/n = 1/w
 * (4h-N)*n/Nhn - Nh/Nhn = 1/w
 * (4hn - Nn - Nh)/Nhn = 1/w
 * Nhn/(4hn-Nn-Nh) = w
 */

Measured memory_bytes: 3180
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
 
ll A,B,N;
 
int main(void)
{
    cin >> A >> B >> N;
    ll ans=0;
    ll m= min(B-1,N);
    ans=(A*m)/B-A*(m/B);
    cout << ans<<endl;
}


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

using namespace std;
long long dp[100005],v[101],c[101];
int main()
{
    long long n,i,maxim = 0,w;
    cin >> n >> w;
    long long sum = 0;
    for(long long t = 1;t<= n;t++){
        cin >> c[t] >> v[t];
        sum += v[t];
    }
    for(i = 1;i <= sum;i++)
        dp[i] = 2e9;
    for(long long t = 1;t<= n;t++){
        for(i = sum;i >= v[t];i--){
            dp[i] = min(dp[i],dp[i-v[t]] + c[t]);
            if(dp[i] <= w)
                maxim = max(maxim,i);
        }
    }
    cout << maxim;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define Q int q; cin >> q; while (q--)
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    set<int> a;
    REP(i, n) {
        int x; cin >> x;
        a.emplace(x);
    }
    int m;
    cin >> m;
    set<int> b;
    REP(i, m) {
        int x; cin >> x;
        b.emplace(x);
    }
    set<int> c;
    set_difference(ALL(a), ALL(b), inserter(c, end(c)));

    for (auto x : c) cout << x << endl;
}



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

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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int T=1;
    //cin >> T;
    while(T--){
        int x,y,z;
        cin>>x>>y>>z;
        cout<<z<<" "<<x<<" "<<y<<el;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main(){
    ll x;
    cin >> x;
    ll k = x / 200;
    cout << 10 - k << endl;
    return 0;
}


Measured memory_bytes: 3636
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	string s; cin >> s;
	vector<ll> r(n + 1), g(n + 1), b(n + 1);
	rep(i, n)
	{
		if (s[i] == 'R')++r[i + 1];
		else if (s[i] == 'G')++g[i + 1];
		else ++b[i + 1];
	}
	rep(i, n)
	{
		r[i + 1] += r[i];
		g[i + 1] += g[i];
		b[i + 1] += b[i];
	}
	ll res = 0;
	for (int j = 1; j < n - 1; ++j)
	{
		if (s[j] == 'R')res += g[j] * (b[n] - b[j + 1]) + b[j] * (g[n] - g[j + 1]);
		else if (s[j] == 'G')res += r[j] * (b[n] - b[j + 1]) + b[j] * (r[n] - r[j + 1]);
		else res += r[j] * (g[n] - g[j + 1]) + g[j] * (r[n] - r[j + 1]);
		for (int d = 1; j - d >= 0 && j+d < n; ++d)
		{
			if (s[j - d] != s[j + d] && s[j] != s[j - d] && s[j] != s[j+d])--res;
		}
	}
	cout << res << endl;
}

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

typedef long long ll;


int main(){
    map<ll, ll> m;
    ll N,M;
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        ll tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        if(m.count(tmp1) == 0){
            m[tmp1] = tmp2;
        } else { 
            m[tmp1] += tmp2;
        }
    }
    
    ll ans = 0;
    ll num = 0;
    for(auto x: m){
        if(num + x.second < M){
            num += x.second;
            ans += x.first * x.second;
        } else { 
            ans += x.first * (M-num);
            num += M - num;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6528
//2018.9.27 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register LL
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline LL read(){
    res s=0;
    bool w=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=1;ch=getchar();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return w?-s:s;
}
inline void _swap(res &x,res &y){
    x^=y^=x^=y;
}
inline LL _abs(const res &x){
    return x>0?x:-x;
}
inline LL _max(const res &x,const res &y){
    return x>y?x:y;
}
inline LL _min(const res &x,const res &y){
    return x<y?x:y;
}
const LL N=1e5+10,P=2200+10;
namespace MAIN{
    LL n,a[N];
    LL prime[N],cnt;
    bool vis[N];
    inline void pre(){
        for(res i=2;i<=P-10;i++){
            if(!vis[i])prime[++cnt]=i;
            for(res j=1;j<=cnt&&prime[j]*i<=P-10;j++){
                vis[i*prime[j]]=1;
                if(i%prime[j]==0)break;
            }
        }
    }
    map<LL,LL> mp,M;
    LL b[N],p[N],ans;
    inline void MAIN(){
        pre();
        n=read();
        for(res i=1;i<=n;i++)a[i]=read(),p[i]=b[i]=1;
        for(res i=1;i<=n;i++){
            for(res j=1;j<=cnt&&a[i]>1;j++){
                if(a[i]%prime[j]==0){
                    res tot=0;
                    while(a[i]%prime[j]==0)a[i]/=prime[j],tot++;
                    tot%=3;
                    if(!tot)continue;
                    if(tot==1)p[i]*=prime[j]*prime[j],b[i]*=prime[j];
                    else p[i]*=prime[j],b[i]*=prime[j]*prime[j];
                }
            }
            if(a[i]==1)continue;
            res s=sqrt(a[i]);
            b[i]*=a[i];
            if(s*s==a[i])p[i]*=s;
            else p[i]*=a[i]*a[i];
        }
        for(res i=1;i<=n;i++)M[b[i]]++;
        for(res i=1;i<=n;i++){
            if(mp[b[i]])continue;
            if(b[i]!=p[i])ans+=_max(M[b[i]],M[p[i]]);
            else ans++;
            mp[b[i]]=mp[p[i]]=1;
        }
        printf("%lld\n",ans);
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 27648
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>

using namespace std;
using ll = long long int;
int main(){

int H,W;
cin >> H >> W;

vector<vector<int>> a;
for(int i=0;i<H;i++){
    
        vector<int> ness;
    for(int j=0;j<W;j++){
        int x;cin >> x;ness.push_back(x);
    }
    a.push_back(ness);
}
int N=0;
vector<int> out;
for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
        if(a[i-1][j-1]%2==1){
            if(j!=W){
                N++;
                out.push_back(i);
                out.push_back(j);
                out.push_back(i);
                out.push_back(j+1);
                a[i-1][j]++;
            }else if(i!=H){
                N++;
                out.push_back(i);
                out.push_back(j);
                out.push_back(i+1);
                out.push_back(j);
                a[i][j-1]++;
            }
        }
    }
}
cout << N << endl;
for(int i=0;i<N;i++){
    cout << out[i*4] << " " << out[i*4+1] << " " << out[i*4+2]<< " " << out[i*4+3] << endl;
}
return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  
  vector <int> L;
  L.reserve(N);
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    L.push_back(l);
  }
  
  int D = 0;
  int n = 1;
  for (int i = 0; i < N; i++) {
    D += L[i];
    if (D <= X) n++;
  }
  cout << n << endl;
  
  return 0;
}

Measured memory_bytes: 256
#! usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    n = int(input())

    for i in range(10):
        if n <= i * 100 + i * 10 + i:
            print(i * 100 + i * 10 + i)
            exit()


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll x2 = 0;
  rep(i,n) {
    if (i%2) x2 -= a[i];
    else x2 += a[i];
  }
  vector<int> ans(n);
  ans[0] = x2/2;
  rep(i,n-1) {
    ans[i+1] = a[i]-ans[i];
  }
  rep(i,n) ans[i] *= 2;
  rep(i,n) printf("%d%c", ans[i], i==n-1?'\n':' ');
  return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
typedef double d;
typedef int i;

int main() {
  i a , b;
  cin >> a >> b;
  cout << ( a + b ) % 24;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
LL d(LL x,LL y){
	if(!y) return x;
	return d(y,x%y);
}
int main(){
	LL a,b;
	scanf("%lld%lld",&a,&b);
	printf("%lld",a*b/d(a,b));
	return 0;
}

Measured memory_bytes: 128
#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 int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define ub            upper_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(4e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>
#define ordered_set   tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v) {
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}

const int N = 1e6+1;
int d[N];
void solve() {
	int n; cin >> n;

	int ans = 0;
	
	for(int i = 1; i <= n; i++) {
		for(int j = i; j <= n; j += i)d[j]++;
	}
	for(int i = 1; i < n; i++) {
		int cur = n-i;
		ans += d[cur];
	}
	cout << ans << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 

    

    int test = 1;
    // cin >> test;
    
    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
    	solve();
    }

    cerr << time(start);
    return 0;
}


Measured memory_bytes: 11616
import copy

D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))
last = [0]*26
    
ans = 0
md = [0]*26
cand = []
cand2 = []
cand3 = []
tl = []

for day in range(D):
    for j in range(26):
        last[j] += 1
    
    for k in range(26):
        #k番目を選ぶことによる
        merit = s[day][k]
        merit += last[k] * c[k]
        demerit = 0
        for j in range(26):
            if j != k:
                demerit += c[j] * last[j]
        md[k] = merit - demerit

    #日程の確定
    md2 = sorted(md)
    t = md.index(md2[-1])
    last[t] = 0
    tl.append(t+1)
    
    can = md.index(md2[-2])
    cand.append(can+1)
    
    can2 = md.index(md2[-3])
    cand2.append(can2+1)
    
    can3 = md.index(md2[-4])
    cand3.append(can3+1)
    #print(t+1)
    

    
#得点計算

def calcans(tl):
    last = [0]*26
    ans = 0
    for day in range(D):
        #満足度プラス計算
        ans += s[day][tl[day]-1]
        for j in range(26):
            last[j] += 1
        last[tl[day]-1] = 0
        #満足度マイナス計算
        minus = 0
        for j in range(26):
            minus += c[j] * last[j]
        ans -= minus
    return ans

normal = calcans(tl)
change = -1

tl2 = copy.deepcopy(tl)
for ii in range(D):
    tl2[ii] = cand[ii]
    challenge = calcans(tl2)
    if normal < challenge:
        normal = challenge
        tl2[ii] = cand2[ii]
        challenge = calcans(tl2)
        if normal < challenge:
            normal = challenge
            tl2[ii] = cand3[ii]
            challenge = calcans(tl2)
            if normal < challenge:
                normal = challenge
            else:
                tl2[ii] = cand2[ii]
        else:
            tl2[ii] = cand3[ii]
            challenge = calcans(tl2)
            if normal < challenge:
                normal = challenge
            else:
                tl2[ii] = cand[ii]
    else:
        tl2[ii] = cand2[ii]
        challenge = calcans(tl2)
        if normal < challenge:
            normal = challenge
            tl2[ii] = cand3[ii]
            challenge = calcans(tl2)
            if normal < challenge:
                normal = challenge
            else:
                tl2[ii] = cand2[ii]
        else:
            tl2[ii] = cand3[ii]
            challenge = calcans(tl2)
            if normal < challenge:
                normal = challenge
            else:
                tl2[ii] = tl[ii]
        
    
for tlc in tl2:
    print(tlc)

Measured memory_bytes: 9580
package main

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

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ri()
	}

	ans := 0
	for i := 0; i < n; i++ {
		ct := 1
		for i+1 < n {
			if a[i] == a[i+1] {
				i++
				ct++
			} else {
				break
			}
		}
		ans += ct / 2
	}
	fmt.Println(ans)
}


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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<pair<int,int>> job(N);
    for(int i=0; i<N; i++) {
        int A, B;
        cin >> A >> B;
        job[i] = make_pair(B, A);
    }
    sort(job.begin(), job.end());
    for(int i=1; i<N; i++) {
        job.at(i).second += job.at(i-1).second;
    }
    for(int i=0; i<N; i++) {
        if(job.at(i).first < job.at(i).second) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1792
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

S = rd()
w, = rdi()

r = ""
while True:
        r = r + S[0]
        S = S[w:]
        if not S:
                break
print r


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

using namespace std;

int dp[100100],a[100100];


int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++)  cin >> a[i];
    for(int i = n - 2; i>=0; i--)
    {
        dp[i] = (abs(a[i] - a[i + 1])+ dp[i + 1]);
        if(i + 2 < n)  dp[i] = min(dp[i], abs(a[i] - a[i + 2]) + dp[i + 2]);
    }
    cout << dp[0];
    return 0;
}


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

using std::cin;
using std::cout;
using std::endl;

using std::vector;

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

    int a, b, c, d;
    d = n % 10;
    c = (n / 10) % 10;
    b = (n / 100) % 10;
    a = (n / 1000) % 10;

    if (a + b + c + d == 7)
        cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
    else if (a + b + c - d == 7)
        cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
    else if (a + b - c + d == 7)
        cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
    else if (a + b - c - d == 7)
        cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
    else if (a - b + c + d == 7)
        cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
    else if (a - b + c - d == 7)
        cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
    else if (a - b - c + d == 7)
        cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
    else if (a - b - c - d == 7)
        cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;

    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
using namespace std;
#define INF 1980000001
int main(){
    int V, E;
    cin >> V >> E;
    vector<vector<int> > A(V, vector<int>(V, INF));
    for (int i = 0; i < V; i++) {
        A[i][i] = 0;
    }
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        A[s][t] = d;
    }
    for (int k = 0; k < V; k++) {
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                if (A[i][k] == INF || A[k][j] == INF) continue;
                A[i][j] = min(A[i][j], A[i][k] + A[k][j]);
            }
        }
    }
    for (int i = 0; i < V; i++) {
        if (A[i][i] != 0) {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            if (A[i][j] == INF) {
                cout << "INF";
            } else {
                cout << A[i][j];
            }
            cout << (j < V - 1 ? " " : "\n");
        }
    }
    return 0;
}



Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string S;
    cin >> S;
    vector<char> S1(S.size());
    vector<char> S2(S.size());
    for(int i=0; i<S.size(); i++){
        if(i%2==0){
            S1.at(i)='0';
            S2.at(i)='1';
        }
        else{
            S1.at(i)='1';
            S2.at(i)='0';
        }
    }
    int countS1=0;
    int countS2=0;
    for(int i=0; i<S.size(); i++){
        if(S.at(i)!=S1.at(i)){
            countS1++;
        }
        if(S.at(i)!=S2.at(i)){
            countS2++;
        }
    }
    cout << min(countS1,countS2) << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

ll lcm(ll a,ll b){
	return a * b / gcd(a,b);
}



signed main(){
	ll n;
	cin >> n;
	ll a[n];
	
	rep(i,0,n) cin >> a[i];

	sort(a,a+n);

	cout << a[n/2]-a[n/2-1] << endl;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	enum suit
	{
		S,
		H,
		C,
		D,
	};
	map<pair<suit, int>, bool> c;
	for (int i = 0; i < 4; i++)
		for (int j = 1; j <= 13; j++)
			c[make_pair((suit)i, j)] = 1;
	for (int i = 0; i < n; i++)
	{
		suit s;
		char ch;
		int j;
		cin >> ch >> j;
		switch (ch)
		{
		case 'S':
			s = S;
			break;
		case 'H':
			s = H;
			break;
		case 'C':
			s = C;
			break;
		case 'D':
			s = D;
			break;
		}
		c[make_pair(s, j)] = 0;
	}
	for (auto x : c)
	{
		if (x.second)
		{
			switch (x.first.first)
			{
			case S:
				cout << 'S';
				break;
			case H:
				cout << 'H';
				break;
			case C:
				cout << 'C';
				break;
			case D:
				cout << 'D';
				break;
			}
			cout << ' ' << x.first.second << endl;
		}
	}
}


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

#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<ll>
#define all(x) x.begin() , x.end()

using namespace std;
void OJ();

const int MAX = 1e5 + 9;



int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); //OJ();

    int n , k , s;
    cin >> n >> k >> s;
    vector<int> vec(k , s);

    int inc = (s == 1e9 ? 1 : 1e9);
    while ( vec.size() < n ){
        vec.pb(inc);
    }

    for ( int i : vec ){
        cout << i << " ";
    }
    return  0;
}

void OJ(){
#ifndef ONLINE_JUDGE
       freopen( "inp.c"         , "r" , stdin  );
       //freopen( "OutPut.txt"   , "w" , stdout );
#endif // ONLINE_JUDGE
}
ll binEXP( ll x , ll pw , ll MOD )
{ ll res=1; while(pw>0){ pw%2 ? res *= x : 0; x *= x; x%=MOD; pw /= 2; res%= MOD; } return res%=MOD; }


Measured memory_bytes: 1912
//Dedicated to the two things I don't have in my life
//Ekagrata and Ekagrata
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(c)	c.begin(),c.end()
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++)
        s[i] == '1' ? cout << 9 : cout << 1;
    cout << '\n';
    return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
# print(L)
ct = 0
cost = 0
i = 0
while ct < M:
    a = min(M-ct, L[i][1])
    ct += a
    cost += a*L[i][0]
    # print(ct,cost)
    i += 1
print(cost)

Measured memory_bytes: 88476
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a,s=0; cin>>n;
  vector<int> v(1); for(int i=0;i<n;i++) cin>>a,s+=a,v.push_back(a);
  sort(v.begin(),v.end());
  for(int i=0;i<n+1;i++){
    if((s-v[i])%10!=0){
      cout<<s-v[i]<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int a, b, c; std::cin >> a >> b >> c;
  a = max(0, a-b);
  std::cout << c - min(a, c) << "\n";
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>

using namespace std;

int main(void){
  double xa1,ya1,xa2,ya2;//A左下,右上
  double xb1,yb1,xb2,yb2;//B左下,右上
  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&xa1,&ya1,&xa2,&ya2,&xb1,&yb1,&xb2,&yb2) != EOF){
    bool f = false;
    double xaa = (xa1>xa2)?xa1:xa2;
    double xab = (xa1>xa2)?xa2:xa1;
    double yaa = (ya1>ya2)?ya1:ya2;
    double yab = (ya1>ya2)?ya2:ya1;
    double xba = (xb1>xb2)?xb1:xb2;
    double xbb = (xb1>xb2)?xb2:xb1;
    double yba = (yb1>yb2)?yb1:yb2;
    double ybb = (yb1>yb2)?yb2:yb1;
    
    if(xab <= xb1 && xb1 <= xaa){
      if(yab <= yb1 && yb1 <= yaa) f = true;
      if(yab <= yb2 && yb2 <= yaa) f = true;
      if(ybb <= ya1 && ya1 <= yba) f = true;
      if(ybb <= ya2 && ya2 <= yba) f = true;
    }
    if(xab <= xb2 && xb2 <= xaa){
      if(yab <= yb1 && yb1 <= yaa) f = true;
      if(yab <= yb2 && yb2 <= yaa) f = true;
      if(ybb <= ya1 && ya1 <= yba) f = true;
      if(ybb <= ya2 && ya2 <= yba) f = true;
    }
    if(xbb <= xa1 && xa1 <= xba){
      if(yab <= yb1 && yb1 <= yaa) f = true;
      if(yab <= yb2 && yb2 <= yaa) f = true;
      if(ybb <= ya1 && ya1 <= yba) f = true;
      if(ybb <= ya2 && ya2 <= yba) f = true;
      
    }
    if(xbb <= xa2 && xa2 <= xba){
      if(yab <= yb1 && yb1 <= yaa) f = true;
      if(yab <= yb2 && yb2 <= yaa) f = true;
      if(ybb <= ya1 && ya1 <= yba) f = true;
      if(ybb <= ya2 && ya2 <= yba) f = true;
    }
    if(f) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

typedef long long ll;

int main() {
    ll n,a,b;cin>>n>>a>>b;
    ll ans=0;
    ans+=a*(n/(a+b));
    n-=(n/(a+b))*(a+b);
    ans+=min(a,n);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N,L,x;
	cin >> N >> L;
	if (0 < L)
		x = L;
	else if (L + N - 1 < 0)
		x = L + N - 1;
	else
		x = 0;
	cout << N*(2*L+N-1)/2-x;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();

		long a = Long.parseLong(str.split(" ")[0]);
		long b = Long.parseLong(str.split(" ")[1]);
		long c = Long.parseLong(str.split(" ")[2]);
		long d = Long.parseLong(str.split(" ")[3]);

		 a -= 1;

		long an = (a - a/c - a/d + (a/(lcm(c, d))));
		long bn = (b - b/c - b/d + (b/(lcm(c, d))));

		System.out.println(bn - an);


	}

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


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    if(N == 1) cout << 1 << endl;
    else if(N % 2 == 0) cout << 0.5 << endl;
    else{
        float a = N;
        a = ((a-1)/2 + 1) / a;
        cout << a << endl;
    }
}

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

int main() {
  int H, W;
  cin >> H >> W;
  for(int i = 0 ; i < W+2 ; i++ ){
  cout << "#";
  }
  cout << endl;
  for(int g = 0; g < H; g++){
   cout << "#";
  for(int f = 0; f < W; f++){
  char x;
  cin >> x;
  cout << x;
  }
   cout << "#" << endl;
  }
  for(int i = 0 ; i < W+2 ; i++ ){
  cout << "#";
  }
  cout << endl;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t d, g;
    cin >> d >> g;
    g /= 100;

    vector<array<int64_t, 2>> pc(d);
    for (auto&& t : pc) {
        cin >> t[0] >> t[1];
        t[1] /= 100;
    }

    int64_t ans = numeric_limits<int64_t>::max();
    for (auto s : irange(0uL, 1uL << d)) {
        bitset<10> bs(s);

        int64_t points = 0;
        int64_t k = 0;
        for (auto i : irange(0L, d)) {
            if (bs[i]) {
                points += pc[i][0] * (i + 1) + pc[i][1];
                k += pc[i][0];
            }
        }

        for (auto i : irange(0L, d) | reversed) {
            if (!bs[i]) {
                auto m = min(pc[i][0] - 1, (max(g - points, 0L) + i) / (i + 1));
                points += m * (i + 1);
                k += m;
            }
        }

        if (points >= g) {
            ans = min(ans, k);
        }
    }

    cout << ans << endl;
}

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(1e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii >

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){out << q.F << " " << q.S; return out;}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){return {p1.F-p2.F, p1.S-p2.S};}

void solve() {
    long double a;
    long double b;
    cin >> a >> b;
    long double x =  a*b;
    int ans = x;
    cout << ans << endl;
}

signed main(){

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

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(20);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif
   
    // cin >> t;
    
    for(int i = 1; i <= t; ++i){
        solve();
    }
    //cerr << time(start);
    return 0;
}


Measured memory_bytes: 3748
#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
    string S;
    int count = 0;
    cin >> S;

    if (S.at(1) == 'R') {
        if (S.at(0) == 'R' && S.at(2) == 'R') {
            count = 3;
            }
        else if (S.at(0) == 'S' && S.at(2) == 'S') {
            count = 1;
        }
        else {
            count = 2;
        }
    }
    else {
        if (S.at(0) == 'S' && S.at(2) == 'S') {
            count = 0;
        }
        else {
            count = 1;
        }

    }
    cout << count;
}


Measured memory_bytes: 3140
import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        String S = sc.next();
        sc.close();
        S = 'R'+S+'L';
        int ans = 0;
        for(int i=1;i<=N;i++){
            int p = 0;
            if(S.charAt(i) == 'R') p = i+1;
            else p = i-1;
            if(S.charAt(i) == S.charAt(p)) ans += 1;
        }
        System.out.println(Math.min(ans+2*K,N-1));
    }
}

Measured memory_bytes: 27476
import heapq

def dijkstra(s,path):
    inf = float('inf')
    n = len(path)

    # 距離をinfで初期化
    d = [inf for i in range(n)]
    d[s] = 0

    # sへの距離は0
    q = [(0,s)]
    heapq.heapify(q)

    # 距離が最小の頂点から更新していけば良い
    while q:
        c,p = heapq.heappop(q)

        # 頂点pまでの距離がheap内のpまでの距離より小さい場合、continue
        if d[p]<c:
            continue

        # 頂点pから伸びる、全ての辺の距離を確認
        for cost,to in path[p]:
            # 頂点pから行ける頂点の距離がpまでの距離とpからの距離の和より小さい場合 -> 距離を更新し、heapに追加
            if d[to] > d[p] + cost:
                d[to] = d[p]+cost
                heapq.heappush(q,(d[to], to))
    return d

n,m = map(int, input().split())
path = [[] for i in range(n)]
for i in range(n-1):
    path[i+1].append([0,i])

for i in range(m):
    l,r,c = map(int, input().split())
    path[l-1].append([c,r-1])

ans = dijkstra(0,path)[-1]
print(-1 if ans==float('inf') else ans)

Measured memory_bytes: 94896