akhauriyash/Code-Regression huggingface dataset:
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll a,b,x;
  cin >> x >> a >> b;
  if(a>=b) cout <<"delicious\n";
  else if(x>=b-a) cout <<"safe\n";
  else cout <<"dangerous\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	
	//masih run error
	char a,b;
	scanf("%c %c",&a,&b);
	if(a=='H' && b=='H'){
		printf("H\n");
	}
	else if(a=='D' && b=='D'){
		printf("H\n");
	}
	else{
		printf("D\n");
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

	static void exec(Scanner in, PrintStream out) {
		int N = in.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i += 1) {
			A[i] = in.nextInt();
		}
		int currentSignum = 0;
		int count = 1;
		for (int i = 0; i < N - 1; i += 1) {
			int signum = Integer.signum(A[i] - A[i + 1]);
			if (currentSignum == 0) {
				currentSignum = signum;
			} else if (!(signum == 0 || currentSignum == signum)) {
				count += 1;
				currentSignum = 0;
			}
		}
		out.println(count);
	}

	public static void main(String[] args) {
		exec(new Scanner(System.in), System.out);
	}

}


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

const ll MOD=1000000007;

ll a[300005];
ll bits[62];

int main(){
    ll n; cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        for(int j=0;j<62;j++){
            if(a[i]&(1LL<<j)) bits[j]++;
        }
    }
    ll ans=0;
    ll b=1;
    for(int i=0;i<62;i++){
        ans+=((((n-bits[i])*bits[i])%MOD)*b)%MOD;
        ans%=MOD;
        b*=2;
        b%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
N = int(input())
mxc = -1
mxi = 0
for i in range(1,N+1):
    c = 0
    x = i
    while x%2 ==0:
        c +=1
        x = x//2
    if c > mxc:
        mxi = i
        mxc = c
print(mxi)

Measured memory_bytes: 3060
# coding: utf-8


class Dictionary(object):

    def __init__(self, m):
        self.T = [None] * m
        self.m = m

    def h1(self, key):
        return key % self.m
    
    def h2(self, key):
        return 1 + (key % (self.m - 1))
    
    def h(self, key, i):
        return ((self.h1(key) + i * self.h2(key)) % self.m)

    def insert(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if not self.T[j]:
                self.T[j] = key
                return j
            else:
                i += 1
    
    def search(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == key:
                return j
            elif not self.T[j] or i >= self.m:
                return 'Not Found'
            else:
                i += 1


if __name__ == "__main__":
    # n = 6
    # orders = [
    #     ('insert', 'AAA'),
    #     ('insert', 'AAC'),
    #     ('find', 'AAA'),
    #     ('find', 'CCC'),
    #     ('insert', 'CCC'),
    #     ('find', 'CCC')
    # ]
    n = int(input())
    orders = []
    for _ in range(n):
        order, chars = input().strip().split()
        orders.append((order, chars))

    # def get_char(char):
    #     if char == 'A':
    #         return 1
    #     elif char == 'C':
    #         return 2
    #     elif char == 'G':
    #         return 3
    #     elif char == 'T':
    #         return 4
    #     else:
    #         return 0

    # def get_char_key(chars):
    #     p = 1
    #     key = 0
    #     for c in chars:
    #         key += p * get_char(c)
    #         p *= 5
    #     return key

    # dictionary = Dictionary(m=10000000)
    # for o in orders:
    #     order, chars = o
    #     key = get_char_key(chars)
    #     if order == 'insert':
    #         dictionary.insert(key)
    #     elif order == 'find':
    #         result = dictionary.search(key)
    #         if result == 'Not Found':
    #             print('no')
    #         else:
    #             print('yes')

    dictionary = {}
    for o in orders:
        order, chars = o
        if order == 'insert':
            dictionary[chars] = 0
        elif order == 'find':
            if chars in dictionary:
                print('yes')
            else:
                print('no')



Measured memory_bytes: 208524
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int X;
int A;
int main(){
  rd(X);
  rd(A);
  if(X<A){
    wt_L(0);
    wt_L('\n');
  }
  else{
    wt_L(10);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190706-1

// --- original code ---
// int X, A;
// {
//   rd(X,A);
//   wt( if[X<A, 0, 10] );
// }


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

signed main()
{
    int N; cin>>N;
    vector<int> v(N),c(N);
    for(int i=0;i<N;i++){
        cin>>v[i];
    }
    for(int i=0;i<N;i++){
        cin>>c[i];
    }
    
    int ans=0;
    for(int i=0;i<N;i++){
        ans+=max(0LL,v[i]-c[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import math
n, d = map(int, input().split())

x = [0] * n
y = [0] * n


for i in range(n):
    x[i], y[i] = map(int, input().split())

dist = []

for i in range(n):
    dist_i = math.sqrt(math.pow(x[i], 2) + math.pow(y[i], 2))
    dist.append(dist_i)

ans = [i for i in dist if i <= d]

print(len(ans))





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


int main(){
	char g[42] = {0,0,0,0,0,0,0,0,97,102,107,112,117,122,0,98,103,108,113,118,46,0,99,104,109,114,119,63,0,100,105,110,115,120,33,0,101,106,111,116,121,32};
	string s,a;
	while(cin >> s,!cin.eof()){
		a = "";
		for(int i = 0;i < s.size();i += 2){
				int l = s[i] - '0', r = s[i+1] - '0';
				if(s.size() % 2 || l < 1 || r < 1 || l > 6 || r > 5){a = "NA";break;}
			a += g[r * 7 + l];
		}
		cout << a << endl;
	}	
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>

int main(void) {
	char s[13] = { 0 };

	scanf("%s", &s);

	for (int i = 0; i < strlen(s); i++) {
		printf("%c", s[i]);
		if (i == 3) printf(" ");
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 128
N,M = map(int,input().split())
A = list(map(int,input().split()))
all = sum(A)
if all % (4 * M) != 0:
    cut = all // (4 * M)
else:
    cut = all // (4 * M) - 1
count = 0
for i in A:
    if i > cut:
        count += 1
if count >= M:
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <functional>

int n;
int a[200005];

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::cin >> n;
    for (int i = 1; i <= n; ++i) std::cin >> a[i];
    std::sort(a + 1, a + n + 1, std::greater<int>());
    long long sum = 0;
    for (int i = 3; i <= n + 1; ++i) sum += a[i >> 1];
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 4412
#include <iostream>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
 
int main(){
    ll n,m,count,cnt,ans=0;
    
    cin>>n>>m;
  int s[11][11],p[11],k[11];
    rep(i,m){
        cin>>k[i];
        rep(j,k[i]){
            cin>>s[i][j];
        }
    }
    rep(i,m){
        cin>>p[i];
    }
    rep(bit,(1<<n)){
        cnt=0;
        rep(i,m){
            count=0;
            rep(j,k[i]){
                if(bit&(1<<(s[i][j]-1))){
                    count++;
                }
            }
            if(count%2==p[i]){
                cnt++;
            }
        }
        if(cnt==m){
            ans++;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

const int MAX_V = 210;
bool can[105][105];

struct edge{
  int to,cap,rev;
};


vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,int cap){
  G[from].pb((edge){to,cap,G[to].size()});
  G[to].pb((edge){from,0,G[from].size()-1});
}

void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int>que;
  level[s]=0;
  que.push(s);
  while(que.size()){
    int v=que.front();que.pop();
    //cout<<"debug: "<<G[v].size()<<endl;
    for(int i=0;i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
	level[e.to]=level[v]+1;
	que.push(e.to);
      }
    }
  }
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    bfs(s);
    if(level[t]<0)return flow;
    // cout<<"in"<<endl;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}

void solve(int n){
  int s=n+n,t=s+1;
  rep(i,n){
    add_edge(s,i,1);
  }
  rep(i,n){
    add_edge(n+i,t,1);
  }
  rep(i,n){
    rep(j,n){
      if(can[i][j]){
	add_edge(i,n+j,1);
      }
    }
  }
  cout<<max_flow(s,t)<<endl;
}

int main(){
  int n,x,y;
  pi a[105],b[105];
  cin>>n;
  rep(i,n){
    cin>>x>>y;
    a[i]=mp(x,y);
  }
  rep(i,n){
    cin>>x>>y;
    b[i]=mp(x,y);
  }
  rep(i,n){
    rep(j,n){
      if(a[i].first<b[j].first&&a[i].second<b[j].second){
	can[i][j]=true;
      }
    }
  }
  solve(n);
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin>>k;
    int s[32]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
cout<<s[k-1]<<endl;
return 0;
}

Measured memory_bytes: 256
n = int(input())
X = [int(i) for i in input().split()]
sortX = sorted(X, reverse=True)
m1 = sortX[n // 2 - 1]
m2 = sortX[n // 2]

for i in range(n):
    if X[i] < m1:
        print(m1)
    else:
        print(m2)

Measured memory_bytes: 25556
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int nmax = 40, abmax = 10, inf = 1000000;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    s.insert(a);
  }
  
  if (s.size() % 2) {
    cout << s.size() << endl;
  } else {
    cout << s.size() -1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 4992
import sys
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():

    n = int(input())
    s = list(input().strip())
    q = int(input())
    alpha = g = [[] for _ in range(26)]
    orda = ord('a')
    for i in range(n):
        alpha[ord(s[i])-orda].append(i)
    for i in range(q):
        a, b, c = map(str, input().split())
        if a == '1':
            b = int(b)-1
            if c != s[b]:
                alpha[ord(s[b])-orda].remove(b)
                s[b] = c
                bisect.insort(alpha[ord(c)-orda], b)
        else:
            ans = 0
            for i in range(26):
                if len(alpha[i]) > 0:
                    it = bisect.bisect_left(alpha[i], int(b)-1)
                    if it < len(alpha[i]) and alpha[i][it] < int(c):
                        ans += 1
            print(ans)


main()


Measured memory_bytes: 107520
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-05-02 20:52:56 +0900
# LastModified: 2020-05-02 21:14:49 +0900
#


import os
import sys


def main():
    k=int(input())
    a,b=map(int,input().split())
    amari=a%k
    shou=a//k
    if amari==0:
        print("OK")
        return
    if (shou+1)*k <= b:
        print("OK")
        return
    print("NG")

if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  int n; cin>>n;
  string s;
  char x;
  rep(i,n){
    char c; cin>>c;
    if(x!=c) s.push_back(c);
    x=c;
  }
  cout<<s.size()<<endl;
}


Measured memory_bytes: 3604
n=int(input())
l=[]
for i in range(0,n):
    o=int(input())
    l.append(o)
q=list(l)
q.sort(key=int,reverse=True)
for i in range(0,len(l)):
    if l[i]!=q[0]:
        print(q[0])
    else:
        print(q[1])


Measured memory_bytes: 15948
h,w,k=map(int,input().split())

s=[input() for _ in range(h)]

#hが短いのでhはbit全探索

count=10**9
#print(s)
for i in range(2**(h-1)):
    cnt=bin(i).count("1")

    #yには何行目で割るかが配列ではいる
    y=[]
    for j in range(h-1):
        if (i>>j) &1:
            y.append(j)
    y.append(h-1)
    ruiseki=[0]*(cnt+1)
    #print("y>>>>",y)
    test=0
    flag2=0
    for xx in range(w):
        yyy=0
        flag=0
        for index,yy in enumerate(y):
            while yyy<=yy:
                if s[yyy][xx]=="1":
                    ruiseki[index]+=1
                yyy+=1
        #print(max(ruiseki))
        if max(ruiseki)>k:
            #print("reset")
            cnt+=1
            yyy=0
            ruiseki=[0]*(bin(i).count("1")+1)
            for index,yy in enumerate(y):
                while yyy<=yy:
                    if s[yyy][xx]=="1":
                        ruiseki[index]+=1
                    yyy+=1
            if max(ruiseki)>k:
                #print("kore ha dame")
                flag2=1
                break
        #print(xx,ruiseki)
        #print("count:",cnt)
    if flag2==0:
        count=min(count,cnt)
print(count)



        


    
        




Measured memory_bytes: 46812
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a) for(int i=0;i<a;i++)
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define tests int t1234;cin>>t1234;for(int i1234=1;i1234<=t1234;i1234++)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mods (1000000007)
#define arrLB(arr,n,x) (int)(lower_bound(arr,arr+n,x)-arr)
#define arrUB(arr,n,x) (int)(upper_bound(arr,arr+n,x)-arr)
#define vecLB(arr,x) (int)(lower_bound(arr.begin(),arr.end(),x)-arr.begin())
#define vecUB(arr,x) (int)(upper_bound(arr.begin(),arr.end(),x)-arr.begin())
const int N=200001;

int main() {
    fastio;
    int h1,m1,h2,m2,k;cin>>h1>>m1>>h2>>m2>>k;
    int dif=(h2-h1)*60+(m2-m1);
    cout<<dif-k<<endl;

}

Measured memory_bytes: 3632
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
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; }

const static lint FibMax = 100001;
int N;
vector<int> h;
int Fib[100001];

int main()
{
    cin >> N;
    h.resize(N);
    rep (i, N) { cin >> h[i]; }
    rep (i, FibMax)
    {
        Fib[i] = INT_MAX;
    }

    Fib[0] = 0;
    Fib[1] = abs(h[1] - h[0]);

    for (int i = 2; i < N; ++i)
    {
        // int a = Fib[i - 2] + abs(h[i-2] - h [i-1]) + abs(h[i-1] - h[i]);
        int b = Fib[i - 2] + abs(h[i-2] - h[i]);
        int c = Fib[i - 1] + abs(h[i-1] - h[i]);
        Fib[i] = min(b, c);
    }

    cout << Fib[N - 1] << endl;

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  long long L0 = 2;
  long long L1 = 1;
  long long L;
  
  for (int i = 2; i < N + 1; i++) {
    L = L0 + L1;
    L0 = L1;
    L1 = L;
  }
  
  if (N == 1){
    cout << 1 << endl;
  }
  else {
    cout << L << endl;
  }
}



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



int main() {
	string  s, t;
	string  U;
	int N, B;
	cin >> s >> t >> N >> B >> U;
	
	vector<string>S(N);
	vector<string>T(B);

	
	if (U == s) {
		cout << S.size() - 1 << endl;
		cout << T.size() << endl;
	}
	else if (U == t) {
		cout << S.size() << endl;
		cout << T.size() - 1 << endl;
	}
	else {}

}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;

const ll mod = 1e9+7;
const ll inf = 1e16;

#define loop(i,m,n) for(ll i=m;i<n;i++)
#define vloop(it,x) for(auto it=x.begin(); it!=x.begin(); it++)
#define all(x) x.begin(),x.end()
#define debug(x) cout << #x <<":"<< x <<endl	
#define showll(x) printf("%lld\n",x)
#define test(t) ll t;cin >> t;while(t--)
#define showc(x) printf("%c\n",x)
#define read(x) cin >> x
#define yes printf("YES\n")
#define no printf("NO\n")
#define pb push_back

void fast()
{
ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}

//////////////////////////////// - _ - \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

ll n;

int main()
{
	fast();
	// debug(n);
	// showll(a);
	ll i,j,k,tmp;
	read(n);
	ll dp[n+1][3];
	ll a[n],b[n],c[n];
	loop(i,0,n)
	{
		cin >> a[i] >> b[i] >> c[i];
		//printf("%lld %lld %lld\n",a[i],b[i],c[i] );
	}
	dp[0][0] = 0;
	dp[0][1] = 0;
	dp[0][2] = 0;
	loop(i,1,n+1)
	{
		dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i-1];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i-1];
		dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c[i-1];
	}
	ll check = max(dp[n][0],dp[n][1]);
	//showll(check);
	ll final = max(dp[n][2],check);
	
	showll(final);
}	


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	long long ans = 0, n = s.length();
	long long a[n];
	a[0] = pow(10, n-1);
	for (ll i = 1; i < n; i++)
		a[i] = 0;

	for (long long i = 0; i < n - 1; i++)
		a[0] += pow(2, i) * pow(10, n - 2 - i);
	
	for (long long i = 1; i < n; i++) {
		a[i] = a[i - 1] - 9 * pow(2, i - 1) * pow(10, n - i - 1);
		ans += (s[i] - '0') * a[i];
	}
	
	ans += (s[0] - '0') * a[0];
	cout << ans;
}

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

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

  /*int flag = 1;
  int count = 0;
  int i = 0;
  while (flag) {
    flag = 0;
    for (i; i < s.size() - 1; i++) {
      if (s.at(i) == 'B' && s.at(i + 1) == 'W') {
        count++;
        s.at(i) = 'W';
        s.at(i + 1) = 'B';
        flag = 1;
      }
    }
    i = 0;
  }
  cout << count;
  */
  long long ans = 0;
  int w_count = 0;
  vector<int> w;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'W') {
      w_count++;
      w.push_back(i);
    }
  }
  for (int i = 0; i < w_count; i++) {
    ans += w.at(i) - i;
  }
  cout << ans;
}


Measured memory_bytes: 1532
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n;cin>>n;
    ll v[n],c[n];
    rep(i,0,n)cin>>v[i];
    rep(i,0,n)cin>>c[i];
    ll ans=0;
    rep(i,0,n){
        if(v[i]>c[i])ans+=v[i]-c[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 888
<?php

 $N = trim(fgets(STDIN));
 $S = trim(fgets(STDIN));

$array = str_split($S);

for ($i = 0; $i < $N-1; $i++) {
    for ($j = $i + 1; $j < $N; $j++) {
        if ($array[$i] !== $array[$j]) {
            break;
        } else {
            unset($array[$i]);
            $i++;
        }
    }
}
echo count($array);

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

#define F(X) (((X)*((X)+1))/2)
int main(void){
  long long n, ans;
  
  cin >> n;
  ans = F(n) - 3*F(n/3) - 5*F(n/5) + 15*F(n/15);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int x,y;
    cin>>x>>y;
    if(2*x<=y&&4*x>=y&&y%2==0)cout<<"Yes";
    else cout<<"No";
	return 0;
}


Measured memory_bytes: 3616
# C - : (Colon)
import math
A, B, H, M = map(int, input().split())

M_r = 360/60 * M
H_r = 30 * H + 30/60 * M

C_r= abs(M_r - H_r)
C_r = min(C_r, 360-C_r)

C_2 = A**2 + B**2 - 2 * A * B * math.cos(math.radians(C_r))
C = math.sqrt(C_2)
print(C)

Measured memory_bytes: 9520
import math
#各桁の和を計算する関数
def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += math.floor(n % 10)
        n /= 10

    return sum

N,A,B = map(int,input().split())
total = 0
for a in range(1,N+1):
    sum = findSumOfDigits(a)
    if A <= sum <= B:
        total += a

print(total)


Measured memory_bytes: 2940
#include <iostream>
#define MAX 2001
using namespace std;

int n, result;
int A[MAX];

int solve(int i, int m) {
    if(m == 0) return true;
    if(i >= n) return false;
    result = solve(i+1, m) || solve(i+1, m-A[i]);
    return result;
}

int main() {
    int q, i, d;
    cin >> n;
    for(i=0; i < n; i++) {
        cin >> A[i];
    }
    cin >> q;
    for(i=0; i < q; i++) {
        cin >> d;
        if(solve(0, d)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <unordered_map>

int n;
std::unordered_map<long long,int> data;
int main(){
  std::cin>>n;
  for(int i=0;i<n;++i){
    long long temp;
    std::cin>>temp;
    ++data[temp];
  }
  
  long long ans=0;
  for(auto&& p:data)
    if(p.first>p.second)
      ans+=p.second;
    else if(p.first<p.second)
      ans+=p.second-p.first;
  
  std::cout<<ans<<std::endl;
  return 0;
}


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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int T1 = H1*60+M1, T2 = H2*60+M2;
  cout << T2-T1-K << endl;
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll X, Y;
    cin >> X >> Y;
    repi(i, 100) {
        repi(j, 100) {
            if(i + j == X) {
                if(2 * i + 4 * j == Y) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

#define REP(i,n) for(int i = 0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long, long> pl;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;string s;
    cin >> n ;
    cin >> s;
    ll r = 0;
    ll b = 0;
    REP(i,n){
        if(s[i]=='B'){
            b++;
        }else{
            r++;
        }
    }
    if(r>b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=1;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,m; cin>>n>>m;
    vector <int> a(n); 
    vector <int> b(m); 
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    a.erase(unique(all(a)), a.end());
    b.erase(unique(all(b)), b.end());
    if(a.size() != n || b.size() != m) {cout<<0<<endl; return 0;}
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    a.push_back(-1);
    b.push_back(-1);
    int ap = 0, bp = 0;
    int ans = 1;
    for(int num = n*m; num>=1; num--){
        if(a[ap] == num && b[bp] == num) {ap++; bp++;  }
        else if(a[ap] == num) { ans *= bp; ans %=MOD;  ap++; }
        else if(b[bp] == num) { ans *= ap; ans %=MOD; bp++;}
        else {ans *= ap*bp - (n*m - num); ans %= MOD;}
        //cout<<ans<<endl;
    }
    if(ans <= 0) cout<<0<<endl;
    else 
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

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

const int MAX = 55;

int n;
int x[MAX];
int y[MAX];
int ans;
vi e[MAX];
map<pll, int> h;

int getid(ll x, ll y) {
	if (h.find(mp(x, y)) != h.end()) {
		return h[mp(x, y)];
	}
	return -1;
}

int deg[MAX];

void solve () {
	fi(0, n - 1) h[mp(x[i], y[i])] = i;	
	int ans = n;
	fi(0, n - 1) fj(0, n - 1) {
		int dx = x[i] - x[j];
		int dy = y[i] - y[j];
		if (dx == 0 && dy == 0) continue;
		memset(deg, 0, sizeof(deg));		
		fi(0, n - 1) {
			ll x2 = (ll) x[i] + dx;
			ll y2 = (ll) y[i] + dy;
			int id = getid(x2, y2);
			if (id != -1) deg[id]++;
		}
		int cur = 0;
		fi(0, n - 1) {
			if (deg[i] == 0) cur++;
		}
		ans = min(ans, cur);
	}	
	printf("%d\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif
	
	scanf("%d", &n);
	fi(0, n - 1) scanf("%d %d", &x[i], &y[i]);
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 256
n,m=[int(i) for i in input().split()]
list=[int(i) for i in input().split()]
x=1/(4*m)
y=sum(list)
count=0
for i in range(1,n+1):
  if list[i-1]>=x*y:
    count+=1

if count>=m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
#define ll long long
#define X first
#define Y second
#define MP make_pair
 
using namespace std;

const int N = 3e5 + 123;
const ll mod = 1e9 + 7;             

int n, h, w;
pair<int, int> a[N];
ll f[N], dp[N];
vector<int> srt;

ll bin_pow(ll x, ll y){
	ll res = 1;
	while(y){
		if(y & 1ll)
			res = res * x % mod;
		x = x * x % mod;
		y >>= 1LL;
	}
	return res;
}

ll calc(ll x, ll y){
	if(x < 0 || y < 0) return 0;
	return f[x + y - 2] * bin_pow(f[x - 1], mod - 2) % mod * bin_pow(f[y - 1], mod - 2) % mod;	
}

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

	f[0] = 1;
	for(ll i = 1;i <= 300000;i++){
		f[i] = f[i - 1] * i % mod;
	}

	cin >> h >> w >> n;
	for(int i = 1;i <= n;i++){
		int x, y;
		cin >> x >> y;
		a[i] = MP(x, y);
	}
	a[++n] = MP(h, w);

	sort(a + 1, a + n + 1);
	for(int i = 1;i <= n;i++){
		ll all = calc(a[i].X, a[i].Y);
		for(int j = 1; j < i; j++){
			all = (all - (dp[j] * calc(a[i].X - a[j].X + 1, a[i].Y - a[j].Y + 1) % mod) + mod) % mod;
		}
		dp[i] = all;
	}
	cout << dp[n];
	return 0;
}


Measured memory_bytes: 4352
require 'set'
N, K = gets.split.map(&:to_i)
d_set = Set.new(gets.chomp.split)

n = N
while true
  if n.to_s.chars.all? { |ch| !d_set.include?(ch) }
    puts n
    exit 0
  end
  n += 1
end


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std ;
int main(){
    int a , b , c , k , cnt = 0 , ans ;
    cin >> a >> b >> c >> k ;
    if(a>=k) ans = k ;
    else{
        if(a+b>=k) ans = a ;
        else ans = a - (k-a-b) ;
    }
    cout << ans << "\n" ;
    return 0 ;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
int a[31],i,b;
for(i=0;i<30;i++){
a[i]=0;
}
for(i=0;i<28;i++){
scanf("%d\n",&b);
a[b-1]++;
}
for(i=0;i<30;i++){
if(a[i]==0){
printf("%d\n",i+1);
}
}
return 0;
}



Measured memory_bytes: 2032
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    int A[n + 1], B[n];
    for (int i = 0; i < n + 1; i++) cin >> A[i];
    for (int i = 0; i < n; i++) cin >> B[i];
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (B[i] - A[i] >= 0) { 
            B[i] -= A[i]; 
            ans += A[i]; 
            if (B[i] - A[i + 1] >= 0) {
                ans += A[i + 1];
                A[i + 1] = 0;
            } else {
                ans += B[i];
                A[i + 1] -= B[i];
            }
        } 
        else ans += B[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  S += ('a' - 1);
  int N = S.size();
  set<char> st;
  for (int i = 0; i < 26; i++){
    st.insert('a' + i);
  }
  string ans = "zz";
  for (int i = 0; i < N; i++){
    if (st.upper_bound(S[i]) != st.end()){
      string T = S.substr(0, i) + *(st.upper_bound(S[i]));
      ans = min(ans, T);
    }
    if (i < N - 1){
      st.erase(S[i]);
    }
  }
  if (ans == "zz"){
    ans = "-1";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main(){
    int a,b;
    char op;
    cin >> a >> op >> b;
    if(op=='+') cout << a+b << endl;
    else cout << a-b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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;
}
int main() {
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;
    if (S == U) { 
        A--;
    } else {
        B--;
    }

        cout << A;
        cout << " ";
        cout << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
void solve(){
	string s;
	cin>>s;
	ll res=0;
	for(ll i=0;i<sz(s);i++)
		res=(res+(s[i]-'0'))%9;
	if(!res)
		cout<<"Yes";
	else
		cout<<"No";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

Measured memory_bytes: 3916
#include<iostream>
#include<vector>
using namespace std;
int n,m;
vector<int> v;
bool f(int sz){
	int temp=sz;
	int ret=1;
	for(int i=0;i<m;i++){
		if(sz-v[i]>=0){
			sz-=v[i];
		}else{
			ret++;
			sz=temp-v[i];
		}
	}
	return ret<=n;
}
int main(){
	while(cin>>n>>m,n||m){
		v=vector<int>(m);
		int l=0,r=0;
		for(int i=0;i<m;i++){
			cin>>v[i];
			r+=v[i];
			l=max(l,v[i]);
		}
		
		while(r>l){
			int mid=(l+r)/2;
			if(f(mid)){
				r=mid;
			}else{
				l=mid+1;
			}
			
		}
		cout<<r<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 1000000
#define INF 1000000

int a[MAX_N];
int b[MAX_N];


int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;


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

  int res = 0;

  res = N * (N-1) / 2;
  res += M * (M-1) / 2;

  cout << res << endl;

  return 0;
  
}


Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      int sum  =  0;
      for(int i=0;i< a+1;i++){
      	sum =sum+i;
      }
      System.out.println(sum);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;
int main() {
    int N, M;
    cin >> N >> M;
    string ans = string(N, ' ');
    int s;
    char c;
    rep(i, M) {
        cin >> s >> c;
        if(ans.at(s - 1) == ' ' || ans.at(s - 1) == c)
            ans.at(s - 1) = c;
        else {
            ans.assign("-1");
            break;
        }
    }
    if(ans.length() > 1 && ans.at(0) == '0') ans.assign("-1");
    if(ans != "-1")
        rep(i, N) if(ans.at(i) == ' ') ans.at(i) =
            ((i > 0) || (N == 1) ? '0' : '1');
    cout << ans << endl;
}

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

int main(void){
  int n;
  cin>>n;
  
  int a,b,c;
  long int cnt=0;
  
  for(int i=1;i<n;i++){
    int k=n-i;
    int root_k=(int)sqrt(k);
     for(a=1;a<=root_k;a++){
       if(k%a==0){
        cnt++;
          if(k/a!=a){
            cnt++;
          }
       }
     }
  }
  
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3672
import collections,sys
p=print
def ask(x,y):
	p('?',x,y)
	return input()=='Y'
A,B=map(int,input().split())
r=range(A+B)
if A<=B:
	p('Impossible')
	sys.exit()
c=collections.deque(r)
while len(c)>2:
	x,y=c.pop(),c.pop()
	if ask(x,y):
		c.appendleft(y)
p('!',''.join(str(int(ask(c[0],i))) for i in r))

Measured memory_bytes: 4036
import numpy as np

n, k = map( int, input().split() )
#print( n, k )

snk = range( n )
snk = list( snk )
snk = [ snki + 1 for snki in snk ]
#print( snk )

for i in range( k ):
    di = int( input() )
    ai = input().split()
    ai = [ int( aix ) for aix in ai ]
#    print( ai )

    for aij in ai:
        if any( si == aij for si in snk ):
            snk.remove( aij )
            
#    print( snk )




print( len( snk ) )
            



Measured memory_bytes: 26988
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    x = 0
    for j in range(n):
        if a[j] >> i & 1:
            x += 1
    ans += x * (n - x) * 2 ** i
    ans %= MOD
print(ans)

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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
	int k,x;
	cin>>k>>x;
	for(int i=x-k+1;i<=x+k-1;++i){
		cout<<i;
		if(i!=x+k-1) cout <<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=36;

typedef struct{
  int n;
  char m;
}array;

void BubbleSort(array A[],int n){
  bool flag=1;
  for(int i=0;flag;i++){
    flag=0;
    for(int j=n-1;j>=i+1;j--){
      if(A[j].n<A[j-1].n){
	  swap(A[j],A[j-1]);
	  flag=1;
	}
    }
  }
}

bool isStable(array A[],array B[],int num){
  bool flag=true;
  int i=0;
  for(;i<num-1;i++){
    cout<<A[i].m<<A[i].n<<' ';
    if(A[i].m!=B[i].m){
      flag=false;
    }
  }

  cout<<A[i].m<<A[i].n<<endl;
  if(A[i].m!=B[i].m){
    flag=false;
  }
  cout<<"Stable"<<endl;

  return flag;
}

  

void selectionSort(array A[],int n){
  for(int i=0;i<n;i++){
    int minj=i;
    for(int j=i;j<n;j++){
      if(A[j].n<A[minj].n)
	minj=j;
    }
    swap(A[i],A[minj]);
  }
}




int main(){
  array A[N];
  array B[N];
  int num;
  bool flag;

  cin>>num;

  for(int i=0;i<num;i++){
    cin>>A[i].m>>A[i].n;
    B[i]=A[i];
  }
  

  BubbleSort(A,num);
  selectionSort(B,num);
  
  flag=isStable(A,B,num);

  int i=0;
  for(;i<num-1;i++){
    cout<<B[i].m<<B[i].n<<' ';
  }
  cout<<B[i].m<<B[i].n<<endl;

  if(flag==true){
    cout<<"Stable"<<endl;
  }
  else cout<<"Not stable"<<endl;

  
  return 0;
}

  



Measured memory_bytes: 3104
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n, k =  map(int, input().split())
    ans = 0

    for i in range(1, n+1):
        for j in range(100):
            if i*2**j >= k:
                ans += 0.5**j
                break
    print((1/n)*ans)


if __name__=="__main__":
    main()


Measured memory_bytes: 70376
n=int(input())
#n,m=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(m)]

num=1
ans=0
for i in range(n):
    if al[i]!=num:
        ans+=1
    else:
        num+=1
if ans==n:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26140
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include<bits/stdc++.h>
#define N 100005
using namespace std;

inline void rd(int &X){
    X=0;int w=0;char ch=0;
    while(!isdigit(ch))w|=ch=='-',ch=getchar();
    while( isdigit(ch))X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    X=w?-X:X;
}

int n;
char a[N];
#define p 1000000007
inline int POW(int a,int b=p-2,int ans=1){
    for(;b;b>>=1,a=1ll*a*a%p)
        if(b&1) ans=1ll*ans*a%p;
    return ans;
}
int cnt[26];
signed main(){
    cin>>n;
    scanf("%s",a+1);
    for(int i=1;i<=n;i++)
        cnt[a[i]-'a']++;
    int ans=1;
    for(int i=0;i<26;i++)
        ans=1ll*ans*(cnt[i]+1)%p;
    cout<<(ans+p-1)%p;
}


Measured memory_bytes: 384
def examA():
    N = I()
    A = LI()
    ans = "YES"
    cur = 0
    for a in A:
        if a%2==1:
            cur +=1
    if cur%2==1:
        ans = "NO"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examA()


Measured memory_bytes: 14672
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

void dfs(vector<vector<int>> &ab, vector<bool> &visited, int index, int n)
{
    for (auto v : ab[index])
    {
        if (visited[v] == false)
        {
            visited[v] = true;
            dfs(ab, visited, v, n);
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    vector<vector<int>> ab(n, vector<int>());
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        ab[a - 1].push_back(b - 1);
        ab[b - 1].push_back(a - 1);
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        bool flag = false;
        for (auto v : ab[i])
        {
            if (h[i] <= h[v])
            {
                flag = true;
                break;
            }
        }
        if (!flag)
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

"""
input:
5 4
0 1
1 2
2 3
3 4

output:
0 1
1 2
2 3
3 4
"""

import sys

sys.setrecursionlimit(int(1e5))


def dfs_Tarjan(current, visited, parent, low, disc):
    global timer
    children = 0
    visited[current] = True
    disc[current] = timer
    low[current] = timer
    timer += 1

    for adj in adj_table[current]:
        if not visited[adj]:
            parent[adj] = current
            children += 1
            dfs_Tarjan(adj, visited, parent, low, disc)
            low[current] = min(low[current], low[adj])
            if low[adj] > disc[current]:
                ans.append(sorted([current, adj]))
        elif adj != parent[current]:
            low[current] = min(low[current], disc[adj])

    return None


def dfs_init():
    visited = [False] * v_num
    disc = [float("Inf")] * v_num
    low = [float("Inf")] * v_num
    parent = [-1] * v_num

    for v in range(v_num):
        if not visited[v]:
            dfs_Tarjan(v, visited, parent, low, disc)

    return ans


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    v_num, e_num = map(int, _input[0].split())
    edges = map(lambda x: x.split(), _input[1:])
    adj_table = tuple([] for _ in range(v_num))
    for v_info in edges:
        source, target = map(int, v_info)
        adj_table[source].append(target)
        adj_table[target].append(source)
        
    timer = 0
    ans = list()

    dfs_init()
    ans.sort()
    for ele in ans:
        print(*ele)

Measured memory_bytes: 23852
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF=1<<30;


int main(void) {

    int A,B,M; cin>>A>>B>>M;
    vector<int> a(A+1,0);
    int amin = 200000;
    for (int i = 1; i <= A; ++i) {
        cin>>a[i];
        amin = min(amin, a[i]);
    }
    vector<int> b(B+1,0);
    int bmin = 200000;
    for (int i = 1; i <= B; ++i) {
        cin>>b[i];
        bmin = min(bmin, b[i]);
    }

    vector<vector<int>> discount(M+1, vector<int>(3,0));
    for (int i = 1; i <= M; ++i) {
        cin>>discount[i][0]>>discount[i][1]>>discount[i][2];
    }

    int sum=amin+bmin;
    for (int i = 1; i <= M; ++i) {
        int shiharai = a[discount[i][0]]+b[discount[i][1]] - discount[i][2];
        sum = min(shiharai, sum);
    }
    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 6528
a,b,c=gets.split.map(&:to_f)
sin=Math.sin((c/180)*Math::PI)
cos=Math.cos((c/180)*Math::PI)
puts sprintf("%.8f",(a*b*sin/2.0))
puts sprintf("%.8f",a+b+((a**2)+((b**2)-2*a*b*cos))**(1/2.0))
puts sprintf("%.8f",sin*b)



Measured memory_bytes: 6956