akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long ans = 0, l = 0, as = 0, bs = 0;

        if (c > d) {
            long f = c;
            c = d;
            d = f;
        }

        l = lcm(c, d);
        as = (a - 1) - (((a - 1) / c) + ((a - 1) / d) - ((a - 1) / l));
        bs = b - ((b / c) + (b / d) - (b / l));
        ans = bs - as;
        System.out.println(ans);
        sc.close();
    }
    
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));
    }
    
    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
}


Measured memory_bytes: 25044
n = int(input())
h = [int(x) for x in input().split()]
dp = [0] * (n + 1)
cc = 0
for i in range(1, n):
  if h[i] <= h[i-1]:
    cc += 1
    dp[i+1] = max(cc, dp[i])
  else:
    dp[i+1] = dp[i]
    cc = 0
print(dp[n])


Measured memory_bytes: 14252
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	ll N,K;
	cin>>N>>K;
	vec(H)
	fx(N){
		vecp(H)
	}
sorts(H)
int mini=1000000000;
for(int i=0;i+K<=N;i++){
	mini=min(mini,H.at(i+K-1)-H.at(i));
}
	ce(mini)
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int cntr = 0, cntb = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == '0'){
            cntr++;
        }else{
            cntb++;
        }
    }
    if (cntr < cntb){
        cout << cntr * 2 << endl;
    }else{
        cout << cntb * 2 << endl;
    }
}

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

int cnt[2005];
int ans;

int main()
{
	string s;
	cin>>s;
	int p=1,now=0;
	cnt[0]=1;
	for(int i=s.length()-1;i>=0;i--)
	{
		now=(now+(s[i]-'0')*p)%2019;
		ans+=cnt[now];
		cnt[now]++;
		p=p*10%2019;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3740
from collections import deque

def main():
    N, M, *L = map(int, open(0).read().split())

    E = [[] for _ in range(N + 1)]
    for a, b in zip(*[iter(L[:2 * M])] * 2):
        E[a].append(b)
        E[b].append(a)

    colors = [0] * (N + 1)
    visited = [-1] * (N + 1)

    for v, d, c in reversed(tuple(zip(*[iter(L[2 * M + 1:])] * 3))):
        Q = deque([(d, v)])
        while Q:
            cnt, v = Q.popleft()
            if visited[v] >= cnt:
                continue
            if colors[v] == 0:
                colors[v] = c
            visited[v] = cnt
            if cnt > 0:
                Q.extend((cnt - 1, u) for u in E[v] if visited[u] < cnt - 1)

    for c in colors[1:]:
        print(c)

if __name__ == '__main__':
    main()

Measured memory_bytes: 50288
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[][][] t = new int[N][][];
        for (int i = 0; i < N; i++) {
            int A = sc.nextInt();
            t[i] = new int[A][2];
            for (int j = 0; j < A; j++) {
                t[i][j][0] = sc.nextInt() - 1;
                t[i][j][1] = sc.nextInt();
            }
        }

        Solver solver = new Solver();
        solver.solve(N, t);
    }
}

class Solver {
    public void solve(int N, int[][][] t) {
        int M = 2 << (N - 1);
        int max = 0;

        for (int i = 0; i < M; i++) {

            boolean correct = true;
            for (int j = 0; j < N; j++) {
                for (int k = 0; k < t[j].length; k++) {
                    if (!isHonest(i, j)) continue;

                    if (t[j][k][1] == 1 && !isHonest(i, t[j][k][0])) {
                        correct = false;
                        break;
                    }

                    if (t[j][k][1] == 0 && isHonest(i, t[j][k][0])) {
                        correct = false;
                        break;
                    }
                }

                if (!correct) {
                    break;
                }
            }

            if (correct && max < honestCount(i, N)) {
                max = honestCount(i, N);
            }
        }

        System.out.println(max);
    }

    private int honestCount(int i, int N) {
        int sum = N;
        while (i > 0) {
            if ((i & 0x01) == 1) sum--;
            i /= 2;
        }
        return sum;
    }

    private boolean isHonest(int i, int honest) {
        return ((i >> honest) & 0x01) == 0;
    }
}




Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, m;
    
    cin >> n >> m;
    int a[n];
    int s = 0;
    int b=0;
    for(int i=0;i<n;i++){
      cin >> a[i];
      s += a[i];
    } 
    sort(a, a+n, greater<>());
    
    double ss = (double)s / (4*m);
    
    for(int i=0;i<m;i++){
        if((double)ss <= a[i]) b++;
        //cout << ss << " " << a[i] << endl;
    }
    
    if(b==m) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

A -= 1
ans = 0

def calc(x):
    x += 1
    lst = [0] * 65
    count = 2
    for i in range(64):
        #0の個数を数える
        tmp = x // count
        a = x % count
        a = min(a, count // 2)
        lst[i] = (x - (a + tmp * count // 2)) % 2
        count *= 2
    return lst

lstA = calc(A)
lstB = calc(B)
# print (lstA)
# print (lstB)
tmp = 1
for i in range(65):
    if abs(lstA[i] - lstB[i]) == 1:
        ans += tmp
    tmp *= 2

print (ans)

Measured memory_bytes: 3064
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	// your code goes here
int n,i,j,k,m;
cin>>n;
k=sqrt(n);
if(n==1)
cout<<1<<endl;
else
{
    m=1;
for(i=1;i<=k;i++)
{
    for(j=2;j<n;j++)
    {
        if(pow(i,j)<=n)
        {
        if(pow(i,j)>m)
        m=pow(i,j);
        }
        else
        break;
    }
}
cout<<m<<endl;
}
}


Measured memory_bytes: 256
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int n;
int a[100000];

int main(){
  cin >> n;
  rep(i, n) cin >> a[i], a[i]--;
  int res = 0;
  rep(i, n) res += a[a[i]] == i;
  res /= 2;
  cout << res << endl;
}


Measured memory_bytes: 640
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    A, B = map(int, sys.stdin.readline().split())
    if A == 2 or B == 2:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 5712
#!/usr/bin/env python3
import sys


def solve(S: str):
    print(S[0:3])


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61652
import java.util.*;
import java.io.*;

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

        String[] S = new String[2];
        S[0] = sc.next();
        S[1] = sc.next();

        if (S[0].charAt(0) == S[1].charAt(2) &&
            S[0].charAt(1) == S[1].charAt(1) &&
            S[0].charAt(2) == S[1].charAt(0)) {
            out.printf("YES\n");
        }
        else {
            out.printf("NO\n");
        }
        out.flush();
    }
}


Measured memory_bytes: 21716
-- (?????°, Out?????°, ????????¶???, ??????????????°?????????
act :: (Int, Int, [Int], [Int]) -> String -> (Int, Int, [Int], [Int]) 

act (a, out, base, score) "OUT" 
  | out == 2  = (0, 0, [0,0,0], (a:score) ) -- ???????????°????????????
  | otherwise = (a, out+1, base, score)
act (a, out, base, score) "HOMERUN"
  = (a + (sum base) + 1, out, [0,0,0], score)
act (a, out, (x1:x2:x3:_), score) "HIT"
  = (a+x3, out, (1:x1:x2:[]), score)

play :: (Int, Int, [Int], [Int]) -> [String] -> [Int]
play (_, _, _, score) [] = score
play state (p:ps) = 
  let next_state = act state p
  in
    play next_state ps

main = do
  c <- getContents
  let l = drop 1 $ lines c
      o = play (0, 0, [0,0,0], []) l
  mapM_ print $ reverse o

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;



signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  int ans = INF;
  for(int i=1;i*i<=N;i++){
    if(N % i == 0) ans = min(ans, N/i+i);
  }
  cout << ans-2 << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> PII;
#define MOD (1000000007ll)

int main(void){
	double n;
	int ans;
	cin >> n;
	ans = sqrt(n);
	cout << (ans*ans) << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, K, Q := sc.nextInt(), sc.nextInt(), sc.nextInt()
	points := make([]int, N)
	for i := 0; i < Q; i++ {
		a := sc.nextInt() - 1
		points[a]++
	}
	for _, p := range points {
		if K-(Q-p) > 0 {
			fmt.Fprintln(wtr, "Yes")
		} else {
			fmt.Fprintln(wtr, "No")
		}
	}
	wtr.Flush()
}


Measured memory_bytes: 3968
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });

            var N = Sarray()[0];
            var Ai = Slist();
            Ai.Sort();
            Ai.Reverse();
            var alice = Ai.Where((a, i) => i % 2 == 0).Sum();
            var bob = Ai.Where((a, i) => i % 2 == 1).Sum();
            WriteLine(alice - bob);
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int n;
int ans = 0;
void dfs(vector<int>&a) {
    if(a.size()==10) return;
    int now = 0;
    
    if(a.size()>=3) {
        int cur = pow(10,a.size()-1);
        rep(i,a.size()) {
            now += a[i]*cur;
            cur /= 10;
        }
    }
    bool ok1 =false;
    bool ok2 = false;
    bool ok3 = false;
    rep(i,a.size()) {
        if(a[i]==3)ok1 = true;
        if(a[i]==5)ok2 = true;
        if(a[i]==7)ok3 = true;
    }
    if(now<=n && ok1 && ok2 && ok3) ans++;
    for(int i = 3;i<=7;i += 2) {
        a.push_back(i);
        dfs(a);
        a.pop_back();
    }
    return;
}

int main() {
    cin >> n;
    vector<int>a;
    int cur = 1;
    dfs(a);
    cout << ans << endl;
}

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

int main() {
    int N;
    int ans = 0;
    cin >> N;
    for (int i=0; i<N; i++) {
        int a;
        cin >> a;
        if (i%2==0 && a%2!=0) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3632
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long  b = scan.nextLong();
		long c = scan.nextLong();
 
		if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
			System.out.println(0);
			return;
		}
		if (a >= b && a >= c) {
			System.out.println(b * c);
		} else if (b >= a && b >= c) {
			System.out.println(a * c);
		} else {
			System.out.println(a * b);
		}
	}
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int s = 0;
    rep(i,n) s += a[i];
    int cnt = 0;
    rep(i,n){
        if(a[i]*4*m>=s) cnt++;
    }
    if(cnt>=m){
        puts("Yes");
    }else{
        puts("No");
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
using namespace std;
set<ll> s;
  ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
void primeFactors(ll n)  
{  
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
            {
              
                if(i>=2)
                s.insert(i);
			}
  
            else 
            {
            
            if(i>=2)
               s.insert(i);
               if(n/i>=2)
               s.insert(n/i);
			}
        } 
    }   
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	ll k,n;
	cin>>k>>n;
	ll a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
	ll ans=a[n-1]-a[0];
	for(i=1;i<n;i++)
	ans=min(k-a[i]+a[i-1],ans);
	cout<<ans;
 cout<<"\n"; 
 } 
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
	int n;
	cin>>n;
	vi b(n+1);
	rep(i,n-1)cin>>b[i+1];
	b[0]=b[n]=inf;
	int ans=0;
	rep(i,n){
		ans+=min(b[i],b[i+1]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 200000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(ll &f){
    f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll n;
ll a[DMAX];
map<ll,ll> ma;
ll tot=0;
int main(){
    read(n);
    for(int i=1;i<=n;i++){
        read(a[i]);
        ma[a[i]]++;
    }
    for(int i=1;i<=n;i++){
        tot+=(ma[i]*(ma[i]-1)/2);
    }
    for(int i=1;i<=n;i++){
        cout<<tot-ma[a[i]]+1<<endl;
    }
    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

template<class T> inline bool UpdateMin(T& a, T b) {
  if (a > b) { a = b; return 1; } return 0;
}

template<class T> inline bool UpdateMax(T& a, T b) {
  if (a < b) { a = b; return 1; } return 0;
}

int Solve() {
 int n;
  cin >> n;
  vector<string> board(n);
  for (int r = 0; r < n; r++) {
    cin >> board[r];
  }

  vector<int> r_counts(n), c_counts(n);
  int total = 0;
  for (int r = 0; r < n; r++) {
    for (int c = 0; c < n; c++) {
      if (board[r][c] == '#') {
        r_counts[r]++;
        c_counts[c]++;
        total++;
      }
    }
  }

  if (total == n * n) {
    return 0;
  }
  if (total == 0) {
    return -1;
  }

  int ans = 1E9;
  for (int r = 0; r < n; r++) {
    if (c_counts[r] > 0) {
      UpdateMin(ans, n - r_counts[r]);
    } else {
      UpdateMin(ans, n - r_counts[r] + 1);
    }
  }

  if (ans == 1E9) {
    exit(1);
  }

  for (int c = 0; c < n; c++) {
    if (c_counts[c] < n) {
      ans++;
    }
  }

  return ans;
}

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

  cout << Solve() << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            int ir = int.Parse(sS);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 3 * ir * ir;

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main() {
	double	a, b, angle;
	cin >> a >> b >> angle;
	double	theta;
	theta = M_PI / 180 * angle;
	cout << fixed << setprecision(8) << a * b / 2.0 * sin(theta) << endl;
	cout << fixed << setprecision(8) << a + b + sqrt(a * a + b * b - 2.0 * a * b * cos(theta)) << endl;
	cout << fixed << setprecision(8) << b * sin(theta) << endl;
}



Measured memory_bytes: 3504
import Data.Int (Int64)

solve :: Integral a => a -> a
solve x
    | m <= 0 = s
    | 1 <= m && m <= 6 = s + 1
    | otherwise = s + 2
    where
        (d, m) = divMod x 11
        s = d * 2

main :: IO ()
main = print . solve =<< (readLn :: IO Int64)


Measured memory_bytes: 508
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

// a^n mod を計算する

int main(){
  ll a,b;
  cin >> a >> b;
  vector<int> c(3);
  c[0] = a+b;
  c[1] = a-b;
  c[2] = a*b;
  ll max=c[0];
  for(int i=0; i<3; i++){
    if(max <= c[i]){
      max = c[i];
    }
  }
  cout << max << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> c(n);
    for( int i = 0; i < n; i++ ){
        cin >> c[i];
    }
    for( int i = n-1; i > 0; i-- ){
        cout << c[i] << ' ';
    }
    cout << c[0] << endl;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++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; }
#define HpOut(S) cout << setprecision(20) << S << endl;
#define print(x) cout << (x) << endl;
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// 入力
ll N;
 
// res は答え
vector<ll> ans;
vector<vector<ll>> G(N);

void dfs(ll v, ll p=-1) {
    for (auto e : G[v]) {
        if (e == p) continue;
        ans[e] += ans[v];
        dfs(e, v);
    }
}

int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N,Q;
    cin >> N >> Q;
    G.assign(N, vector<ll>());
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b; 
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ans.assign(N, 0);
    for (int q = 0; q < Q; ++q) {
        int p, x; cin >> p >> x; --p;
        ans[p] += x;
    }
    dfs(0);
    rep(i,N) cout << ans[i] << " ";
}

Measured memory_bytes: 23552
#include<iostream>

using namespace std;

int main(){
    int i,j,r,c,temp,sum_row,sum_col;
    cin >> r>> c;
    int matrix[r+1][c+1];
    for (i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            matrix[i][j]=0;
        }
    }
    sum_row = 0;
    sum_col = 0;
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            cin >> temp;
            matrix[i][j]=temp;
            sum_row += temp;
            temp = 0;
        }
        matrix[i][c]=sum_row;
        sum_row=0;
    }
    for(j=0;j<c+1;j++){
        for(i=0;i<r;i++){
            matrix[r][j] += matrix[i][j];
        }
    }
    for(i=0;i<r+1;i++){
        for(j=0;j<c;j++){
            cout << matrix[i][j]<<" ";
        }
        cout << matrix[i][c]<<endl;
}
}


Measured memory_bytes: 3104
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, D = sc.nextInt()
    val X = Array.fill(N, D)(sc.nextInt())

    val res =for {
      i <- 0 until (N - 1)
      j <- i + 1 until N
    } yield {
      val sum = X(i).zip(X(j)).foldLeft(0: Double) { case (b, n) =>
        b + Math.pow(n._1 - n._2, 2)
      }
      val sqrt = Math.sqrt(sum)
      sqrt % 1 == 0
    }
    println(res.count(identity))
  }

}


Measured memory_bytes: 25800
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String num = sc.nextLine();
		int n = Integer.valueOf(num);
		ArrayList<String> s = new ArrayList<String>();
		for(int i=0;i<n;i++) {
			s.add(sc.nextLine());
		}
		Set<String> linkedHashSet = new LinkedHashSet<String>();
	    for (int i = 0; i < s.size(); i++) {
	    	linkedHashSet.add(s.get(i));
	    }
	    System.out.println(linkedHashSet.size());
	}
}


Measured memory_bytes: 82088
K = gets.chomp.to_i               # 単一整数
a = gets.split.map(&:to_i)  # スペースで区切られた複数の整数

K.freeze
a[0].freeze
a[1].freeze

for num in a[0]..a[1] do
  if num % K == 0 then
    puts "OK"
    exit
  end
  num = num + 1
end
puts "NG"

Measured memory_bytes: 14416
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

const long long INF = 1LL << 60;

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

// 比較+dpテーブル更新　最大問題
// 更新する方の参照をaに渡すこと.
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
// 比較+dpテーブル更新 最小問題// 更新する方の参照をaに渡すこと.　
// 最小問題なので, 更新される側にある数字が比較されてる数字よりも大きければ更新する.こうすることで, 常に小さいものが選ばれていく.
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
// このdpTableのイメージとしては, 中身に入っているのは価値の大きさ, 最初の配列はindex,次の配列はその時の合計の重さである
long long dp[110][100010] = {0};
long long weight[110];
long long value[110];
signed main()
{
    fast;
    int N, W = 0;
    cin >> N >> W;
    REP(i, N)
    {
        cin >> weight[i] >> value[i];
    }
    // DPループ
    for (int i = 0; i < N; ++i)
    {
        for (int sum_w = 0; sum_w <= W; ++sum_w)
        {

            // i 番目の品物を選ぶ場合
            // 0 になってはいけない
            // イメージ: インデクスが１ずれて, それから重さがWのマスに飛んでいくイメージ
            if (sum_w - weight[i] >= 0)
            {
                chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }

            // i 番目の品物を選ばない場合
            // ただindexを１ずらす.
            chmax(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }

    // 最適値の出力
    // 最後はindexN, 重さWのマスの値を出力すればよい.
    // (けどindexが最後のマスにおいても重さWを使い切らない方が返って価値が高くなる時があるような気がするので一応最後の段について全て比較した方がいいのかもしれない.)
    cout << dp[N][W] << endl;
}


Measured memory_bytes: 79488
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef long double ld;

ll __lcm(ll a, ll b){return (a*b)/__gcd(a,b);}

const int maxn = 1e4+5;
const ll mod = 1e9+7;
int a[maxn];


ll fpow(ll a, ll b){
	a%=mod; ll res = 1;
	while(b>0){
		if(b&1) res = res*a%mod;
		a = a*a%mod;
		b>>=1;
	}
	return res%mod;
}

ll inv(ll x){return fpow(x, mod-2);}

int main(){
	fastio();
	int n; cin >> n;
	map<int, int> lcm;
	for(int i = 0; i<n; i++) {
		cin >> a[i];
		int x = a[i];
		for(int j = 2; j*j<=x; j++){
			int exp = 0;
			while(x%j == 0) exp++, x/=j;
			if (exp>0) lcm[j] = max(lcm[j], exp);
		}
		if (x>1) lcm[x]= max(lcm[x], 1);
	}
	ll ps = 1;
	for(auto&p: lcm) ps = (ps*fpow(p.first,p.second))%mod;
	ll ans = 0;
	for(int i = 0; i<n; i++) ans = (ans + (ps*inv(a[i]))%mod)%mod;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <queue>
//#include <fstream>	// require freopen

using namespace std;

const int MAX_N = 100;
const int INF = 10000000;
const int MAX_C = 10;

// XÌîñ
// pair <cèÌø, XÌÔ>
typedef pair<int, int > T;

// n_Ìîñ
// pair <Å¬RXg,n_Ìîñ>
typedef pair<int, T > P;

// üÍ
int c, n, m, s, d;

// »ÌXÜÅÌÅ¬ÌRXg
// cost[cèÌø][XÌÔ] = ïp
int cost[MAX_C + 1][MAX_N];

// ùÉÅKlªèÏÝ©Ç¤©
bool flag[MAX_C + 1][MAX_N];

// HüÌîñ
// line[n_][I_] = ¿à
int line[MAX_N][MAX_N];

// DPpÌL[
typedef priority_queue <P, vector <P>, greater<P> > Q;
Q dp_q;

// _CNXg@
int dijkstra ()
{
	while (!dp_q.empty() ){
		P p = dp_q.top(); dp_q.pop();
		T &t = p.second;

		// ùÉÅKlªèÏÝ©²×é
		if (flag[t.first][t.second] ){
			continue;
		} // end if
		
		flag[t.first][t.second] = true;

		// ÅIn_
		if (t.second == d ){
			return p.first;
		} // end if

		for (int i = 0; i < n; ++i ){
			// øðgíÈ¢ê
			if (cost[t.first][i] > p.first + line[t.second][i] ){
				cost[t.first][i] = p.first + line[t.second][i];
				dp_q.push (P(p.first + line[t.second][i], T(t.first, i ) ) );
			} // end if

			// øðg¤ê
			if (t.first > 0 && cost[t.first - 1][i] > p.first + line[t.second][i]/2 ){
				cost[t.first - 1][i] = p.first + line[t.second][i]/2;
				dp_q.push (P(p.first + line[t.second][i]/2, T(t.first - 1, i ) ) );
			} // end if
		} // end for
	} // end while

	return INF;
}

void solve()
{
	// ú»
	for (int i = 0; i <= MAX_C; ++i ){
	 	for (int j = 0; j < MAX_N; ++j ){
			cost[i][j] = INF;
			flag[i][j] = false;
		} // end for
	} // end for

	// Jnn_
	dp_q = Q();
	dp_q.push (P(0, T(c, s ) ) );

	// _CNXg@
	int res = dijkstra();

	cout << res << endl;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.heb", "r", stdin );

	while (cin >> c >> n >> m >> s >> d && c && n && m && s && d){
		s--;d--;
		for (int i = 0; i < MAX_N; ++i ){
			for (int j = 0; j < MAX_N; ++j ){
				line[i][j] = INF;
			} // end for
		} // end for

		for (int i = 0; i < m; ++i ){
			int a, b, f;
			cin >> a >> b >> f;
			a--; b--;
			line[a][b] = f; line[b][a] = f;
		} // end for

		solve();
	} // end while

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
typedef long long int ll;

ll counter[200000];
ll scores[200000];

int main(int argc, const char * argv[]) {
    int N, Q;
    cin >> N >> Q;
    
    vector<vector<int> > children(N);
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        children[a-1].push_back(b-1);
        children[b-1].push_back(a-1);
    }
    
    REP(i, Q) {
        int p, x;
        cin >> p >> x;
        counter[p-1]+=x;
    }
    
    queue<int> q;
    q.push(0);
    vector<bool> visited(N);
    while (q.size()) {
        int i = q.front();
        q.pop();
        if (i == 0) scores[i] = counter[i];
        else {
            int par = 0;
            REP(j, children[i].size()){
                if (visited[children[i][j]]) {
                    par = children[i][j];
                    break;
                }
            }
            scores[i] = counter[i] + scores[par];
        }

        visited[i] = true;
        REP(j, children[i].size())
            if (!visited[children[i][j]])
                q.push(children[i][j]);
    }
    
    REP(i, N) {
        cout << scores[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 17016
N = int(input())
A = list(int(x) for x in input().split())
B = list(int(x) for x in input().split())
ans = 0

for i in range(N):
    if A[i] >= B[i]:
        ans += B[i]
    else:
        if A[i] + A[i+1] >= B[i]:
            ans += B[i]
            A[i+1] -= (B[i]-A[i])
        else:
            ans += A[i]+A[i+1]
            A[i+1] = 0

print(ans)


Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,T;cin>>n>>T;
    ll ans=LLONG_MAX;
    for(ll i=0;i<n;i++){
        ll c,t;cin>>c>>t;
        if(t<=T)ans=min(ans,c);
    }
    if(ans==LLONG_MAX)return cout<<"TLE" , 0;
    cout<<ans;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
}

class MyException extends Exception{
  public MyException(String msg){
    super(msg);
  }
}

Measured memory_bytes: 21844
object Main extends App{
  import scala.io.StdIn._
  val n: Int = readLine.trim.toInt
  val numbers = Array.tabulate(n){ _ ⇒ readLine.trim.toInt}.sorted.take(4)
  println(numbers.combinations(2).flatMap{_.permutations}.map{_.mkString("").toInt}.toList.sorted.apply(2))
}


Measured memory_bytes: 46352
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

void printvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void printvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void prints(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void printvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

uintmax_t combination(unsigned int n, unsigned int r) {
	if (r * 2 > n) r = n - r;
	uintmax_t dividend = 1;
	uintmax_t divisor = 1;
	for (unsigned int i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}

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

	ll  d, n, r ,l ,k, ans = 0, ret = M;
	bool flag = false, flag2 = false;
	string s, t;
	ll q;
	char c;
	cin >> n >> q >> s;
	vll v(n, 0);
	ll cnt = 1;
	REP(i,1, n) {
		if (s[i-1] == 'A' && s[i] == 'C') v[i]++;
		v[i] += v[i - 1];
	}
	//rep(i, n) cout << v[i] << " ";
	//cout << endl;
	rep(i, q) {
		cin >> l >> r;
		l--; r--;
		cout << v[r] - v[l] << endl;
	}
	return 0;

}


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

int main() {
  int N, X;
  int bound_count = 1;
  int zahyou = 0;
  cin >> N >> X;
  for (int i = 0; i < N; i++) {
    int L; cin >> L;
    zahyou += L;
    if (zahyou <= X) bound_count += 1;
    else break;
  }
  cout << bound_count;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] d  = new int[101];
		
		for(int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		
		int x = 0;
		int sum = 0;
		
		for(int i = 0; i < N; i++) {
			for(int j = i+1; j < N; j++) {
				x = d[i] * d[j];
				sum += x;
			}
		}		
		System.out.println(sum);
		
		sc.close();
	}
}

Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

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


			int n = in.nextInt();
			int a = in.nextInt();
			int b = in.nextInt();

			String ans = "";
			if ((a-b-1)%2!=0) {
				ans = "Alice";
			} else {
				ans = "Borys";
			}
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

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

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

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

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

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

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

	}

}


Measured memory_bytes: 23508
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


const int max_comb=220000;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(int a, int b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(int a, int b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(int i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}

int main(int argc, char* argv[])
{
    int h,w,n;
    scanf("%d%d%d", &h, &w, &n);

    vector<pair<int,int> > z(n+1);
    int i, j;
    for(i=0; i<n; i++) {
        int r,c;
        scanf("%d%d", &r, &c);
        z[i]=make_pair(r,c);
    }
    z[n]=make_pair(h,w);
    sort(z.begin(), z.end());

    pre_comb();

    vector<ll> dp(n+1);
    for(i=0; i<=n; i++) {
        int r = z[i].first;
        int c = z[i].second;
        dp[i] = comb((r-1)+(c-1), r-1);
        for(j=0; j<i; j++) {
            int r0=z[j].first, c0=z[j].second;
            if(r0<=r && c0<=c) {
                dp[i] = (dp[i] - (dp[j] * comb((r-r0)+(c-c0),r-r0))%MOD + MOD)%MOD;
            }
        }
    }
    printf("%lld\n", dp[n]);

    return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>
 
int main(void){
  
  int n, i;
  
  long long int sum=0;
  
  scanf("%d", &n);
  
  for(i = 1; i <= n; i++){
    if(i%15 == 0){
    }else if(i%5 == 0){
    }else if(i%3 == 0){
    }else{
      sum += i;
    }
  }
  
  printf("%lld", sum);
  
  return 0;
 
}

Measured memory_bytes: 1736
#include <stdio.h>

int main(void)
{
	int i;
	int n;
	int a;
	int v;
	int ma;
	int mv;
	
	scanf("%d", &n);
	
	mv = 0;
	for (i = 0; i < n; i++){
		scanf("%d %d", &a, &v);
		
		if (v > mv || v >= mv && a < ma){
			mv = v;
			ma = a;
		}
	}
	printf("%d %d\n", ma, mv);
	
	return (0);
}

Measured memory_bytes: 1032
ls = [[0 for _ in range(10)] for _ in range(10)]
N = int(input())
for i in range(1,N+1):
    s = str(i)
    ls[int(s[-1])][int(s[0])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += ls[i][j]*ls[j][i]
print(ans)

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

int main(int argc, char const *argv[])
{
    int n = 0;
    std::cin >> n;
    std::vector<int> v;
    for(int i = 0 ; i < n ; i++){
        int temp = 0;
        std::cin >> temp;
        v.push_back(temp);
    }
    //algorithm
    int count = 0;
    for(int i = 0 ; i < n ; i++){
        int minidx = i;
        for(int j = i ; j < n; j++){
            if(v.at(j) < v.at(minidx)){
                minidx = j;
            }
        }
        if(minidx != i) count ++;
        int temp = v.at(i);
        v.at(i) = v.at(minidx);
        v.at(minidx) = temp;
    }
    //output
    for(int i = 0 ; i < n -1 ; i ++){
        std::cout << v.at(i) << " ";
    }
    std::cout << v.at(n-1) << std::endl;
    std::cout << count << std::endl;
    return 0;
}

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

int main(){

	int a, b;
	char op;

	while(1){

		cin >> a >> op >> b;

		if(op == '?') break;

		if(op == '+') cout << a + b << endl;
		if(op == '-') cout << a - b << endl;
		if(op == '*') cout << a * b << endl;
		if(op == '/') cout << a / b << endl;
	}

	return 0;
}


Measured memory_bytes: 3100
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;

	if ((b*10+c)%4==0) cout << "YES" << "\n";
	else cout << "NO" << "\n";

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)

int main(){
	//input
	ll A,B,C,X; cin>>A>>B>>C>>X;
    ll ans=0;

	//solve
	rep(i,A+1)rep(j,B+1){
        if(X-i*500-j*100>=0 && (X-i*500-j*100)%50==0 && (X-i*500-j*100)/50<=C) ans++;
    }

	//output
	cout<<ans;
}

Measured memory_bytes: 256