akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};


int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    int cond = 0;
    for(int i = 0; i < s1.size(); i++){
        int cond1 = 1;
        for(int j = 0; j < s2.size(); j++){
            int ind = i+j;
            if(ind >= s1.size()) ind -= s1.size();
            if(s1[ind] != s2[j]){
                cond1 = 0;
                break;
            }
        }
        cond = cond1;
        if(cond) break;
    }
    if(cond) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
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 (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}


int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}


int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}


int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  int n,m;
  cin>>n>>m;
  vector<int> h;
  map<int,int> map;
  vector<pair<int,int> > l;
  rep(i,n){
    int j;
    cin>>j;
    h.pb(j);
  }
  rep(i,n){
    map[i]=0;
  }
  rep(i,m){
    int a,b;
    pair<int,int> t;
    cin>>a>>b;
    lint h1,h2;
    h1=h[a-1];
    h2=h[b-1];
    if(h1>h2){
      map[b-1]=-1;
    }
    else if(h1<h2){
      map[a-1]=-1;
    }
    else if(h1==h2){
      map[a-1]=-1;
      map[b-1]=-1;
    }
  }
  lint co=0;
  for(int i=0;i<map.size();i++){
    if(map[i]==0){
      co++;
    }
  }
  cout<<co;
}

Measured memory_bytes: 8228
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        for (int i = 1; i < 10; i++) {
            if (N % i == 0) {
                for (int j = 9; j > 0; j--) {
                    if (j * i == N) {
                        System.out.println("Yes");
                        return;
                    }
                }
            }
        }
        System.out.println("No");
    }
}

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

using namespace std;

int mylog2(unsigned long long int N){
  int cnt = 0;
  unsigned long long int tmp = 1;
  while(tmp <= N){
    cnt++;
    tmp *= 2;  
  }
  return cnt;
}

int main(){
  unsigned long long int X, Y;
  cin >> X >> Y;
  unsigned long long int tmp;
  tmp = Y / X;
  cout << mylog2(tmp);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

bool check(int x,int y,vector<string> a,vector<string> b ){
    for(auto i = 0; i<b.size();i++){
        for(auto j =0; j<b.size();j++){
            if(a[x+i][y+j]!= b[i][j]) return false;
        }
    }
    return true;
}

int dist(pii a, pii b){
    return abs(a.first-b.first) + abs(a.second-b.second);
}


int main() {
    int n,k;cin>>n>>k;
    int x[n+1];rep(i,n) cin>>x[i+1];
    
    int ans = 0;
    rep(i,n){
        ans += min(2*abs(x[i+1]-k),2*abs(x[i+1]));
    }
    cout<<ans << endl;
    
    return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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 (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K; 
  cin >> N >> K;

  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
    A[i]--;
  }

  vector<int> visited(N, -1);

  int now = 0;
  int cnt = 0;
  while(1){
    if(visited[now] != -1) break;
    visited[now] = cnt++;

    now = A[now];
  }

  int roop = cnt-visited[now];

  if(K <= visited[now]){
    REP(i, N) if(visited[i] == K){
      cout << i+1 << "\n";
      return 0;
    }
  }
  K -= visited[now];
  K %= roop;

  REP(i, N) if(visited[i] == K+visited[now]){
    cout << i+1 << "\n";
    return 0;
  }

  return 0;
}

Measured memory_bytes: 6368
#include<stdio.h>
#define INFTY 1000000000
#define N 500005


void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int count=0;

int main(){
  int n,i,right,left=0,A[N];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  right = n;

  mergeSort(A,left,right);

  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i < n - 1){
      printf(" ");
    }
    if(i == n -1){
      printf("\n");
    }
  }
  printf("%d\n",count);
  
  return 0;
}

void merge(int A[],int left, int mid, int right){
  int n1,n2,L[N],R[N],i,j,k;

  n1 = mid - left;
  n2 = right - mid;

  for(i=0;i<n1;i++){
    L[i] = A[left + i];
  }

  for(i=0;i<n2;i++){
    R[i] = A[mid + i];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;

  for(k=left;k<right;k++){
    count = count + 1;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }else{
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(int A[],int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}



Measured memory_bytes: 5600
N,M,X=map(int,input().split())

A=[]
for _ in range(N):
    A.append(list(map(int,input().split())))

ans=float("inf")
for i in range(2**N):
    ans_temp=0
    f=True
    check=[0]*M
    for j in range(N):
        if (i>>j)&1:
            ans_temp+=A[j][0]
            for k in range(M):
                check[k]+=A[j][k+1]
    for l in check:
        if l<X:
            f=False
    if f:
        ans=min(ans,ans_temp)

if ans==float("inf"):
    print("-1")
else:
    print(ans)


Measured memory_bytes: 9192
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N;
  cin >> N;
  
  vll a(N);
  bool f = false;
  rep(i, N) {
    cin >> a[i];
    if(a[i] % 2 != 0) {
      f = true;
    }
  }

  if(f) {
    fin("first");
    return 0;
  }
  fin("second");
  
}

Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
int main(){
  ll n;
  cin>>n;
  map<ll,ll> mp;
  ll ans=0;
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    ans+=a;
    mp[a]++;
  }
  int q;
  cin>>q;
  while(q--){
    ll b,c;
    cin>>b>>c;
    ans+=mp[b]*(c-b);
    mp[c]+=mp[b];
    mp[b]=0;
      cout<<ans<<"\n";
  }
}



Measured memory_bytes: 9536
import java.util.*;

public class Main { 
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in); 
		int cnt = sc.nextInt();	//count回数

		for (int i=1; i <= cnt; i++) {
			if (i % 3 == 0) {
				//3で割った余りが0なら出力
		        System.out.printf(" " + i);
			} else {
				//10で割った余りが3なら出力
				if (i % 10 == 3) {
					System.out.printf(" " + i);
				} else {
					//3が含まれるなら出力 30,31,32,33,34..!!
					String x = String.valueOf(i);
					if (x.contains("3")) {
						System.out.printf(" " + i);
					}
				}
			}
		}
		System.out.println("");
	}
}




Measured memory_bytes: 31208
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int n, k;
	cin >> n >> k;
	vector<int> vec(200010);
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		vec[a]++;
	}
	sort(vec.begin(), vec.end(), greater<int>());
	int Cnt = 0, Ans = 0;
	for (auto e : vec) {
		if (Cnt >= k) Ans += e;
		Cnt++;
	}
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 1792
ipt1 = [int(i) for i in input().split()]
a = [int(i) for i  in input().split()]
n = ipt1[0]
m = ipt1[1]
x = ipt1[2]
cost_0 = 0
cost_n = 0
for i in range(m):
    if a[i] < x:
        cost_0 += 1
    else:
        cost_n += 1

print(int(min(cost_0, cost_n)))


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

int main()
{
    int n, m;
    cin >>n >>m;
    if(n  <= m)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
N=int(input())
S=list(str(input()))

max_match=0
for i in range(1,N):
  match=0
  left=set(S[:i])
  right=set(S[i:])
  for j in left:
    if j in right:
      match+=1
  if match > max_match:
    max_match=match
print(max_match)


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

 int main()
{
   long long int n;
   cin>>n;
   long long int z=n/500;
   long long int k=n%500;
   long long int c=k/5;
   long long int ans=z*1000+c*5;
   cout<<ans<<endl;
   
   
   
   return 0;
}


Measured memory_bytes: 256
import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict, OrderedDict
#すべてのkeyが用意されてる defaultdict(int)で初期化
#順序を保ったdict
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
n=int(input())
s=input()
A=[int(i)-1 for i in s]

RUI2=[pow(2,i) for i in range(21)]
import bisect as bi
@lru_cache(maxsize=10**10)
def tan(n):
    if n==0:return [1]
    if n==1:return [1,1]
    if n==2:return [1,0,1]
    i= bi.bisect_right(RUI2,n)-1
    return tan(n-pow(2,i)) + [0]*(pow(2,i+1)-n-1) + tan(n-pow(2,i))


# for i in range(n-1):
#     if A[i]==A[i+1]: A[i]=0
#     elif (A[i]^A[i+1])&1 : A[i]=1
#     else:A[i]=2
# for i in range(n-2):
#     if (A[i]^A[i+1])&1 : A[i]=1
#     else:A[i]=0

# print(A[:-2],tan(n-3))
if A.count(1)!=0:
    A=[i%2!=1 for i in A]
    a=[i&j for i,j in zip(A,tan(n-1))]
    # print(a)
    print(1 if sum(a)%2==1 else 0)
else:
    a=[(i//2)&j for i,j in zip(A,tan(n-1))]
    #print(a,tan(4))
    print(2 if sum(a)%2==1 else 0)
    


Measured memory_bytes: 48784
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a < b {
		for i := 0; i < b; i++ {
			fmt.Print(a)
		}
	} else {
		for i := 0; i < a; i++ {
			fmt.Print(b)
		}
	}
	fmt.Println()
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			C();
		}

		public static void C()
		{
			Scanner cin = new Scanner();
			int n = cin.NextInt();
			string s = cin.Next();

			int count = 0;
			for (int i = 0; i < n; ++i) {
				if (s[i] == '#') {
					count += 1;
				}
			}

			int w = 0;
			int b = n - count;
			int min = w + b;
			for (int i = 0; i < n; ++i) {
				if (s[i] == '#') {
					++w;
				} else {
					--b;
				}

				if (w + b < min) {
					min = w + b;
				}
			}

			Console.WriteLine(min);
		}




	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}


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



int main() {
int a,b;
cin>>a>>b;
vector<string>v(a);
for(int i=0;i<a;i++){
cin>>v[i];
}
cout<<"#";
for(int i=0;i<b;i++)
cout<<"#";
cout<<"#"<<endl;
for(int i=0;i<a;i++){
cout<<"#"<<v[i]<<"#"<<endl;
}
cout<<"#";
for(int i=0;i<b;i++)
cout<<"#";
cout<<"#"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        ans += s[i] != t[i];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3852
#include <iostream>


int main()
{
	int N;
	long n;
	int c;
	long sum=0;
	std::cin >> N;
	for (int i = 1; i <= N; i++) {
		std::cin >> n;
		c = n % 2;
		while (c == 0) {
			n = n / 2;
			c = n % 2;
			sum++;
		}
	}
	std::cout << sum;
}


Measured memory_bytes: 256
n=int(input())

t = list(map(int,input().split()))

memo = [0]*(2*(10**5)+1)

for i in t:
    memo[i]+=1

sumv=0

for j in memo:
    sumv+=j*(j-1)//2

for i in t:
    print(sumv-(memo[i]*(memo[i]-1))//2+((memo[i]-2)*(memo[i]-1)//2))


Measured memory_bytes: 82564
from collections import defaultdict
MOD = 10**9 + 7

def Mod_Power(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

def Mod_Inverse(a, mod):
    return Mod_Power(a, mod-2, mod)

def Mod_Combination(n, k, mod):
    p, q = 1, 1
    for i in range(n-k+1, n+1):
        p = (p * i) % mod
    for i in range(2, k+1):
        q = (q * i) % mod
    return int(p * Mod_Inverse(q, mod) % mod)

N, M = map(int, input().split())
prime_factors = defaultdict(int)
i, L = 2, M
while True:
    while L % i == 0:
        L /= i
        prime_factors[i] += 1
    if L == 1 or i * i > M:
        break
    i += 1
if L > 1:
    prime_factors[L] = 1
res = 1
for key in prime_factors:
    res = res * Mod_Combination(prime_factors[key] + N - 1, N - 1, MOD) % MOD
print(int(res))

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


int main(){

    int L,A,B,C,D;
    cin>>L>>A>>B>>C>>D;
    
    int ans=0;
    if(A%C==0)ans+=A/C;
    else ans+=A/C+1;
    
    if(B%D==0)ans=max(ans,B/D);
    else ans=max(ans,B/D+1);
    
    cout<<L-ans<<endl;
    
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>

#define llong long long
#define rep(i,l,n) for(llong (i)=(l);(i)<(n);(i++))
#define _min(a,b) ((a)<(b)?(a):(b))
#define _max(a,b) ((a)>(b)?(a):(b))
#define _abs(a) ((a)>0?(a):(-(a)))

using namespace std;

struct group{
	int num;
	int size;
};

int root(struct group *data,int x){
	if( (data+x)->num == x ) return x;
	else{
		int rx = root(data,(data+x)->num);
		(data+x)->num = rx;
		return rx;
	}
}

void unite(struct group *data,int x,int y){
	int rx = root(data,x),ry = root(data,y);
	if( rx == ry ) return;
	(data+rx)->num = ry;
	(data+ry)->size += (data+rx)->size;
}

int main(){
	int N,M;
	cin >> N >> M;
	struct group data[N];
	
	rep(i,0,N){
		data[i].num = i;
		data[i].size = 1;
	}
	
	rep(i,0,M){
		int a,b;
		cin >> a >> b;
		a--; b--;
		unite(data,a,b);
	}
	
	int ans = 0;
	rep(i,0,N){
		ans = _max(ans,data[i].size);
	}
	
	cout << ans;
	
	return 0;
}


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

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

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

ll a[100005][4], sum[100005][4],n;

ll solve(ll prev,ll idx)
{	
	if(idx > n-1)
		return 0;

	if(sum[idx][prev] != -1)
		return sum[idx][prev];
	else
	{
		for(ll i=1;i<4;i++)
		{
			if(i != prev)
			{
				sum[idx][prev] = max(sum[idx][prev],solve(i,idx+1) + a[idx][i]);
			}	
		}
	}

	return sum[idx][prev];

}

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

	ll i,j,prev;

	cin >> n;

	for(i=0;i<n;i++)
		cin >> a[i][1] >> a[i][2] >> a[i][3];

	memset(sum,-1,sizeof(sum));

	ll ans = -1;

	for(i=1;i<4;i++)
	{
		ans = max(ans , solve(i,1) + a[0][i]);
	}

	cout << ans << endl;
	
}

Measured memory_bytes: 12800
//https://atcoder.jp/contests/dp/tasks/dp_a
#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<vector<int>> a;
    for(int i=0;i<n;i++){
        vector<int> b(3);
        cin>>b[0]>>b[1]>>b[2];
        a.push_back(b);
    }
    vector<vector<int>> dp(n,vector<int>(3,-1));
    for(int j=0;j<3;j++){
        dp[0][j] = a[0][j];
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(k!=j){
                    dp[i][j] = max(dp[i][j],dp[i-1][k]+a[i][j]);       
                }
            }
        }
    }

    int ans=0;
    for(int j=0;j<3;j++){
        ans = max(ans,dp[n-1][j]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11568
#include <iostream>
using namespace std;
int main(){
  int x,a,b;
  cin>>x>>a>>b;
  a = abs(x-a);
  b = abs(x-b);
  if(a>b){
    cout<<"B"<<endl;
    return 0;
  }else {
    cout<<"A"<<endl;
    return 0;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b)for(int i=(a);i<=(b);i++)
#define repR(i,n) for(int i=n;i>=0;i--)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue<int>
#define PQR priority_queue<int,VE,greater<int>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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

using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

const long long MOD = 1000000007;
const long long INF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

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



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, w; cin >> h >> w;
	vector<string>field(h);
	rep(i, h)cin >> field[i];
	vector<VE>dist(h, VE(w, -1));
	queue<P>que;
	rep(i, h)rep(j, w) {
		if (field[i][j] == '#') {
			dist[i][j] = 0; que.push(P(i, j));
		}
	}
	while (!que.empty()) {
		P p = que.front(); que.pop();
		rep(i, 4) {
			int nx = p.first + dx[i]; int ny = p.second + dy[i];
			if (0 <= nx && nx < h && 0 <= ny && ny < w&&dist[nx][ny] == -1) {
				dist[nx][ny] = dist[p.first][p.second] + 1;
				que.push(P(nx, ny));
			}
		}
	}
	int ans = 0;
	rep(i, h)rep(j, w)chmax(ans, dist[i][j]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 25524
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		String[] A = new String[N];
		String[] B = new String[M];

		for(int i = 0; i < N; i++) {
			A[i] = sc.next();
		}
		for(int i = 0; i < M; i++) {
			B[i] = sc.next();
		}

		String result = Serch(N,M,A,B);
		System.out.println(result);
	}

	private static String Serch(int N,int M,String[] A,String[] B) {
		int count = 0;
		for(int i = 0; i <= N-M; i++) {
			for(int j = 0; j <= N-M; j++) {
				for(int k = 0; k < M; k++) {
					if(A[i+k].substring(j,j+M).equals(B[k].substring(0))) {
						count++;
					}else {
						count = 0;
						break;
					}
					if(count == M) {
						return "Yes";
					}
				}
			}
		}
		return "No";
	}
}


Measured memory_bytes: 27336
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define display(v) for (auto x : v) cout << x << ", "
#define print(x) cout << (#x) << " = [ ";display(x); cout << "]\n"
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define ceel(x, y) ((x) / (y) + !((x) % (y) == 0))
#define ss second
#define ff first
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
 
// DEBUG TEMPLATE by livw
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifdef INCLUDEWHENOFFLINE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int len = 1e7 + 10;
ll cnt[len];

int main()
{
    fastio;
    fill(cnt, cnt + len, 0);
    for (int i = 1; i < len; i++)
    {
        for (int j = i; j < len; j += i)
        {
            cnt[j] += 1;
        }
    }
    ll k;
    cin >> k;
    ll ans = 0;
    for (ll i = 1; i <= k; i++)
    {
        ans += i * cnt[i];
    }
    //cout << cnt[1000000];
    cout << ans;
    return 0;
}


Measured memory_bytes: 81820
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) (m*n)/GCD(m,n)
# define mod 1000000007

ll a[100005][5];
ll dp[100005][5];
ll n;

ll solve(ll day,ll flag)
{
    if(day==n)
        return 0;
    if(dp[day][flag]!=-1) return dp[day][flag];

    ll maxi=0;
    if(flag==0)
    {
        maxi=max(maxi,a[day][1]+solve(day+1,1));
        maxi=max(maxi,a[day][2]+solve(day+1,2));
        maxi=max(maxi,a[day][3]+solve(day+1,3));
    }
    else if(flag==1)
    {
        maxi=max(maxi,a[day][2]+solve(day+1,2));
        maxi=max(maxi,a[day][3]+solve(day+1,3));
    }
    else if(flag==2)
    {
        maxi=max(maxi,a[day][1]+solve(day+1,1));
        maxi=max(maxi,a[day][3]+solve(day+1,3));
    }
    else
    {
        maxi=max(maxi,a[day][1]+solve(day+1,1));
        maxi=max(maxi,a[day][2]+solve(day+1,2));
    }
      return dp[day][flag] = maxi;
}
int main()
{
   ll i,j;
   memset(dp,-1,sizeof(dp));
   cin >> n;
   for(i=0;i<n;i++)
   {
       cin >> a[i][1];
       cin >> a[i][2];
       cin >> a[i][3];
   }
   cout << solve(0,0);
}


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

int main() {
	ios_base::sync_with_stdio( false );

	string S;
	cin >> S;

	if( S == "Sunny" ) {
		cout << "Cloudy";
	}
	else if( S == "Cloudy" ) {
		cout << "Rainy";
	}
	else if( S == "Rainy" ) {
		cout << "Sunny";
	}

	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

vector<int> r, g, b;

bool isOK(int index, int key) {
    if (b[index] >= key) return true;
    else return false;
}

int binary_search(int key) {
    int ng = -1;
    int ok = (int)b.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    int n; cin >> n;
    string s; cin >> s;
    rep(i, 0, n)
    {
        if (s[i] == 'R') r.push_back(i);
        if (s[i] == 'G') g.push_back(i);
        if (s[i] == 'B') b.push_back(i);
    }

    ll ans = r.size() * g.size() * b.size();
    rep(i, 0, r.size())
    {
        rep(k, 0, g.size()) 
        {
            int idx;
            if ((r[i] + g[k]) % 2 == 0)
            {
                idx = binary_search((r[i] + g[k]) / 2);
                if (idx != b.size() && b[idx] == (r[i] + g[k]) / 2) ans--;
            } 
            idx = binary_search(2 * g[k] - r[i]);
            if (idx != b.size() && b[idx] == 2 * g[k] - r[i]) ans--;
            idx = binary_search(2 * r[i] - g[k]);
            if (idx != b.size() && b[idx] == 2 * r[i] - g[k]) ans--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
#include <stdio.h>
main(){
  int h,m,s,S,t,w;
  scanf("%d",&S);
  h=S/3600;
  t=S%3600;
  m=t/60;
  s=t%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}
  

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

int main(){
  string S,T;
  char tmp;
  cin >> S >> T;
  for(int i = 0; i < S.size(); i++){
    if(S == T){
      cout << "Yes" << endl;
      return 0;
    }
    else{
      tmp = S[0];
      S.erase(0,1);
      S.push_back(tmp);
    } 
  }
  cout << "No" << endl;
      
}

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

int main(){
  int N,D,X;
  cin>>N>>D>>X;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  int ans=N+X;
  for(int i=0;i<N;i++){
    ans+=(D-1)/A.at(i);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
   int main(void) {
      int n;
      scanf("%d", &n);
      switch (n % 10) {
      case 2:
      case 4:
      case 5:
      case 7:
      case 9:
         puts("hon");
         break;
      case 0:
      case 1:
      case 6:
      case 8:
         puts("pon");
         break;
      case 3:
         puts("bon");
         break;
      }
      return 0;
   }


Measured memory_bytes: 1596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int a[100000];
int b[100000];

int main()
{
	int A, B, M, ans = 10000000;
	int amin = 1000000, bmin = 1000000;

	cin >> A >> B >> M;
	rep(i, A) {
		cin >> a[i];
		amin = min(amin, a[i]);
	}

	rep(i, B) {
		cin >> b[i];
		bmin = min(bmin, b[i]);
	}

	ans = amin + bmin;

	rep(i, M) {
		int x, y, c;

		cin >> x >> y >> c;

		ans = min(ans, a[x - 1] + b[y - 1] - c);
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
  int n,res=0,flag=0;
  
  cin >> n;
  
  if((n/10)!=0){
    res+=9;
  }else{
    flag = 1;
    res +=n;
  }
  if((n/1000)!=0&&flag!=1){
    res+=999-99;
  }else if(flag!=1){
    flag = 1;
    if(n<100){
    }else{
     res+=n-99;
    }
  }
  if((n/100000)!=0&&flag!=1){
    res+=99999-9999;
  }else if(flag!=1){
    flag = 1;
    if(n<10000){
    }else{
      res+=n-9999;
    }
  }
  
  cout << res <<endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define speed ios::sync_with_stdio(0); cin.tie(0);
int const N = 1e5+1;
vector< pair < int , int > > v;
ll a[N] , b[N];
int main(){
	speed 
	ll x , k , sum = 0; 
	cin >> x >> k;
	f(i,0,x)cin >> a[i];
	sort(a , a+x);
	int ans = 0;
	f(i,0,x){
		sum+=a[i];
		if (sum <= k && i != x - 1 || sum == k && i == x - 1)ans++;else sum-=a[i];
	}
	cout << ans << endl;
	return 0;
}


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

import math
A, B = map(int, input().split())
if B==1:
    print(0)
else:
    count = 0
    while True:
        B -= A
        count += 1
        if B > 0:
            B += 1
        else:
            break
    print(count)


Measured memory_bytes: 38256
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w, n, a, b, i, swap;
		String str;
		w = scan.nextInt();
		int[] amidakuji = new int[w];
		n = scan.nextInt();
		for (i = 0; i < w; i ++) amidakuji[i] = i;
		for (i = 0; i < n; i ++) {
			str = scan.next();
//			a = scan.nextInt();
//			b = scan.nextInt();
			String[] seisuu = str.split(",", 0);
			a = Integer.parseInt(seisuu[0]);
			b = Integer.parseInt(seisuu[1]);
			a --; b --;
			swap = amidakuji[a]; amidakuji[a] = amidakuji[b]; amidakuji[b] = swap;
		}
		for (i = 0; i < w; i ++) {
			System.out.println(amidakuji[i] + 1);
		}
	}
}

Measured memory_bytes: 25988
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000;

int main(){
    int a, b;
    cin >> a >> b;
    rep (i, 1010) {
        int aa = i * 8 / 100, bb = i * 10 / 100;
        if (aa == a && bb == b) {
            cout << i << endl;
            return 0;
        }
    }

    cout << "-1" << endl;

    return 0;
} 

Measured memory_bytes: 3620
#include <cstdio>

char pi[2][233];

int main()
{
	int n; scanf("%d",&n);
	scanf("%s%s",pi[0],pi[1]);
	for(int i=0; i<n; i++)
	{
		printf("%c",pi[0][i]);
		printf("%c",pi[1][i]);
	}
	return 0;
}

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

typedef pair<int64_t, int64_t> P;
typedef int64_t ll;
ll INF = 1000000000000;

int N, A[100000];
int main(){
    cin >> N;
    for(int i=0;i<N;i++)    cin >> A[i];
    
    vector<int> nums1, nums2, nums4;
    for(int i=0;i<N;i++){
        if(A[i] % 4 == 0)       nums4.push_back(A[i]);
        else if(A[i] % 2 == 0)  nums2.push_back(A[i]);
        else                    nums1.push_back(A[i]);
    }

    vector<int> B;
    int j = 0;
    for(int i=0;i<nums1.size();i++){
        B.push_back(nums1[i]);
        if(j < nums4.size()){
            B.push_back(nums4.front());
            nums4.pop_back();
        }
    }

    while(nums4.size()){
        B.push_back(nums4.front());
        nums4.pop_back();
    }

    while (nums2.size()){
        B.push_back(nums2.front());
        nums2.pop_back();
    }

    string ans = "Yes";
    for(int i=0;i<N-1;i++){
        if(B[i] * B[i+1] % 4 != 0){
            ans = "No";
            break;
        }
    }

    cout << ans << endl; 
}

Measured memory_bytes: 1788
/*Program from Luvwgyx*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
struct node{int to,nxt;}e[maxn<<1];
int tot,head[maxn];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(int x){print(x);puts("");}
void add(int u,int v){e[++tot].to=v;e[tot].nxt=head[u];head[u]=tot;}
int dfs(int x,int fa){
    int ret=0;
    for(int i=head[x],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
        if(v!=fa)ret+=dfs(v,x);
    return ret>=2?ret:ret^1;
}
int main(){
    int n=read();
    for(int i=1;i<n;i++){int u=read(),v=read();add(u,v);add(v,u);}
    puts(dfs(1,0)?"First":"Second");
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io

    char c[3][3];
    rep(i,3) rep(j,3) cin>>c[i][j];

    cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;

    return 0;

}


Measured memory_bytes: 256
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] p = in.nextIntArray(n);
			int[] dp = new int[n+1];

			int max = -INF;
			for (int i = 0; i < n; i++) {
				dp[p[i]] = dp[p[i]-1] + 1;
				max = max(max, dp[p[i]]);
			}

			out.println(n-max);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 46740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int w, a, b; cin >> w >> a >> b;
    cout << max(0, abs(b - a) - w) << "\n";
    return 0;
}

Measured memory_bytes: 384
#! python3
# doubly_linked_list.py

from collections import deque

keys = deque([])

n = int(input())

for i in range(n):
    command = input()
    if command == 'deleteFirst':
        keys.popleft()
    elif command == 'deleteLast':
        keys.pop()
    else:
        command, x = command.split(' ')
        if command == 'insert':
            keys.appendleft(int(x))
        elif command == 'delete':
            if int(x) in keys:
                keys.remove(int(x))

print(' '.join([str(k) for k in keys]))


Measured memory_bytes: 46068
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main() {
    int A, B, H, M;
    double Hangle, Mangle, angle, SQ_C, C;
    scanf("%d %d %d %d", &A, &B, &H, &M);
    Hangle = (H * 30) + (M * 0.5);
    Mangle = 6 * M;
    if (Hangle > Mangle) {
        angle = Hangle - Mangle;
    } else {
        angle = Mangle - Hangle;
    }
    SQ_C = (A * A) + (B * B) - 2 * A * B * cos(angle * 3.14159265359 / 180);
    C = sqrt(SQ_C);
    printf("%.16f", C);
    return 0;
}

Measured memory_bytes: 2604
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MaxN = 1e5, MaxM = 2e5;
int n, all;
int pre[MaxM + 5], last[MaxN + 5], other[MaxM + 5];
int deg[MaxN + 5];
LL a[MaxN + 5];
bool flag;

void Build(int x, int y)
{
	pre[++all] = last[x];
	last[x] = all;
	other[all] = y;
}

void Init()
{
	all = -1; memset(last, -1, sizeof(last));
	memset(deg, 0, sizeof(deg));
	for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	for (int i = 1; i <= n - 1; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		Build(u, v); Build(v, u);
		deg[u]++; deg[v]++;
	}
}

void Dfs(int x, int fa)
{
	if (deg[x] == 1) return;
	int ed = last[x], dr;
	LL sum = 0, MaX = 0;
	while (ed != -1) {
		dr = other[ed];
		if (dr != fa) {
			Dfs(dr, x);
			sum = sum + a[dr];
			MaX = max(MaX, a[dr]);
		}
		ed = pre[ed];
	}
	if (sum < a[x]) {flag = false; return;}
	if (sum - a[x] > min(sum / 2, sum - MaX)) flag = false;
	else a[x] = 2 * a[x] - sum;
}

void Solve()
{
	flag = true;
	if (n == 2) {
		if (a[1] == a[2]) flag = true;
			else flag = false;
	}
	else {
		int root = 0;
		for (int i = n; i >= 1; i--) 
			if (deg[i] > 1) root = i;
		Dfs(root, 0);
		if (a[root] != 0) flag = false;
	}
	if (!flag) printf("NO\n"); else printf("YES\n");
}

int main()
{
	while (~scanf("%d", &n)) {
		Init();
		Solve();
	}
	return 0;
}

Measured memory_bytes: 9984
import sys
input = sys.stdin.readline
N = int(input())
p = list(map(int, input().split()))
class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0] * (n + 1)
    self.el = [0] * (n + 1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j = None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i)
fwk = BIT(N)
res = 0
for i in range(N):
  g = fwk.sum(p[i])
  if g > 0:
    res += 1
  fwk.add(p[i], 1)
print(N - res)

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

int main(){
    int n;
    cin>>n;
    ll num[n];
    for (int i = 0; i < n; ++i) {
        cin>>num[i];
    }
    int count=0;
    for (int j = 0; j < n; ++j) {
        int c=0;
        while(num[j]%2==0){
            num[j]/=2;
            c++;
        }
        count+=c;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            String[] in = br.readLine().split(" ");
            
            int a = Integer.parseInt(in[0]);
            int b = Integer.parseInt(in[1]);
            
            br.close();
 
            System.out.println(a * b);

        }
    }
}

Measured memory_bytes: 32540
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 21:02:29 2020

@author: NEC-PCuser
"""

A, B, C = map(int, input().split())
K = int(input())

# B > A C > B
for i in range(K):
    if (C <= B):
        C *= 2
    elif B <= A:
        B *= 2

if (A < B and B < C):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9176