akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; //
typedef string str; //
//
typedef pair<int,int> pi;
typedef pair<ll,ll> pl; //
typedef pair<db,db> pd; //
//
typedef vector<int> vi; 
typedef vector<ll> vl; //
typedef vector<db> vd; //
typedef vector<str> vs; //
typedef vector<pi> vpi;
typedef vector<pl> vpl; //
typedef vector<pd> vpd; //
 
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() //
#define rsz resize
#define ins insert //
#define ft front() //
#define bk back()
#define pf push_front //
#define pb push_back
#define eb emplace_back //
#define lb lower_bound //
#define ub upper_bound //
 
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
 
const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5; //
const ll INF = 1e18; //
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1}; //
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); //
//
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { //
	return a < b ? a = b, 1 : 0; } //
constexpr int pct(int x) { return __builtin_popcount(x); } //
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) //
constexpr int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 //
// IGNORE
int fstTrue(function<bool(int)> f, int lo, int hi) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true 
		int mid = (lo+hi)/2; 
		f(mid) ? hi = mid : lo = mid+1; 
	} 
	return lo;
}
template<class T> void remDup(vector<T>& v) { 
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// IGNORE
//
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N;
	ll K;
	cin >> N >> K;
	ll A[N];
	F0R(a, N)
		cin >> A[a];
	int x = 1000000000;
	for(int a = 1000000000; a >= 1; a /= 2){
		while(x - a >= 1){
			ll cnt = 0;
			F0R(i, N)
				cnt += (A[i] - 1) / (x - a);
			if(cnt <= K)
				x -= a;
			else
				break;
		}
	}
	cout << x << endl;
}


Measured memory_bytes: 5108
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,a,b,c,d=map(int,input().split())
delta=d-c
delta=delta*(n-1)
l=a-(n-1)*d
r=a+(n-1)*c
while True:
    if l<=b<=l+delta:
        print("YES")
        exit()
    l+=(c+d)
    if l>r:
        break
print("NO")

Measured memory_bytes: 66924
#nCrをmodで割った余りO(r)
def comb(n, r, mod):
    r = min(r, n-r)
    mol = 1
    deno = 1
    for i in range(1, r+1):
        mol = mol * (n-r+i) % mod
        deno = deno * i % mod
    ret = mol * pow(deno, mod-2, mod) % mod
    return ret

x,y = map(int,input().split())
if (x+y)%3 != 0 or 2*y-x < 0 or 2*x-y < 0:
    print(0)
else:
    a = (2*y-x)//3
    b = (2*x-y)//3
    mod = 10**9+7
    print(comb(a+b,a,mod))


Measured memory_bytes: 3064
#include <iostream>                                                                   
#include <string>                                                                     
using namespace std;                                                                  
                                                                                      
int main(int argc, char **argv)                                                       
{                                                                                     
  string s, t;                                                                        
  cin >> s >> t;                                                                      
  int i, count = 0;                                                                   
  for (i=0; i<s.length(); i++)                                                        
      if (s[i] != t[i])                                                               
        count++;                                                                      
  cout << count << endl;                                                              
                                                                                      
  return 0;                                                                           
}                                                                                     
                                                                                      
                                                                                      

Measured memory_bytes: 3860
#include <bits/stdc++.h>
using namespace std;
char s[100005];
bool a[100005];
int main(){
    int n;
    scanf("%d", &n);
    scanf("%s", s+1);
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            a[1] = i;
            a[2] = j;
            for(int i=3;i<=n;i++){
                if(a[i-1] == 0){
                    if(s[i-1] == 'o') a[i] = a[i-2];
                    else a[i] = 1-a[i-2];
                }
                else{
                    if(s[i-1] == 'o') a[i] = 1-a[i-2];
                    else a[i] = a[i-2];
                }
            }
            bool ok = 1;
            if(a[1] == 0){
                if(s[1] == 'o'){
                    if(a[2] != a[n]) ok = 0;
                }
                else{
                    if(a[2] == a[n]) ok = 0;
                }
            }
            else{
                if(s[1] == 'o'){
                    if(a[2] == a[n]) ok = 0;
                }
                else{
                    if(a[2] != a[n]) ok = 0;
                }
            }
            if(a[n] == 0){
                if(s[n] == 'o'){
                    if(a[n-1] != a[1]) ok = 0;
                }
                else{
                    if(a[n-1] == a[1]) ok = 0;
                }
            }
            else{
                if(s[n] == 'o'){
                    if(a[n-1] == a[1]) ok = 0;
                }
                else{
                    if(a[n-1] != a[1]) ok = 0;
                }
            }
            if(ok){
                for(int i=1;i<=n;i++){
                    if(a[i] == 0) printf("S");
                    else printf("W");
                }
                return 0;
            }
        }
    }
    printf("-1\n");
}

Measured memory_bytes: 512
s = int(input())
l = []
l.append(s)
counter = 0

while(True):
    counter += 1
    n = l[counter-1]
    if n%2 != 0:
        if 3*n+1 in l:
            print(len(l)+1)
            break
        l.append(3*n+1)
    else:
        if n//2 in l:
            print(len(l)+1)
            break
        l.append(n//2)




Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	char str[82];
	int i, f;
	
	while (gets(str) != NULL){
		while (1){
			i = 0;
			while (str[i] != '\0'){
				if (str[i] >= 'a' && str[i] <= 'z'){
					str[i]++;
					
					if (str[i] > 'z'){
						str[i] = 'a';
					}
				}
				
				i++;
			}
			
			i = 0;
			f = 0;
			while (str[i] != '\0'){
				if (str[i] == 't' && str[i + 1] == 'h'){
					if (str[i + 2] == 'e'){
						f = 1;
						break;
					}
					else if (str[i + 2] == 'i' && str[i + 3] == 's'){
						f = 1;
						break;
					}
					else if (str[i + 2] == 'a' && str[i + 3] == 't'){
						f = 1;
						break;
					}
				}
				i++;
			}
			
			if (f == 1){
				printf("%s\n", str);
				break;
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 524
#B - Tax Rate 
import math
N = int(input())

result = ':('
for i in range(1,N+1):#+1しないとi=Nの時(1,2,3,4,5,6,7,8,9,10,11,12)が入らない
    if math.floor(i * 1.08) == N:#小数点以下切り捨て
        result = i
print(result)

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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<vector<PI>> wit(n);
	rep(i,n){
		int A; cin >> A;
		rep(j,A){
			int a, b; cin >> a >> b; 
			a--;
			wit.at(i).push_back(make_pair(a, b));
		}
	}
	int ans = 0;
	//bit全探索
	for(int i = 0; i < (1 << n); i++){
		bool ok = true;
		for(int j = 0; j < n; j++){
			if(i & (1 << j)){ // j番目の人が正直者の時
				for(auto nj: wit.at(j)){
					int p = nj.first, q = nj.second; //pは人qは0or1
					if(((i >> p) & 1) ^q){
						ok = false;
						break;
					}
				}
				if(!ok) break;
			}
		}
		if(ok){
			ans = max(ans, __builtin_popcount(i));
		}
	}
	cout << ans << endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+10;
set<int>s1,s2;
//set<int>::iterator it;
int a[N],pos[N];
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);pos[a[i]]=i;
	}
	ll ans=0;
	for(int i=n;i>=1;i--){
		int x1=pos[i],y1=pos[i],y2=0,x2=n+1;
		if(s1.size()>=1){
			auto it =s1.upper_bound(pos[i]);
			if(it!=s1.end()){
				x1=*it;
				it++;
				if(it!=s1.end()){
					x2=(*it);
				}
			}
		}
		if(s2.size()>=1){
			auto it=s2.upper_bound(-pos[i]);
			if(it!=s2.end()){
				y1=-(*it);
				it++;
				if(it!=s2.end()){
					y2=-(*it);	
				}
			}
		}
		//cout<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<endl;
		s2.insert(-pos[i]);
		s1.insert(pos[i]);
		if(x1==pos[i]&&y1==pos[i])continue;
		if(x1==pos[i]){
			ans+=1ll*(n-pos[i]+1)*(y1-y2)*i;
		}else if(y1==pos[i]){
			ans+=1ll*(pos[i])*(x2-x1)*i;
		}
		else {
			ans+=1ll*(y1-y2)*(x1-pos[i])*i;
			ans+=1ll*(x2-x1)*(pos[i]-y1)*i;
		}
		
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 10368
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 100005;
int n, a[N], sum;
int main () {
cin >> n;
memset(a, -1, sizeof(a));
for (int i = 1; i <= n; i ++) {
cin >> a[i];
}
for (int i = 1; i <= n; i ++) {
if (a[i] == i) {
if (a[i + 1] == i + 1) {
int t = a[i];
a[i] = a[i + 1];
a[i + 1] = t;
sum ++;
continue;
}
if (i == n) {
int t = a[i];
a[i] = a[i-1];
a[i-1] = t;
sum ++;
}
else
{
int t = a[i];
a[i] = a[i+1];
a[i+1]=t;
sum ++;
}
}
}
cout << sum;
return 0;
}

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

using namespace std;

typedef long long ll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;  

int main(){
    int N;
    cin >> N;
    if( N % 1000 == 0) cout << 0 << endl;
    else cout << (N / 1000 + 1)*1000 - N << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#define int long long
using namespace std;
int a[200000];
signed main(){
	int n;
	string s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		int dot=100;
		for(int j=0;j<s.size();j++)
			if(s[j]=='.')
				dot=j;
		if(dot!=100){
			s.erase(s.begin()+dot);
			a[i]=stoll(s)*(int)round(pow(10,9-(s.size()-dot)));
		}else
			a[i]=stoll(s)*1000000000;
	}
	int dd[19][19]={};
	for(int i=0;i<n;i++){
		int a2=a[i],a5=a[i];
		int div2=0,div5=0;
		while(a2%2==0){
			a2/=2;
			div2++;
		}
		while(a5%5==0){
			a5/=5;
			div5++;
		}
		dd[min(18ll,div2)][min(18ll,div5)]++;
	}
	int ans=0;
	for(int i=0;i<=18;i++)
		for(int j=0;j<=18;j++)
			for(int k=18-i;k<=18;k++)
				for(int l=18-j;l<=18;l++)
					if(i==k&&j==l)
						ans+=dd[i][j]*(dd[i][j]-1);
					else
						ans+=dd[i][j]*dd[k][l];
	cout<<ans/2<<endl;
}

Measured memory_bytes: 5396
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
    char a[8];
	long long h,l,n;
	cin>>n;
	for(int k=0;k<n;k++){
		for(int j=0;j<8;j++)
			cin>>a[j];
		for(int i=0;i<7;i++){
            for(int j=7;j>i;j--){
	            if(a[j]<a[j-1]){
	            int tmp=a[j];
	            a[j]=a[j-1];
	            a[j-1]=tmp;
	            }
            }
        }
		h=0,l=0;
		for(int j=0;j<8;j++){
			double t=j;
			l+=a[j]*pow(10,7-t);
			h+=a[7-j]*pow(10,7-t);
		}
		cout<<h-l<<endl;
	}
	return 0;
}


Measured memory_bytes: 3260
#include<stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    if(n % 10 == 3){
        puts("bon");
    }else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8){
        puts("pon");
    }else{
        puts("hon");
    }

    return 0;
}

Measured memory_bytes: 1644
A=[int(i) for i in input().split()]
#Alice turns the swich on faster than Bob
if A[0]<=A[2]:
    if A[1]<A[2]:
        print(0)
    elif A[1]>=A[3]:
        print(A[3]-A[2])
    else:
        print(A[1]-A[2])
#bob turns the swich on faster than alice
else:
    if A[3]<A[0]:
        print(0)
    elif A[3]>=A[1]:
        print(A[1]-A[0])
    else:
        print(A[3]-A[0])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100005

int N,M;
vector<int> G[MAX_N];
int w[MAX_N];

bool visited[MAX_N];

int t[MAX_N];
int cc=0;

void dfs(int pos){
  visited[pos]=true;
  t[cc]=w[pos];
  cc++;
  for(int to:G[pos]){
    if(visited[to])continue;
    dfs(to);
  }
}

int main(){
  scanf("%d %d",&N,&M);
  for(int i=0;i<N;i++){
    scanf("%d",&w[i]);
  }
  for(int i=0;i<M;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int X=0;
  long long ans=0;
  vector<int> v;
  for(int i=0;i<N;i++){
    if(visited[i])continue;
    X++;
    cc=0;
    dfs(i);
    sort(t,t+cc);
    ans+=t[0];
    for(int j=1;j<cc;j++)v.push_back(t[j]);
  }
  
  if(X==1){
    cout<<0<<endl;
    return 0;
  }
  
  int Y = (X-1)*2;
  
  if(Y-X > (int)v.size()){
    cout<<"Impossible"<<endl;
    return 0;
  }

  sort(v.begin(),v.end());
  for(int i=0;i<Y-X;i++){
    ans+=v[i];
  }
  cout<<ans<<endl;
  return 0;  
}


Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;

int main(void){
    ll N,M,K;
    cin >> N >> M >> K;
    vector<int> a(N),b(M);
    REP(i,N)
        cin >> a[i];
    REP(i,M)
        cin >> b[i];

    ll sum=0;
    REP(i,M) sum+=b[i];

    int j=M;
    int ans=0;
    REP(i,N+1){
        while(j>0 && sum>K){
            --j;
            sum-=b[j];
        }
        if(sum>K) 
            break;
        ans=max(ans,i+j);
        if(i==N)
            break;
        sum+=a[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4800
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main  (){
  ll n,k;
  cin  >>n>>k;
  if(n>=k){
    ll a=n%k;
    ll  b=k-a;
    ll c=min(a,b);
    cout  <<c<<endl;
  }else{
    cout <<min(n,k-n)<<endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i, s, t) for(re int i = s; i <= t; ++ i)
#define drep(i, s, t) for(re int i = t; i >= s; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 8005
#define maxm 200005
int n, m, dp[maxn][maxn], a[maxm], b[maxm], jie[maxn], inv[maxn];
il int qpow(int a, int b) {
	int r = 1;
	while(b) {
		if(b & 1) r = 1ll * r * a % mod;
		a = 1ll * a * a % mod, b >>= 1;
	} 
	return r;
}
il int C(int a, int b) {
	int x = 2 * (a + b), y = 2 * a;
	return 1ll * jie[x] * (1ll * inv[y] * inv[x - y] % mod) % mod;
}
int main() {
	n = read(), jie[0] = 1, inv[0] = 1;
	rep(i, 1, 8000) jie[i] = 1ll * jie[i - 1] * i % mod, inv[i] = qpow(jie[i], mod - 2);
	rep(i, 1, n) a[i] = read(), b[i] = read(), ++ dp[4001 - a[i]][4001 - b[i]];
	rep(i, 1, 8002) {
		rep(j, 1, 8002) {
			dp[i][j] = ((dp[i][j] + dp[i][j - 1]) % mod + dp[i - 1][j]) % mod;
		}
	}
	int ans = 0;
	rep(i, 1, n) ans = (ans + dp[a[i] + 4001][b[i] + 4001]) % mod;
	rep(i, 1, n) ans = (ans - C(a[i], b[i]) + mod) % mod;
	printf("%d", 1ll * ans * qpow(2, mod - 2) % mod);
	return 0;
}

Measured memory_bytes: 252160
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long int
#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 vv(type)		vector<vector<type>>
#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 db(x) 			cout<<x<<" "
#define db1(x) 			cout<<x<<'\n'
#define db2(x,y) 		cout<<x<<" "<<y<<'\n'
#define db3(x,y,z) 		cout<<x<<" "<<y<<" "<<z<<'\n'
#define rep(i,n) 		for(int i=0;i<(n);++i)
#define repA(i,a,n) 	for(int i=a;i<=(n);++i)
#define repD(i,a,n) 	for(int i=a;i>=(n);--i)
#define so(a) 			sort(a.begin(),a.end())
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
// to find all local maximaa and minima in O(n)
//	 for (int i=1;i<=n;i++)
//        {
//            if (i==1 || i==n || (p[i-1]<p[i])!=(p[i]<p[i+1]))
//           ans.push_back(p[i]);
//        }
int dx[] = { -1, 1, -1, 0, 0, -1, 1, 1 };
int dy[] = { -1, -1, 1, -1, 1, 0, 0, 1 };
int gcd(int a, int b)
{
	if (!b)
		return a;
	return gcd(b, a % b);
}
int modular_expo(int x, int y, int m)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans % m * x % m) % m;
		x = (x % m * x % m) % m;
		y /= 2;
	}
	return ans % m ;
}
int power(int x, int y)
{
	int ans = 1;
	while (y)
	{
		if (y & 1)
			ans = (ans * x);
		x *= x;
		y /= 2;
	}
	return ans;
}
void solve()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, w;
	cin >> n >> w;
	vector<vector<int>>item(n, vector<int>(2));
	rep(i, n)
	cin >> item[i][0] >> item[i][1];
	vector<vector<int>>dp(n + 1, vector<int>(w + 1, 0));
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			dp[i][j] = dp[i - 1][j];
			if (j >= item[i - 1][0])
				dp[i][j] = max(dp[i][j], item[i - 1][1] + dp[i - 1][j - item[i - 1][0]]);
		}
	}
	int ans = 0;
	rep(i, w + 1)
	ans = max(ans, dp[n][i]);
	db1(ans);
}

int32_t main()
{
	solve();
	return 0;
}


Measured memory_bytes: 83116
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

bool solve(LLI a, LLI b, LLI c, LLI d){
  if(a < b or d < b) return false;
  LLI g = gcd(b,d);
  a %= g;

  if(((c-a+g)/g)*g < b-a) return false;
  return true;
}

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

  
  int T;
  while(cin >> T){
    REP(i,T){
      LLI A,B,C,D; cin >> A >> B >> C >> D;

      if(solve(A,B,C,D)){
	cout << "Yes" << endl;
      }else{
	cout << "No" << endl;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define eb emplace_back
#define PI 3.14159265
#define sz(c) (ll) c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define tr(container, it) \
    for (typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container), element) != container.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double ld;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    ll ans = 0;
    cin >> n >> s;
    set<int> s1, s2, s3;
    fr(i, 0, n)
    {
        if (s[i] == 'R')
        {
            s1.insert(i + 1);
        }
        else if (s[i] == 'B')
        {
            s2.insert(i + 1);
        }
        else if (s[i] == 'G')
        {
            s3.insert(i + 1);
        }
    }
    set<int>::iterator it1, it2;
    for (it1 = s1.begin(); it1 != s1.end(); it1++)
    {
        for (it2 = s2.begin(); it2 != s2.end(); it2++)
        {
            ans += sz(s3);
            int x = *it1;
            int y = *it2;
            if (s3.find(2 * x - y) != s3.end())
            {
                ans--;
            }
            if (s3.find(2 * y - x) != s3.end())
            {
                ans--;
            }
            if (s3.find((x + y) / 2) != s3.end() && (x + y) % 2 == 0)
            {
                ans--;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

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

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

  int N=(s.size()+1)/2;
  string word;
  for(int i=0;i<N;i++){
    word=word+s.at(2*i);
  }
  
  cout<<word<<endl;
}

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

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


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

using namespace std;

const double PI = 3.1415926;

int main() {
	int m, n, degree, rest;
	double sum1, sum2;

	while (cin >> m, m) {
		sum1 = rest = 0;
		for (int i = 1; i < m; i++) {
			cin >> degree;
			rest += degree;
			sum1 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum1 += sin(degree*PI / 180.0);
		//cout << "sum1="<<sum1 << endl;

		cin >> n;
		sum2 = rest = 0;
		for (int i = 1; i < n; i++) {
			cin >> degree;
			rest += degree;
			sum2 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum2 += sin(degree*PI / 180.0);
		//cout << "sum2"<<sum2 << endl;

		if (fabs(sum1 - sum2) < 1e-10) {
			cout << "0" << endl;
		}
		else if (sum1 < sum2) {
			cout << "2" << endl;
		}
		else {
			cout << "1" << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    cout << max(0, x - 2 * y) << endl;
    return 0;
}


Measured memory_bytes: 256
# 最大価値が取れて種類数も増えるなら必ずとる
# 
# 種類数を固定すると：各種類のベストを見て貪欲に種類を決めているはず
# あとは種類数を更新できないものの中から貪欲
#
# 最大価値が等しい2種類：第2種の貪欲が使われだすなら両方取ってるはずなので優先度は同じでよい
#
# 種類数を増やしたときの変化を見る

import sys
input = sys.stdin.readline
from heapq import heappush,heappop

N,K = map(int,input().split())
kind_value = [[] for _ in range(N+1)]
for _ in range(N):
  t,d = map(int,input().split())
  kind_value[t].append(d)
for li in kind_value:
  li.sort()
  
first_type = [(li[-1],i) for i,li in enumerate(kind_value) if li]
first_type.sort(reverse = True)

kind = 0
value_type1 = 0
second_type = []
second_type_sum = 0
second_type_cnt = 0

answer = 0
for v,i in first_type:
  kind += 1
  if kind > K:
    break
  value_type1 += v
  for d in kind_value[i][:-1]:
    heappush(second_type,d)
    second_type_sum += d
    second_type_cnt += 1
  while second_type_cnt > K-kind:
    d = heappop(second_type)
    second_type_cnt -= 1
    second_type_sum -= d
  value = kind*kind + value_type1 + second_type_sum
  if answer < value:
    answer = value

print(answer)


Measured memory_bytes: 28880
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cstring>
#include<functional>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	long long n;

	scanf("%lld", &n);

	char input[4001];
	string str;

	scanf("%s", input);

	str = input;

	long long cnt[255] = { 0, };

	for (int i = 0; i < n; i++)
	{
		cnt[str[i]]++;
	}

	long long sol;

	sol = cnt['R'] * cnt['G'] * cnt['B'];

	for (int i = 1; i < n - 1; i++)
	{
		int bound;

		bound = i < n - 1 - i ? i : n - 1 - i;

		for (int j = 1; j <= bound; j++)
		{
			if (str[i - j] != str[i + j] && str[i + j] != str[i] && str[i - j] != str[i])
			{
				sol--;
			}
		}
	}

	printf("%lld\n", sol);

	return 0;
}

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

signed main(void)
{
	int n;
	cin >> n;
	rep(i, 26)
	{
		if (n - 4 * i >= 0 && (n - 4 * i) % 7 == 0)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

#define N 100005
vii q(N, vi());
vector<bool> used(N,false);
vi ans;

int main() {
	int n, m, i, j;
	cin >> n >> m;
	int a, b;
	for (i = 0; i < m; i++) {
		cin >> a >> b;
		a--; b--;
		q[a].push_back(b);
		q[b].push_back(a);
	}
	ans.push_back(a);
	ans.push_back(b);
	int left = ans[0], right = ans[1];
	used[ans[0]] = used[ans[1]] = true;
	vi head;
	while (true) {
		bool flag = true;
		for (i = 0; i < q[left].size(); i++) {
			if (!used[q[left][i]]) {
				flag = false;
				left = q[left][i];
				head.push_back(left);
				used[left] = true;
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	reverse(head.begin(), head.end());
	vi tail;
	while (true) {
		bool flag = true;
		for (i = 0; i < q[right].size(); i++) {
			if (!used[q[right][i]]) {
				flag = false;
				right = q[right][i];
				tail.push_back(right);
				used[right] = true;
				break;
			}
		}
		if (flag) {
			break;
		}
	}
	cout << head.size() + 2 + tail.size() << endl;
	for (i = 0; i < head.size(); i++) {
		cout << head[i] + 1 << " ";
	}
	for (i = 0; i < ans.size(); i++) {
		cout << ans[i] + 1 << " ";
	}
	for (i = 0; i < tail.size(); i++) {
		cout << tail[i] + 1 << " ";
	}
	cout << endl;
}

Measured memory_bytes: 6776
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000;
#define MAX_N 100000



int main()
{
	int x[5];
	rep(i,5){
		cin>>x[i];
	}
	rep(i,5){
		if(x[i] == 0){
			cout<<i+1<<endl;
			break;
		}
	}
	return 0;
}



Measured memory_bytes: 3144
#!/usr/bin/env python3
def f(s):
    n = len(s)
    if s[-1] == '1' or s[-2] == '0' or s[0] == '0':
        print(-1)
        return
    i,j = 0,n-2
    while i < j:
        if s[i] != s[j]:
            print(-1)
            return
        i+=1
        j-=1
    e = []
    k = 0
    for i, c in enumerate(s):
        if c == '1':
            if i == 0:
                k = 0
                continue
            for j in range(k+1): e.append((i-k+j, i+1))
            k = 0
        else: k += 1
    e.append((n-k, n))
    for u,v in e: print(u,v)
f(input())


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

int vx[4] = {1,0,-1,0};
int vy[4] = {0,1,0,-1};
using P = pair<ll, ll>;

int H, W;
vector<string> S;
vector<vector<bool>> visited;

P dfs(int y, int x) {
  P ret = {0, 0};
  if(S[y][x] == '.') ret.first++;
  else ret.second++;
  visited[y][x] = true;
  rep(i, 0, 4) {
    int nx = x + vx[i];
    int ny = y + vy[i];
    if(nx < 0 || W <= nx || ny < 0 || H <= ny) continue;
    if(visited[ny][nx]) continue;
    if(S[y][x] == S[ny][nx]) continue;
    P T = dfs(ny, nx);
    ret.first += T.first;
    ret.second += T.second;
  }
  return ret;
}

int main() {
  cin >> H >> W;
  S.resize(H);
  visited.assign(H, vector<bool>(W));
  rep(i, 0, H) cin >> S[i];
  ll ans = 0;
  rep(i, 0, H) rep(j, 0, W) {
    if(!visited[i][j]) {
      P tmp = dfs(i, j);
      ans += tmp.first * tmp.second;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 20480
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int n,mx;
string s[200100];
map <string,int> cnt,vis;
vector <string> ans;
int main()
{
    go;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        mx=max(mx,++cnt[s[i]]);
    }
    for(int i=0;i<n;i++)
    {
        if(cnt[s[i]]<mx) continue;
        if(vis[s[i]]) continue;
        ans.pb(s[i]);
        vis[s[i]]=1;
    }
    sort(ans.begin(),ans.end());
    for(string x : ans)
        cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 39536
#include <iostream>

using namespace std;

int main() {

  double eyesight[2];

  int a[2],b[2],c[2],d[2];


  for(int i=0;i<2;i++) a[i]=0;
  for(int i=0;i<2;i++) b[i]=0;
  for(int i=0;i<2;i++) c[i]=0;
  for(int i=0;i<2;i++) d[i]=0;
  
  while(cin >> eyesight[0] >> eyesight[1]) {

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

      if(eyesight[i]>=1.1) a[i]++;

      else if(eyesight[i]>=0.6) b[i]++;

      else if(eyesight[i]>=0.2) c[i]++;
      
      else d[i]++;

    }

  }
  
  cout << a[0] << " " << a[1] << endl;
  cout << b[0] << " " << b[1] << endl;
  cout << c[0] << " " << c[1] << endl;
  cout << d[0] << " " << d[1] << endl;

  return 0;

}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
int main()
{
  int w[10];
  for (int i = 0;i < 10; i++) {
    std::cin >> w[i];
  }
  std::sort(w, w + 10);
  std::cout << w[9] << std::endl << w[8] << std::endl << w[7] << std::endl;
  return 0;
}

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

vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};

int main() {
	int H, W;
	cin >> H >> W;
	int Ch, Cw, Dh, Dw;
	cin >> Ch >> Cw >> Dh >> Dw;
	Ch--;
	Cw--;
	Dh--;
	Dw--;

	vector<string> S(H);
	for (int i=0;i<H;i++) {
		cin >> S[i];
	}

	vector<vector<bool>> visited(H, (vector<bool>(W, false)));
	queue<pair<int, int>> q;
	pair<int, int> first = make_pair(Ch, Cw);
	visited[Ch][Cw] = true;
	q.push(first);

	int ans = 0;


	vector<vector<bool>> visited_second(H, (vector<bool>(W, false)));
	queue<pair<int, int>> q_second;

	bool flag = false;
	int add_cnt = 33;
	while (add_cnt>0) {
		while (!q.empty()) {
			pair<int, int> rem = q.front();
			q.pop();
			int y = rem.first;
			int x = rem.second;
			if (Dh == y && Dw == x) {
				flag = true;
				break;
			}
			// if (visited[y][x]) continue;
			// visited[y][x] = true;

			for (int i=0;i<4;i++) {
				if (y+dy[i] < 0 || H <=y+dy[i] || x+dx[i] < 0 || W <= x+dx[i]) continue;
				if (S[y+dy[i]][x+dx[i]] == '#') continue;
				if (visited[y+dy[i]][x+dx[i]]) continue;
				pair<int, int> add = make_pair(y+dy[i], x+dx[i]);
				visited[y+dy[i]][x+dx[i]] = true;
				q.push(add);
			}

			for (int d_y=-2;d_y<=2;d_y++) {
				for (int d_x=-2;d_x<=2;d_x++) {
					if (y+d_y < 0 || H <=y+d_y || x+d_x < 0 || W <= x+d_x) continue;
					if (S[y+d_y][x+d_x] == '#') continue;
					if (visited[y+d_y][x+d_x]) continue;
					if (visited_second[y+d_y][x+d_x]) continue;
					pair<int, int> add = make_pair(y+d_y, x+d_x);
					visited_second[y+d_y][x+d_x] = true;
					q_second.push(add);
				}
			}
		}
		if (flag) break;

		add_cnt = 0;
		while (!q_second.empty()) {
			pair<int, int> rem = q_second.front();
			q_second.pop();
			q.push(rem);
			add_cnt++;
		}
		ans++;
	}

	if (flag) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}



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

	int ans=0;
	rep(i,n)repi(j,i+1,n){
		int dist=0;
		rep(k,d)dist+=pow((p[i][k]-p[j][k]),2);

		repi(i,1,40*40*10+1)if(dist==i*i)ans++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
    double d,t,v;
    scanf("%lf %lf %lf",&d,&t,&v);
    double v2 = d/t;
    if((v2<v)){
        printf("Yes");
    }
    else if (v2==v)
    {
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 1748
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = Input.NextInt();
            var list = Enumerable.Range(2, N - 1).ToList();
            var array = Enumerable.Repeat(0, N + 1).ToArray();

            while(list.Any()) {
                var tmp = list.First();
                var count = N / tmp;
                var sum = count;

                while(count > 0) {
                    count /= tmp;
                    sum += count;
                }

                array[tmp] = sum;
                list = list.Where(x => x % tmp != 0).ToList();
            }

            Console.WriteLine(array.Where(x => x != 0).Aggregate(1L, (prev, now) => ((now + 1) * prev) % 1000000007));
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13396
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, Y = na()
ans = 'No'
for turu in range(X+1):
    kame = X - turu
    if turu * 2 + kame * 4 == Y:
        ans = 'Yes'
        break
print(ans)

Measured memory_bytes: 10800
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n;
  cin >> n;
  ll x, y;
  cin >> x >> y;
  rep(i,n-1) {
    ll t, a;
    cin >> t >> a;
    ll c = max((t+x-1)/t, (a+y-1)/a);
    t *= c;
    a *= c;
    x = t;
    y = a;
  }
  cout << x+y << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <boost/range/algorithm/count.hpp>
using namespace std;


void solve(std::string S){
    cout << 700 + 100*boost::count(S, 'o') << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

#define int long long
#define endl '\n'
#define maxn 10000010
const int MOD = 1000000007;
using int32 = __uint32_t;

int pre[maxn];
void solve() {
    int n;
    cin >> n;

    int ct = 1;
    int sum = 0;

    while(sum <= n)sum += ct,ct++;
    for(int i = 1; i < ct; i++){
        if(sum - n == i)continue;
        cout << i <<endl;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define res register int
#define N 2005
using namespace std;
int ans=2e9,tot,n,d[N],m,dep[N];
struct papa
{
  int to,next;
} e[N<<1];
inline void add(res x,res y)
{
  e[++tot].to=y;
  e[tot].next=d[x];
  d[x]=tot;
}
inline int read()
{
  int X=0,w=0;
  char ch=0;
  while(!isdigit(ch))
  {
    w|=ch=='-';
    ch=getchar();
  }
  while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
  return w?-X:X;
}
inline void dfs(res now,res fa)
{
  if(dep[now]>(m>>1)) tot++;
  for(res i=d[now]; i; i=e[i].next)
  {
    res x=e[i].to;
    if(x==fa) continue;
    dep[x]=dep[now]+1;
    dfs(x,now);
  }
}
int main()
{
  n=read(),m=read();
  for(res i=1; i<n; i++)
  {
    res x=read(),y=read();
    add(x,y),add(y,x);
  }
  if(m&1)
  {
    for(res i=1; i<=n; i++)
      for(res j=d[i]; j; j=e[j].next)
      {
        res x=e[j].to;
        tot=0,dep[x]=0;
        dfs(x,i);
        dep[i]=0;
        dfs(i,x);
        ans=min(ans,tot);
      }
    printf("%d\n",ans);
    return 0;
  }
  for(res i=1; i<=n; i++)
    tot=0,dep[i]=0,dfs(i,-1),ans=min(ans,tot);
  printf("%d\n",ans);
}

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

int main(void) 
{
	int n, t, sum = 0;
	int a[150];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < n - 1; j++) {
			if (a[j] > a[j + 1]) {
				t = a[j];
				a[j] = a[j + 1];
				a[j + 1] = t;
				sum++;
			}
		}
	}

	cout << a[0];
	for (int i = 1; i < n; i++)
		cout << " " << a[i];
	cout << endl;
	cout << sum << endl;

	return 0;
}



Measured memory_bytes: 3100
public class Main {

    public static void main(String[] args) {
int s=0,s1=0,res = 0;

for(int cont = 1;cont<10;cont ++)
{
  int n1 = 1; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 2; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 3; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 4; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 5; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 6; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 7; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 8; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}
for(int cont = 1;cont<10;cont ++)
{
  int n1 = 9; 
  res = n1*cont;
  System.out.println(+n1 +"x"+cont +"=" +res);
  s = n1+1;
  
}


    }
}

Measured memory_bytes: 16848
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>(n, Collections.reverseOrder());
        for (int i = 0; i < n; i++) {
            int val = std.nextInt();
            queue.add(val);
        }

        int count = 0;
        while (!queue.isEmpty()) {
            int v = queue.poll();
            if (v % 2 == 0) {
                int nv = v / 2;
                queue.add(nv);
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 38208
#pragma region header
#define _GLIBCXX_DEBUG 
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
signed main() {
    int INF=1000000007;
    int N;
    cin>>N;
    int ans=1;

    for(int i=1;i<=N;i++){
        ans=ans*i;
        if(ans>=INF){
            ans=ans%INF;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define fast std::ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
using namespace std;

void solve(){
    int x;cin>>x;
    long long sum=0, y,mx=0;
    for(int i=0;i<x;i++){
          cin>>y;
          sum+=y;
          mx=max(mx,y);
    }
    if(mx%2==0)
    sum-=(mx/2);
    else {
        sum-=(mx/2);
        sum--;
    }
    cout<<sum;

}
int main()
{
    fast
    solve();
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s == "SUN") {
    cout << 7 << endl;
  }else if (s == "MON") {
    cout << 6 << endl;
  }else if (s == "TUE") {
    cout << 5 << endl;
  }else if (s == "WED") {
    cout << 4 << endl;
  }else if (s == "THU") {
    cout << 3 << endl;
  }else if (s == "FRI") {
    cout << 2 << endl;
  }else if (s == "SAT") {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 3576
(declaim (optimize (speed 3) (debug 0) (safety 0)))
(let* ((N (read))
       (Ai (sort (loop repeat N
                       collect (read))
                 #'>)))
  (labels ((f (list num acc)
             (if (or (null list) (= num 2))
                 (* (first acc) (second acc))
                 (if (eq (first list) (second list))
                     (f (cddr list) (1+ num) (cons (car list) acc))
                     (f (cdr list) num acc)))))
    (format t "~A~%" (f Ai 0 '(0 0)))))

Measured memory_bytes: 59880
#include<iostream>
#include<cstdio>
using namespace std;
int f[100005*2],r[100005*2];
int a[100005*2];
bool ok[100005*2];
int maxm;
int main(){
	int n;
	scanf("%d",&n);
	for (int i = 0;i < n;++i){
		f[i+1]=1;
		scanf("%d",&a[i]);
	}
	for (int i = 0;i < n;++i){
		ok[a[i]]=1;
		if (ok[a[i]-1]) {
			f[a[i]]=f[a[i]-1]+1;
		}
		maxm = max(maxm,f[a[i]]);
	}
	printf("%d\n",n-maxm);
	return 0;
}

Measured memory_bytes: 2048