akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc071/tasks/arc081_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, A, h, w;
unordered_map<ll, ll> s;

int main()
{
  h = w = 0;

  cin >> N;
  REP(i, N)
  {
    cin >> A;
    if (s.count(A) == 0)
      s[A] = 1;
    else
      s[A]++;
  }

  for (auto &i : s)
  {
    ll k = i.first, v = i.second;
    if (w < k)
    {
      if (4 <= v)
      {
        w = k;
        h = max(h, k);
      }
      else if (2 <= v)
      {
        w = k;
        if (h < w)
          swap(h, w);
      }
    }
  }

  cout << h * w << '\n';

  return 0;
}


Measured memory_bytes: 4388
import copy
n = int(input())
a = list(map(int, input().split()))
b = copy.deepcopy(a)
b.sort()
loop = []
minp = min(a)
t = [0 for i in range(n)]
while True:
    i = t.index(0)
    j = len(loop)
    loop.append([a[i]])
    t[i] = 1
    while True:
        i = b.index(a[i])
        if t[i] == 1:
            break
        t[i] = 1
        loop[j].append(a[i])
    if sum(t) == n:
        break
    j += 1
cost = 0
for i in loop:
    if len(i) == 1:
        continue
    ps = sum(i)
    pl = len(i)
    pm = min(i)
    p1 = ps + (pl - 2) * pm
    p2 = ps + pm + (pl + 1) * minp
    cost += min(p1, p2)
print(cost)


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  scanf("%d", &A);
  scanf("%d", &B);
  if((A>B && B!=1) || (A==1 && B!=1)){
    printf("Alice");
  }else if((A<B && A!=1) || (B==1 && A!=1)){
    printf("Bob");
  }else if(A==B){
    printf("Draw");
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, A[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    vector<pair<int,int>> v;
    rep(i, 0, N) v.push_back({A[i], i + 1});
    sort(all(v));

    rep(i, 0, N) {
        if (i) printf(" ");
        printf("%d", v[i].second);
    }
    printf("\n");
}








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

int main() {
	int n;
	int flag = 0;

	cin >> n;

	for (int i = 9; i  > 0; i--) {
		if (n % i == 0) {
			if (n / i < 10) {
				flag = 1;
				break;
			}
		}
	}

	if (flag) {
		cout << "Yes";
	} else {
		cout << "No";
	}

	return 0;
}

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

int main() {
  int N, D;
  cin >> N >> D;
  vector<vector<int>> data(N, vector<int> (D));
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < D; j++) {
      cin >> data.at(i).at(j);
    }
  }
  int count = 0;
  for(int i = 0; i < N - 1; i++) {
    for(int j = i + 1; j < N; j++) {
      int sum = 0;
      for(int k = 0; k < D; k++) {
        sum += pow(data.at(i).at(k) - data.at(j).at(k), 2);
      }
      for(int k = 1; k * k <= sum; k++) {
        if(k * k == sum) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

const int mod = 1000000007;


int main() {
    int n, m;
    cin >> n >> m;
    int o = n + m;
    int p = o - 1;
    vector<P> edges(p);
    rep(i, p) cin >> edges[i].first >> edges[i].second;
    rep(i, p) edges[i].first--;
    rep(i, p) edges[i].second--;

    int root = -1;
    vector<int> parent_count(n, 0);
    rep(i, p) parent_count[edges[i].second]++;
    rep(i, n) if (parent_count[i] == 0) root = i;


    vector<vector<int>> tos(n);

    for (P q : edges) {
        tos[q.first].push_back(q.second);
    }

    vector<int> parents(n, -1);

    queue<int> q;
    q.push(root);
    while (!q.empty()) {
        int from = q.front();
        q.pop();
        for (int to : tos[from]) {
            parent_count[to]--;
            if (parent_count[to] == 0) {
                parents[to] = from;
                q.push(to);
            }
        }
    }

    for (int parent : parents) cout << parent + 1 << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
// template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

ll divisor(ll n) {
  ll r = 0;

  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      r++;

      if (i != (n / i)) {
        r++;
      }
    }
  }

  return r;
}

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

  ll N;
  cin >> N;

  ll c = 0;
  for (ll i = 1; i <= N; i += 2) {
    // cout << i << " " << divisor(i) << endl;
    if (divisor(i) == 8) {
      c++;
    }
  }

  cout << c << endl;

  return 0;
}


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

#define lli long long 
#define fr(i,n)     for(int i=0;i<n;i++)
#define fre(i,n)    for(int i=1;i<n;i++)
#define fstio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mx(a,b) (a>b)?a:b
#define mn(a,b) (a<b)?a:b
#define ptar(arr,i,n)   for(int i=0;i<n;i++){cout<<arr[i]<<" ";} cout<<endl;
#define itar(arr,i,n)  int arr[n]; for(int i=0;i<n;i++){cin>>arr[i];} 

int main(){
    fstio;
    double x;
    cin>>x;
    if(x>=0 && x<=1){
   if(x==0){
       cout<<1<<endl;
   }
   if(x==1){
       cout<<0<<endl;
   }
    }
}

Measured memory_bytes: 3804
#include <stdio.h>
#include <stdlib.h>

#define MAX_STONES      100000
#define min(a, b)       ( (a) < (b) ? (a) : (b) )
#define myABS(a)        ( (a) < 0 ? (-a) : (a) )

int
main(void)
{
    int dp[MAX_STONES + 1], heights[MAX_STONES + 1], n;

    scanf("%d", &n);
    
    if(n < 2 || n > MAX_STONES)
    {
        fprintf(stderr, "The number of stones is outside the bounds\n");
        return 1;
    }

    /* Read the stone heights */
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &heights[i]);
        if(heights[i] < 1 || heights[i] > 10000)
        {
            fprintf(stderr, "The stone height is outside the bounds\n");
            return 2;
        }
    }

    /* Build the table */
    dp[0] = 0;
    dp[1] = abs(heights[1] - heights[0]);
    for(int i = 2; i <= n; i++)
    {
        int one_skip_cost, two_skip_cost;
        one_skip_cost = abs(heights[i] - heights[i-1]) + dp[i-1];
        two_skip_cost = abs(heights[i] - heights[i-2]) + dp[i-2];
        dp[i] = one_skip_cost < two_skip_cost ? one_skip_cost : two_skip_cost;        
    }

    /*
    for(int i = 0; i < n; i++)
        printf("%d\t", dp[i]);
    putchar('\n');
    */
    printf("%d\n", dp[n-1]);

}


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

using namespace std;

const int maxn = 1e5 + 5;

int n;
set<string>s;
string str[maxn];

inline int read(){
	char ch = getchar(); int u = 0, f = 1;
	while(!isdigit(ch)){if(ch == '-')f = -1; ch = getchar();}
	while(isdigit(ch)){u = u * 10 + ch - 48; ch = getchar();} return u * f; 
}

int main(){
	n = read();
	for(register int i = 1; i <= n; i++){
		cin >> str[i];
		if(s.count(str[i])){cout << "No"; return 0;}
		if(str[i][0] != str[i - 1][str[i - 1].size() - 1] && i != 1){cout << "No"; return 0;}
		s.insert(str[i]);
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
typedef long long LL;
LL F(LL N, LL b)
{
	if(N < b) return N;
	else return N%b + F(N/b, b);
}
bool check(LL N, LL S, LL b)
{
	if(b <= 1) return 0;
	return F(N, b) == S;
}
LL solve(LL N, LL S)
{
	if(S == N) return N+1;
	LL i, b;
	for(i=2; i*i<=N; ++i)
		if(check(N, S, i))
			return i;
	for(; i>0; --i)
	{
		b = (N-S)/i + 1;
		if(check(N, S, b))
			return b;
	}
	return -1;
}
int main()
{
	LL N, S;
	scanf("%lld%lld", &N, &S);
	printf("%lld\n", solve(N, S));
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define vi vector<int>

using ll = long long;
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
inline ll inv(ll x, ll div){return pow(x, div - 2, div);}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  string s; cin >> s;
  if(s == "AAA" || s == "BBB")
   cout << "No" << endl;
  else
   cout << "Yes" << endl;
}


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

int main(){
string S;
long long ans,sum,a;
int n,i,j;
cin >> S;
n = S.size();
for(i=0;i<1<<(n-1);i++){
	sum = 0;
	a = S[0]-'0';
	for(j=0;j<n-1;j++){
		if(i&(1<<j)){
			sum += a;
			a = 0;
		}
		a = a*10+S[j+1] -'0';
	}
	sum += a;
	ans += sum;
}
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
import math
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
n = II()
x = 0
y = 0
z = 0
k = 0
for q in range(n):
	s = SI()
	if s == "AC":
		x+=1
	elif s == "WA":
		y+=1
	elif s == "TLE":
		z+=1
	else:
		k+=1
print("AC x "+str(x))
print("WA x "+str(y))
print("TLE x "+str(z))
print("RE x "+str(k))

Measured memory_bytes: 73732
N,L= map(int, input().split())
sum=0
A=[]
ans=-1
for x in range(0,N):
    A.append(-L-x)
for i in range(0,N):
    sum=sum+L+i
for i in range(0,N):
    for j in range(0,N):
        A[i]=A[i]+L+j
    if sum==A[i]:
        ans=i
        break
if ans>-1:
    print(A[ans])
elif A[0]<sum:
    print(A[0])
else:
    print(A[N-1])

Measured memory_bytes: 3064
K,N=map(int,input().split(' '))
A=sorted(list(map(int,input().split(' '))))
res = 0
for i in range(N-1):
    res = max(res,A[(i+1)%N]-A[i])
res = max(res,K-A[-1]+A[0])
print(K-res)

Measured memory_bytes: 26444
#include <iostream>

int main(){
	using namespace std;
 	long long h, w;
  	cin >> h >> w;
  	if(w == 1 || h == 1){
    	cout << 1 << endl;
    }
  	else if((w * h) % 2 == 0){
    	cout << h * w / 2 << endl;
    }
  	else{
       	cout << (h * w + 1) / 2 << endl;
    }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<class V,int NV> class SegTree_1 {
public:
	vector<V> val;
	static V const def=1<<25;
	V comp(V l,V r){ return min(l,r);};
	
	SegTree_1(){val=vector<V>(NV*2,def);};
	V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i<y
		if(r<=x || y<=l) return def;
		if(x<=l && r<=y) return val[k];
		return comp(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1));
	}
	void update(int entry, V v) {
		entry += NV;
		val[entry]=v;
		while(entry>1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]);
	}
};
SegTree_1<int,1<<20> seg;

int N,K;
int P[501010];
int R[501010];
int vis[505050];
int fix;
void go(int i) {
	while(1) {
		int a = seg.getval(0,P[i]);
		if(a>=i+K) break;
		go(a);
	}
	
	vis[i]=1;
	R[i] = ++fix;
	seg.update(P[i],1<<30);
}



void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N) {
		cin>>P[i];
		P[i]--;
		seg.update(P[i],i);
	}
	
	FOR(i,N) if(vis[i]==0) go(i);
	FOR(i,N) cout<<R[i]<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

#define reint register int
#define coint const int

using namespace std;

string xstr;

int main(void) {
    cin >> xstr;
    if (xstr[0] == xstr[1] || xstr[1] == xstr[2] || xstr[2] == xstr[3])
        puts("Bad");
    else puts("Good");
    return 0;
}



Measured memory_bytes: 256
N,K = map(int,input().split())
Pi = list(map(int,input().split()))

Sim = [0]
for i in range(0,N):
  Sim.append(Sim[i]+Pi[i])
MAX = max(Sim[i+K] - Sim[i] for i in range(N+1-K))

print((MAX+K)/2)




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

int main() {
  int n, k, a;
  cin >> n >> k;
  vector<int> tree(n);
  for (int i = 0; i < n; i++) {
    cin >> tree.at(i);
  }
  sort(tree.begin(), tree.end());
  reverse(tree.begin(), tree.end());
  
  for (int i =0; i < n - k + 1; i++) {
    if (i == 0) {
      a = tree.at(i) - tree.at(i + k - 1);
    }
    else if (a > tree.at(i) - tree.at(i + k - 1)) {
      a = tree.at(i) - tree.at(i + k - 1);
    }
  }
  cout << a << endl;
}



Measured memory_bytes: 640
N, K = map(int, input().split())
ans = 0
if K % 2 != 0:
    ans = (N // K) ** 3
else:
    tmp1 = K // 2
    tmp2 = (N // tmp1) - (N // K)
    ans = (N // K) ** 3 + tmp2 ** 3

print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
map<string,priority_queue<int,vector<int>,greater<int> > > Map;
signed main(void){
	ios::sync_with_stdio(false);
	string s;int page;
	while(cin>>s>>page)	Map[s].push(page);
	for(map<string,priority_queue<int,vector<int>,greater<int> > >::iterator it=Map.begin();it!=Map.end();++it,cout<<endl){
		cout<<it->first<<endl;
		for(int fst=1;!it->second.empty();it->second.pop(),fst=0){
			if(!fst)cout<<" ";
			cout<<it->second.top();
		}
	}
}

Measured memory_bytes: 1244
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    H, W = map(int, input().split())
    A = [list(map(int, input().split())) for _ in range(H)]
    answer = []
    for h in range(H):
        for w in range(W):
            if A[h][w] % 2 == 0:
                continue
            else:
                if h + 1 <= H - 1 and w + 1 <= W - 1:
                    if A[h + 1][w] % 2 == 1:
                        A[h + 1][w] += 1
                        answer.append([h + 1, w + 1, h + 2, w + 1])
                    else:
                        A[h][w + 1] += 1
                        answer.append([h + 1, w + 1, h + 1, w + 2])
                elif h + 1 <= H - 1:
                    A[h + 1][w] += 1
                    answer.append([h + 1, w + 1, h + 2, w + 1])
                elif w + 1 <= W - 1:
                    A[h][w + 1] += 1
                    answer.append([h + 1, w + 1, h + 1, w + 2])
                else:
                    continue
    N = len(answer)
    print(N)
    for i in range(N):
        print(*answer[i], sep=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 71388
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String[] info = new Scanner(System.in).nextLine().split(" ");
		Integer min=Integer.valueOf(info[0]);
		Integer max=Integer.valueOf(info[1]);
		int count=0;
		for(Integer i=min;i<=max;i++) {
			char[] numlist=i.toString().toCharArray();
			if(numlist[0]==numlist[4]&&numlist[1]==numlist[3])
				count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 30292
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
 
    public  static void main(String[] args)   throws Exception, IOException{
     
        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
     
        // int n=sc.nextInt();
        // long n=sc.nextLong();
        // char c[][] = new char[h][w];
        // long a[] = new long [n];
        // for (int i=0; i<n; i++ ) {a[i]=sc.nextInt();}
        // char c[] = sc.nextString().toCharArray();
        long x=sc.nextLong();
        long y=sc.nextLong(),ans=0;
        while(x*2<=y){ans++; x*=2;}
    
        out.println(ans+1);
        out.flush();
    }

    static void db(Object... os){
     
        System.err.println(Arrays.deepToString(os));
     
    }
     
    static boolean validpos(int x,int y,int r, int c){
        
        return x<r && 0<=x && y<c && 0<=y;
        
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}
 
class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 21204
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {
	
	int n, k, ans = 1;
	scanf("%d%d", &n, &k);
	rep(i, n) {
		ans = min(ans * 2, ans + k);
	}
	printf("%d\n", ans);
	
	return 0;
}


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

int main(){
    string s ;
    cin >> s ;
    int n ;
    cin >> n ;
    set<string> T ;
    int k = s.size() ;
    rep(i,k){
        rep(j,6){
            T.insert(s.substr(i,j));
        }
    }
    int count = 0 ;
    for(auto p : T ){
        if( n == count)cout << p << endl ;
        count++ ;
    } 
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=405;
namespace{
	const int mod=998244353;
	int fac[N],rev[N];
	int power(int x,int p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	int inv(int x){
		return power(x,mod-2);
	}
	void add(int &x,int y){
		x=(x+y>=mod?x+y-mod:x+y);
	}
	int mul(int x,int y){
		return (ll)x*y%mod;
	}
	void init(int n=400){
		fac[0]=1;
		rep(i,1,n)fac[i]=(ll)fac[i-1]*i%mod;
		rev[n]=power(fac[n],mod-2);
		per(i,n,1)rev[i-1]=(ll)rev[i]*i%mod;
	}
}
int f[N][N],g[N][N],a[N],b[N],pw[N];
int n,A,B,ans;

int main(){
	read(n),init();
	f[0][0]=mod-1;
	rep(i,1,n){
		read(a[i]),read(b[i]);
		pw[0]=1;
		rep(k,1,b[i]-1)
			pw[k]=mul(pw[k-1],a[i]);
		memcpy(g,f,sizeof g);
		rep(k,0,A)rep(x,0,B)
			if(f[k][x])
				rep(y,0,b[i]-1)
					add(g[k+a[i]][x+y],mod-mul(f[k][x],
									mul(rev[y],pw[y])));
		A+=a[i],B+=b[i]-1;
		rep(k,0,A)rep(x,0,B)
			f[k][x]=g[k][x];
	}
	rep(k,1,A)rep(x,0,B)
		if(f[k][x]){
			int c=mul(fac[x],power(inv(k),x));
			c=mul(c,mul(A,inv(k)));
			add(ans,mul(c,f[k][x]));
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1536
N = int(input())
p = []
for i in range(N):
    X1, Y1, H1 = map(int, input().split())
    if H1 != 0:
        p.append([X1, Y1, H1])

if len(p) == 1:
    print(p[0][0], p[0][1], p[0][2])
    exit()


for i in range(101):
    for j in range(101):
        h = -1
        fg = True
        for t in p:
            if h == -1:
                h = t[2] + abs(i - t[0]) + abs(j - t[1])

            else:
                ht = t[2] + abs(i - t[0]) + abs(j - t[1])
                if h == ht:
                    h = ht
                else:
                    fg = False
                    break
        if fg:
            print(i, j, h)
            exit()


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

using ll=long long int;
ll mod=998244353;
vector<ll> seg;
void update(ll v, ll tl, ll tr, ll l, ll r, ll add) {
    if (l > r)
        return;
    if (l == tl && r == tr) {
        (seg[v] += add)%=mod;
    } else {
        ll tm = (tl + tr) / 2;
        update(v*2, tl, tm, l, min(r, tm), add);
        update(v*2+1, tm+1, tr, max(l, tm+1), r, add);
    }
}
ll get(ll v,ll tl,ll tr,ll pos)
{
    if(tl==tr)
    return seg[v];
    ll mid=(tl+tr)/2;
    if(pos<=mid)
    return (seg[v]+get(2*v,tl,mid,pos))%mod;
    else
    {
        return (seg[v]+get(2*v+1,mid+1,tr,pos))%mod;
    }
    
}
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<pair<ll,ll> > a(k);
    for(ll i=0;i<k;i++)
    {
        cin>>a[i].first>>a[i].second;
    }
    sort(begin(a),end(a));
    seg.resize(5*n,0);
    vector<ll> dp(n+1,0);
    update(1,1,n,1,1,1);
    for(ll i=1;i<=n;i++)
    {
        ll value=get(1,1,n,i);
        for(ll j=0;j<k;j++)
       {
           if(i+a[j].first>n)
           continue;
            update(1,1,n,i+a[j].first,min(n,i+a[j].second),value);
        }
    }
    cout<<get(1,1,n,n);
        
}

Measured memory_bytes: 12756
/*
 * Author: Anmol Choudhary
 */
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
void solve()
{
    int n;
    cin>>n;
    vector<int>v[3];
    string s;
    cin>>s;
    rep0(i,n){
        if(s[i]=='R') v[0].pb(i);
        if(s[i]=='B') v[1].pb(i);
        if(s[i]=='G') v[2].pb(i);
    }
    int f1=v[0].si;
    int f2=v[1].si;
    int f3=v[2].si;
    int an=f1*f2*f3;
    rep0(i,n)rep0(j,n){
        int x=i;
        int y=x+1+j;
        int z=y+1+j;
        if(z>=n) break;
        if(s[x]!=s[y]&&s[x]!=s[z]&&s[y]!=s[z]) an--;
    }
    pr(an);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nx;
    }
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define prvp(a) for(auto x : a) cout << "{" << x.ff << ',' << x.ss << "}";cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const ll INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(int a, int b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(int a, int b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(int a, int b){return (int)((long long) a * b % mod);}
inline int modexpo(int a, int b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(int a, int b){ return mul(a, modexpo(b, mod - 2));}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

const int N = 1e5 + 4;
int a[N], dp[N];

void solve(){
  int n, i, j, k;
  cin >> n;
  for(i = 1; i <= n; i++){
    cin >> a[i];
  }
  dp[1] = 0;
  for(i = 2; i <= n; i++){
    if(i > 2){
      dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    }else{
      dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
    }
  }
  cout << dp[n] << '\n';
}

int main(){
  fastio

  pre();

  int t = 1;
  // cin >> t;
  while(t--){
    solve();
  }

  ktj();
}


Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> tim(5);
    for(int i=0; i<5; i++) {
        cin >> tim[i];
    }

    int ans = 0;
    for(int i=0; i<5; i++) {
        ans = max(ans, (N + tim[i] - 1) / tim[i] + 4);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
struct UnionFind{
  vector<ll>par;
  vector<ll>size;
  UnionFind(ll n):par(n),size(n){
    for(ll i=0;i<n;i++){
      par[i]=i;
      size[i]=1;
    }
  }
  ll root(ll x){
    return par[x]==x?x:par[x]=root(par[x]);
  }
  bool same(ll x,ll y){
    return root(x)==root(y);
  }
  void unit(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(size[x]<size[y]){
      par[x]=y;
      size[y]+=size[x];
    }else{
      par[y]=x;
      size[x]+=size[y];
    }
  }
  ll treesize(ll x){
    return size[root(x)];
  }
};
int main(){
  ll n,m;
  cin>>n>>m;
  vector<pair<ll,ll>>edge(m);
  for(ll i=0;i<m;i++){
    ll a,b;
    cin>>a>>b;
    a--,b--;
    edge[i].first=a;
    edge[i].second=b;
  }
  reverse(edge.begin(),edge.end());

  ll all=n*(n-1)/2;
  //cout<<all<<endl;
  vector<ll>ans;
  ans.push_back(all);
  UnionFind uf(n);
  for(ll i=0;i<m;i++){
    ll x=edge[i].first;
    ll y=edge[i].second;
    if(!uf.same(x,y)){  
      ll size_x_tree=uf.treesize(x);
      ll size_y_tree=uf.treesize(y);
     // cout<<size_x_tree<<" "<<size_y_tree<<endl;
      all-=size_x_tree*size_y_tree;
      uf.unit(x,y);
    }
    ans.push_back(all);
    //cout<<all<<endl;
  }

  reverse(ans.begin(),ans.end());
  for(ll i=1;i<=m;i++){
    cout<<ans[i]<<endl;
  }
}

Measured memory_bytes: 7416
import java.math.BigDecimal;
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int L = sc.nextInt();
		
		double temp = Math.pow(L, 3) / 27;
		System.out.println(BigDecimal.valueOf(temp));
		sc.close();
		
	}
	
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>                          
using namespace std;
long long n,a[10005],ans;                                          
int main(){	
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		int j=2,x=0;
		while(a[i]!=1)
		{
			if(a[i]%j==0) a[i]/=j,x++;
			else break;
		}
		ans+=x;
	}
	cout<<ans;
	return 0;
}

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

struct st {int x, y, cnt;};
int H,W;
int vs[1000][1000];
queue<st> que;
int ans;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

int main()
{
  cin >> H >> W;
  rep(i,H) rep(j,W){
    char c;
    cin >> c;
    if (c == '#'){
      que.push({i,j,0});
      vs[i][j] = 1;
    }
  }

  while(!que.empty()){
    int x = que.front().x,y = que.front().y,cnt = que.front().cnt; que.pop();
    ans = max(ans,cnt);
    rep(i,4){
      int nx = x + dx[i],ny = y + dy[i];
      if (nx < 0 || ny < 0 || nx >= H || ny >= W || vs[nx][ny]) continue;
      que.push({nx,ny,cnt+1});
      vs[nx][ny] = 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 16272
n,m = map(int,input().split())
a = list(map(int,input().split()))

sum = 0
for i in range(len(a)):
    sum += a[i]

min_hyou = sum/(4*m)

count = 0
for i in range(len(a)):
    if min_hyou <= a[i]:
        count+=1
if count>=m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
char*s,T['   '],*r=T;U[1<<27];i;k;main(n){for(;gets(r+1);k=0)for(--n;*++r&=31;)U[r-T]=k|=!!n<<*r;for(;s-->T||!printf("��%d"+i++,n,s=r);k=U[k]=U[k+=*s+2<<21]?:*s?s-T:0)n+=__builtin_popcount(U[s-T]&(U[k+'   ']^=!s[-1]<<*s));}

Measured memory_bytes: 135032
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

// vector<vector<int>> to;
// vi seen;

// void dfs(int v) {
//     if (seen[v]) return;
//     seen[v] = true;
//     for (auto u : to[v]) {
//         dfs(u);
//     }
// }

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

//     int n, m;
//     cin >> n >> m;
//     to.resize(m+n);
//     rep(i, n) {
//         int id = m+i;
//         int k;
//         cin >> k;
//         rep(j, k) {
//             int l;
//             cin >> l;
//             l--;
//             to[id].pb(l);
//             to[l].pb(id);
//         }
//     }
//     seen.resize(m+n);
//     dfs(m);
//     for (int i = m; i < m+n; ++i) {
//         if (!seen[i]) { puts("NO"); return 0;}
//     }
//     puts("YES");
// }

struct unionfind {
    vector<int> d;
    unionfind(int n=0) : d(n,-1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

int main() {
    int n, m;
    cin >> n >> m;
    unionfind uf(m+n);
    rep(i, n) {
        int id = m+i;
        int k;
        cin >> k;
        rep(j, k) {
            int l;
            cin >> l;
            l--;
            uf.unite(id, l);
        }
    }
    rep(i, n) {
        int id = m+i;
        if (!uf.same(m, id)) {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
}


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

int main() {
    long long N, T;
    cin >> N >> T;

    long long ans = T, last = T, s = 0;
    for (int i = 0; i < N; i++) {
        long long t;
        cin >> t;

        if (t == 0) continue;

        if (t < last) ans += t - s;
        else ans += T;
        last = T + t;
        s = t;
    }

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

Measured memory_bytes: 256
package main

/*
#cgo CFLAGS: -Wno-unused-result
#include <stdio.h>
long long nextInt(){
	long long a;
	scanf("%lld", &a);
	return a;
}
*/
import "C"
import "fmt"

func nextInt() int{
	return int(C.nextInt())
}

func main(){
	//n := nextInt()
	var c string
	fmt.Scan(&c)
	if c=="a" || c=="e" || c=="i" || c=="o" || c=="u"{
		fmt.Println("vowel")
	}else{
		fmt.Println("consonant")
	}
}

Measured memory_bytes: 640
MOD = 10 ** 9 + 7

x, y = map(int, input().split())
n = int((2 * x - y) / 3)
m = int(x - 2 * n)

if (x + y) % 3 != 0:
    print(0)
    exit()

def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

if n >= 0 and m >= 0:
    print(nCr(n + m, n, MOD))
else:
    print(0)


Measured memory_bytes: 38512
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main(){
    ll ans = 0;
    int N; cin >> N;
    vector <ll> A(N);
    rep(i,0,N){
        cin >> A[i];
        while(A[i]%2 == 0){
            ans++;
            A[i] = A[i]/2;
        }
    }
    
    cout << ans;
}


Measured memory_bytes: 384
h,n = gets.split.map(&:to_i)  # スペースで区切られた複数の整数
ary = gets.split.map(&:to_i)  # スペースで区切られた複数の整数

#newary = ary.sort {|a, b| (-1) * (a <=> b) }  # 配列降順ソート
ary.sort! #配列昇順ソート

i = 0

#必殺技判定
if n >= h then
  puts i
  exit
else
  h = h - n #必殺技分だけ減算
end

ans = 0

while i < h do
  ans = ans + ary[i]
  i = i + 1
end

puts ans

Measured memory_bytes: 17648
#include "bits/stdc++.h"
using namespace std;
#define ll long long;
int main(){
	vector<int> M(2);
	vector<int> D(2);
	for(int x=0; x<2; x++){
		cin >> M[x];
		cin >> D[x];
	}
	if(M[1]!=M[0]){
		cout << "1";
	}else{
		cout << "0";
	}
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	long long int n,a;
	while(cin>>n>>a){
		long long int c;
		c=n%500;
		if(c<=a){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
set<int> S;
const int mod=998244353;
int dp[200005],l,r,n,k;
int sp[200005];
pair<int,int> v[200005];


int main()
{
    scanf("%d%d",&n,&k);

    for(int i=1;i<=k;i++) {
        scanf("%d%d", &v[i].first, &v[i].second);

    }

    sort(v+1,v+k+1);

    dp[1]=1;
    sp[1]=1;

    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            int x,y;
            x=i-v[j].first;
            y=i-v[j].second;
            if(x<=0) continue;
            y=max(1,y);
            int add=(sp[x]-sp[y-1]+mod)%mod;
            dp[i]=(dp[i]+add)%mod;
        }
        sp[i]=(sp[i-1]+dp[i])%mod;
    }

    printf("%d\n",dp[n]);

        return 0;

    }

Measured memory_bytes: 5384
def main():
  import sys
  input = sys.stdin.readline
  n, m = map(int, input().split())
  h = list(map(int, input().split()))
  ab = [list(map(int, input().split())) for _ in range(m)]
  L = [0] * n

  for i in range(m):
      A =ab[i][0]-1
      B =ab[i][1]-1
      if h[A] == h[B]:
          L[A] -= 1000
          L[B] -= 1000
      else:
          M = max(h[A],h[B])
          if M == h[A]:
              L[A] += 0.33
              L[B] -= 1000
          else: 
              L[B] += 0.33
              L[A] -= 1000
      
  L= list(filter(lambda x: x >= 0, L))
  print(len(L))
  
if __name__ == '__main__':
    main()


Measured memory_bytes: 34948
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
using namespace std;
 
#define int                 long long int
#define ld                  long double
#define pb                  push_back
#define F                   first
#define S                   second
#define si                  set <int>
#define vi                  vector <int>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vpp                 vector <pair<int, pii>>
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define mip                 map <int, pii>
#define spi                 set <pii>
#define speed               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl                "\n"
#define all(p)              p.begin(), p.end()
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(T)          priority_queue <T>
#define que_min(T)          priority_queue <T, vector<T>;, greater<T>>
#define debuga(a, l, r)     for(auto x:a)cout<<x<<" ";cout<<endl;
#define debug1(x)           cout << #x " = " << x << endl;
#define debug2(x,y)         cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x,y,z)       cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x,y,z,w)     cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x,y,z,w,v)   cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define debug6(x,y,z,w,v,a) debug3(a, y, x)debug3(w, v, a)
#define p2d(v)             for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)              for(auto a:v)cout<<a<<" ";cout<<endl;


int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005
#define PI 3.14159265359

void aps554(int n=20){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    // #ifndef ONLINE_JUDGE
    //      freopen("input.txt",  "r",  stdin);
    //      freopen("output.txt", "w", stdout);
    // #endif
}
int32_t main(){
    ld a,b,x;
    aps554();
    cin>>a>>b>>x;
    if(x>a*a*b){cout<<0;return 0;}
    ld ans=(atan((b*b*a)/(2*x))*(180.0/PI));
    if(x<((a*a*b)/2.0))cout<<ans;
    else cout<<(atan((2.0*(b*a*a-x))/(1.0*a*a*a))*(180/PI));
      
} 

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

int main(){


    int A,B; cin >> A >>B;
    int ans=0;
    
    if(A <= B){
        ans += B;
        B--;
    }else{
        ans += A;
        A--;
    }
    
    if(A <= B){
        ans += B;
        B--;
    }else{
        ans += A;
        A--;
    }

    cout << ans << endl;
}



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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)



void solve() 
{
    string s;
    cin>>s;
    int count = 0;
    int maxcount = 0;
    for(int i=0; i<3; i++)
    {
        if(s[i] == 'R')
        {
            count++;
            maxcount = max(count,maxcount);
        }
        else 
        {
            count=0;
        }
    }
    cout<<maxcount;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int tc=1; 
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}


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


int main() {
  int N;cin>>N;
  string S;cin>>S;
  int cnt=1;
  char z=S[0];
  for(int i=1;i<S.size();i++){
    if(z!=S[i])cnt++;
    z=S[i];
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    map<string, vector<pair<int, int> > > mp;
    for(int i = 0; i < n; i++){
        string s;
        int p;
        cin >> s >> p;
        mp[s].push_back(make_pair(p, i+1));
    }
    for(auto i: mp){
        sort(i.second.begin(), i.second.end());
        reverse(i.second.begin(), i.second.end());
        for(auto p : i.second){
            cout << p.second << endl;
        }
    }
}

Measured memory_bytes: 256