akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll choose(int n, int a){
  ll res = 1;
  vector<int>num;
  for(int i=2; i<=a; ++i){
    num.push_back(i);
  }
  for(int i = 0; i < a; ++i){
    res *= n-i;
    rep(j,num.size()){
      if(num[j] == -1)continue;
      if(res % num[j] == 0){
        res /= num[j];
        num[j] = -1;
      }
    }
  }
  return res;
}

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  vector<ll>v(n);
  map<ll,int>mp;
  rep(i,n){
    cin>>v[i];
    mp[v[i]]++;
  }
  sort(v.rbegin(),v.rend());

  double num=0;
  rep(i,a){
    num+=v[i]/(1.0*a);
  }

  bool go=false;
  ll ans=0;

  for(int i=a; i<=b; ++i){
    ll res=1;

    if(i!=n){
      set<ll>judge;
      rep(j,i+1)judge.insert(v[j]);
      if(judge.size()>=2)go=true;
    }

    map<ll,int>mpcnt;
    rep(j,i)mpcnt[v[j]]++;
    for(auto p:mpcnt){
      res*=choose(mp[p.first],p.second);
    }
    ans+=res;
    
    if(go)break;
  }
  printf("%.10f\n%lld\n",num,ans);
}

Measured memory_bytes: 3800
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

char a[100][100];
char b[100][100];
int n,m;

bool f(int h,int w)
{
	REP(i,m)
	{
		REP(j,m)
		{
			if(b[i][j] != a[i+h][j+w])return false;
		}
	}
	return true;
}

int main()
{
	cin >> n >> m;
	REP(i,n)
	{
		cin >> a[i];
	}
	REP(i,m)
	{
		cin >> b[i];
	}
	
	REP(i,n)
	{
		REP(j,n)
		{
			if(f(i,j))
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	
	cout << "No" << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
const int MAX = 500050;
typedef pair<int, int>P;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long power_mod(long long x, long long n, long long m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return power_mod(x * x % m, n / 2, m);
	else
		return x * power_mod(x, n - 1, m) % m;
}
//n人からk人組をx個
ll func(int n, int k, int x) {
	return COM(n, k * x)* fac[k * x] % MOD* power_mod(finv[k], x, MOD) % MOD*finv[x]%MOD;
}

int dp[1010][1010];
signed main() {
	int N, A, B, C, D; 
	cin >> N >> A >> B >> C >> D;
	REP(i, 1010) {
		dp[i][0] = 1;
	}
	COMinit();
	for(int k = 1; k <= N; k++) {
		REP(n, N + 1) {
			ll res = 0;
			if (A <= k && k <= B) {
				res += func(n, k, 0) * dp[k - 1][n];
				FOR(x, C, D + 1) {
					if (n-k*x<0)break;
					res += func(n, k, x) * dp[k - 1][n - k * x]%MOD;
					res %= MOD;
				}
			}
			else {
				res += func(n, k, 0) * dp[k - 1][n];
			}
			dp[k][n] = res;
		}
	}
	/*REP(i, N + 1) {
		REP(j, N + 1) {
			pe(i)pe(j); print(dp[i][j]);
		}
	}*/
	print(dp[N][N]);
	/*while (true) {
		int n, k, x; cin >> n >> k >> x;
		print(func(n, k, x));
	}*/
}

Measured memory_bytes: 19968
s=input()
x,y=map(int,input().split())
*l,=map(len,s.split("T"))
n=len(l)

def f(pos,start):
  dp={0}
  for i in range(start,n,2):
    tmp=set()
    for j in dp:
      if i==0:
        tmp.add(j+l[i])
      else:
        tmp.add(j+l[i])
        tmp.add(j-l[i])
    dp=tmp
  return pos in dp

if f(x,0) and f(y,1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3564
// 0240
#include <iostream>
#include <math.h>
#define  M  10000
using namespace std;

double s_int(double y, double r){
	return M*(1+y*r/100);
}

double c_int(double y, double r){
	return M*pow(1+r/100, y);
}

int main(){
	while(1){
		int n, max_num = 0;
		double y, max_m = M;

		cin>>n;
		if(n == 0)
			break;

		cin>>y;
		for(int i=0;i<n;i++){
			int b, r, t, money;
			cin>>b>>r>>t;

			if(t == 1)
				money = s_int(y, r);
			else if(t == 2)
				money = c_int(y, r);

			if(money > max_m){
				max_m = money;
				max_num = b;
			}
		}

		cout<<max_num<<endl;
	}
	return 0;
}

Measured memory_bytes: 1320
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
int main(){

 //   freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();
        
    int n, m; cin >> n >> m;
    multiset <ll > elementsl;
    forn(i, n) {
        int x; cin >> x;
        elementsl.insert(x);
    }

    while(m --){
        auto ptr = elementsl.end();
        ptr --;
        int k = *ptr;
        elementsl.erase(ptr);
        elementsl.insert(k/2);

        // for(int x: elementsl) cout << x<<" "; cout << endl;
    }
    ll ans  = 0;
    for(int x : elementsl) ans += x;

    cout << ans << endl;

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


Measured memory_bytes: 4992
import math
A, B, H, M = map(int, input().split())

tyousin = M*6
tansin = H*30 + M*0.5

kakudosa = abs(tyousin - tansin)
if kakudosa >= 180:
    kakudosa = 360 - kakudosa

result_root = A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudosa))

print(math.sqrt(result_root))

Measured memory_bytes: 62412
A,B,H,M=map(int,input().split())

import math


thA=2*math.pi*((H/12)+(M/(12*60)))
#print(thA)
thB=2*math.pi*M/60

listB=[B*math.sin(thB),B*math.cos(thB)]
listA=[A*math.sin(thA),A*math.cos(thA)]

#print(listA)
#print(listB)

print(((listB[0]-listA[0])**2+(listB[1]-listA[1])**2)**0.5)

Measured memory_bytes: 9588
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
  ll X,Y;
  cin>>X>>Y;
  ll ans=1;
  while(true){
    if(X*2>Y){
      break;
    }
    X*=2;
    ans++;
  }
  cout<<ans<<endl;
}

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

int main() {
    int t = 1;
    while(t--)
    {
    	int n;
    	cin >> n;
    	int h[n];
    	for(int &val : h) 
    	    cin >> val;
    	int dp[n] = {0};
    	for(int i = 1; i < n; i++)
    	{
    	    int op1, op2;
    	    op1 = op2 = 1e9;
    	    if(i-2 >= 0)
    	        op1 = dp[i-2] + abs(h[i]-h[i-2]);
    	    if(i-1 >= 0)
    	        op2 = dp[i-1] + abs(h[i]-h[i-1]);
    	    dp[i] = min(op1, op2);
    	}
    	cout << dp[n-1];
    }
	return 0;
}

Measured memory_bytes: 4392
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
cin>>str;
if(str=="ABC")
{
    cout<<"ARC"<<endl;
}
else
{
    cout<<"ABC"<<endl;
}
    return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007


int main()
{
	long long int n;
	cin >> n;
	long long int ans = n - 1;
	for(long long int i = 2; i * i <= n; i++){
		if(n % i > 0) continue;
		ans = min(ans, i + (n / i) - 2);
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>  //for bool
#include <stdlib.h> // abs,labs,llabs
#include <limits.h>
#include <ctype.h>

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld; //%Lf

int main(void) {
  int n, i = 0, ans = 0, max = 0;
  scanf("%d", &n);
  int h[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &h[i]);
  }
  for (i = 0; i < n - 1; i++) {
    if(h[i] >= h[i + 1]) {
      ans++;
      if(ans > max) {
        max = ans;
      }
    } else {
      ans = 0;
    }
  }
  printf("%d\n", max);
  return 0;
}



Measured memory_bytes: 512
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

ll powll(ll base,ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (base*ans)%mod;
        base = (base*base)%mod;
        power >>= 1;
    }
    return ans;
}

int n,a,b,ret;
vvi children;
bool visited[200010];

int f(int x){
    visited[x] = true;
    if (sz(children[x]) == 1) return 1;
    vi nodes;
    for(auto v: children[x]){
        if (visited[v]) continue;
        nodes.pb(f(v));
    }
    int subtree = accumulate(all(nodes), 0LL) + 1;
    if (n-subtree) nodes.pb(n-subtree);

    // ^ -x = ^ mod-1-x
    int zerotree = powll(2,mod-n);
    int onetree = 0;
    for(auto nd: nodes){
        int lit = 1 - powll(2, mod-1-nd) + mod;
        int dim = powll(2, mod-(n-nd));
        onetree = (onetree + lit * dim) % mod;
    }
    ret = (ret + (1 - zerotree - onetree + 2 * mod) * powll(2,mod-2)) % mod;

    return subtree;
}

signed main(){
    I(n);
    if (n == 2){
        cout << 0 << endl;
        return 0;
    }
    children.resize(n);
    REP(i,n-1){
        I(a); I(b);
        a--; b--;
        children[a].pb(b);
        children[b].pb(a);
    }
    int st = 0;
    while(sz(children[st]) == 1) st++;
    cerr << st << endl;
    f(st);
    cout << ret << endl;
}

Measured memory_bytes: 29696
n = int(input())
a, b, c, d = 0, 0, 0, 0
for i in range(n):
  s = input()
  if s == 'AC':
    a+=1
  elif s== 'WA':
    b+=1
  elif s=='TLE':
    c+=1
  else:
    d+=1
print("AC x {}".format(a))
print("WA x {}".format(b))
print("TLE x {}".format(c))
print("RE x {}".format(d))



Measured memory_bytes: 9196
#include <iostream>
using namespace std;
char map[101][101];

int h,w;
void dfs(int y,int x,char str){
	int nx,ny;
	map[y][x] = 'x';
	int dx[] = {0,-1,1,0},dy[] = {-1,0,0,1};
	for(int i=0;i<4;i++){
		ny = y + dy[i];
		nx = x + dx[i];
		if(nx > -1 && nx < w && ny > -1 && ny < h && map[ny][nx] == str) dfs(ny,nx,str);
	}
	return ;
}
void scan(){
	char str[3] = {'#','*','@'};
	int count = 0;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int k=0;k<3;k++){
				if(map[i][j] == str[k]){
					dfs(i,j,str[k]);
					count++;
				}
			}
		}
	}
	cout << count << endl;
	return ;
}
int main(){

	while(cin >> h >> w &&(h!=0&&w!=0)){
		for(int i=0;i<h;i++){
			cin >> map[i];
		}
		scan();
	}
	return 0;
}

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

const int N = 123456;

int n;
ll a[N];

int main() {
    ll single = 0;
    ll sm = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        single += i + 1;
        scanf("%lld", &a[i]);
        sm += a[i];
    }

    if (n == 1) {
        puts("YES");
        return 0;
    }

    if (sm % single != 0) {
        puts("NO");
        return 0;
    }

    ll cnt = sm / single;
    ll tot = 0;

    for (int i = 0; i < n; i++) {
        ll d = a[(i + 1) % n] - a[i];
        if ((cnt - d) % n != 0 || (cnt - d) / n > cnt || (cnt - d) / n < 0) {
            puts("NO");
            return 0;
        }
        tot += (cnt - d) / n;
    }

    puts("YES");
}


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

typedef long long ll;
typedef long double ld;

int MOD=1000000007;


int main(){
    ll X,ans=0;
    ll da=100;
    cin >> X;
    while(da<X){
        da*=1.01;
        ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N;
    cin >> N;
    vector<ll> P(N), pos(N);
    Rep (i, N) {
        cin >> P[i];
        P[i]--;
        pos[P[i]] = i;
    }

    ll sub = 1, ans = 0;
    Rep (i, N-1) {
        if (pos[i] < pos[i+1]) {
            sub++;
        } else {
            ans = max(ans, sub);
            sub = 1;
        }
    }

    ans = max(ans, sub);
    cout << N - ans << endl;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    long long a, b;
    cin >> a >> b;
    string ans;
    if((a<=0)&&(0<=b)) ans="Zero";
    else if(0<a) ans="Positive";
    else{
        if((b-a)%2==0) ans="Negative";
        else ans="Positive";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
if n % 4 == 0: print('Yes')
elif n >= 7 and n % 4 == 3: print('Yes')
elif n >= 14 and n % 4 == 2: print('Yes')
elif n >= 21 and n % 4 == 1: print('Yes')
else: print('No')

Measured memory_bytes: 2940
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
def unite(x,y):
	if same(x,y)==False:
		rx=root(x);ry=root(y)
		if rank[rx]>rank[ry]:
			parent[ry]=rx
			size[rx]+=size[ry]
		else:
			parent[rx]=ry
			size[ry]+=size[rx]
			if rank[rx]==rank[ry]:
				rank[ry]+=1
def root(x):
	if x!=parent[x]:
		return root(parent[x])
	return x
def same(x,y):
	return root(x)==root(y)
parent=list(range(n))
rank=[0]*n
size=[1]*n
for i in range(m):
	a,b=map(int,input().split())
	unite(a-1,b-1)
kind=set()
for i in range(n):
	r=parent[root(i)]
	kind.add(r)
print(len(kind)-1)

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

using namespace std;

main(){
	vector<int> arr;
	int size; scanf("%d",&size);
	int num;
	long long sumA=0, sumB=0;
	for(int i=0;i<size;++i){
		scanf("%d",&num);
		arr.push_back(num);
		sumA += num;
	}
	sumA -= arr[0];
	sumB += arr[0];
	long long less = abs(sumB-sumA);
	for(int i=1;i<size-1;++i){
		sumA -= arr[i];
		sumB += arr[i];
		long diff = abs(sumB-sumA);
		if(diff<less) less = diff;
	}
	cout << less;
}

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

int main(){
  
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "No";
  if(a + b >= c) ans = "Yes";
  cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    map<int,int>mp;
    mp[1]=1;
    mp[3]=1;
    mp[5]=1;
    mp[7]=1;
    mp[8]=1;
    mp[10]=1;
    mp[12]=1;
    mp[4]=2;
    mp[6]=2;
    mp[9]=2;
    mp[11]=2;
    mp[2]=3;
   int a,b;
   cin>>a>>b;
   if(mp[a]==mp[b])
    cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}


int N;
string S;


ll solve(vi &A, vi &B, vi &C){
    
    ll ans = 0;
    rep(i,int(A.size())){
        int a = A[i];
        
        auto itr = lower_bound(all(B),a);
        if(itr == B.end()) break;
        
        int aa = itr - B.begin();
        
        reps(j,aa,int(B.size())){
            
            auto itr1 = lower_bound(all(C),B[j]);
            ans += C.end() - itr1;
            
            int b = upper_bound(all(C),B[j]+B[j]-a) - lower_bound(all(C),B[j]+B[j]-a);
            
            ans -= (ll)b;
        }
        
    }
    
    return ans;
    
}


int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    
    cin >> N;
    cin >> S;
    
    vi R,G,B;
    rep(i,N){
        if(S[i] == 'R') R.pb(i);
        else if(S[i] == 'G') G.pb(i);
        else B.pb(i);
    }
    
    ll ans = 0;
    
    ans += solve(R,G,B);
    ans += solve(R,B,G);
    ans += solve(G,B,R);
    ans += solve(G,R,B);
    ans += solve(B,G,R);
    ans += solve(B,R,G);
    
    
    cout << ans << endl;
    
    
    

    return 0;
}


Measured memory_bytes: 3660
from itertools import accumulate
S = input()
dic =  {"g":0, "p":1}
# 最適なのはgpgpgpgpと出し続ける
# me g-g 0
# me g-p -1
# me p-g 1
# me p-p 0
# 相手がpのとき、pを出すほうが良い、相手がgのとき、pを出すほうが良い
# 従って、pが余っている状態のときは常に出し続けるのが良い
As = [dic[s] for s in S]
cnt = 0
for i,s in enumerate(S):
    a = i % 2
    b = dic[s]
    cnt += (a-b)
print(cnt)

Measured memory_bytes: 9796
object Main extends App {
  val sc = new java.util.Scanner (Console.in)

  def print(s: String, a: Int, b: Int): Unit =
    println(s.substring(a, b+1))
  def reverse(s: String, a: Int, b: Int): String =
    s.take(a) + s.substring(a, b+1).reverse + s.drop(b+1)
  def replace(s: String, a: Int, b: Int, p: String): String =
    s.take(a) + p + s.drop(b+1)

  def next() = sc.next
  def nextInt() = sc.next.toInt

  var str = next
  var n = nextInt

  while (n > 0) {
    val cmd = next
    if (cmd == "print")
      print(str, nextInt, nextInt)
    else if (cmd == "reverse")
      str = reverse(str, nextInt, nextInt)
    else
      str = replace(str, nextInt, nextInt, next)

    n -= 1
  }
}



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

using namespace std;

int main()
{
    long long x, k, d;

    cin >> x >> k >> d;

    long long tp = abs(x) / d;

    if (tp > k)
    {
        cout << abs(x) - k * d;

        return 0;
    }

    k -= tp;

    if (k == 0) cout << abs(x) - tp * d;

    else if (k & 1 == 1) cout << abs(abs(x) - tp * d - d);

    else cout << abs(x) - tp * d;
}

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

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

	vector<long long> a(n);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);

	long long ans = 0;
	long long curr = 1;
	for (int i = 0; i < n; i++) {
		if (a[i] <= curr) {
			curr = max(curr, a[i] + 1);
		} else {
			long long use = (a[i] - curr - 1) / curr;
			a[i] -= use * curr;
			ans += use;
			if (a[i] >= curr + 1) a[i] -= curr, ans++;
			curr = max(curr, 2LL);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm> 
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include  <ctime>
#include <iomanip>
using namespace std;

#define ll                    long long int
#define ull                   unsigned long long int
#define loop(i,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar
#define gc                    getchar
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define mp                    make_pair
#define itoc(c)               ((char)(((int)'0')+c))
#define all(p)                p.begin(),p.end()
#define max(x,y)              ((x>y)?x:y)
#define min(x,y)              ((x<y)?x:y)
#define mid(s,e)              (s+(e-s)/2)
#define vi                    vector<int>
#define vvi                   vector<vector<int>>
const ll MOD = 998244353;

ll modpow(ll a, ll b, ll mod) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a; res%=mod; a = a * a; a%=mod; }return res; }
//ll p(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1)res = res * a;a = a * a; }return res; }

struct dsu {
    vector<ll> p,sum,minn,maxx,r;
    dsu(int n) {
        loop(i,0,n+1) {
            p.pb(i); sum.pb(i); minn.pb(i); maxx.pb(i); r.pb(0);
        }
    }
    int get(int a) {
        return (p[a] = (p[a]==a)?a:get(p[a]));
    }
    void uni(int a, int b) {
        a = get(a); b = get(b);
        if(a==b) return;
        if(r[a]==r[b]) r[a]++;
        if(r[a] < r[b]) swap(a,b);
        p[b] = a;
        sum[a] += sum[b];
        minn[a] = min(minn[a], minn[b]);
        maxx[a] = max(maxx[a],maxx[b]);
    }
};


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /* code */
    int n; cin >> n;
    vector<int> a(n), b(n);
    loop(i,0,n) cin >> a[i]>>b[i];
    int flag = 0;
    loop(i,0,n) {
        if(i+2==n) break;
        if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2]) { flag = 1; break; }
    }
    if(flag) cout << "Yes\n";
    else cout << "No\n";
    /* end code */
}

Measured memory_bytes: 3652
x,y = list(map(int,input().split()))
MIN = float('inf')
for i in [1,-1]:
    for j in [1,-1]:
        ans = 0
        tmpx = x
        if i == -1:
            tmpx = i*tmpx
            ans += 1
        tmpx += abs(abs(x)-abs(y))
        ans += abs(abs(x)-abs(y))
        if j == -1:
            tmpx = j*tmpx
            ans += 1
        if tmpx == y:
            MIN = min(MIN,ans)
print(MIN)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int i;
	char str[3];
	int n = 0;
	
	scanf("%s", str);
	
	for (i = 0; i < 3; i++){
		if (str[i] == 'o'){
			n++;
		}
	}
	
	printf("%d\n", n * 100 + 700);
	
	return (0);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double N = sc.nextInt();
		 double ct = 0; 
		for(int a = 1;a<=N;a++) {
			if(a%2==1) {
				ct++;
			}
		}
		System.out.println(ct/N);
	}
}


Measured memory_bytes: 25044
use std::cmp::max;

// vacation.rs --- Vacation
// author: Seong Yong-ju <sei40kr@gmail.com>

// tanakah's input macro
// cf https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: usize,
        hs: [[i32; 3]; n],
    }

    let mut dp = vec![[None; 3]; n + 1];
    dp[0] = [Some(hs[0][0]), Some(hs[0][1]), Some(hs[0][2])];

    for i in 1..n {
        for j in 0..3 {
            match dp[i - 1][j] {
                None => continue,
                Some(h) => {
                    for k in (0..3).filter(|&k| k != j) {
                        dp[i][k] = Some(max(dp[i][k].unwrap_or(0), h + hs[i][k]));
                    }
                }
            }
        }
    }

    let ans = dp[n - 1].into_iter().max().unwrap().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 14588
public class
Main
{
  public void
  run (
    final java.util.Scanner sc,
    final java.io.PrintStream out
    )
  {
    Pair[ ] heap;
    int[ ]  paeh;
    int n, q;
    int i;
    
    n = sc.nextInt ( );
    q = sc.nextInt ( );

    heap = new Pair[ n ];
    paeh = new int[ n + 1 ];
    for ( i = 1; i <= n; ++i )
    {
      paeh[ i ] = i - 1;
      heap[ paeh[ i ] ] = new Pair ( i, 0 );
    }

    for ( ; q > 0; --q )
    {
      int a, v, b;

      a = sc.nextInt ( );
      v = sc.nextInt ( );
      b = heap[ heap.length - 1 ].index;

      swap ( heap, paeh[ a ], paeh[ b ] );
      swap ( paeh, a, heap[ paeh[ a ] ].index );
      for ( ; ; )
      {
        if ( paeh[ b ] * 2 + 2 < heap.length - 1
          && heap[ paeh[ b ] * 2 + 2 ].compareTo ( heap[ paeh[ b ] * 2 + 1 ] ) < 0
          && heap[ paeh[ b ] * 2 + 2 ].compareTo ( heap[ paeh[ b ] ] ) < 0 )
        {
          swap ( heap, paeh[ b ], paeh[ b ] * 2 + 2 );
          swap ( paeh, b, heap[ paeh[ b ] ].index );
        }
        else if ( paeh[ b ] * 2 + 1 < heap.length - 1
               && heap[ paeh[ b ] * 2 + 1 ].compareTo ( heap[ paeh[ b ] ] ) < 0 )
        {
          swap ( heap, paeh[ b ], paeh[ b ] * 2 + 1 );
          swap ( paeh, b, heap[ paeh[ b ] ].index );
        }
        else break ;
      }
      heap[ paeh[ a ] ].value += v;
      for ( ; ; )
      {
        if ( paeh[ a ] > 0
          && heap[ paeh[ a ] ].compareTo ( heap[ ( paeh[ a ] - 1 ) / 2 ] ) < 0 )
        {
          swap ( heap, paeh[ a ], ( paeh[ a ] - 1 ) / 2 );
          swap ( paeh, a, heap[ paeh[ a ] ].index );
        }
        else break ;
      }
      System.out.println ( heap[ 0 ].index + " " + heap[ 0 ].value );
    }
  }

  private static void
  swap (
    int[ ] a,
    int i,
    int j
    )
  {
    final int t = a[ i ];
    a[ i ] = a[ j ];
    a[ j ] = t;
  }

  private static <T> void
  swap (
    T[ ] a,
    int i,
    int j
    )
  {
    final T t = a[ i ];
    a[ i ] = a[ j ];
    a[ j ] = t;
  }

  public static void
  main (
    final String[ ] args
    )
  {
    ( new Main ( ) ).run ( new java.util.Scanner ( System.in ), System.out );
  }

  private class
  Pair
  implements Comparable<Pair>
  {
    public final int index;
    public       int value;

    public
    Pair (
      final int index,
      final int value
      )
    {
      this.index = index;
      this.value = value;
    }

    public int
    compareTo (
      final Pair obj
      )
    {
      if ( this.value == obj.value )
        return ( this.index - obj.index );
      return ( obj.value - this.value );
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define ld double
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define len length()
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect

void solve() {
    int n;
    cin >> n;
    loop (i, 50001) {
        if (floor(i * 1.08) == n) {
            cout << i; return;
        }
    }
    cout << ":(";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)
#define INF 1000000000

int main(void){

    int d, g;
    cin >> d >> g;
    vector<int> p(d), c(d);
    loop(i, d) cin >> p[i] >> c[i];

    int ans = INF;

    loop(bit, 1 << d){
        int point = 0;
        int count = 0;
        loop(i, d){
            if(bit & (1 << i)){
                point += (i+1) * 100 * p[i] + c[i];
                count += p[i];
            }
        }
        if(point >= g){
            ans = min(ans, count);
            continue;
        }
        loop(i, d){
            if(bit & (1 << i)) continue;
            if((g - point)/((i+1)*100) <= p[i]){
                count += (g - point)/((i+1)*100);
                ans = min(ans, count);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int N,A[110];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A,A+N);
    reverse(A,A+N);
    int alice=0,bob=0;
    for(int i=0; i<N; i++){
        if(i%2 == 0){
            alice += A[i];
        }else{
            bob += A[i];
        }
    }
    cout << alice-bob << endl;
    return 0;
}


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

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

    vector<int> a(n);

    vector<int> count(M,0);

    for(int i=0; i<n; i++) {
        cin>>a[i];
        int v = a[i];
        count[v]++;
    }

    sort(count.begin(),count.end());

    int sum = 0;

    for(int i=M; i>=M-k; i--)sum+=count[i];

    int ans = (n - sum);

    cout<<ans<<endl;

    return 0;
    
}

Measured memory_bytes: 1792
// input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: usize,
        w: usize,
    }
    if s <= w {println!("unsafe"); }
    else {println!("safe"); }
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
	int X, Y;
	cin >> X >> Y;
	fx(X+1) {
		if (x*2+(X-x)*4==Y) {
			cey;
			return 0;
		}
	}
	cen;
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    mint ans = 0;
    int num = 0;
    REP(i,S.size()){
        if(S[i] == '1'){
            int len = (int)S.size() - 1 - i;
            ans += modpow(mint(2), num) * modpow(mint(3), len);
            num++;
        }
    }
    ans += modpow(mint(2), num);
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
 
  char str[3];
 
  int i;
  scanf("%c %c %c",&str[0],&str[1],&str[2]);
 
  if(atoi(str)%4 == 0){
    printf("YES");
  }else{
    printf("NO");
  }
 
  return 0;
 }

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

//最大公約数
ll gcd(ll a, ll b){
    if (a%b == 0) {
        return(b);
    } else {
        return(gcd(b, a%b));
    }
}
//最小公倍数
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

void solve() {
    ll n; cin >> n;
    Vl t(n);
    rep(i, 0, n) cin >> t[i];
    ll ans = t[0];
    rep(i, 1, n) ans = lcm(t[i], ans);
    cout << ans << endl;
    return;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

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

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0;i < n;i++){
        cin >> a[i];
    }
    int ans;
    
    cout << ((n-2)/(k-1)) + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
'use strict'
const lines = require('fs').readFileSync(0, 'utf8').split('\n')
const N = parseInt(lines[0], 10)
const map = lines[1].split(' ').map((v) => parseInt(v, 10))
const dp = []
dp[0] = 0
dp[1] = Math.abs(map[1] - map[0])
for (let i=2;i<N;i++) {
  const step1 = dp[i-1] + Math.abs(map[i] - map[i-1])
  const step2 = dp[i-2] + Math.abs(map[i] - map[i-2])
  dp[i] = Math.min(step1, step2)
}
console.log(dp[N-1])

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

int uni[100010];
void init(){
    for(int i = 0;i < 100010;i++){
        uni[i] = i;
    }
}

int root(int i){
    if(uni[i] == i) return i;
    return uni[i] = root(uni[i]);
}

void unite(int i, int j){
    i = root(i);
    j = root(j);
    if(i != j){
        uni[max(i, j)] = min(i, j);
    }
    return;
}

bool same(int i, int j){
    return root(i) == root(j);
}

#define P pair<long long, pair<int ,int> >

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

    pair<long long, int> x[100010], y[100010];

    for(int i = 0;i < n;i++){
        cin >> x[i].first >> y[i].first;
        x[i].second = y[i].second = i;
    }

    sort(x, x+n);
    sort(y, y+n);

    priority_queue<P, vector<P>, greater<P> > que;
    for(int i = 0;i < n-1;i++){
        que.push(make_pair(x[i+1].first-x[i].first, make_pair(x[i].second, x[i+1].second)));
        que.push(make_pair(y[i+1].first-y[i].first, make_pair(y[i].second, y[i+1].second)));
    }

    long long ans = 0;
    init();

    while(!que.empty()){
        int idx1 = que.top().second.first;
        int idx2 = que.top().second.second;
        long long cost = que.top().first;
        que.pop();
        if(!same(idx1, idx2)){
            unite(idx1, idx2);
            ans += cost;
        }
    }

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




Measured memory_bytes: 9584
x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()), reverse=True)
q = sorted(map(int, input().split()), reverse=True)
r = sorted(map(int, input().split()))
v = 0
c = sorted(p[0:x] + q[0:y])
for i in range(x + y):
    if len(r):
        if c[i] < r[-1]:
            c[i] = r.pop()
    else:
        break
print(sum(c))


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N,D;
    cin >> N >> D;
   
    int ans = 1;
    while(true)
    {
        if(N <= 2*D+1)
        {
            cout << ans << endl;
            return 0;
        }
        else
        {
            ans++;
            N -= 2*D+1;
        }
    }


}


Measured memory_bytes: 256
/*
--> WHEN IT'S OBVIOUS THAT THE GOAL CANNOT BE REACHED,
	DON'T ADJUST THE GOALS,
	ADJUST THE ACTION STEPS.

--> THE WAY YOU CONQUER SELF-DOUBT IS BY DOING THINGS THAT MAKE YOU UNCOMFORTABLE.

--> IT IS DURING OUR DARKEST MOMENTS WE MUST FOCUS TO SEE LIGHT.
*/

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <climits>
using namespace std;
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(all(x))
#define sz(x) (int)x.size()
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); IO();
typedef long long ll;
typedef pair< int, int >	pii;
typedef pair< ll, ll >		pl;
typedef vector< int >		vi;
typedef vector< ll >		vl;
typedef vector< pii >		vpii;
typedef vector< pl >		vpl;
typedef vector< vi >		vvi;
typedef vector< vl >		vvl;

const int MOD = 1e9 + 7;

ll power(ll a, ll b)
{
	ll ans = 1;

	while (b > 0)
	{
		if (b & 1)
			ans *= a;
		a = a * a;
		b >>= 1;
	}
	return ans;
}

ll powm(ll a, ll b)
{
	a %= MOD;
	ll ans = 1;

	while (b > 0)
	{
		if (b & 1)
			ans = (ans * a) % MOD;
		a = (a * a) % MOD;
		b >>= 1;
	}
	return ans;
}

void IO()
{
	#ifndef ONLINE_JUDGE
		freopen("Input.txt", "r", stdin);
		freopen("Output.txt", "w", stdout);
	#endif
}

//================================

int main()
{
	// FAST;

	ll n, k;
	cin >> n >> k;

	cout << min(n % k, abs(n % k - k)) << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
typedef long long ll;
using namespace std;
int a,b,c,d;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%.6f %d\n",0.5*a*b,c*2==a&&d*2==b);
	return 0;
} 

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

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        Integer[] x = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            x[i] = p[i];
        }

        Arrays.sort(x);
        int result = 0;
        for (int i = 0; i < n && result <= 2; i++) {
            if (p[i] != x[i]) {
                result++;
            }
        }

        System.out.println(result == 2 || result == 0 ? "YES" : "NO");
    }
}


Measured memory_bytes: 22740
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

signed main() {
	IOS;
	int a;	ld b;
	cin >> a >> b;
	a = round(b*a*100);
	a /= 100;
	cout << a;	
	return 0;
}

Measured memory_bytes: 3744