akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define gc getchar_unlocked
#define foi(i,n) for(int i=0;i<n;i++)
#define Foi(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define fol(i,n) for(ll i=0;i<n;i++)
#define Fol(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<pii>     vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m){
    int i, u, v;
    while(m--){
        cin>>u>>v;
        g[u-1].pb(v-1);
        g[v-1].pb(u-1);
    }
}

void dfs(int u, int par){
    for(int v:g[u]){
        if (v == par) continue;
        dfs(v, u);
    }
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    n%=10;
    if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon\n";
    else if(n==0||n==1||n==6||n==8)
        cout<<"pon\n";
    else
    {
        cout<<"bon\n";
    }
       
    return 0;
}

Measured memory_bytes: 10612
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define STRMAX 50

using namespace std;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;

bool boin(char c) {
    if (c == 'a'|| c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        return true;
    } else {
        return false;
    }
}

void change(string& str) {
    int len = (int)str.length();
    string ret = "";
    ret += str[0];
    for (int i = 1; i < len; i++) {
        if (boin(str[i - 1])) {
            ret += str[i];
        }
    }
    str = ret;
    return;
}

int main(void) {
    while(1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        VS vec(n);
        set<string> st;
        for (int i = 0; i < n; i++) {
            string str;
            cin >> str;
            change(str);
            vec[i] = str;
            st.insert(str);
        }

        if (st.size() != n) {
            cout << -1 << endl;
            continue;
        } else {
            for (int j = 0; j < STRMAX; j++) {
                set<string> stk;
                for (int k = 0; k < n; k++) {
                    string target = vec[k].substr(0, j + 1);
                    stk.insert(target);
                }
                if (stk.size() == n) {
                    cout << j + 1 << endl;
                    break;
                }
            }
        }
    }
    return 0;
}

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

int main() {
	int A,B;
	cin >> A >>B;
	if(A==B){
		cout<<"Draw";
		return 0;
	}
	if(A==1){
		cout<<"Alice";
		return 0;
	}
	if(B==1){
		cout<<"Bob";
		return 0;
	}
	if(A < B){
		cout<<"Bob";
		return 0;
	}
	if(A > B){
		cout<<"Alice";
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, M;
	cin >> N >> M;

	int sum = 0;
	REP(_, M){
		int a;
		cin >> a;
		sum += a;
	}

	cout << max(-1, N - sum) << endl;


	return 0;
}


Measured memory_bytes: 3652
from collections import Counter
from collections import defaultdict

N = map(int, input().split())
D = list(map(int, input().split()))




c = Counter(D)


# 高橋君と同じ時間帯の人が一人でもいれば、時差の最小は常に0
if c[0] >= 2:
    print(0)
    exit(0)

# 高橋君との時差がdの人が3人以上いる場合も、時差の最小は常に0（同じ時間帯の都市に二人以上いることになるから）
for i in c.values():
    if i >= 3:
        print(0)
        exit()


times = defaultdict(int)
c[0] += 1
# 0時との時間差をとるときに24がいたほうがよいか？なくてもいいか。
c[24] += 1
before_12 = True
D.sort()
for d in D:
    if before_12:
        times[d] += 1
        before_12 = False
    else:
        times[24-d] += 1
        before_12 = True


# 高橋君との時差で答えを初期化
ans = min(D)

tlst = list(times.keys())
tlst.sort()

for a,b in zip(tlst, tlst[1:]):
    ans = min(ans, b - a)

print(ans)


Measured memory_bytes: 3444
import java.util.Scanner;

//c が母音であるとき、vowel と、そうでないとき consonant と出力せよ
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char c = sc.next().charAt(0);
		
		if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c ==  'o') {
			System.out.println("vowel");
		} else {
			System.out.println("consonant");
		}

	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
 
using namespace std;
int main(void){
 
    int n,m;
    int a;
    int b[1000]={0};
    int c[1000]={0};
    int v;
    int i,j;
    for(;;){
 
    cin >> n;
    cin >> m;
    for (i = 0; i < 1000; i++) b[i] = 0; 
    if(n==0&&m==0)break;
    for( i=0;i<n;i++){
        for( j=0;j<m;j++){
 
            cin >> a;
            b[j]+=a;
 
        }
    }
    v = 0;
    for( i=n;i>=0;i--){
        for(j=0;j<m;j++){
 
            if(b[j]==i){
                c[v]=j;
                v++;
            }
        }
    }
    for(j=0;j<m;j++){
 
        printf("%d%c", c[j] + 1, j == m - 1 ? '\n' : ' ');
        }
    }
 
    return 0;
}

Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
num = {i:0 for i in range(10**5+1)}
for a in A:
    num[a] += 1
ans = sum(A)
for _ in range(Q):
    B, C = map(int, input().split())
    num_B = num[B]
    num_C = num[C]
    num[C] += num_B
    num[B] = 0
    #print(B, num_B)
    #print(C, num_C)
    ans += -num_B*B + (num[C]-num_C)*C
    print(ans)

Measured memory_bytes: 24596
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

A, B = LI()

da = int(0)
db = int(0)

a = A-1
b = B

if a%2==0:
    da = a
if ((a+1)//2)%2==1:
    da +=1

if b%2==0:
    db = b
if ((b+1)//2)%2==1:
    db +=1

ans = da^db
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long count=0;
  string s;cin>>s;
  int a=0;
  for(int i=0;i+1<s.size();){
    if((s[i]=='A'&&s[i+1]=='A')||(s[i]=='A'&&s[i+1]=='B')){
      a++;
      i++;
    }
    else if(s[i]=='B'&&s[i+1]=='C'){
      count+=a;
      i++;
    }
    else if((s[i]=='B'&&s[i+1]=='B')||(s[i]=='C'&&s[i+1]=='C')
            ||(s[i]=='A'&&s[i+1]=='C')||(s[i]=='B'&&s[i+1]=='A')){
      a=0;
      i++;
    }
    else if((s[i]=='C'&&s[i+1]=='A')||(s[i]=='C'&&s[i+1]=='B'))i++;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	int W, H, x, y, r;

	cin >> W >> H >> x >> y >> r;

	if (0 <= x - r&&x + r <= W && 0 <= y - r&&y + r <= H)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;
#define VQ vector<priority_queue<pair<ll,vector<int>>>>
#define VQQ vector<vector<pair<ll,vector<int>>>>


const int MAX = 1010000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main() {
	COMinit();

	int x, y;
	cin >> x >> y;

	int cnt;
	int cnt1;
	bool b = false;
	REP(i, x + 1) {
		if ((x - i) % 2 == 1)continue;
		int tmp = i + ((x - i) / 2);
		if (y == i * 2 + (x - i)/2) {
			b = true;
			cnt = i;
			cnt1 = tmp;
		}
	}
	if (!b) {
		cout << 0 << endl;
		return 0;
	}

	cout << COM(cnt1, cnt) << endl;
	

}


Measured memory_bytes: 24064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[][] graph = new int[n][n];
      String[] vInfo;
      int degree;

      for(int i=0; i<n; i++) {
        vInfo = br.readLine().split(" ");
        degree = Integer.parseInt(vInfo[1]);
        for(int j=0,k=2,v=0; j<degree; j++) {
          v = Integer.parseInt(vInfo[k++]);
          graph[i][v-1] = 1;
        }
      }

      StringBuilder buf = new StringBuilder();
      for (int[] i : graph) {
        for (int v : i) {
          buf.append(v).append(" ");
        }
        buf.setLength(buf.length()-1);
        buf.append("\n");
      }

      System.out.print(buf);
    }
    catch (IOException e) {
      System.out.println("IOException!");
    }
  }
}


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

int main(){
int a,b,c;
  cin>>a>>b>>c;
  if(a+b<b+c && a+b<a+c){cout<<a+b<<endl;}
else if(b+c<a+c && b+c<a+b){cout<<b+c<<endl;}
else{cout<<c+a<<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

using namespace std;

typedef long long ll;

#define f first
#define s second

ll a, b, k;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> a >> b >> k;
  if (k >= a) {
    k -= a;
    cout << 0 << " " << max(0ll, b - k);
  }
  else {
    cout << a - k << " " << b;
  }
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
ok = 10**12
ng = -1


def check(time):
    shugyou = 0
    for i in range(N):
        if A[i]*F[i] > time:
            shugyou += A[i] - (time//F[i])
    return shugyou <= K


while ok - ng > 1:
    mid = (ok + ng)//2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)


Measured memory_bytes: 113704
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[1000000],b[1000000]={};
signed main(){
  ll n;
  cin>>n;
  for(ll i=1;i<=n;i++){
	cin>>a[i];
    b[a[i]]++;
  }
  for(ll i=1;i<=n;i++){
	cout<<b[i]<<"\n";
  }
  return 0;
}


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

int main(){
    string n;
    cin >> n;
    if(n[0] == '7' || n[1] == '7' || n[2] == '7'){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <vector>
using namespace std;

int deg[100010];
vector<int> con[100010];
vector<long long> in[100010];
long long p[100010];

bool dfs(int x, int par){
  if(deg[x] == 1){ // leaf
    in[par].push_back(p[x]);
    return true;
  }

  for(int y : con[x]){
    if(y != par && !dfs(y, x)) return false;
  }

  long long tot = 0, mx = 0;
  for(long long v : in[x]){
    tot += v; if(v > mx) mx = v;
  }

  long long mat = tot - p[x];
  if(mat < 0) return false;

  if(tot < 2 * mat || tot - mx < mat) return false;
  if(tot != 2 * mat) in[par].push_back(tot - 2 * mat);
  return true;
}

int main(){
  int N; scanf("%d", &N);
  for(int i = 1; i <= N; i++) scanf("%lld", &p[i]);

  for(int i = 1; i <= N - 1; i++){
    int x, y; scanf("%d%d", &x, &y);
    deg[x]++; deg[y]++;
    con[x].push_back(y); con[y].push_back(x);
  }

  if(N == 2){
    puts(p[1] == p[2] ? "YES" : "NO");
    return 0;
  }

  int P = -1;
  for(int i = 1; i <= N; i++) if(deg[i] > 1){ P = i; break; }

  if(!dfs(P, 0) || !in[0].empty()) puts("NO");
  else puts("YES");

  return 0;
}


Measured memory_bytes: 16640
from math import *
def calcAngle(h,m): 
        if (h == 12): 
            h = 0
        if (m == 60): 
            m = 0
        hour_angle = 0.5 * (h * 60 + m) 
        minute_angle = 6 * m 
        angle = abs(hour_angle - minute_angle) 
        angle = min(360 - angle, angle) 
        return radians(angle)
a,b,h,m=map(int,input().split())
angle = calcAngle(h,m)
l=(b-a*cos(angle))**2
r1=a**2
r2=(a*cos(angle))**2
print('{0:.{1}f}'.format(sqrt(l+r1-r2),20))
# print("{0.20f}".format(sqrt(l+r1-r2)))

Measured memory_bytes: 9472
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e6 + 6;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> cnt(N);
    for(int i=0;i<n;i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    bool pairwise = true;
    for(int p=2;p<=N;p++) {
        int cur = 0;
        for(int i=p;i<=N;i+=p) {
            cur += cnt[i];
        }
        if(cur > 1) {
            pairwise = false;
            break;
        }
    }
    if(pairwise) {
        cout << "pairwise coprime" << endl;
        return;
    }
    int g = a[0];
    for(int i=1;i<n;i++) g = gcd(g, a[i]);
    if(g == 1) {
        cout << "setwise coprime" << endl;
        return;
    }
    cout << "not coprime" << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


Measured memory_bytes: 15028
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
const int N=305;
int n,cnt[4];
double dp[N][N][N];
bool vis[N][N][N];
double dfs(int i,int j,int k){
	if(i==0&&j==0&&k==0) return 0;
	if(vis[i][j][k]) return dp[i][j][k];
	vis[i][j][k]=1;
	if(k!=0) dp[i][j][k]+=(k*1.0*dfs(i,j+1,k-1)/n);
	if(j!=0) dp[i][j][k]+=(j*1.0*dfs(i+1,j-1,k)/n);
	if(i!=0) dp[i][j][k]+=(i*1.0*dfs(i-1,j,k)/n);
	dp[i][j][k]++;
	dp[i][j][k]/=1.0*(i+j+k)/n;
	return dp[i][j][k];
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {int x;scanf("%d",&x);cnt[x]++;}
	printf("%.14lf\n",dfs(cnt[1],cnt[2],cnt[3]));
	
}

Measured memory_bytes: 246016
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
int main()
{
	int n = 0;
	int a = 0;
	cin >> n >> a;
	cout << (n * n) - a << endl;
}

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

double h(double a,double b,double c){
  double s = (a+b+c)/2;
  return sqrt( (s-a)*(s-b)*(s-c)*s );
}

int main(){
  double a,l,x;
  while(scanf("%lf%lf%lf",&a,&l,&x)!=EOF)
    printf("%.8lf\n",h(l,l,a)+2*h((l+x)/2,(l+x)/2,l));
}

Measured memory_bytes: 1084
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if (a>0&&b>0) cout<<"Positive"<<endl;
    else if(max(a,b)>=0&& min(a,b)<=0)cout<<"Zero"<<endl;
    else if((abs(min(a, b))-abs(max(a, b)))%2==0) cout <<"Negative"<<endl;
    else cout <<"Positive"<<endl;   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007;
#define pi 3.14159265358979323846264
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vl vector <long long>
#define vpii vector <pair <int, int> >
#define ll long long
#define fi first
#define se second
int n;
bool notprime[1005];
ll ans=1;
int main() {
    scanf("%d", &n);
    for (int i=2;i<=1000;i++) {
        if (!notprime[i]) {
            for (int j=i+i;j<=1000;j+=i) notprime[j]=true;
        }
    }
    for (int i=2;i<=n;i++) {
        if (!notprime[i]) {
            ll x = i, sum=0;
            while (true) {
                if (x>n) break;
                sum+=(int)(1.0*n/x);
                x*=i; 
            }
            ans*=(sum+1);
            ans%=mod;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	string A,B,C;
	while(cin>>N>>A>>B>>C) {
		ll ans = 0;
		REP(i, N) {
			map<ll, char> h;
			h[A[i]]++;
			h[B[i]]++;
			h[C[i]]++;
			if(h.size()==2) ans++;
			if(h.size()==3) ans+=2;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


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

p = list(map(int,input().split()))
p.sort()

ans = 0

if N != 0 :
    for i in range(105):
        if p.count(i)==0 :
            if abs(X-i) < abs(X-ans) :
                ans = i
    print(ans)
else :
    print(X)


Measured memory_bytes: 9128
N = gets
ary = gets.chomp.split(' ').map(&:to_i).select{|num| num.even?}

if ary.length == 0
  puts "APPROVED"
  exit;
end

for n in ary do
  if n % 5 != 0 and n % 3 != 0
    puts "DENIED";
    exit
  end
end

puts "APPROVED";


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

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

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    char c; cin >> c;
    cout << (char)(c + 1) << "\n";
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] s = sc.Next().Select(c => c - '0').ToArray();

        var dp1 = new bool[1000];
        var dp2 = new bool[100];
        var dp3 = new bool[10];

        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < 100; j++)
            {
                if (dp2[j])
                {
                    dp1[j * 10 + s[i]] = true;
                }
            }

            for (int j = 0; j < 10; j++)
            {
                if (dp3[j])
                {
                    dp2[j * 10 + s[i]] = true;
                }
            }
            dp3[s[i]] = true;
        }

        int cnt = 0;
        for (int i = 0; i < 1000; i++)
        {
            if (dp1[i]) cnt++;
        }
        
        Console.WriteLine(cnt);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

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

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

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  int num, num1, num2;
  num1 = max(a, b);
  num2 = max(b, c);
  num = max(num1, num2);
  if(num == a) {
      cout << num*10+b+c << '\n';
  }else if(num == b) {
      cout << num*10+a+c << '\n';
  }else {
      cout << num*10+b+a << '\n';
  }

}

Measured memory_bytes: 256
n,x=map(int, input().split())
b=[1]*51
p=[1]*51
for i in range(50):
    b[i+1]=2*b[i]+3
    p[i+1]=2*p[i]+1    

def eat(l,x):
    if x==0:
        return 0
    if l==0:
        return 1
    if x<b[l-1]+2:
        ans=eat(l-1,x-1)
    else:
        ans=p[l-1]+1+eat(l-1,x-2-b[l-1])
    return ans
print(eat(n,x))

Measured memory_bytes: 3064
/**
 * Title: C - Skill Up
 * Url: https://atcoder.jp/contests/abc167/tasks/abc167_c
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int n, m, x; cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    for(int i=0; i<n; i++) {
        cin >> c[i];
        for(int j=0; j<m; j++) cin >> a[i][j];
    }

    ll ans = 1000000000000;
    bool flag = false;
    for(int bit=0; bit<(1<<n); ++bit) {
        vector<int> score(m, 0);
        ll okane = 0;
        for(int i=0; i<n; i++) {
            if(bit & 1<<i) {
                okane += c[i];
                for(int j=0; j<m; j++) {
                    score[j] += a[i][j];
                }
            }
        }
        bool tflag = true;
        for(int j=0; j<m; j++) {
            if(score[j]<x) {
                tflag = false;
                break;
            } 
        }
        if(tflag) {
            flag = true;
            ans = min(ans, okane);
        }
    }
    if(flag) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }


    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    Integer s = sc.nextInt();
    Integer w = sc.nextInt();
    if (s <= w) {
      System.out.println("unsafe");
    } else {
      System.out.println("safe");
    }
    sc.close();

  }
}

Measured memory_bytes: 35764
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back

using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const int MAX_N=100003;
const ll LINF=100000000000000000;

ll ub[MAX_N],det[MAX_N],t[MAX_N],a[MAX_N];

int main(){
  int N;
  cin >> N ;
  REP(i,1,N+1) scanf("%lld",&t[i]);
  REP(i,0,N) scanf("%lld",&a[i]);
  t[0]=0;
  a[N]=LINF;
  fill(det,det+N,0);
  fill(ub,ub+N,LINF);
  bool ok=true;
  rep(i,N){
    if(t[i+1]!=t[i]) det[i]=t[i+1];
    else ub[i]=t[i+1];
  }
  for(int i=N-1;i>=0;i--){
    if(a[i+1]!=a[i]){
      if(det[i]!=0 && det[i]!=a[i]){
        ok=false;
        break;
      }
      else det[i]=a[i];
    }else{
      ub[i]=min(ub[i],a[i]);
    }
  }
  rep(i,N){
    if(det[i]>ub[i]){
      ok=false;
      break;
    }
  }
  if(!ok) cout << "0" << endl;
  ll cnt=1;
  rep(i,N){
    if(det[i]==0){
      cnt=(cnt*ub[i])%mod;
    }
  }
  if(ok) cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

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

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

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    string S;
    cin>>S;
    
    vll E(N),W(N);
    if(S[0]=='E')E[0]=1;
    else W[0]=1;
    for(ll i=1;i<N;i++){
        if(S[i]=='E'){
            E[i]=E[i-1]+1;
            W[i]=W[i-1];
        }else{
            E[i]=E[i-1];
            W[i]=W[i-1]+1;
        }
    }
    
    ll ans=LLMAX;
    for(ll i=0;i<N;i++){
        if(i==0){
            chmin(ans,E[N-1]-E[0]);
            //printf("%d:%d\n",i,E[N-1]-E[0]);
        }else if(i==N-1){
            chmin(ans,W[N-2]);
            //printf("%d:%d\n",i,W[N-2]);
        }else{
            chmin(ans,W[i-1]+E[N-1]-E[i]);
            //printf("%d:%d\n",i,W[i-1]+E[N-1]-E[i]);
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 5396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  //freopen("input.txt","r",stdin);
#endif

  ll n;
  cin>>n;
  ll sum=0;
  sum+=(n/500)*1000;
  n=n%500;
  sum+=(n/5)*5;
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
#include <cstdint>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long int ll;
typedef pair<int, int> P;
const vector<int> di = { -1, 0, 1, 0 };
const vector<int> dj = { 0, 1, 0, -1 };


int main() {

	string s;
	cin >> s;
	int a = 0;
	int z = 0;
	rep(i, s.size()) {
		if (s.at(i) == 'A') {
			a = i;
			break;
		}
	}
	for (int i = s.size() - 1; i > 0; i--) {
		if (s.at(i) == 'Z') {
			z = i;
			break;
		}
	}
	cout << z - (a - 1) << endl;



	
	return 0;
}

Measured memory_bytes: 640
S = input()
T = input()
A = len(T)  
ls = []
for i in range(len(S)-len(T)+1):
    ls.append(S[i:i+len(T)])
for i in range(len(ls)):
    same = 0
    for j in range(len(T)):
        if T[j] == ls[i][j]:
            same += 1;
        if len(T)-same < A:
            A = len(T)-same
print(A)

Measured memory_bytes: 73820
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	ll N;
	cin>>N;
	VI A(N);
	VI B(N);
	ll a=0,b=0;
	REP(i,N){
		cin>>A[i]>>B[i];
		ll aa,bb;
		if(a==0 && b==0)a=A[i],b=B[i];
		else{
			if(a%A[i])aa=a/A[i]+1;
			else aa=a/A[i];
			
			if(b%B[i])bb=b/B[i]+1;
			else bb=b/B[i];
			
			ll n=max(aa,bb);
			
			a=n*A[i],b=n*B[i];
		}
	}
	
	cout<<a+b<<endl;
	return 0;
}

Measured memory_bytes: 256
def func(s1, s2):
    set1 = set(s1)
    set2 = set(s2)

    cnt = 0
    for _ in range(len(set1)):
        s = set1.pop()
        if s in set2:
            cnt += 1
    return cnt


def main():
    n = int(input())
    s = input()

    mx = 0
    for i in range(len(s) - 1):
        s1 = s[:i + 1]
        s2 = s[i + 1:]
        ans = func(s1, s2)
        if ans > mx:
            mx = ans

    print(mx)


if __name__ == '__main__':
    main()
    # print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n, a, b, c;
vi l;
int ans = INF;

void rec(int i, int la, int lb, int lc, int mp) {
  if (i == n) {
    if (la == 0 || lb == 0 || lc == 0) return;
    mp += abs(a-la) + abs(b-lb) + abs(c-lc);
    ans = min(ans, mp);
    return;
  }
  rec(i+1, la+l[i], lb, lc, mp+10-(la==0?10:0));
  rec(i+1, la, lb+l[i], lc, mp+10-(lb==0?10:0));
  rec(i+1, la, lb, lc+l[i], mp+10-(lc==0?10:0));
  rec(i+1, la, lb, lc, mp);
  return;
}

int main () {
  cin >> n >> a >> b >> c;
  l = vi(n);
  rep(i,n) cin >> l[i];
  rec(0,0,0,0,0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
V = input().split()
C = input().split()
X = [int(V) for V in V]
Y = [int(C) for C in C]

XY = []
s = 0
for k in range(N):
    xy = X[k] - Y[k]
    XY.append(xy)

for i in range(N):
    if XY[i] > 0:
        s = s + XY[i]

print(s)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

class Union_Find
{
	std::vector<LL>per, rank, cnt;
public:
	void init(LL size)
	{
		rep(i, size)
		{
			per.push_back(i);
			rank.push_back(0);
			cnt.push_back(1);
		}
	}
	LL get_per(LL x)
	{
		if (x == per[x]) return x;
		return per[x] = get_per(per[x]);
	}
	bool is_same_per(LL x, LL y)
	{
		return get_per(x) == get_per(y);
	}
	LL togett(LL x, LL y)
	{
		LL x_per = get_per(x), y_per = get_per(y);
		if (x_per == y_per) return 0;
		LL res = cnt[x_per] * cnt[y_per];
		if (rank[x_per] < rank[y_per])
		{
			per[x_per] = y_per;
			cnt[y_per] += cnt[x_per];
			cnt[x_per] = 0;
		}
		else
		{
			per[y_per] = x_per;
			cnt[x_per] += cnt[y_per];
			cnt[y_per] = 0;
			if (rank[x_per] == rank[y_per]) ++rank[x_per];
		}
		return res;
	}
};

int main()
{
	LL N, M;
	in >> N >> M;
	std::vector<LL>A(M), B(M);
	rep(i, M) in >> A[i] >> B[i];

	Union_Find tree;
	tree.init(N + 1);

	std::vector<LL>ans;
	LL res = N * (N - 1) / 2;
	ans.push_back(res);
	rep(i, M - 1)
	{
		res -= tree.togett(A[M - i - 1], B[M - i - 1]);
		ans.push_back(res);
	}
	std::reverse(ans.begin(), ans.end());
	rep(i, M) out << ans[i] << std::endl;
}


Measured memory_bytes: 6112
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    ll N;
    cin >> N;
    vec<ll> a(3*N);
    REP(i, 3*N){
        cin >> a[i];
    }
    sort(ALLR(a));
    ll sum = 0;
    REP(i, N){
        sum += a[2*i+1];
    }
    cout << sum << el;
}



Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cfloat>
#include <climits>
#include <cassert>
#include <random>

struct Island {
	int p, d;
};
constexpr long long int INF = LLONG_MAX >> 1;

void set_memo(const Island current, const int from, const int until, const int left, const int right_until, const std::vector<Island>& single, const std::vector<long long int> &prev, std::vector<long long int> &memo, const std::vector<long long int> &sum_diff) {
	if (from == until) return;
	if (prev[right_until] == INF) return;
	const auto mid = (from + until) / 2;
	long long int min = prev[mid];
	int best = std::max(mid, left);
	long long int sum = sum_diff[best] - sum_diff[mid];
	for (int i = best, rest = current.d - best + mid; i < right_until && rest > 0; ++i, --rest) {
		sum += std::abs(current.p - single[i].p);
		if (min > sum + prev[i + 1]) {
			min = sum + prev[i + 1];
			best = i;
		}
	}
	memo[mid] = min;
	set_memo(current, from, mid, left, best + 1, single, prev, memo, sum_diff);
	set_memo(current, mid + 1, until, best, right_until, single, prev, memo, sum_diff);
}
int main(){
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		std::vector<Island> islands(n), single, many;
		for (auto& i : islands) std::cin >> i.p >> i.d;
		std::sort(islands.begin(), islands.end(), [](Island a, Island b) {return a.p < b.p; });
		for (const auto i : islands) {
			if (i.d == 1) {
				single.push_back(i);
			}
			else {
				many.push_back(i);
			}
		}
		if (many.empty() && single.size() == 2) {
			std::cout << single.back().p - single.front().p << '\n';
			continue;
		}
		long long int cost = 0;
		for (auto i = 1; i < many.size(); ++i) {
			cost += many[i].p - many[i - 1].p;
		}
		long long int count = 0;
		if (many.size() != 1) for (auto i = 0; i < many.size(); ++i) {
			if (i == 0 || i == many.size() - 1) {
				--many[i].d;
			}
			else {
				many[i].d -= 2;
			}
			count += many[i].d;
		}
		else {
			count = many.front().d;
		}
		if (count < single.size()) {
			std::cout << "-1\n";
			continue;
		}
		std::vector<std::vector<long long int>> memo(2, std::vector<long long int>(single.size() + 1, INF));
		std::vector<long long int> sum_diff(single.size() + 1, 0);
		memo.front().back() = memo.back().back() = 0;
		std::reverse(many.begin(), many.end());
		for (auto i = 0; i < many.size(); ++i) {
			for (auto j = 0; j < single.size(); ++j) {
				sum_diff[j + 1] = sum_diff[j] + std::abs(single[j].p - many[i].p);
			}
			set_memo(many[i], 0, single.size(), 0, single.size(), single, memo[i & 1], memo[(i + 1) & 1], sum_diff);
		}
		if (memo[many.size() & 1].front() == INF) {
			std::cout << -1 << '\n';
		}
		else {
			std::cout << (cost + memo[many.size() & 1].front()) << '\n';
		}
	}
}



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


int main() {
	long long N;
	cin >> N;
	long long sum = 0;
	for (long long i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}

	cout << sum;

	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3576