akhauriyash/Code-Regression huggingface dataset:
A = [int(input())] # s
while True:
    if A[len(A)-1] % 2 == 0:
        A.append(A[len(A)-1]//2)
    else:
        A.append(3*A[len(A)-1]+1)
    if A.count(A[len(A)-1]) == 2:
        print(len(A))
        exit()

Measured memory_bytes: 3060
def examC():
    N, M = LI()
    if N-M//2>=0:
        ans = M//2
    else:
        ans = N + (M-N*2)//4
    print(ans)
    return

def examD():
    return

def examE():
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Measured memory_bytes: 3444
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;

#define LL long long
#define Re register
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define CLR(i,a) memset(i,a,sizeof(i))
#define BR printf("--------------------\n")
#define pb push_back
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dir[4][2]={1,0,0,1,-1,0,0,-1};

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    int d=a-b;
    c-=d;
    cout<<max(0,c);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a,b; cin>>a>>b;
    cout<<max(a + b, max(a - b, a * b));

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

N, K = map(int, input().split())

h = list(map(int, input().split()))
# print(N, K, h)

inf = float("inf")
dp = [inf for _ in range(N)]

dp[0] = 0

# 配るDP
for i in range(N):
    for k in range(1, K + 1):
        if i + k < N:
            k_step = dp[i] + abs(h[i] - h[i + k])
            dp[i + k] = min(dp[i + k], k_step)

print(dp[N - 1])


Measured memory_bytes: 58848
N,Y=[int(a) for a in input().split(" ")]
if Y%1000!=0:
    print("-1 -1 -1")
    exit()
for i in range(0,N+1):
    for j in range(i,N+1):
        if 10000*(i)+5000*(j-i)+1000*(N-j) == Y:
            print(" ".join([str(a) for a in [i,j-i,N-j]]))
            exit()
print("-1 -1 -1")


Measured memory_bytes: 40684
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
int n,d[100],i,ans = 0;

cin >> n;

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

sort(d,d+n);

for(i = n - 1;i > 0;i--){
  if(d[i] > d[i - 1]){
    ans++;
  }
}

cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define INF 1000000000000000000
#define fn(i,n) for(int i=0;i<n;i+=1)
int h[100100];
int dp[100100]={0};
int fun(int n)
{
    if(n<1)return INF;
    if(dp[n]!=-1)
    return dp[n];
    int ans=min(fun(n-1)+abs(h[n]-h[n-1]),fun(n-2)+abs(h[n]-h[n-2]));
    dp[n]=ans;
    return dp[n];
}
signed main() {
    int n,k;cin>>n>>k;
    for(int i=1;i<=n;i+=1){cin>>h[i];dp[i]=INF;}
    dp[1]=0;
    
    for(int i=1;i<=n;i+=1)
    {
       for(int j=1;j<=k;j+=1)
       {
           if(i-j>=1)
           dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
       }
    }
    
    cout<<dp[n]<<endl;
    return 0;
}



Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll n;

	cin>>n;

	vll v1(n/2), v2(n/2);

	map<ll, ll> c1, c2;

	rep(i, n/2){
		cin>>v1[i]>>v2[i];
		c1[v1[i]]++; c2[v2[i]]++;
	}

	vll cost1(100001, 1e18), cost2(100001, 1e18);

	ll min1=1e18, min2=1e18, i1, i2;
	repr(i, 1, 100001){
		cost1[i]=n/2-c1[i];
		cost2[i]=n/2-c2[i];
		if(min1>cost1[i]){
			min1=cost1[i]; i1=i;
		}
		if(min2>cost2[i]){
			min2=cost2[i]; i2=i;
		}
	}

	ll ans=1e18;
	repr(i, 1, 100001){
		if(i!=i1&&ans>cost1[i1]+cost2[i]){
			ans=cost1[i1]+cost2[i];
		}
	}
	repr(i, 1, 100001){
		if(i!=i2&&ans>cost1[i]+cost2[i2]){
			ans=cost1[i]+cost2[i2];
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (ll)1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};

//constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main(void) {
	int a, b, tmp=0;
	cin >> a >> b;
	rep(i, (b - a)) {
		tmp += i;
	}
	cout << tmp - a << endl;
}



Measured memory_bytes: 256
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n;

int calc(int a,int b)
{
	if(a%b==0)return a/b;
	int d=a/b,have=a%b;have=(have+d)/(d+1);
	a-=have*(d+1);
	return calc(a,b);
}

int main()
{
	get1(n);
	int a,b,ans=0;
	while(n--)
	{
		get2(a,b);
		ans^=calc(a,b);
	}
	if(ans)puts("Takahashi");else puts("Aoki");
	return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end();
#define pp pair<ll,ll>
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
using namespace std;
vector<pp> pps[200010];
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	n -= a;
	cout << (n%b) << endl;
	return 0;
}


Measured memory_bytes: 4992
x, len_arr = map(int, input().split())

if len_arr == 0:
    print(x)
    exit(0)

arr = set(map(int, input().split()))

for i in range(0, 100):
    if x - i not in arr:
        print(x - i)
        exit(0)
    if x + i not in arr:
        print(x + i)
        exit(0)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define ll long long int
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define N 100005
using namespace std;
void solve(){
    string s,t;
    cin>>s>>t;
    int ans=t.length();
    for(int i=0;i<=s.length()-t.length();i++){
        int k=0,c=0;
        for(int j=i;j<s.length() && k<t.length();j++,k++){
            c+=(s[j]!=t[k]);
        }
        ans=min(ans,c);
    }
    cout<<ans;
}
int main()
{
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	int X, Y, Z;
	cin >> X >> Y >> Z;
	int ans = 0;
	X -= Z;
	ans += (X / (Y + Z));
	cout << ans << endl;
}

Measured memory_bytes: 256
# queue.rb
s=STDIN.gets.split
n=s[0].to_i
q=s[1].to_i
queue=Array.new(n)
name =Array.new(n)
time =Array.new(n)

0.upto(n-1) {|i|
  s=STDIN.gets.split
  queue[i]=i
  name[i]=s[0].to_s
  time[i]=s[1].to_i
}

qp=0
elapsed=0
while (n>0) do
  top=queue[qp]
  if time[top] <= q then
    elapsed += time[top]
    printf("%s %d\n",name[top],elapsed)
    n-=1
  else
    elapsed += q
    time[top] -= q
    queue << top
  end
  qp+=1
end

Measured memory_bytes: 13796
package main 
 
import "fmt"
 
func main() {
	var N int
  fmt.Scan(&N)
  nums := make([]int, N)
  for i := range nums{
    fmt.Scan(&nums[i])
  }
  zero := 0
  for _, num := range nums{if num == 0{zero++}}
  if zero > 0 {
    fmt.Println(0)
    return
  }
  ans := 1
  for _, num := range nums{
    if num <= 1000000000000000000/ans{
    	ans *= num
    }else{
      fmt.Println(-1)
      return
    }
  }
  fmt.Println(ans)
} 

Measured memory_bytes: 6304
"""
・偶奇に分けて考える
・完全グラフと正解のグラフを比較する
・「任意の頂点」と「その頂点から削除する辺」の関係を考える

偶数
-> 和が(N+1)となる頂点を繋いでいない
奇数
-> 頂点Nからは全て引く。
-> それ以外は、和がNとなる頂点を繋いでいない。
"""

N = int(input())

M = 0
ans = []

# 1 <= i < j <= N

if N % 2 == 0:
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            if i + j != N + 1:
                ans.append((i, j))
                M += 1
else:
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            if i + j != N:
                ans.append((i, j))
                M += 1

print(M)
for i, j in ans:
    print(i, j)

Measured memory_bytes: 3956
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var S string
var K int

func main() {
	sc.Split(bufio.ScanWords)

	S = nextStr()
	K = nextInt()

	ans := "1"
	for i := 0; i < K; i++ {
		if string(S[i]) == "1" {
			continue
		}
		ans = string(S[i])
		break
	}

	fmt.Println(ans)
}


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

int main(){
	int n,deg; cin>>n;
	int **vertex,**matrix;
	vertex = new int*[n]; for(int i=0;i<n;i++) vertex[i] = new int[n+1];
	matrix = new int*[n]; for(int i=0;i<n;i++) matrix[i] = new int[n];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++)
			matrix[i][j] = 0;
	}
	
	for(int i=0;i<n;i++){
		cin>>vertex[i][0];
		cin>>deg;
		for(int j=1;j<=deg;j++){
			cin>>vertex[i][j];
			matrix[vertex[i][0]-1][vertex[i][j]-1] = 1;
		}
	}

	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(j) cout<<" ";
			cout<<matrix[i][j];
		}
		cout<<endl;
	}

	for(int i=0;i<n;i++) delete [] vertex[i]; delete [] vertex;
	for(int i=0;i<n;i++) delete [] matrix[i]; delete [] matrix;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
pair<int,int> pii;
vector<int> vec;
int main()
{
  int n;
  string s;

  cin>>n>>s;

  s.erase(unique(s.begin(),s.end()),s.end());

  cout<<s.size()<<'\n';

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        int c = sc.nextInt();
        int[] b = new int[m];
        int[][] a = new int[n][m];
        
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextInt();
        }
        
        int ansCnt = 0;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j < m; j++) {
                a[i][j] = sc.nextInt();
                sum += b[j] * a[i][j];
            }
            if (sum + c > 0)
                ansCnt++;
        }
        
        System.out.println(ansCnt);
    }
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    vector<ll>a[4];
    ll n,w;
    cin>>n>>w;
    ll w1,v;
    cin>>w1>>v;
    a[0].push_back(v);
    for(int i=1;i<n;i++)
    {
        ll w,x;
        cin>>w>>x;
        a[w-w1].push_back(x);
    }
    for(int i=0;i<4;i++)
    {
        sort(a[i].begin(),a[i].end(),greater<ll>());
    }
    for(int i=0;i<4;i++)
    {
        for(int j=1;j<a[i].size();j++)
        {
            a[i][j]+=a[i][j-1];
        }
    }
    ll val=0;
    for(int i=0;i<=a[0].size();i++)
    {
        for(int j=0;j<=a[1].size();j++)
         {
             for(int k=0;k<=a[2].size();k++)
                {
                    for(int m=0;m<=a[3].size();m++)
                        {
                            if(i*w1+j*(w1+1)+k*(w1+2)+m*(w1+3)<=w)
                            {
                                ll v=0;
                                if(i>0)
                                    v+=a[0][i-1];
                                if(j>0)
                                    v+=a[1][j-1];
                                if(k>0)
                                    v+=a[2][k-1];
                                if(m>0)
                                    v+=a[3][m-1];
                                    if(v>val)
                                        val=v;
                            }
                        }
                }
         }
    }
    cout<<val;
}


Measured memory_bytes: 3608
#include <iostream>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    int n, m, l, r, minv = 0, maxv = 1e+5;
    cin >> n >> m;
    rep(i, m){
        scanf("%d %d", &l, &r);
        minv = max(minv, l);
        maxv = min(maxv, r);
    }
    int ans = maxv - minv + 1;
    cout << (ans > 0 ? ans : 0) << "\n";
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                bool[] memo = new bool[n];

                for (int i = 1; i < n; i++)
                {
                    int temp = (i * i) % n;
                    memo[temp] = true;
                }

                List<int> nums = new List<int>();

                for (int i = 0; i < n; i++)
                {
                    if (memo[i]) nums.Add(i);
                }

                int m = (n - 1) / 2;

                int[] counts = new int[m + 1];

                for (int i = 0; i < nums.Count; i++)
                {
                    for (int j = i + 1; j < nums.Count; j++)
                    {
                        int a = nums[i];
                        int b = nums[j];

                        int temp = a - b;

                        if (a - b < 0) temp += n;

                        if (temp > m) temp = n - temp;

                        counts[temp]++;
                    }
                }

                for (int i = 1; i <= m; i++)
                {
                    sb.AppendLine((counts[i] * 2).ToString());
                }
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9836
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] m = new int[n];
		int min = 1001;
		int sum = 0;
		int c = 0;
		for (int i = 0; i < n; i++) {
			m[i] = sc.nextInt();
			if (min > m[i]) {
				min = m[i];
			}
			sum += m[i];
		}
		int sa = x - sum;
		c = n;
		int kosu = sa / min;
		c += kosu;
		System.out.println(c);
	}

}


Measured memory_bytes: 21972
#include<iostream>

using namespace std;
int main()
{
    int n,x;
    cin>>n>>x;
    int s,sum=0;
    for(int i=1;i<=n;i+=1){
        s = n-(x*i);sum++;
        if(s==0 || s<0)break;
    }
    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 256
//File Name: code_festival_2017_qualb_a.cpp
  //Created Time: 2017年10月10日 星期二 16时10分52秒
                                   
#include <bits/stdc++.h>
using namespace std;

int main(){
	string str;
	cin >> str;
	size_t len = str.length();
	for(size_t i(0);i<len-8;++i)
		cout << str[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
# D
N, W = map(int, input().split())
 
import numpy as np

dp = np.zeros(W+1, dtype=int)

for i in range(1, N+1):
    w, v = map(int, input().split())
    dp[w:W+1] = np.maximum(dp[0:W-w+1]+v, dp[w:W+1])

print(dp[-1])


Measured memory_bytes: 15476
#include <iostream>
#include <utility>

using namespace std;

pair<int, int> solve(int H, int W, long long N) {
    long long grid[H][W];
    for(int i=0;i<H;++i) {
        for(int j=0;j<W;++j) {
            cin >> grid[i][j];
        }
    }

    long long dp[H+1][W+1];
    fill(dp[0], dp[H]+W+1, 0LL);
    dp[0][0] = N-1;
    for(int i=0;i<H;++i) {
        for(int j=0;j<W;++j) {
            if(grid[i][j]) {
                dp[i][j+1] += (dp[i][j]+1)/2;
                dp[i+1][j] += dp[i][j]/2;
            } else {
                dp[i+1][j] += (dp[i][j]+1)/2;
                dp[i][j+1] += dp[i][j]/2;
            }
        }
    }
    for(int i=0;i<H;++i) {
        for(int j=0;j<W;++j) {
            grid[i][j] = (grid[i][j] + dp[i][j]) & 1;
        }
    }

    int y = 0, x = 0;
    while(y < H && x < W) {
        if(grid[y][x]) {
            x += 1;
        } else {
            y += 1;
        }
    }
    return pair<int, int>(y+1, x+1);
}

int main() {
    int H,W; long long N;
    while(cin >> H >> W >> N, N) {
        pair<int, int> ans = solve(H, W, N);
        cout << ans.first << " " << ans.second << endl;
    }
}


Measured memory_bytes: 18664
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

#define DIV 1000000007

long long N;

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

int main(){
	cin >> N;

	long long ans = modpow(10, N);
	ans -= modpow(9, N);
	ans += DIV;
	ans %= DIV;
	ans -= modpow(9, N);
	ans += DIV;
	ans %= DIV;
	ans += modpow(8, N);
	ans += DIV;
	ans %= DIV;

	cout << ans << endl;
}

Measured memory_bytes: 3672
#include <stdio.h>

int main(void){
	char s[4];
	int yymm=0;
	int mmyy=0;
	int f,l;
	
	scanf("%s",s);
	
	f=(s[0]-'0')*10+(s[1]-'0');
	l=(s[2]-'0')*10+(s[3]-'0');

	if(f>0&&f<13)
		mmyy=1;

	if(l>0&&l<13)
		yymm=1;

	if(yymm&&mmyy)
		printf("AMBIGUOUS\n");
	else if(yymm&!mmyy)
		printf("YYMM\n");
	else if(!yymm&&mmyy)
		printf("MMYY\n");
	else
		printf("NA");
	
	return 0;
}


Measured memory_bytes: 128
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Data.Array.IArray
import Control.Monad

lowerBound:: (Integral i, Ix i, Ord e, IArray a e) => e -> a i e -> i
lowerBound x a =
    let (b,e) = bounds a in bsearch b (e + 1)
  where
    bsearch b e
      | e == b    = b
      | x <= a!p  = bsearch b p
      | otherwise = bsearch (p + 1) e
      where p = (b + e) `div` 2

main :: IO ()
main = do
    n <- readLn :: IO Int
    l <- map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    let sl = listArray (0,length l - 1) $ sort l :: Array Int Int
    suma <- forM [0..length sl - 1] $ \a -> do
        sumb <- forM [(a+1)..length sl - 1] $ \b -> do
            let c = lowerBound ((sl!a)+(sl!b)) sl
                len = c - (b+1)
            return $ max 0 len
        return sumb
    print . sum . concat $ suma


Measured memory_bytes: 321916
#include<iostream>
#include<algorithm>
using namespace std;
int N,A[10010];
int ans=-1;
bool check(int n)
{
	int pre=n%10;
	n/=10;
	while(n)
	{
		if(pre-1!=n%10)return false;
		pre--;
		n/=10;
	}
	return true;
}
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)
	{
		if(check(A[i]*A[j]))
		{
			ans=max(ans,A[i]*A[j]);
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class B {
    static void Main(string[] args) {
        var A = new int[3, 3];
        for (int i = 0; i < 3; i++) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            A[i, 0] = st[0];
            A[i, 1] = st[1];
            A[i, 2] = st[2];
        }

        int N = int.Parse(Console.ReadLine());
        var b = new int[N];
        for (int i = 0; i < N; i++) {
            b[i] = int.Parse(Console.ReadLine());
        }

        for (int i = 0; i < N; i++) {
            for (int k = 0; k < 3; k++) {
                for (int j = 0; j < 3; j++) {
                    if (A[k, j] == b[i]) {
                        A[k, j] = -1;
                    }
                }
            }
        }

        for (int i = 0; i < 3; i++) {
            if (A[i, 0] == -1 && A[i, 1] == -1 && A[i, 2] == -1) {
                Console.WriteLine("Yes");
                return;
            }
        }
        for (int i = 0; i < 3; i++) {
            if (A[0, i] == -1 && A[1, i] == -1 && A[2, i] == -1) {
                Console.WriteLine("Yes");
                return;
            }
        }
        if (A[0, 0] == -1 && A[1, 1] == -1 && A[2, 2] == -1) {
            Console.WriteLine("Yes");
            return;
        }
        if (A[2, 0] == -1 && A[1, 1] == -1 && A[0, 2] == -1) {
            Console.WriteLine("Yes");
            return;
        }

        Console.WriteLine("No");

    }
}

Measured memory_bytes: 13396
#include<cstdio>
int s(int x)
{
	int ret=0;
	while(x) ret+=x%10,x/=10;
	return ret;
}
int main()
{
	int n;scanf("%d",&n);
	if(n%s(n)) printf("No\n");else printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// #define pair pair<ll,ll> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


const ll mod =1e9+7;
ll n,k;
ll f(){
	ll ans=0;
	ll dp[n+1][k+1];
	ll sum[n+1]{0};
	// for(int i=0;i<=k;i++){
	// 	dp[0][i]=0;
	// }
	for(ll i=1;i<=n;i++){
		for(ll j=1;j<=k;j++){
            if(i==1){
                dp[i][j]=1;
            }
            else
			    dp[i][j]=sum[i-1]-dp[i-1][j];
			sum[i]+=dp[i][j];
		}
	}
	return sum[n];
}


int main(){

	
	cin>>n>>k;

	ll ans=f();
	cout<<ans<<endl;

}

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

int main()
{
	int n, q;

	cin >> n >> q;

	vector<vector<int>> v(n);

	for (int i = 0; i < q; i++) {
		int command, t;
		cin >> command >> t;

		if (command == 0) {
			int x;
			cin >> x;

			v[t].push_back(x);
		}		
		else if (command == 1 && !v[t].empty()) {
			int size = v[t].size() - 1;

			cout << v[t][size] << endl;
		}
		else if (command == 2 && !v[t].empty()) {
			v[t].pop_back();
		}
	}

	return 0;
}



Measured memory_bytes: 3840
import java.util.*;

public class Main {
  public static void main(String[] srgs) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] input = new int[n];
    for(int i = 0; i < n; i++) {
      input[i] = Integer.parseInt(sc.next());
    }
    int[] ans = new int[n];
    int temp = n;
    if(temp % 2 == 0) {
      for(int i = 0; i < n; i++) {
        if(temp % 2 == 0 && temp != 0) {
          ans[i] = input[temp-1];
          temp -= 2;
        } else if(temp == 0) {
          ans[i] = input[0];
          temp += 3;
        } else {
          ans[i] = input[temp-1];
          temp += 2;
        }
      }
    } else {
      for(int i = 0; i < n; i++) {
        if(temp % 2 == 1 && temp != 1) {
          ans[i] = input[temp-1];
          temp -= 2;
        } else if(temp == 1) {
          ans[i] = input[0];
          temp += 1;
        } else {
          ans[i] = input[temp-1];
          temp += 2;
        }
      }
    }
    for(int i = 0; i < n - 1; i++) {
      System.out.print(ans[i] + " ");
    }
    System.out.println(ans[n-1]);
  }
}


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

int yaku(int a, int b, int c){
  int i , cnt = 0;
  for(i = a; i < b+1; i++){
    if(c%i == 0)  cnt++;
  }
  return cnt;
}

int main(){
  int a, b, c;

  cin >> a >> b >> c;
  cout << yaku(a, b, c) << endl;
}

Measured memory_bytes: 1160
sn = int(input())
S = [0 for i in range(sn)]
S = input().split()
for i in range(sn):
	S[i] = int(S[i])

tn = int(input())
T = [0 for i in range(tn)]
T = input().split()
for i in range(tn):
	T[i] = int(T[i])


cnt=0

for i in range(tn):

	key=T[i]
	left=0
	right=sn
	c=0

	while left<right:

		mid=(int)((left+right)/2)

		if S[mid]==key:
			if c==0:
				cnt+=1
				c=1
				
			break

		if S[mid]>key:
			right=mid

		if S[mid]<key:
			left=mid+1


print(cnt)


Measured memory_bytes: 13904
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 1e5;
LL A[N];
LL fA[N+1]; 
LL B[N];
LL fC[N+1];
LL C[N];
int main()
{
	int n; cin >> 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];

	// keep the n biggest
	// throw away the smallest
	priority_queue<LL,vector<LL>,greater<LL>> deleteA;
	fA[0] = 0;
	for(int i = 0; i < n; i++)
	{
		deleteA.push(A[i]);
		fA[0] += A[i];
	}
	for(int i = 1; i <= n; i++)
	{
		fA[i] = fA[i-1];

		deleteA.push(B[i-1]);
		fA[i] += B[i-1];

		fA[i] -= deleteA.top();
		deleteA.pop();
	}

	// keep the n smallest
	// throw away the biggest
	priority_queue<LL> deleteC;
	fC[n] = 0;
	for(int i = 0; i < n; i++)
	{
		deleteC.push(C[i]);
		fC[n] += C[i];
	}
	for(int i = n-1; i >= 0; i--)
	{
		fC[i] = fC[i+1];

		deleteC.push(B[i]);
		fC[i] += B[i];

		fC[i] -= deleteC.top();
		deleteC.pop();
	}

	LL ans = -1e18; //-INF
	for(int i = 0; i <= n; i++)
		ans = max(ans,fA[i]-fC[i]);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 8736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n;
  cin >> n;
  bool ok = true;
  rep(i,n){
    int a;
    cin >> a;
    if(a%2==0){
      if(a%3!=0 && a%5!=0) ok = false;
    }      
  }
  if(ok) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;

  
  return 0;
    

}


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

 
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
    a.at(i) = p.at(i);
  }
 sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  /*rep(i,N){
    cout << p[i] <<endl;
  }*/
  if(p[0]==p[1]){
    rep(i,N){
      cout << p[0] << endl;
    }
  }
  int b;
  if(p[0] != p[1]){
    rep(i,N){
      if(a.at(i) == p[0]){
        b = i;
      }
    }
    rep(i,N){
      if(i != b){
        cout << p[0] << endl;
      }else{
        cout << p[1] << endl;
      }
    }
  }
    
}

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

int op(int a, int b)
{
    return max(a, b);
}

int e()
{
    return 0;
}

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

    const int MAX_A = 300000;

    int n, k;
    cin >> n >> k;

    segtree<int, op, e> seg(MAX_A + 1);

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

        int l = max(0, a - k), r = min(a + k, MAX_A);
        int ma = seg.prod(l, r + 1);
        seg.set(a, ma + 1);
    }
    cout << seg.all_prod() << '\n';
    return 0;
}

Measured memory_bytes: 8512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n; ll t;
    cin >> n >> t;
    VL a(n);
    FOR(i, 0, n)cin >> a[i];

    VL dif;
    ll from = a[0], to = a[0];
    FOR(i, 1, n) {
        if (a[i - 1] > a[i]) {
            dif.push_back(to - from);
            chmin(from, a[i]);
            to = a[i];
        }
        else to = a[i];
        if (i == n - 1)dif.push_back(to - from);
    }
    rSORT(dif, [](ll x, ll y) {return x > y; });
    int i = 1;
    while (i < dif.size() && dif[i - 1] == dif[i])i++;
    cout << i << "\n";
    
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> f(h);
    rep(i,h)cin >> f[i];
    queue<P> q;
    vector<vector<int>> dist(h,vector<int>(w,-1));

    
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    rep(i,h)rep(j,w){
        if(f[i][j] == '#'){
            dist[i][j] = 0;
            q.push(P(i,j));
        }
    }
    while(!q.empty()){
        P now = q.front();q.pop();
        int x = now.first,y = now.second;
        
        rep(i,4){
            int nx = x + dx[i],ny = y+dy[i];
            if(nx < 0 ||ny < 0||nx > h-1|| ny > w-1)continue;
            if(f[nx][ny] == '#')continue;
            if(dist[nx][ny] !=-1)continue;
            q.push(P(nx,ny));
            dist[nx][ny] = dist[x][y]+1;
        }


    }
    int ans = 0;
    rep(i,h)rep(j,w)ans = max(ans,dist[i][j]);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 13456
/*
ID: dorijan1
TASK: tu napisi ime zadatka molim te molim te ali samo ako si na usaco training
LANG: C++11
*/
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define rand rund
#define pb push_back

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
const int MOD=1000000007;
const int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

ll raand()
{
	ll a=rand();
	a*=RAND_MAX;
	a+=rand();
    return a;
}

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

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

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

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

ll lcm(ll a,ll b)
{
	return a/gcd(a,b)*b;
}

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

int sub(int a,int b)
{
	return (a-b+MOD)%MOD;
}

int add(int a,int b)
{
	return (a+b)%MOD;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
int n,w;
ll ma;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
ll dp[110][N];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(raand()%MOD+13893829);
	cin>>n>>w;
	for (int i=0;i<n;++i)
	{
		int k,v;
		cin>>k>>v;
		for (int j=0;j<=w;++j) dp[i+1][j]=dp[i][j];
		for (int j=0;j<=w-k;++j) dp[i+1][j+k]=max(dp[i+1][j+k],dp[i][j]+v),ma=max(ma,dp[i+1][j+k]);
	}
	cout<<ma;
}



Measured memory_bytes: 233728
inputs = []
loop do
    input = gets.split(" ")
    if input[1] == "?"; break; end
    inputs << input
end
inputs.size.times do |i|
    a, b = inputs[i][0].to_i, inputs[i][2].to_i 
    case inputs[i][1]
    when "+"
        puts a + b
    when "-"
        puts a - b
    when "*"
        puts a * b
    when "/"
        puts a / b
    end
end


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

#define int long long
#define double long double
template<class T> void read(T& a) { cin >> a; }
template<class T1, class... T2> void read(T1& a, T2&... args) { cin >> a; read(args...); }
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fors(i, s) for (auto i = (s).begin(); (i) != (s).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define forv(i, v) forn(i, sz(v))
#define make(t, ...) t __VA_ARGS__; read(__VA_ARGS__)
#define makev(a, n) vi a(n); forn(i, n) cin >> a[i]
#define mp make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

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

auto fastio = (ios::sync_with_stdio(0), cin.tie(0));


int32_t main() {
	make(int, n);
	makev(a, n);
	sort(all(a));
	a.resize(unique(all(a)) - a.begin());
	if (sz(a) == n) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
}



Measured memory_bytes: 1792
#include <iostream>
using namespace std;
struct point
{
    int tan;
    int sum;
}ans1,ans2;
int main()
{
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    ans2.tan=-1;
    ans2.sum=1;
    //double C=(100*e)/(100+e);
    for(int a1=0;a1*a*100<=f;a1++)
        for(int b1=0;b1*b*100<=f-a1*a*100;b1++)
            for(int c1=0;c1*c<=f-a1*a*100-b1*b*100;c1++)
                for(int d1=0;d1*d<=f-a1*a*100-b1*b*100-c1*c;d1++)
                {
                    
                        ans1.tan=c*c1+d*d1;
                        ans1.sum=a1*a*100+b1*b*100+c1*c+d*d1;
                        if(ans1.tan>(ans1.sum-ans1.tan)/100*e) continue;
                        if(ans1.tan*ans2.sum>ans1.sum*ans2.tan)
                        {
                            ans2.tan=ans1.tan;
                            ans2.sum=ans1.sum;
                        }
                    
                }
    cout<<ans2.sum<<" "<<ans2.tan<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
ans += min(a[0], b[0])
b[0] = max(0,b[0]-a[0])
ans += min(a[-1], b[-1])
b[-1] = max(0,b[-1]-a[-1])
i1 = 0
i2 = b[0]
for i in range(n-1):
  i1 = i2
  i2 = b[i+1]
  ai = a[i+1]
  if ai <= i1:
    ans += ai
  elif ai <= i1 + i2:
    ans += ai
    i2 -= ai - i1
  else:
    ans += i1 + i2
    i2 = 0
print(ans)
  
  
  

Measured memory_bytes: 18752
a, b, c = map(int, input().split(" "))
ans = 0
if b == 0 :
    if c%a == 0:
        ans = c//a
    else:
        ans = c//a+1
else:
    unit = 7*a+b
    if c%unit==0:
        ans = 7*c//unit
    else:
        temp = c%unit
        if temp >= 7*a:
            ans = 7*(c//unit+1)
        else:
            if temp%a==0:
                ans = 7*(c//unit) + temp//a
            else:
                ans = 7*(c//unit) + temp//a + 1
print(ans)


Measured memory_bytes: 5596
for i in range(3000):
  a = input().split()
  x = int(a[0])
  y = int(a[1])
  if x + y == 0:
    break
  elif x < y:
    print(x,y)
  elif y < x:
    print(y,x)
  else:
    print(x,y)
    



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

int main() {
	int N, P, COUNT = 0;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> P;
		if (P != i) COUNT++;
	}
	if (COUNT <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

int main()
{
    int x, a, b, d_a, d_b;
    cin >> x >> a >> b;

    d_a = abs(x-a);
    d_b = abs(x-b);

    if ( d_a < d_b ) cout << "A";
    else cout << "B";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  ll x = 1, sum = 0;
  while(sum < n) {
    sum += x;
    x++;
  }
  ll k = sum - n;
  rep2(i, 1, x) if(i != k) cout << i << endl;
}

Measured memory_bytes: 3596
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val result = readLine()
        ?.split(" ")
        ?.map { it.toLong() }
        ?.sortedDescending()
        ?.dropLast(n)
        ?.filterIndexed { index, l -> index % 2 == 1 }
        ?.sum()
        ?: return
    println(result)
}

Measured memory_bytes: 92908
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
------------------------
author : iiou16
time : 11/01/12:15
------------------------
'''
import math


def main():
    a, b, x = list(map(int, input().split()))

    if (x / (a * a)) >= b / 2:
        p = (2 * b) - (2 * x / (a * a))
        ans = 180 * math.atan2(p, a) / math.pi
    else:
        p = 2 * x / (a * b)
        ans = 180 * math.atan2(b, p) / math.pi
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<cstdio>
int n,i,j,b[3],a=1,P=998244353;int main(){scanf("%d\n",&n);for(i=3*n;--i;){char c=getchar();int &t=b[c%3],m=P;for(j=3;~--j;)m=b[j]>t&&b[j]-t<m?b[j]-t:m;a=1ll*a*(m<=n?m:1)%P*(i<=n?i:1)%P;++t;}printf("%d",a);}

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

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

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

int main() {

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

	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < A.size(); i++) A[i] -= i + 1;
	sort(A.begin(), A.end());

	int b = A[N / 2];// + !(N % 2) * A[N / 2 - 1];
	//b /= !(N % 2) + 1;

	lint ans = 0;
	for (int i = 0; i < N; i++) ans += abs(A[i] - b);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
long long n,k,L,R,M;
long long t[100000];
 
int check(long long);
 
int main(){
 
  int i;
 
  scanf("%d %d",&n,&k);
 
  L=1;
  for(i=0;i<n;i++){
    scanf("%d",&t[i]);
    L=(L<t[i]?t[i]:L);
  }
   
  R=1000000000LL;
  while(L<R){
    M=(L+R)/2;
    if(check(M)==-1){
      R=M;
    }else{
      L=M+1;
    }
  }
 
  printf("%d\n",L);
 
  return 0;
 
}
 
int check(long long x){
 
  long long i,id=0,cnt=0;
 
  for(i=0;i<n;i++){
    if(cnt+t[i]>x){
      cnt=t[i];
      id++;
    }else{
      cnt+=t[i];
    }
    if(id==k)return 0;
  }
  return -1;
}

Measured memory_bytes: 1376
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;
void solve(int test)
{
  cin >> n;
  cout << (n - 1) * 1ll * n / 2 << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  string S;
  cin>>N>>S>>K;
  for(int i=0;i<N;i++){
    if(S.at(i)!=S.at(K-1)){
      S.at(i)='*';
    }
    else{
    }
  }
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    ll a,b;
    cin>>a>>b;
    if(a==1&&b==1)cout<<1;
    else if(a==1)cout<<b-2;
    else if(b==1)cout<<a-2;
    else cout<<(a-2)*(b-2);
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 3;
    vector<int> ns(T);
    for (auto& n : ns) {
        cin >> n;
    }
    int k;
    cin >> k;
    vector<vector<long long>> xss(T);
    for (int i = 0; i < T; ++i) {
        xss[i].resize(ns[i]);
        for (auto& x : xss[i]) {
            cin >> x;
        }
    }
    auto add = [&](vector<long long> as, vector<long long> bs) {
        vector<long long> cs;
        for (auto& a : as) {
            for (auto& b : bs) {
                cs.push_back(a+b);
            }
        }
        sort(cs.begin(), cs.end(), [](long long i, long long j) { return i > j; });
        if (cs.size() > k) {
            cs.resize(k);
        }
        return cs;
    };
    for (int i = 1; i < T; ++i) {
        xss[0] = add(xss[i], xss[0]);
    }
    for (int i = 0; i < k; ++i) {
        cout << xss[0][i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 43240