akhauriyash/Code-Regression huggingface dataset:
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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 end


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<ll> a(3);
    in >> a[0] >> a[1] >> a[2];
    SORT(a);

    out << a[0] + a[1] << endl;
}


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

res = []
for i in range(1,N+1):
    counter = 0
    if i % 2 == 0:
        while i % 2 == 0:
            counter += 1
            i /= 2

        res.append(counter)
    else:
        res.append(counter)


print(res.index(max(res)) + 1)

Measured memory_bytes: 3060
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

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

const int N=200010;

int fa[N],l[N],r[N];
bool w[N];

struct edge
{
	int x,y,z;
	bool operator <(const edge &a)const {return z<a.z;}
}a[N];

int find(int x)
{
	if (x!=fa[x]) fa[x]=find(fa[x]);
	return fa[x];
}

int main()
{
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	int n,m;scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
	sort(a+1,a+m+1);
	for (int i=1;i<=m;i++) {l[i]=i-1;r[i]=i+1;}
	int head=1,E=r[m]=0;ll ans=0;
	for (int i=0;i<n;i++) fa[i]=i;
	for (int t=a[1].z;E<n-1;t++)
	{
		int p=head;
		while (p)
		{
			if (a[p].z>t) break;
			int x=(a[p].x+(t-a[p].z+1)/2)%n,y=(a[p].y+(t-a[p].z)/2)%n;
			int fx=find(x),fy=find(y);
			if (fx!=fy)
			{
				fa[fx]=fy;ans+=t;E++;w[p]=0;
			}
			else
			{
				if (!w[p])
				{
					w[p]=1;
				}
				else
				{
					if (!l[p]) head=r[p]; else r[l[p]]=r[p];
					if (r[p]) l[r[p]]=l[p];
				}
			}
			p=r[p];
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
#include <cstring>


int main() {
    int l, r, d; std::cin >> l >> r >> d;
    int cnt = 0;
    for (int i = l; i <= r; i++) {
        cnt += i % d == 0;
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3560
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;

 int main()
 {
   string s;
   while(cin>>s)
   {
     bool flag=false;
     for(int i=0;i<(s.length()-1);i++)
     {
       if(s[i]=='A'&&s[i+1]=='C') 
       {
         flag=true;
         break;                           
       }        
     } 
     if(flag) cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
   } 
   return 0;
 }
 

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

int main(){
    string s; cin >> s;
    int n = s.size();
    vector<int> num(n);
    rep(i,n) {
        num[i] = s[i] - '0';
    }
    int x = 99999;
    for(int i = 1; i <= n - 2; i++){
        int sum = num[i-1]*100 + num[i]*10 + num[i+1];
        x = min(x,abs(sum-753));
    }
    cout << x;
}

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


int main() {long x;
cin >> x;
long ans = 0;
ans += x / 11 * 2;
if(x % 11 >= 1 && x % 11 <= 6) ans++;
else if(x % 11 >= 7) ans += 2;


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



Measured memory_bytes: 256
#include <iostream>
int count = 0;

void print_array(int a[], int n)
{
  for (int i=0; i<n; i++)
    std::cout << ((i!=0)?" ":"") << a[i];
  std::cout << std::endl;
}

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

  for (i=0; i < n1; i++)
    L[i] = a[left + i];
  for (i=0; i < n2; i++)
    R[i] = a[mid+i];

  j=i=0;
  for (k=left; k<right; k++)
  {
    if((j==n2  || L[i] <= R[j]) && i!=n1)
    {
      a[k] = L[i];
      i++;
    }else{
      a[k] = R[j];
      j++;
    }
    count ++;
  }
}

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


void inputdata(int *n, int **a)
{
  std::cin >> *n;
  *a= new int[*n];
  for(int i=0; i< *n; i++)
    std::cin >> (*a)[i];
}
int main(void)
{
  int *a, n;
  inputdata(&n, &a);
  merge_sort(a, 0, n);

  print_array(a,n);
  std::cout << count <<std::endl;
  delete a;
}



Measured memory_bytes: 6688
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    map<int,int> T;
    int ans = 0, N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        T[a]++;
    }
    for (auto x : T) {
        if (x.second % 2 == 1) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

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

  bool ans = (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) || (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) || (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]);
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    char r = '\0';
    int count = 0;
    for (const char c : S) {
        if (r != c) {
            count += 1;
            r = c;
        }
    }
    cout << count << '\n';
}



Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Thu Jun  6 21:15:08 2019

@author: hisaki
"""

import numpy as np

r,D,x_2000 = map(int,input().split())

def f(i):
    global x_2000
    global D
    global r
    if i == 2000:
        return x_2000
    temp = f(i-1)*r - D
    print (temp)
    return temp
  
    

f(2010)



Measured memory_bytes: 12488
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,ans,k,cou;
  cou=0;
  ans=0;
  string str;
  cin>>str;
  a=0;
  b=str.size()-1;
  while(a<str.size()){
    while(a<str.size()){
      if(str.at(a)!='x'){
        break;
      }
      a++;
      k++;
    }
    while(0<=b){
      if(str.at(b)!='x'){
        break;
      }
      k--;
      b--;
    }
    if(a==str.size()){
      break;
    }
    if(str.at(a)!=str.at(b)){
      ans=-1;
      break;
    }
    ans=ans+abs(k);
    a++;
    b--;
    if(cou==0){
      cou=abs(k)+1;
    }
    k=0;
  }
  if(ans==-1){
    cout<<ans;
  }
  else{
 	 cou=cou-1;
 	 ans=(ans+cou)/2;
  	cout<<ans;
  }
}

Measured memory_bytes: 512
s = str(input())
n = len(s)

#スライスを用いて奇数番目s1と偶数番目s2に分ける
s1 = s[::2]
s2 = s[1::2]

zero = s1.count('0')
one = s2.count('1')

if zero + one < n/2:
  print(zero + one)
else:
  print(n - zero - one)


Measured memory_bytes: 3188
def min(a, b)
   (a < b) ? a : b
end

n = gets.chomp.to_i
tmp = gets.chomp
a_ary = tmp.split(" ")
a_ary.map! do |a|
  a.to_i
end

tmp = gets.chomp
b_ary = tmp.split(" ")
b_ary.map! do |b|
  b.to_i
end

result = 0

idx = 0
while idx < n do
  result += min(a_ary[idx], b_ary[idx])
  r_power = b_ary[idx] - a_ary[idx]
  if 0 < r_power
  	result += min(a_ary[idx+1], r_power)
  	a_ary[idx + 1] -= min(a_ary[idx+1], r_power)
  end
  idx += 1
end

puts result



Measured memory_bytes: 15636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

struct UnionFind{
  VI par;
  UnionFind(int N):par(N){
    rep(i,N) par[i]=i;
  }
  int root(int x){
    if(par[x]==x) return x;
    return par[x]=root(par[x]);
  }
  void unite(int x, int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry) return;
    par[rx]=ry;
  }
  bool same(int x, int y){
    int rx=root(x);
    int ry=root(y);
    return rx==ry;
  }
};

int main(){
  int N;
  cin>>N;
  VI X(N),Y(N);
  rep(i,N) cin>>X[i]>>Y[i];
  vector<tuple<int,int,int>> A(0),B(0);
  rep(i,N){
    A.pb(mt(X[i],Y[i],i));
    B.pb(mt(Y[i],X[i],i));
  }
  sort(all(A));
  sort(all(B));
  vector<tuple<int,int,int>> C(0);
  rep(i,N-1) C.pb(mt(get<0>(A[i+1])-get<0>(A[i]),get<2>(A[i+1]),get<2>(A[i])));
  rep(i,N-1) C.pb(mt(get<0>(B[i+1])-get<0>(B[i]),get<2>(B[i+1]),get<2>(B[i])));
  sort(all(C));
  UnionFind uf(N);
  ll ans=0;
  rep(i,C.size()){
    if(uf.root(get<1>(C[i]))==uf.root(get<2>(C[i]))) continue;
    ans+=get<0>(C[i]);
    uf.unite(get<1>(C[i]),get<2>(C[i]));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 7980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  ll n,c,k;
  cin>>n>>c>>k;
  ll t[n];
  for(int i=0;i<n;i++) cin>>t[i];
  sort(t,t+n);
  ll ti=0,ca=0, ans=0;
  for(int i=0;i<n;i++){
    if(t[i]-ti<=k){
      if(ca!=c){
        ca++;
      }else{
        ti=t[i];
        ca=0;
        i--;ans++;
      }
    }else{
      if(ca!=0){
        ca=0;
        ans++;
      }
      ti=t[i];
      i--;
    }
  }
  if(ca!=0) ans++;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
//be naame khodaa

#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <sstream>
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

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

int in(){ int x; scanf("%d", &x); return x; }

const int maxn = 100 * 1000 + 5;

vector <int> v[maxn];
int res = 0;

int dfs(int x, int par = -1){
	int ch = 0, cnt = 0;
	for (int y : v[x]){
		if (y == par) continue;
		ch++;
		cnt += dfs(y, x);
	}
	if (ch == 0)
		return 1;
	else if (ch == 1 && cnt == 1)
		return 1;
	else{
		res += max(0, cnt-1);
		return 0;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	int n = in();
	for (int i = 0; i < n-1; i++){
		int x = in(), y = in();
		v[x].pb(y);
		v[y].pb(x);
	}
	int root = -1;
	for (int i = 0; i < n; i++)
		if (v[i].size() > 2)
			root = i;
	if (root == -1)
		return (cout << 1 << endl), 0;
	dfs(root);
	cout << res << endl;
	return 0;
}

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

int main() {
    int n; string s; cin >> n >> s;
    int cnt = 1;
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i-1]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
const int MAX=105;
const int INF= 1<<30;
int M[MAX][MAX],n,d[MAX],p[MAX],vis[MAX];
void init(){
	for(int i=0;i<n;i++){
		d[i]=INF;
		p[i]=-1;
		vis[i]=0;
	}
	d[0]=0;
}
int Prim(){
	init();
	while (true){
		int u=-1;
		int minCost=INF;
		for(int i=0;i<n;i++){
			if(!vis[i] && d[i]<minCost){
				u=i;
				minCost=d[i];
			}
		}
		if(u==-1)break;
		vis[u]=1;
		for(int i=0;i<n;i++){
			if(!vis[i] && M[u][i]!=-1 &&M[u][i]<d[i]){
				d[i]=M[u][i];
				p[i]=u;
			}
		}
	}
	int sum=0;
	for(int i=0;i<n;i++){
		sum+= (p[i]==-1)?0:M[i][p[i]];
	}
	return sum;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>M[i][j];
		}
	}
	cout<<Prim()<<endl;
	return 0;
} 


Measured memory_bytes: 3136
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    S = input()
    if S == "AC":
        AC += 1
    if S == "WA":
        WA += 1
    if S == "TLE":
        TLE += 1
    if S == "RE":
        RE += 1
ans = "AC x " + str(AC) + "\n"
ans = ans + "WA x " + str(WA) + "\n"
ans = ans + "TLE x " + str(TLE) + "\n"
ans = ans + "RE x " + str(RE)
print(ans)


Measured memory_bytes: 9172
def counting_sort(lst,ans,max):
    cnt_lst = [0] * (max+1)
    for i in range(0,len(lst)):
        cnt_lst[lst[i]] += 1
    for j in range(1,max+1):
        cnt_lst[j] = cnt_lst[j] + cnt_lst[j-1]

    for k in range(len(lst)-1,-1,-1):
        ans[cnt_lst[lst[k]]-1] = lst[k]
        cnt_lst[lst[k]] -= 1
    return ans

n = int(input())
n_lst = list(map(int,input().split()))
ans = [0] * len(n_lst)
ans = map(str,counting_sort(n_lst,ans,max(n_lst)))
print(' '.join(ans))



Measured memory_bytes: 234820
N = int(input())

L = []
for i in range(N):
  A, B = list(map(int, input().split()))
  L.append([A + B, A, B])
L = sorted(L)
a = 0
b = 0
for i in range(N):
  if i % 2 == 0:
    a += L[-1 - i][1]
  else:
    b += L[-1 - i][2]
print(a - b)


Measured memory_bytes: 24496
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		double S, L, h;
		
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		S = a * b * Math.sin(Math.toRadians(c)) / 2.0;
		L = a + b + Math.sqrt(a*a + b*b - 2*a*b*Math.cos(Math.toRadians(c)));
		h = b * Math.sin(Math.toRadians(c));
		
		System.out.println(S);
		System.out.println(L);
		System.out.println(h);
	}
}

Measured memory_bytes: 26264
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define maxn 1000201

using namespace std;

int n,l,r,a[maxn];

int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    l=1;
    for (int i=1;i<=n;i++)
        if (abs(a[i])>abs(a[l]))
            l=i;
    printf("%d\n",n*2-1);
    for (int i=1;i<=n;i++)
            printf("%d %d\n",l,i);
    if (a[l]>0)
        for (int i=1;i<n;i++)
            printf("%d %d\n",i,i+1);
    else
        for (int i=n;i>1;i--)
            printf("%d %d\n",i,i-1);
    return 0;
}


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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long a, b, c, k;
  cin >> a >> b >> c >> k;
  long long ans = 0;
  ans += k > a? a * 1: k * 1;
  k -= a;
  k -= b;
  ans -= k > 0? k * 1: 0;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

long max(long a, long b)
{
	if (a > b)
		return a;
	return b;
}

int N;
int W;
long w[110];
long v[110];
long dp[110][100010];
int main(int argc, char const *argv[])
{
	scanf("%d%d", &N, &W);
	for (int i = 0; i < N; i++)
		scanf("%ld%ld", w+i, v+i);
	
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j <= W; j++)
		{
			if (j + w[i] <= W)
				dp[i+1][j + w[i]] = max(dp[i+1][j + w[i]], dp[i][j] + v[i]);
			
			dp[i+1][j] = max(dp[i][j], dp[i+1][j]);	
		}
	}
	printf("%ld\n", dp[N][W]);
	return 0;
}


Measured memory_bytes: 79232
N = input()
A = list(map(int,input().split()))
def main(A):
    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)

main(A)


Measured memory_bytes: 21780
#include <iostream>
#include <cstring>

using namespace std;


bool iroha(int price, bool usable[])
{
    while (price > 0) {
        if (!usable[price % 10])
            return false;
        price /= 10;
    }
    return true;
}


int main(void)
{
    int n, k;
    bool usable[10];

    for (int i = 0; i < 10; i++)
        usable[i] = true;

    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        int tmp;
        cin >> tmp;
        usable[tmp] = false;
    }

    int i;
    for (i = n; ; i++) {
        if (iroha(i, usable))
            break;
    }
    cout << i << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000
 
void Preorder(int);
void Inorder(int);
void Postorder(int);
 
struct Node{
  int p,s,l,r;
};
 
struct Node T[MAX];

int n,i;

int main(){
  int j,lf,ri,c[MAX],id[MAX],p,s,deg[MAX],dep,h;
  scanf("%d",&n);
 
  for(i = 0 ; i < n ; i++){
    T[i].p = -1;
    T[i].s = -1;
    T[i].l = -1;
    T[i].r = -1;
  }
   
  for(i = 0 ; i < n ; i++){
    scanf("%d",&id[i]);
    for(j = 0 ; j < 2 ; j++){
      scanf("%d",&c[j]);
      if(j == 0){
        lf = c[j];
        T[id[i]].l = c[j];
        T[c[j]].p = id[i];
      }
      else {
        ri = c[j];
        T[id[i]].r = c[j];
        T[c[j]].p = id[i];
      }
    }
  }
 
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1) break;
  }
   
  printf("Preorder\n");
  Preorder(i);
  
  printf("\nInorder\n");
  Inorder(i);
  
  printf("\nPostorder\n");
  Postorder(i);
  printf("\n");
   
  return 0;
}
 
void Preorder(int u){
 
  printf(" %d",u);
  
  if(T[u].l != -1){
    Preorder(T[u].l);
  }
  if(T[u].r != -1){
    Preorder(T[u].r);
  }
}
 
void Inorder(int u){
 
  if(T[u].l != -1){
    Inorder(T[u].l);
  }
  printf(" %d",u);
 
  if(T[u].r != -1){
    Inorder(T[u].r);
  }
}
 
void Postorder(int u){
    
  if(T[u].l != -1){
    Postorder(T[u].l);
  }
  if(T[u].r != -1){
    Postorder(T[u].r);
  }
  printf(" %d",u);
   
}

Measured memory_bytes: 632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

int main() {
	std::string s; std::cin >> s;
	if (s.size() % 2 == 1) {
		std::cout << "No" << std::endl;
		return 0;
	}
	std::sort(s.begin(), s.end());
	for(int i = 0; i < s.size(); i += 2)
		if (s[i] != s[i + 1]) {
			std::cout << "No" << std::endl;
			return 0;
		}
	std::cout << "Yes" << std::endl;

	return 0;
}

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

using namespace std;

const int N = 69;

int a[N], mx, n;

int main(){
//	freopen("input.inp", "r", stdin);
	mx = 1;
	cin >> n >> a[1];
	for(int i = 2; i <= n; ++i){
		cin >> a[i];
		if (abs(a[i]) > abs(a[mx])) mx = i;
	}
	cout << 2 * n - 2 << endl;
	for(int i = 1; i <= n; ++i) if (i != mx) cout << mx << " " << i << endl;
	if (a[mx] < 0) for(int i = n; i > 1; --i) cout << i << " " << i - 1 << endl;
	else for(int i = 1; i < n; ++i) cout << i << " " << i + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>

using namespace std;

int n;
int g[10][10];
int dist[10] = {};
int maxHate[10] = {};
int minHate[10] = {};
int ord[10];
int maxRest[10][1<<10];

int solve(){
	if (n == 1) return 0;
	ord[1] = 0;
	int minD = 1 << 30;
	int sumMinHate = 0;
	for (int i = 0; i < n; ++i) sumMinHate += minHate[i];
	do{
		int pOne = -1;
		int used = (1 << ord[0]);
		int rest = sumMinHate - minHate[ord[0]];
		bool one = ord[0] == 0;
		for (int i = 1; i < n; ++i) {
			int p = ord[i];
			if (ord[i] == 0) {
				if (one) {
					pOne = i;
					p = ord[i] = 1;
				}
				one = !one;
			}
			rest -= minHate[p];
			dist[i] = dist[i-1];
			for (int j = i-1; j >= 0; --j) {
				if (dist[i] - dist[j] >= maxRest[p][used]) break;
				dist[i] = max(dist[i], dist[j] + g[p][ord[j]]);
			}
			if (dist[i] + rest >= minD) {
				dist[n-1] = 1 << 30;
				break;
			}
			used += 1 << p;
		}
		minD = min(minD, dist[n-1]);
		if (pOne != -1) ord[pOne] = 0;
	} while (next_permutation(ord, ord+n));
	return minD;
}

int main(){
	int trailZero[1024] = {};
	for (int i = 0; i < 10; ++i) {
		trailZero[(1 << (i+1)) - 1] = i;
	}
	while(true) {
		cin >> n;
		if (n == 0 || cin.eof()) break;
		for (int i = 0; i < n; ++i) {
			ord[i] = i;
			minHate[i] = 1 << 30;
			maxHate[i] = 0;
			for (int j = 0; j < n; ++j) {
				scanf("%d", g[i] + j);
			}
		}
		memset(maxRest, 0, sizeof(maxRest));
		for (int i = 0; i < n; ++i) {
			for (int j = i+1; j < n; ++j) {
				g[i][j] = g[j][i] = max(g[i][j], g[j][i]);
				maxHate[i] = max(maxHate[i], g[i][j]);
				maxHate[j] = max(maxHate[j], g[i][j]);
				minHate[i] = min(minHate[i], g[i][j]);
				minHate[j] = min(minHate[j], g[i][j]);
			}
		}
		for (int j = 1; j < (1 << n); ++j) {
			for (int k = 0; k < n; ++k) {
				if ((j & (1 << k)) == 0 || j == (1 << k)) continue;
				int st = j - (1 << k);
				int prev = st & (st-1);
				int pos = trailZero[st ^ (st-1)];
				maxRest[k][st] = max(maxRest[k][prev], g[k][pos]);
			}
		}
		printf("%d\n", solve());
	}
}

Measured memory_bytes: 960
#include<cstdio>
#include<cstring>
#include<vector>
#include<iostream>
using namespace std;
int  a[110];
vector<int> sn;
void fun(int n){
	int i=2;
	int x=n;
	while(n!=1){
		
		while(n%i==0){
			a[i]++;
			n/=i;	
		}	
		if(i==2)
			i++;
		else
			i+=2;
	}
}
int main()
{
	int n;
	cin>>n;
	for(int i=2;i<=n;i++)
		fun(i);
	for(int i=1;i<=n;i++)
		if(a[i]&&a[i]>=2)
			sn.push_back(a[i]);
	//cout<<sn.size()<<endl;
	
	int ans=0;
	for(int i=0;i<sn.size();i++)
		if(sn[i]>=74)  ans++;
	//exam 1 
	for(int i=0;i<sn.size();i++){
		for(int j=i+1;j<sn.size();j++){
			if(sn[j]>=24)
				ans++;
		}
		if(sn[i]>=24){
			for(int j=i+1;j<sn.size();j++){
				if(sn[j]>=2)
				ans++;
			}
		}
	}
	//exam 2	
	for(int i=0;i<sn.size();i++){
		if(sn[i]>=4){
			for(int j=i+1;j<sn.size();j++){
				if(sn[j]>=14)
					ans++;
			}
		}
		
		if(sn[i]>=14){
			for(int j=i+1;j<sn.size();j++){
				if(sn[j]>=4)
				ans++;
			}
		}
	}	
	//exam 3
	for(int i=0;i<sn.size();i++){
		if(sn[i]>=2){
			for(int j=i+1;j<sn.size();j++){
				if(sn[j]>=4){
					for(int k=j+1;k<sn.size();k++){
						if(sn[k]>=4)
							ans++;
					}
				}
					
			}
		}
		if(sn[i]>=4){
			for(int j=i+1;j<sn.size();j++){
				if(sn[j]>=4){
					for(int k=j+1;k<sn.size();k++){
						if(sn[k]>=2)
							ans++;
					}
				}
				if(sn[j]>=2){
					for(int k=j+1;k<sn.size();k++){
						if(sn[k]>=4)
							ans++;
					}
				}	
			}
		}
		
	}
	cout<<ans<<endl;
			
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,m;
int main(){
	scanf("%lld%lld",&n,&m);
	ll l=1,r=n;
	rep(i,0,m){
		ll p,q;
		scanf("%lld%lld",&p,&q);
		l=max(l,p);
		r=min(r,q);
	}
	printf("%lld",r-l+1>0?r-l+1:0);
}



Measured memory_bytes: 128
//
// Created by watemus on 04.07.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FF first
#define SS second

using ll = long long;
using ld = long double;

template<typename T>
using vec = std::vector<T>;

template<typename T>
using uset = std::unordered_set<T>;

template<typename T1, typename T2>
using umap = std::unordered_map<T1, T2>;

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;
const ld PI = acos(-1);
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());

vec<pair<int, int>> DD = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

#ifdef LOCAL
#else
#endif

void run() {
  ll n;
  cin >> n;
  string ans;
  while (n > 0) {
    ans += 'a' + (n - 1) % 26;
    n--;
    n /= 26;
  }
  reverse(ALL(ans));
  cout << ans << '\n';
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

signed main() {
#ifdef LOCAL
  std::freopen("input.txt", "r", stdin);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif
  int t = 1;
  //cin >> t;
  while (t--) {
    run();
  }
  return 0;
}



Measured memory_bytes: 3604
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL a,b,c=mod*2+10,ta,tb;
	cin>>ta>>tb;
	FOR(i,0,4){
		a=ta;
		b=tb;
		LL t=0;
		if(i&1){
			t++;
			a=-a;
		}
		t+=fabs(fabs(b)-fabs(a));
		a+=fabs(fabs(b)-fabs(a));
		if(i&2){
			t++;
			a=-a;
		}
		if(b!=a)continue;
		c=min(c,t);
	}
	cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    while (1){
        int a, c;
        char b;
        cin >>a >>b >>c;
        if (b == '?'){
            break;
        } else if (b == '+'){
            cout << a + c <<endl;
        } else if (b == '-'){
            cout << a - c <<endl;
        } else if (b == '*'){
            cout << a * c <<endl;
        } else if (b == '/'){
            cout << a / c <<endl;
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 3080
R, C, K = map(int, input().split())

mp = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
  r,c,v = map(int, input().split())
  mp[r][c] = v

memo = [[0]*4 for _ in range(R+1)]

for j in range(1,C+1):
  for i in range(1,R+1):
    if mp[i][j] > 0:
      memo[i][3] = max(memo[i][3], memo[i][2] + mp[i][j])
      memo[i][2] = max(memo[i][2], memo[i][1] + mp[i][j])
      memo[i][1] = max(memo[i][1], memo[i][0] + mp[i][j], max(memo[i-1])+mp[i][j])
      memo[i][0] = max(memo[i][0], max(memo[i-1]))
    else:
      memo[i][0] = max(memo[i][0], max(memo[i-1]))
      
print(max(memo[R]))

Measured memory_bytes: 147408
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

#define INF 999999999

int main(){
	int ans, n, m, p, x[101], par;
	
	int key[26] = {1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,1,2,1,1,1,2,1};
	while(1){
		cin >> n >> m >> p;
		if(!n)break;
		ans = 0;
		par = 0;
		for(int i= 0; i<n; i++){
			cin >> x[i];
			par+= x[i];
		}
		if(x[m-1]){
			ans = par * (100-p);
			ans = ans / x[m-1];
			cout << ans << endl;
		}
		else cout << "0" << endl;
	}
	return 0;
}

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

#define N 4
#define LIM 46


int ans[N][N]={
    {1,2,3,4},
    {5,6,7,8},
    {9,10,11,12},
    {13,14,15,0}};

int x[N*N]={3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2},y[N*N]={3,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3};

int min = LIM;

int evaluation(int p[N][N])
{
    int i,j,d=0;
    
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            if(p[i][j]!=0)
                d+=abs(j-x[p[i][j]])+abs(i-y[p[i][j]]);
        }
    }
    return d;
}

void dfs(int p[N][N], int pr[N][N], int n)
{
    int i,j,i0,j0,a=0,b=1;
    int f=0;
    int tmp[N][N];
    
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            if(ans[i][j]!=p[i][j])f++;
            if(p[i][j]==0)
            {
                i0=i;
                j0=j;
            }
        }
    }
    
    if(f==0)
    {
        if(min>n)
        {
            min=n;
        }
        return;
    }
    if(evaluation(p)+n>min) return;
    
    
    if(i0>0 && i0<N)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i0][j0];
        tmp[i0][j0]=tmp[i0-1][j0];
        tmp[i0-1][j0]=f;
        if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
            dfs(tmp, p, n+1);
    }
    if(j0>0 && j0<N)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i0][j0];
        tmp[i0][j0]=tmp[i0][j0-1];
        tmp[i0][j0-1]=f;
        if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
            dfs(tmp, p, n+1);
    }
    
    if(i0>=0 && i0<N-1)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i0][j0];
        tmp[i0][j0]=tmp[i0+1][j0];
        tmp[i0+1][j0]=f;
        if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
            dfs(tmp, p, n+1);
    }
    if(j0>=0 && j0<N-1)
    {
        memcpy(tmp,p,sizeof(int)*N*N);
        f=tmp[i0][j0];
        tmp[i0][j0]=tmp[i0][j0+1];
        tmp[i0][j0+1]=f;
        if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
            dfs(tmp, p, n+1);
    }
    
}

int main()
{
    int i,j;
    int p[N][N];
    
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            scanf("%d",&p[i][j]);
        }
    }
    dfs(p,p,0);
    
    printf("%d\n",min);
    
    return 0;
}

Measured memory_bytes: 620
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

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

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int n,m;//線路の情報の数,駅の数
int dpc[101][101];
int dpt[101][101];
const int INF = 100000000;


void WarshallFloyd(){
  for(int i = 1;i <= m;i++){
    for(int j = 1;j <=m;j++){
      for(int k = 1;k <=m;k++){
      dpc[j][k] =min(dpc[j][k],dpc[j][i]+dpc[i][k]);
      dpt[j][k] =min(dpt[j][k],dpt[j][i]+dpt[i][k]);
      }
    }
  }
  return;
}

int main()
{
  while(cin >>n>>m){
    if(n ==0&&m ==0){
      break;
    }
   
    for(int i = 1;i <=m ;i++){
      for(int j = 1;j <=m;j++){
	dpc[i][j] =INF;
	dpc[j][i] =INF;
	dpt[i][j] =INF;
	dpt[j][i] =INF;
      }
    }
    for(int i = 1;i <= m;i++){
      dpc[i][i] = 0;
      dpt[i][i] = 0;
    }
    for(int i = 0;i < n;i++){
      int from,to,cost,time;
      cin >>from>>to>>cost>>time;
      dpc[from][to] =cost;
      dpt[from][to] =time;
      dpc[to][from] =cost;
      dpt[to][from] =time;
    }
    /* for(int i = 1;i <=m;i++){
      for(int j = 1;j <=m;j++){
	cout <<"dpc["<<i<<"]["<<j<<"]"<<dpc[i][j] <<endl;
	cout <<"dpt["<<i<<"]["<<j<<"]"<<dpt[i][j] <<endl;
      }
      }*/
    WarshallFloyd();
    int k;//問い合わせの数
    cin >>k;
    for(int i = 0;i <k;i++){
      int s;
      int f;
      int r;
      cin >>s>>f>>r;
      if(r)
	cout<<dpt[s][f]<<endl;
      else
	cout<<dpc[s][f]<<endl;
    }
  }
  return 0;
}

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

int h, w, k;
char s[51][51];
int dp[51][51][1 << 12][4], dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
bool used[51][51];
void mark(int x, int y, int t, int s) {
	used[x][y] = true;
	if (!s)return;
	int a = ((t >> 1 & 1) << 1) + (t & 1);
	x -= dx[a], y -= dy[a];
	t >>= 2;
	mark(x, y, t, s - 1);
}
int rec(int x, int y, int t, int a, int cnt) {
	if (dp[x][y][t][a] != -1)return dp[x][y][t][a];
	int res = -INF;
	rep(i, 4) {
		if (i % 2 && !a)continue;
		int nx = x + dx[i], ny = y + dy[i];
		if (nx < 0 || ny < 0 || nx >= h || ny >= w || s[nx][ny] == '#')continue;
		memset(used, 0, sizeof(used));
		mark(x, y, t, cnt);
		int v = ((!used[nx][ny] && '1' <= s[nx][ny] && s[nx][ny] <= '9') ? s[nx][ny] - '0' : 0);
		int p = (t >> (k * 4 - 2)) << (k * 4 - 2); p = t - p;
		p = (p << 2) + i; int b = cnt; if (b < 2 * k)b++;
		int o = rec(nx, ny, p, a - i % 2, b);
		if (o != -INF)res = max(res, o + v);
	}
	if (x == h - 1 && y == w - 1 && res == -INF)return dp[x][y][t][a] = 0;
	return dp[x][y][t][a] = res;
}
int main() {
	scanf("%d%d%d", &h, &w, &k);
	rep(i, h)scanf("%s", s[i]);
	memset(dp, -1, sizeof(dp));
	printf("%d\n", rec(0, 0, 0, k, 0));
}

Measured memory_bytes: 169648
import bisect
n=int(input())
*L,=map(int,input().split())
L.sort()
ans=0
for i in range(n-1):
      for j in range(i+1,n):
            idx=bisect.bisect_left(L,L[i]+L[j])
            ans+=idx-(j+1)
print(ans)


Measured memory_bytes: 3316
<?php
fscanf(STDIN, "%d %d", $r, $c);
$last_column = array_fill(0, $c+1, 0);

for($i = 0; $i < $r; $i++){
    $input = trim(fgets(STDIN));
    $column = explode(" ", $input);
    $column[] = array_sum($column);
    echo implode(" ", $column).PHP_EOL;

    foreach($column as $key => $value){
        $last_column[$key] += $value;
    }
}
echo implode(" ", $last_column).PHP_EOL;

Measured memory_bytes: 15320
#include <cstdio>

int g[500000],h[500000];
int i,j,k,n,t,x,y;

int main()
{
	scanf("%d%d%d",&n,&x,&y);
	if (x>n)
	{
		puts("-1");
		return 0;
	}
	for (i=1;i<=x;i++)
		k++,g[k]=n-x+i;
	y--;
	while ((k<n) && (y))
	{
		y--;
		for (j=k+1;(j<=k+x) && (n-j>=y);j++)
			t++,h[t]=n-j+1;
		if (! t)
		{
			puts("-1");
			return 0;
		}
		for (;t>0;t--)
			k++,g[k]=h[t];
	}
	if ((k<n) || (y))
		puts("-1");
	else
		for (i=1;i<=n;i++)
			printf("%d ",g[i]);
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main(void)
{
  int num[3];
  int max,mid,min;
  
  scanf("%d %d %d",&num[0],&num[1],&num[2]);

  max=num[0];
  mid=num[1];
  min=num[2];

  if(num[1]>=max){
    max=num[1];
    mid=num[0];
    min=num[2];
  }
  
  if(num[2]>=max){
    max=num[2];
    mid=num[0];
    min=num[1];
  }
  

  printf("%d\n",10*max+mid+min);

  return 0;
}

      

  


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>

int n,m;

struct edge{int to,nxt;}E[200050];
int H[100050],tot=1;
void add_edge(int a,int b){
	E[++tot]=(edge){b,H[a]},H[a]=tot;
	E[++tot]=(edge){a,H[b]},H[b]=tot;
}

int D[100050],cnt6,cnt4,way,P,Q;

void dfs(int now,int S,int T,int fae){
	if (fae&&now==S) return;
	if (now==T){way++;return;}
	for (int i=H[now];i;i=E[i].nxt){
		if ((i^1)==fae) continue;
		dfs(E[i].to,S,T,i);
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1,x,y;i<=m;i++) scanf("%d%d",&x,&y),add_edge(x,y),D[x]++,D[y]++;
	for (int i=1;i<=n;i++){
		if (D[i]&1) return puts("No"),0;
		if (D[i]==6) cnt6++;
		if (D[i]==4){
			cnt4++;
			if (!P) P=i;
			else if (!Q) Q=i;
		}
	}
	if (cnt6||cnt4>=3) puts("Yes");
	else if (cnt4==2){
		dfs(P,P,Q,0);
		puts(way==4?"No":"Yes");
	}
	else puts("No");
}


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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    cout << (int)(log(n) / log(k) + 1) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int a, b;
    int i, j;
    while (1) {
        scanf("%d %d", &a, &b);
        if (a==0 && b==0) {
            break;
        }
        for ( i = 0; i < a; i++ ){
            for ( j = 0; j < b; j++ ){
                if (i==0 || i==a-1 || j==0 || j==b-1) {
                    printf("#");
                }else{
                printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
 
#define ll long long
#define ull unsigned long long
 
using namespace std;
 
int main() {
	int A, B, C;
	cin >> A >> B >> C;
 
	if (A+B+C >= 22){
	cout << "bust" ;
 	} else {
	cout << "win" ;
 
 	}
 
 
 
	return 0;
}

Measured memory_bytes: 3464
#include <bits/stdc++.h>
using namespace std;
#define LL long int
#define ULL unsigned long int
#define LD long double

LL MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];

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

    int ans = 0;
    vector<int> num(a.back() + 1);
    for(int i = 0; i < n; ++i){
        num[a[i]]++;
    }

    vector<bool> f(a.back() + 1, true);

    for(int i = 0; i < n; ++i){
        if(f[a[i]]){
            if(num[a[i]] == 1){
                ans++;
            }
            for(int j = a[i]; j <= a.back(); j = j + a[i]){
                f[j] = false;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7960
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t x;
    cin >> x;
    vi prime(0);
    prime.push_back(2);
    for(int i=2; i<=100010; i++){
        rep(j,prime.size()){
            if(i%prime.at(j)==0){
                break;
            }
            if(j==prime.size()-1){
                prime.push_back(i);
            }
        }
    }
    cout << *lower_bound(prime.begin(), prime.end(), x) << endl;
}


Measured memory_bytes: 512
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function permutation(a,n)
	ans = Array{Int,1}[copy(a)]
	c = ones(Int,n)
	i = 1
	while i<=n
		if c[i]<i
			if i%2==1
				tmp = a[1]
				a[1] = a[i]
				a[i] = tmp
			else
				tmp = a[c[i]]
				a[c[i]] = a[i]
				a[i] = tmp
			end
			c[i] += 1
			i = 1
			push!(ans,copy(a))
		else
			c[i] = 1
			i += 1
		end
	end
	ans
end

function calc(a::Array{Int,1})
	l = length(a)
	x = 0
	for i in 1:l
		x += a[i]*10^(l-i)
	end
	x
end

function main()
	n = readline() |> parseInt
	p = readline() |> split |> parseMap
	q = readline() |> split |> parseMap
	perm = permutation([i for i in 1:n],n)
	pb = [calc(perm[i]) for i in 1:length(perm)]
	pb = sort(pb)
	px = calc(p)
	qx = calc(q)
	a = 0
	b = 0
	for i in 1:length(perm)
		if pb[i]==px
			a = i
		end
		if pb[i]==qx
			b = i
		end
	end
	println(abs(a-b))
end

main()

Measured memory_bytes: 170904
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define reps(i, n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
    int n,d;
    cin>>n>>d;
    cout<<(n+(2*d+1)-1)/(2*d+1)<<endl;
}


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

typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') insert(key);
    else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L') deleteLast();
      } else deleteKey(key);
    }
  }
  printList();
  return 0;
}


Measured memory_bytes: 33004
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int x1, x2, x3, x4, x5;

    cin >> x1 >> x2 >> x3 >> x4 >> x5;

    int i = 0;

    if (x1 == 0)
    {
        i = x3 - x2;
    }

    if (x2 == 0)
    {
        i = x1 + 1;
    }

    if (x3 == 0)
    {
        i = x2 + 1;
    }

    if (x4 == 0)
    {
        i = x3 + 1;
    }

    if (x5 == 0)
    {
        i = x4 + 1;
    }

    cout << i << endl;
}

Measured memory_bytes: 3620
raw_condition = raw_input()
result_line = raw_input()

N = int(raw_condition.split(" ")[0])
A = int(raw_condition.split(" ")[1])
B = int(raw_condition.split(" ")[2])

current_num = 0
international_ranking = 0
for result in result_line:
    if result == 'a':
        if current_num < A+B:
            current_num += 1
            print "Yes"
        else:
            print "No"
    elif result == 'b':
        if current_num < A+B and international_ranking < B:
            current_num += 1
            international_ranking += 1
            print "Yes"
        else:
            print "No"
    else:
        print "No"

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


int main(){
	long long a,b,c,d;
	long long int t;
	cin>>a>>b>>c>>d;
	if (a<0&&c<0) t=max((a*c),(b*d));
	else if (b>=0&&d>=0) t=b*d;
	else if (b>0&&d<0 ) t=d*a;
	else if (d>0&&b<0) t=c*b;
	else t=b*d;
	cout<<t;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;



int main(){
	ll a, b, c;
	cin>>a>>b>>c;
	if(c%(a+b)<=a){
		cout<<c<<endl;
		return 0;
	}
	if((a+b)%60==0){
		cout<<-1<<endl;
		return 0;
	}
	for(int i = 0; i < 1e7; i++){
		c+=60LL;
		if(c%(a+b)<=a){
			cout<<c<<endl;
			return 0;;
		}
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 1160
#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)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,v,p;cin>>n>>m>>v>>p;
    vector<ll> a(n);rep(i,n)cin>>a[i];
    sort(a.rbegin(),a.rend());
    vector<ll> sum(n+1);sum[0]=0;
    for(int i=0; i<n; i++){
        sum[i+1]=sum[i]+a[i];
    }
    //for(int i:sum)cout<<i<<endl;
    ll l = p-1, u = n;
    while(l+1<u){
        ll c = (l+u)/2;
        ll rem = max(v-p-n+c+1, 0LL);
        //if((n-p)*(m+a[c])>m*rem+sum-a[c]&&a[p-1]<=m+a[c])l=c;
        if((c-p+1)*(m+a[c])>=m*rem+sum[c]-sum[p-1]&&a[p-1]<=m+a[c])l=c;
        else u=c;

    }

    /*ll d = 8;
    ll re = max(v-p,0LL);
    cout<<(d-p+1)*(m+a[d])<<","<<m*(re-n+d+1)+sum[d]-sum[p-1]<<endl;*/
    cout<<l+1;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define P pair<ll, ll>

typedef vector<ll> vec;
typedef vector<vec> mat;

int main(){
    ll n, d;
    cin >> n >> d;
    ll x[n], y[n];
    rep(i, n) cin >> x[i] >> y[i];
    ll ans = 0;
    rep(i, n) {
        if(x[i] * x[i] + y[i] * y[i] <= d * d) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6720
#include <stdio.h>

int main(void){
    int num,sum,i,year,mon,day;
    scanf("%d",&num);
    for(i=0;i<num;i++){
        sum=0;
        scanf("%d %d %d",&year,&mon,&day);
        while(year != 1000){
        if(year % 3 == 0 || mon % 2 != 0){
            sum+=20-day;
        }
        else if(mon % 2 == 0){
            sum+=19-day;
        }
        day=0;
        mon++;
        if(mon == 11){
            mon=1;
            year++;
        }
        }
        printf("%d\n",sum+1);
    }
    return 0;
}

Measured memory_bytes: 596
l = int(input())
k=list(map(int,input().split()))
m = []
for i in k:
  if i % 2 == 0:
    m.append(i)
for x in range(len(m)):
  if m[x] % 3 == 0 or m[x]%5==0:
    continue
  else:
    print("DENIED")
    exit()
print("APPROVED")

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=1e9+7;
#define INF 1e9+7
#define N 400001
#define MAX_V 400010
#define vec vector<int>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<ll,int,custom_hash>
struct pair_hash
{
    template<class T1,class T2>
    size_t operator() (const pair<T1,T2> &p)const{
        return hash<T1>()(p.first)^hash<T2>()(p.second);
    }
};
main(){
    string s;cin>>s;
    ll ans=0;
    ll black=0;
    rep(i,s.size()){
        if(s[i]=='B')black++;
        else ans+=black;
    }
    cout<<ans;
}

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

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int min = N;
  int cnt = 0;
  
  rep(i, N){
    if(i == 0){
      rep(j, N-1){
        if(S.at(j+1) == 'E'){
          cnt++;
        }
      }
      min = cnt;
    }
    else{
      if(S.at(i-1) == 'W'){
        cnt++;
      }
      if(S.at(i) == 'E'){
        cnt--;
      }
      if(cnt < min){
        min = cnt;
      }
    }
  }
  
  cout << min << endl;
}

Measured memory_bytes: 900