akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef unsigned long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[200010],B[200010];
pair<int,int> p[200010];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i]>>B[i];
		
	}
	sort(A,A+N);
	sort(B,B+N);
	if(N%2==0){
		int a=B[N/2-1];
		int b=B[N/2];
		int c=A[N/2-1];
		int d=A[N/2];
		cout<<a+b-c-d+1<<endl;
	}
	else{
		cout<<B[N/2]-A[N/2]+1<<endl;
	}
	return 0;
}


Measured memory_bytes: 6652
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
using namespace std;
typedef long long ll;

int const SIZ = 100000001;
bitset<SIZ> chk;

void sieve() {
    chk.set();
    chk.set(0, 0);
    chk.set(1, 0);
    for (int i=4; i<SIZ; i+=2) {
        chk.set(i, 0);
    }
    for (int i=3; i*i<SIZ; i+=2) {
        if ( ! chk[i]) continue;
        for (int j=2; i*j<SIZ; ++j) {
            chk.set(i*j, 0);
        }
    }
}

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

    sieve();

    int n;
    cin >> n;
    int m, ans = 0;
    for (int i=0; i<n; ++i) {
        cin >> m;
        if (chk[m]) {
            ++ ans;
            chk[m] = 0;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13404
# ABC126D - Even Relation
def main():
    # same parity of distance from root <-> same group
    global T, D
    N, *A = map(int, open(0).read().split())
    T = [[] for _ in range(N + 1)]
    for i in range(0, (N - 1) * 3, 3):
        v, u, w = A[i : i + 3]
        T[v] += [(u, w)]
        T[u] += [(v, w)]
    D = [-1] * (N + 1)  # D[i] := parity of distance from vertex 1 (root)
    D[1] = 0
    stack = [1]  # dfs starting from root
    while stack:
        v = stack.pop()
        for u, w in T[v]:
            if D[u] == -1:
                D[u] = (D[v] + w) % 2
                stack.append(u)
    print(*D[1:], sep="\n")


if __name__ == "__main__":
    main()

Measured memory_bytes: 42824
const int dx[]={1,0,0,1, 1,0, 0,1,-1,1, 1, 1, 1};
const int dy[]={0,1,0,1,-1,1, 1,0, 0,1, 1,-1,-1};
const int dz[]={0,0,1,0, 0,1,-1,1, 1,1,-1, 1,-1};
M[9][9][9],H[9][9],q[2];main(n,m,p,I,x,y,z,j,c,d,J){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,I=0,sizeof(M)),memset(H,I=0,sizeof(H)),c=1;I++<p;c*=-1){
		scanf("%d%d",&x,&y);
		M[x][y][z=++H[x][y]]=c;
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(q[j]=0;;q[j]+=2*j-1)if(M[x+dx[d]*q[j]][y+dy[d]*q[j]][z+dz[d]*q[j]]!=c)break;
			if(q[1]-q[0]-1>=m){printf(c==1?"Black %d\n":"White %d\n",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I++<p;)scanf("%d%d",&x,&y);
}exit(0);}

Measured memory_bytes: 612
fun main(args: Array<String>) {
    val (h, n) = readLine()!!.split(" ").map { it.toInt() }
    val a = IntArray(n)
    val b = IntArray(n)
    for (i in 0 until n) {
        readLine()!!.split(" ").map { it.toInt() }.let {
            a[i] = it[0]
            b[i] = it[1]
        }
    }

    val dp = IntArray(h+1)
    for(i in 1..h){
        dp[i] = (0 until n).map {
            dp.getOrElse(i - a[it]){0} + b[it]
        }.min()!!
    }
    println(dp[h])
}

Measured memory_bytes: 112376
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    string s;
    cin >> s;
    string ans = "Yes";
    rep(i,s.size()) {
        if ((i+1)%2==1) {
            if (s[i]=='L') ans = "No";
        } else {
            if (s[i]=='R') ans = "No";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    map<int,int>mp;
    vector<int>D(N);
    for(int i = 0; i < N; i++) {
        cin >> D[i];
        mp[D[i]]++;
    }
    int M;
    cin >> M;
    for(int i = 0; i < M; i++) {
        int T;
        cin >> T;
        if(mp[T] <= 0) {
            cout << "NO" << endl;
            return 0;
        }
        mp[T]--;
    }
    cout << "YES" << endl;
}

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

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

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

    int n;
    cin >> n;

    int nm = 100000;

    vector<int> a{1, 6, 9, 36, 216, 1296, 7776, 46656, 81, 729, 6561, 59049};
    sort(a.begin(), a.end());

    vector<int> dp(nm + 1, 10000);
    dp[0] = 0;
    dp[1] = 1;
    for (int i = 2; i < nm + 1; i++) {
        for (int j = 0; j < a.size(); j++) {
            if(i-a[j]<0){
                break;
            }else{
                dp[i] = min(dp[i], dp[i - a[j]] + 1);
            }
        }
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>

using namespace std;

#define rep(i,a,b) for(int i=a;i<b;++i)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int const N = 2e5 + 41;
ll const INF = 1e18;

int n, q, a, b;
ll x[N];
ll suf[N];
int per[N], pos[N];

ll tminus[N * 4], tplus[N * 4];
ll la[N * 4];

void push(int v, int tl, int tr){
	if(tl != tr){
		tminus[v*2+1] += la[v];
		tminus[v*2+2] += la[v];
		tplus[v*2+1] += la[v];
		tplus[v*2+2] += la[v];
		la[v*2+1] += la[v];
		la[v*2+2] += la[v];
	}
	la[v] = 0;
}

void add(ll val){
	tminus[0] += val;
	tplus[0] += val;
	la[0] += val;
}

void remin(ll *t, int v, int tl, int tr, int p, ll val){
	push(v, tl, tr);
	if(tl == tr){
		t[v] = min(t[v], val);
	}else{
		int tm = (tl+tr)/2;
		if(p <= tm) remin(t, v*2+1, tl, tm, p, val);
		else remin(t, v*2+2, tm+1, tr, p, val);
		t[v] = min(t[v*2+1], t[v*2+2]);
	}
}

ll get(ll *t, int v, int tl, int tr, int l, int r){
	if(tl > r || tr < l) return INF;
	if(l <= tl && tr <= r){
		return t[v];
	}
	push(v, tl, tr);
	int tm = (tl+tr)/2;
	ll ret = min(get(t, v*2+1, tl, tm, l, r), get(t, v*2+2, tm+1, tr, l, r));
	t[v] = min(t[v*2+1], t[v*2+2]);
	return ret;
}

void build(int v, int tl, int tr){
	if(tl == tr){
		tminus[v] = tplus[v] = INF;
	}else{
		int tm = (tl+tr)/2;
		build(v*2+1, tl, tm);
		build(v*2+2, tm+1, tr);
		tminus[v] = tplus[v] = INF;
	}
}

void solve(){
	cin >> n >> q >> a >> b;
	--a;--b;
	rep(i, 0, q){
		cin >> x[i];
		--x[i];
	}
	build(0, 0, n-1);
	remin(tminus, 0, 0, n-1, a, abs(b - x[0]) - a);
	remin(tplus, 0, 0, n-1, a, abs(b - x[0]) + a);
	remin(tminus, 0, 0, n-1, b, abs(a - x[0]) - b);
	remin(tplus, 0, 0, n-1, b, abs(a - x[0]) + b);

	rep(i, 1, q){
		ll newVal1 = get(tminus, 0, 0, n-1, 0, x[i]) + x[i];
		ll newVal2 = get(tplus, 0, 0, n-1, x[i], n-1) - x[i];
		ll newVal = min(newVal1, newVal2);
		add(abs(x[i] - x[i-1]));

		remin(tminus, 0, 0, n-1, x[i-1], newVal - x[i-1]); 
		remin(tplus, 0, 0, n-1, x[i-1], newVal + x[i-1]);
	}
	ll ans = INF;
	rep(i, 0, N){
		ll pansMin = get(tminus, 0, 0, n-1, i, i) + i;
		ll pansPlus = get(tplus, 0, 0, n-1, i, i) - i;
		ans = min(ans, min(pansMin, pansPlus));
	}
	cout << ans << endl;

}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if ((a - b) % 2 == 0){
    cout << (a + b) / 2 << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
  
}
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;
typedef int Data;
pair<vector<int>,vector<int>> compressor(vector<Data> c) {
  int n = c.size();
  vector<Data> v(c), w;
  vector<int> res(n);
  sort(v.begin(), v.end());
  auto itr = unique(begin(v),end(v));
  v.erase(itr,end(v));
  REP(i,v.size()) w.push_back(v[i]);
  REP(i,n) res[i] = lower_bound(w.begin(), w.end(), c[i]) - w.begin();
  return make_pair(v,res);
}

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> x(n);
  vector<int> y(n);
  vector<int> x1(m);
  vector<int> x2(m);
  vector<int> y1(m);
  vector<int> y2(m);
  REP(i,n)
    cin>>x[i]>>y[i];
  REP(i,m)
    cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
  vector<int> xl;
  vector<int> yl;
  REP(i,n){
    xl.push_back(x[i]);
    yl.push_back(y[i]);
  }
  vector<int> cmpx,cmpy,sxl,syl;
  tie(sxl, cmpx) = compressor(xl);
  tie(syl, cmpy) = compressor(yl);
  sxl.insert(begin(sxl),-1000000001);
  syl.insert(begin(syl),-1000000001);
  int w=sxl.size();
  int h=syl.size();
  vector<vector<int16_t>> t(h,vector<int16_t>(w));
  REP(i,n)
    ++t[cmpy[i]][cmpx[i]];
  vector<vector<int16_t>> t2(h+1,vector<int16_t>(w+1));
  REP(i,h) {
    vector<int16_t> t1(w+1);
    partial_sum(begin(t[i]),end(t[i]),begin(t1)+1);
    REP(j,w+1){
      t2[i+1][j] = t2[i][j] + t1[j];
    }
  }
  REP(i,m){
    int xi1,yi1,xi2,yi2;
    xi1=prev(lower_bound(begin(sxl),end(sxl),x1[i]))-begin(sxl);
    yi1=prev(lower_bound(begin(syl),end(syl),y1[i]))-begin(syl);
    xi2=prev(upper_bound(begin(sxl),end(sxl),x2[i]))-begin(sxl);
    yi2=prev(upper_bound(begin(syl),end(syl),y2[i]))-begin(syl);
    cout<<(t2[yi2][xi2]-t2[yi2][xi1]-t2[yi1][xi2]+t2[yi1][xi1])<<endl;
  }
  return 0;
}

Measured memory_bytes: 107128
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
while True:
    try:
        a, b = map(int, input().split())
        d = gcd(max(a, b), min(a, b))
        print(d, a * b // d)
    except:
        break

Measured memory_bytes: 7620
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  double l;
  cin >> l;
  l /= 3;
  cout << setpre(10) << l * l * l;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] A = new long[N];
		for(int i=0; i<N; i++) {
			A[i] = sc.nextLong();
		}
		Arrays.sort(A);
		long longer = 0;
		long shorter = 0;
		int shorter_comming = 0;
		long current = 0;
		for(int i=N-1; 0<=i; i--) {
			if(shorter_comming == 0) {
				if(current == A[i]) {
					longer = A[i];
					shorter_comming = 1;
					current = 0;
				} else {
					current = A[i];
				}
			} else {
				if(current == A[i]) {
					shorter = A[i];
					break;
				} else {
					current = A[i];
				}
			}
		}
		System.out.println(shorter * longer);
	}
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef long double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const DOUBLE EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 5e5 + 5;
deque<pair<DOUBLE, DOUBLE> > pol;

void solve(){
	int n, l;
	DOUBLE L;
	scanf("%d%d", &n, &l);
	L = l;
	pol.pb(mp((DOUBLE)0, (DOUBLE)0));
	pol.pb(mp(L, (DOUBLE)0));
	REP(i, 0, n) {
		ll t, v;
		scanf("%lld%lld", &t, &v);
		DOUBLE X = pol.back()._1 + v;
		DOUBLE Y = pol.back()._2 + v * t;
		
		//cout << X << " " << Y << endl;
		
		while(SZ(pol) > 1 && pol[1]._1 < X - L + EPS) {
			pol.pop_front();
		}
		if (SZ(pol) > 1) {
			DOUBLE x0 = X - L;
			DOUBLE y0 = pol[1]._2 - (pol[1]._2 - pol[0]._2) / (pol[1]._1 - pol[0]._1) * (pol[1]._1 - x0);
			pol[0] = mp(x0, y0);
		}
		
		while(SZ(pol) > 1) {
			DOUBLE k1 = (pol[SZ(pol) - 1]._2 - pol[SZ(pol) - 2]._2) / (pol[SZ(pol) - 1]._1 - pol[SZ(pol) - 2]._1);
			DOUBLE k = (Y - pol[SZ(pol) - 2]._2) / (X - pol[SZ(pol) - 2]._1);
			if (k1 > k + EPS) {
				pol.pop_back();
			} else {
				break;
			}
		}
		
		pol.pb(mp(X, Y));
		
		printf("%.12lf\n", (double)((Y - pol[0]._2) / (X - pol[0]._1)));
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 27828
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int A,B;
	scanf("%d %d",&A,&B);

	printf("%d\n",max(A+B,max(A-B,A*B)));

	return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(sc.next());
        Long[] d = new Long[n];
        Arrays.fill(d, 0L);
        long s = 0;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            if (i + a < n) d[i + a]++;
            if (i - a >= 0) s += d[i - a];
        }
        out.println(s);
        out.flush();
    }
}

Measured memory_bytes: 59916
inp = gets.split.map!(&:to_i)
apple = []  #美味しさの配列
apple_abs = []  #美味しさの絶対値の配列
inp[0].times do |i|
  apple << inp[1]+(i+1)-1  #インデックスとりんごの番号は１ズレてる
end
apple_abs = apple.map(&:abs).sort!  #これの0番目が食うやつ
#p apple  #for debug
#p apple_abs[0]  #for debug

ans = 0
apple.each do |v|
  ans += v if v.abs != apple_abs[0]
end
puts ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    string x,y;
	cin >> x>> y;
    string ans;
    if(x[0]==y[2]&&x[1]==y[1]&&x[2]==y[0])ans="YES";
    else ans = "NO";
      cout << ans << endl;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    int d = 0;
    if((b-1)%(a-1) == 0) d=(b-1)/(a-1);
    else d = (b-1)/(a-1) +1;
    cout << d << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, a, b;

bool solve() {
    return (b - a) % 2 == 0;
}

void input() {
    cin >> n >> a >> b;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << (solve()?"Alice":"Borys") << endl;
}


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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;
//#define DEBUG(x) ;

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

ll N, M, S, T;
vector<vector<ll>> G;
vector<vector<ll>> dist;

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N >> M;
	G.resize(N);
	dist.assign(3, vector<ll>(N, -1));
	// node, cnt;

	REP(i, M)
	{
		ll a, b; cin >> a >> b;
		--a, --b;
		G[a].push_back(b);
	}

	cin >> S >> T;
	--S, --T;

	queue<P> que;
	que.push(P(0, S));
	dist[0][S] = 0;
	
	while (que.size())
	{
		auto now = que.front();
		que.pop();

		ll prec = now.first;
		ll c = (prec + 1) % 3;
		ll n = now.second;

		for (auto &nv : G[n])
		{
			if (dist[c][nv] != -1) continue;
			dist[c][nv] = dist[prec][n] + 1;
			que.push(P(c, nv));
		}
	}

	ll t = dist[0][T];
	std::cout << (t == -1 ? t : t/3)<< std::endl;
	return 0;
}


Measured memory_bytes: 10896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxN = 3005;
int a[maxN], n;
vector<vector<ll>> dp(maxN, vector<ll>(maxN, 0));
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int L = n-1; L >= 0; L--) {
        for(int R = L; R < n; R++) {
            if (R == L) {
                dp[L][R] = a[L];
            } else {
                dp[L][R] = max(a[L] - dp[L+1][R], a[R] - dp[L][R-1]);
            }
        }
    }
    cout << dp[0][n-1];
    return 0;
}


Measured memory_bytes: 74332
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  string ans="Yes";
  cin>>S[0];
  for(int i=1;i<N;i++){
    cin>>S[i];
    if(S[i][0]!=S[i-1][S[i-1].size()-1]){
      ans="No";
      break;
      }
    }
  sort(S.begin(),S.end());
  for(int i=1;i<N;i++){
    if(S[i]==S[i-1]){
      ans="No";
      break;
      }
    }
  cout<<ans<<endl;
  }

Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {

	static DecimalFormat df = new DecimalFormat("0.0000000000000000000");

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);

		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if (h == 0 && w == 0) break;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}

		sc.close();
	}

}

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

struct data
{
    int b, c;
};
vector<data> que;
int ara[100005];
int n;

bool cmp(data a, data b)
{
    if (a.c == b.c)
        return a.b > b.b;
    return a.c > b.c;
}

int upper_(int y)
{
    int lo, hi, mid;
    lo = 1;
    hi = n;
    while (lo <= hi)
    {
        mid = lo + hi >> 1;
        if (ara[mid] <= y)
            lo = mid + 1;
        else
            hi = mid - 1;
    }
    return hi;
}

int main( )
{
    data tm;
    int i, j, k, l, m;
    long long int s = 0;

    cin >> n >> m;
    for (i = 1; i <= n; i++)
    {
        cin >> ara[i];
    }
    sort(ara + 1, ara + n + 1);


    for (i = 1; i <= m; i++)
    {
        cin >> tm.b >> tm.c;
        que.push_back(tm);
    }
    sort(que.begin( ), que.end( ), cmp);
    j = upper_(que[0].c);


    for (i = j + 1; i <= n; i++)
    {
        s += ara[i];
    }
    k = 0;
    for (i = 1; i <= j; i++)
    {
        if (k < que.size( ) && que[k].c > ara[i])
        {
            s += que[k].c;
            que[k].b--;
            if (que[k].b == 0)  k++;
        }
        else
        {
            s += ara[i];
        }
    }

    cout << s << "\n";

    return 0;
}


Measured memory_bytes: 1784
from collections import deque

n,q = map(int,input().split())
que = deque([])

for i in range(n):
    name, time = input().split()
    time = int(time)
    que.append([name, time])

t =0
while len(que) >0:
    atop = que.popleft()
    spend = min(atop[1],q)
    atop[1] -= spend
    t += spend
    if atop[1] == 0:
        print(atop[0],t)
    else:
        que.append(atop)


Measured memory_bytes: 13276
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int a = in.nextInt();
        int b = in.nextInt();
        out.println(a<=b?a:a-1);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }

        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}



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

int main(){
	int A,B,C,D,E;
	std::cin>>A>>B>>C>>D>>E;

	int min = std::max({10 - (A-1)%10,10 - (B-1)%10,10 - (C-1)%10,10 - (D-1)%10,10 - (E-1)%10});
	min -= 1;	
	A =((A + 9)/10)*10;
	B =((B + 9)/10)*10;
	C =((C + 9)/10)*10;
	D =((D + 9)/10)*10;
	E =((E + 9)/10)*10;

	std::cout<<(A+B+C+D+E - min)<<std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	int N; cin >> N;
	string S,T; cin >> T;
	S = T.substr(0, N);
	T = T.substr(N, N);
	reverse(ALL(T));
	
	map<pair<string, string>, ll> mp,mpS,mpT;
	
	REP(i, 1 << N) {
		string SR, SB, TR, TB;
		REP(j, N) ((i & 1 << j) ? SR : SB) += S[j];
		REP(j, N) ((i & 1 << j) ? TR : TB) += T[j];
		mp[{SR, SB}] = mp[{TR, TB}] = 1;
		mpS[{SR, SB}]++;
		mpT[{TR, TB}]++;
	}
	ll ans = 0;
	for (auto p : mp) ans += mpS[p.first] * mpT[p.first];
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 157440
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>

using namespace std;
int main() {
    int a,b,c,d,aa,bb,ans=0;
    string  s,t;
    cin>>a>>b>>c>>d;
    aa = max(a,c);
    bb = min(b,d);
    ans = max(0,bb-aa);


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


Measured memory_bytes: 256
//============================================================================
// Name        : a
// Date        : Sat Apr 20 20:05:05 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define x first
#define y second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fore(i, a, b) for (int i = a; i < b; ++i)
#define prt(x, i, n) { cout << x[i] << (i == n - 1 ? "\n" : " "); }
#define par(x, s, n, v) if(v) cout << #x << ": "; fore(i, s, n) prt(x, i, n)
template<class T> inline void amin(T &x, const T &y) { if (y < x) x = y; }
template<class T> inline void amax(T &x, const T &y) { if (x < y) x = y; }
template <typename T> void output(T t) { cout << t << "\n"; }
template <typename T, typename U, typename... Args>
void output(T t, U u, Args... args) { cout << t << " "; output(u, args...); }

#ifndef _has_trace
#define trace(...)
#define dbstream ostream
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

void solve() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a > b) {
    swap(a, b);
  }
  int ret = 0;
  if (a <= c && c <= b) {
    ret = 1;
  }
  output(ret ? "Yes" : "No");
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n;
    long long int x,ans=0;
    int i;
    int a[100000];
    int sum[100000];
    scanf("%d %lld",&n,&x);
    //隣り合う箱の中がx以下になるようにしたい
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    while(a[0]>x){
        a[0]--;
        ans++;
    }
    for(i=0;i<n-1;i++){
        sum[i]=a[i]+a[i+1];
        while(sum[i]>x){
            ans++;
            a[i+1]--;
            sum[i]--;
        }
    }
   /* for(i=0;i<n;i++)printf("%d ",a[i]);
    printf("\n");
    for(i=0;i<n-1;i++)printf("%d ",sum[i]);
    printf("\n");*/
    printf("%lld\n",ans);
    
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;
public class Main {
	
	static int list[][];
	
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt(); list=new int[n+1][n+1];
		
		for(int i=1;i<=n;i++) {
			int u=Integer.parseInt(in.next()), k=Integer.parseInt(in.next());
			list[u][0]=k;
			for(int j=1;j<=k;j++) {
				int v=Integer.parseInt(in.next());
				list[u][j]=v;
			}
		}
		
		BFS(n);
	}
	
	static void BFS(int n) {
		Queue<Integer> q=new ArrayDeque<>();
		int S[]=new int[n+1], d=-1;
		for(int i=0;i<=n;i++)S[i]=-1;
		q.add(1);
		S[1]=0;
		while(!q.isEmpty()) {
			int u=q.remove();
			for(int i=1;i<=list[u][0];i++) {
				int next=list[u][i];
				if(S[next]==-1) {
					S[next]=S[u]+1;
					q.add(next);
				}
			}
		}
		
		PrintWriter out=new PrintWriter(System.out);
		for(int i=1;i<=n;i++) {
			out.println(i+" "+S[i]);
		}
		out.flush();
	}

}



Measured memory_bytes: 28344
#include <stdio.h>

#define N 100000
#define Q 50000

int main(){
  int i, j, n, m, a[N], b[Q], f = 0, left, right, mid;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);

  scanf("%d", &m);

  for(i = 0; i < m; i++)
    scanf("%d", &b[i]);

  for(i = 0; i < m; i++){
    left = 0;
    right = n;

    while(left < right){
      mid = (left + right) / 2;
      if(a[mid] == b[i]){
	f++;
	break;
      }

      else if(b[i] < a[mid]){
	right = mid;
	continue;
      }

      else{
	left = mid + 1;
	continue;
      }
    }
  }

  printf("%d\n", f);

  return 0;
}
      

    
    



Measured memory_bytes: 2328
N = int(input())
n = N
cnt = 0
while N > 0:
    cnt += 1
    if N > 26:
        N -= 26 ** cnt
    else:
        break

s = 0
for i in range(1,cnt):
    s += 26 ** i
k = n-s-1

A = []
for i in range(cnt):
    A.append(k%26)
    k = k // 26
    
ans = []
for i in A:
    ans.append(chr(i + 97))

print(*ans[::-1], sep = "")


Measured memory_bytes: 9140
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = unsigned long long;
using namespace std;

ll my_lower_bound(ll* beg, ll* end, ll val){

    ll mid = 0;
    ll l = 0;
    ll r = end - beg;

    while(l < r) {
        mid = (l + r)/2;
        if(val > *(beg + mid)) {
            l = mid + 1;
        } else{
            r = mid; 
        }
    }
    return l;
}

ll my_upper_bound(ll val, ll* target, size_t tsize){

    ll mid = 0;
    ll l = 0;
    ll r = tsize;

    while(l < r) {
        mid = (l + r)/2;
        if(val < target[mid]) {
            r = mid;
        } else{
            l = mid + 1; 
        }
    }

    return l;
}

int main(void) {
    int n;
    cin >> n;

    ll *a,*b,*c;
    a = new ll[n];
    b = new ll[n];
    c = new ll[n];

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

    for(int i = 0 ; i < n; ++i ) {
        cin >> b[i];
    }

    for(int i = 0 ; i < n; ++i ) {
        cin >> c[i];
    }

    sort(a, a+n);
    sort(b, b+n);
    sort(c, c+n);

    size_t sum = 0;
    for(size_t i = 0; i < n; ++i) {

        // lower bound search : 最低k以上の要素を探す
        // upper bound search : 最高k未満の要素を探す
        // ll num_c = my_lower_bound(b[i], c, n);
        // ll num_a = my_upper_bound(b[i], a, n);
        auto iter_a = my_lower_bound(a, a+n, b[i]);
        auto iter_c = upper_bound(c, c+n, b[i]);

        // ll val_a = iter_a - a;
        ll val_a = iter_a;
        ll val_c = c+n - iter_c;

        sum += val_a * val_c;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 2560
n, q = gets.split.map(&:to_i)
chars = gets.chomp.split('')
edges = []
q.times do
  edges << gets.split.map(&:to_i)
end

ac_count = chars.map.with_index { |char, i|
  prev_i = i - 1
  prev_char = prev_i >= 0 ? chars[prev_i] : nil

  prev_char == 'A' && char == 'C' ? 1 : 0
}

cumerative_ac_count = ac_count.each_with_object([0]) { |count, counts|
  counts << counts.last + count
}

edges.each do |first, last|
  puts cumerative_ac_count[last] - cumerative_ac_count[first]
end


Measured memory_bytes: 29212
N = int(input())
otoshidama = 0
for i in range(N):
    x,u = map(str,input().split())
    x = float(x)
    if u == "JPY":
        otoshidama += x
    elif u == "BTC":
        otoshidama += x * 380000.0
    
print(otoshidama)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <numeric>
#include <algorithm>

using namespace std;


#define ll long long
#define fn for(i=0;i<n;i++)
#define f(k,n) for(i=k;i<n;i++)
#define deb(x) cout<<#x<<" "<<x<<endl;
#define read(x) getline(cin,x)

typedef pair<int, int> pairii;
typedef vector<int> veci;
typedef set<int> seti;
typedef unordered_set<int> unseti;

template<typename... T>
void r(T&... args){
    ((cin>>args),...);
}

template<typename... T>
void w(T&&... args){
    ((cout<<args<<" "),...);
}

template<typename T>
void disp(T arr)
{
    for (ll i = 0; i < arr.size(); i++)
    {
        cout << arr[i] << " ";
    }
    cout << endl;
}




void solve(){
    ll n,m,x,temp=0,sum1=0,sum2=0,cnt=0,in,i,j,k,flag=1;
    string s,s1s2;
    veci e,o,p;
    char ch;
    cin>>ch;
    if(ch>=97)
        cout<< "a";
    else
        cout<< "A";
}


int main(){

    /*#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif*/

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

    ll t=1;
    //cin >> t;

    while(t--)
        solve();
    return 0;
}



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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n;
    string s;
    cin >> n >> s;
    int l = 0,r = n-1,ans = 0;
    while (l < r) {
        while (l < n && s[l] == 'R') l++;
        while (r >= 0 && s[r] == 'W') r--;
        if (l < r && s[l] == 'W' && s[r] == 'R') {
            ans++;
            l++;
            r--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ar array
#define uint unsigned int
#define ld long double
struct debug {
~debug() {cerr << "\n";}
template<class C> debug& operator<<(C c) {cerr << c; return *this;}
};
#define var(x) " [" << #x << ": " << x << "]"

string s;

void sol() {
	cin >> s;
	ll su=0;
	for(int i=0; i<s.size(); ++i) {
		su+=(int)(s[i]-'0');
	}
	if(su%9==0) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	sol();
	return 0;
}

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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> A(N);
  int count=0;
  for(int i=0;i<N;++i){
    cin >> A.at(i);
    X-=A.at(i);
    ++count;
  }
  sort(A.begin(),A.end());
  while(X-A.at(0)>=0){
    X-=A.at(0);
    ++count;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n;
	cin >> n;
	int i, j;
	int cnt = 0;
	for (i = 1; i <= n; i++)
	{
		for (j = 1; j <= n; j++)
		{
			if (i * j >= n)
				break;
			cnt++;
		}
	}
	cout << cnt << endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int n;
  	cin >> n;
  	vi s(n);
  	int sum = 0;
  	vector<bool> avoid(n);
  	vector<pair<int, bool>> data(n);
  	rep(i,n) {
      	cin >> s[i];
      	if(s[i]%10==0) avoid[i] = true;
    	sum += s[i];
      	data[i] = make_pair(s[i],avoid[i]);
    }
  	stable_sort(all(data));
  	if(sum%10) {
      	cout << sum << endl;
      	return;
    }else{
    	rep(i,n){
        	if(!data[i].second) {
              	sum -= data[i].first;
            	cout << sum << endl;
              	return;
            }
        }
    }
  	cout << 0 << endl;
  	return;
}

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

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	string s;
	cin >> s;

	bool is_good = true;
	rep(i, 3) {
		if(s[i] == s[i+1]) is_good = false;
	}

	cout << (is_good ? "Good" : "Bad") << endl;

	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    for (;;) {
        auto n = readln.chomp.to!int;
        if (n == 0) return;

        auto as = readln.split.to!(int[]);
        sort(as);
        auto d = int.max;
        foreach (i; 0..n-1) {
            d = min(d, as[i+1] - as[i]);
        }
        writeln(d);
    }
}


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

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

using ll = long long;
using ull = unsigned long long;

int main() {
  int h, w;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0) break;
    rep(i, h) {
      rep(j, w) {
        cout << '#';
        if (j == w - 1) cout << endl;
      }
      if (i == h - 1) cout <<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3076
#include<stdio.h>

int main()
{
	int N, K;
	int length[50];

	scanf("%d %d", &N, &K);
	int i;
	for (i = 0; i < N; i++)
		scanf("%d", &length[i]);
	int j, tmp;

	for(i=0;i<N;i++)
		for ( j = i+1; j < N; j++)
		{
			if (length[i]>length[j])
			{
				tmp = length[i];
				length[i] = length[j];
				length[j] = tmp;
			}
		}

	tmp = 0;

	while (K)
	{
		tmp += length[N - K];
		K--;
	}
	printf("%d", tmp);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	long long int N, A, B, C, D; 
	cin >> N >> A >> B >> C >> D; 
	if(D == 0 && A == B) cout << "YES" << endl; 
	else if(D == 0) cout << "NO" << endl; 
	else{
		long long int I, J; 
		I = (abs(B-A)+(N-1)*D)/(C+D); // 増加回数はこれ以下
		J = (abs(B-A)+(N-1)*C+C+D-1)/(C+D); //増加回数はこれ以上
		if(I >= J && J <= N-1) cout << "YES" << endl; 
		else cout << "NO" << endl; 
	}
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    val a = intArrayOf(0) + readLine()!!.split(" ").map(String::toInt).toIntArray() + intArrayOf(0)

    var total = 0
    for (i in 1 until a.size){
        total += Math.abs(a[i] - a[i-1])
    }

    for(i in 1..n){
        println(total - (Math.abs(a[i] - a[i-1]) + Math.abs(a[i+1] - a[i])) + Math.abs(a[i+1] - a[i-1]))
    }
}

Measured memory_bytes: 58372
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(123456789012345678)
#define MAX_V 1000


int main(void){
	string s, t;	cin >> s >> t;
	int l_s, l_t;
	l_s = s.size();
	l_t = t.size();
	vector< vector<int> > dp;
	rep(i, l_s+1){
		dp.push_back(vector<int>());
		rep(j, l_t+1){
			dp[i].push_back(0);
		}
	}

	rep(i, l_s){
		rep(j, l_t){
			if(s[i] == t[j]){
				dp[i+1][j+1] = dp[i][j]+1;
			}else{
				dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
			}
		}
	}

	string res = "";
	while (l_s > 0 && l_t > 0){
		if (dp[l_s][l_t] == dp[l_s-1][l_t]){
			--l_s;
		}
		else if (dp[l_s][l_t] == dp[l_s][l_t-1]){
			--l_t;
		}
		else {
			res = s[l_s-1] + res;
			--l_s, --l_t;
		}
	}

	cout << res << endl;
	return 0;
}


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

#define int long long

int n, m, p;
int dat[8][8][8];

bool check(int t) {
  for ( int x = 0; x < n; x++ ) {
    for ( int y = 0; y < n; y++ ) {
      for ( int z = 0; z < n; z++ ) {
	for ( int dx = -1; dx <= 1; dx++ ) {
	  for ( int dy = -1; dy <= 1; dy++ ) {
	    for ( int dz = 0; dz <= 1; dz++ ) {
	      if ( dx == 0 && dy == 0 && dz == 0 ) continue;	    
	      int cnt = 0;
	      int nx = x, ny = y, nz = z;	    
	      while ( 1 ) {
		if ( nx < 0 || ny < 0 || nz < 0 ||
		     nx >= n || ny >= n || nz >= n ||
		     dat[nx][ny][nz] != t ) break;
		cnt++;
		nx += dx; ny += dy; nz += dz;
		if ( cnt == m ) return true;	      
	      }
	    }
	  }
	}
      }
    }
  }  

  return false;  
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int cnt = 0;  
  while ( cin >> n >> m >> p, n ) {
    fill_n(**dat, 8*8*8, -1);
    bool flag = false;
    for ( int i = 0; i < p; i++ ) {
      int x, y;
      cin >> x >> y;
      if ( flag ) continue;
      x--; y--;
      for ( int j = 0; j < n; j++ ) {
	if ( dat[x][y][j] == -1 ) {	  
	  dat[x][y][j] = i%2;	  
	  break;
	}
      }

      if ( check(i%2) ) {
	if ( i%2 ) cout << "White " << i+1 << endl;
	else  cout << "Black " << i+1 << endl;
	flag = true;
      }
    }

    if ( !flag ) cout << "Draw" << endl;    
  }
  
  return 0;
}



Measured memory_bytes: 3096
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        Sushi[] sushi = new Sushi[N];
        HashSet<Integer> set = new HashSet<>();
        ArrayList<Integer> list = new ArrayList<>();
        PriorityQueue<Long> queue = new PriorityQueue<>(Collections.reverseOrder());

        for(int i = 0; i<N; i++) {
            sushi[i] = new Sushi(sc.nextInt(),sc.nextInt());
        }
        //for(Sushi s : sushi) System.out.println(s.d);

        Arrays.sort(sushi, (ca, cb)->(cb.d - ca.d));
        long max = 0;
        for(int i = 0; i<K; i++) {
            max += sushi[i].d;
            if(set.contains(sushi[i].t)) list.add(0,i);
            set.add(sushi[i].t);

        }

        max += (long)set.size()*(long)set.size();
        //System.out.println(max);
        //for (int s:list.toArray(new Integer[0])) System.out.println(s);
        queue.add(max);
        long zantei = max;
        for(int i = K; i<N; i++) {
            if(!set.contains(sushi[i].t)&& list.size()>0) {
                zantei += sushi[i].d;
                zantei -= sushi[list.get(0)].d;
                zantei -= (long)(set.size())*(long)(set.size());
                zantei += (long)(set.size()+1)*(long)(set.size()+1);
                list.remove(0);
                set.add(sushi[i].t);
                queue.add(zantei);
            }
            //System.out.println(zantei +" "+max +" " + set.size());
        }
        System.out.println(queue.peek());
    }
}
class Sushi {
    int t,d;
    public Sushi(int t, int d) {
        this.t = t;
        this.d = d;
    }
}

Measured memory_bytes: 94776
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    priority_queue<int> q;
    set<int> st;
    int n, h;
    cin >> n >> h;
    imfor(i, n) {
        int a, b;
        cin >> a >> b;
        q.push(a);
        q.push(b);
        st.insert(a);
    }
    int ans = 0;
    while (true) {
        ans++;
        h -= q.top();
        if (st.find(q.top()) == st.end()) {
            q.pop();
        }
        else {
            while (h > 0) {
                h -= q.top();
                ans++;
            }
        }
        if (h <= 0) {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1784