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

using namespace std;
 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

bool era[60000];

void makeERA(){
	for(int i=0;i<60000;i++){
		if(era[i]==true){
			for(int j=2;j*i<60000;j++){
				era[j*i]=false;
			}
		}
	}
}


int main(){
	for(int i=2;i<60000;i++){
		era[i]=true;
	}

	makeERA();


	vector<int> prime;

	for(int i=0;i<60000;i++){
		if(era[i]==true)prime.push_back(i);
	}


	int n;
	while(cin>>n){
	
		for(int i=0;i<prime.size();i++){
			if(prime[i]==n){
				cout<<prime[i-1]<<" "<<prime[i+1]<<endl;
				break;
			}
			else if(prime[i]>n){
				cout<<prime[i-1]<<" "<<prime[i]<<endl;
				break;
			}
		}
	}
	return 0;
}

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

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    if(b-a+1 < k)
        k = b-a+1;
    int idx;
    for(int i = a, cnt = k; cnt > 0; i++, cnt--){
        cout << i << endl;
        idx = i;
    }
    for(int i = b-k+1; i <= b; i++){
        if(i == idx || i < idx) continue;
        cout << i << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		sc.close();
		int tmp = x / 500;
		x -= tmp * 500;
		int ans = tmp * 1000;
		tmp = x / 5;
		ans += tmp * 5;
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W, N;
  cin >> H >> W >> N;
  
  int black = 0;
  int ans = 0;
     for (int i = 0; i < min(H,W) ; i++) { 
       if (black >= N){
         break;
       }
       black += max(H,W);
       ans++;
     }
  cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=1e6;
ll d[mm];
ll vis[mm];
int main()
{
	ll n,m,i,j,k,kk,a,b,t;
	cin>>n>>k;
	for(i=0;i<k;i++)
	{
		cin>>a;
		for(j=0;j<a;j++)
		{
			cin>>b;
			vis[b]=1;
		}
	}
	ll s=0;
	for(i=1;i<=n;i++)
	{
		if(vis[i]==0)
		s++;
	}
	cout<<s<<endl;

}

Measured memory_bytes: 3624
#include<stdio.h>
 
int main()
{
  int N,A[200],i,a,b,c,j;
  
  scanf("%d",&N);
    
  for(i=0;i<N;i++)
  {
   scanf("%d",&A[i]);
  }
  
  a=-1;
  b=0;
  
  while(b==0)
  {
  for(i=0;i<N && b==0;i++)
  {
    if(A[i]%2==0)
    {
      A[i]=A[i]/2;  
    }
    else
    {
      b=1;
    }
  }
  a++;
  }
  
  printf("%d",a);
  
  
  return 0;
}

Measured memory_bytes: 128
{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE RecordWildCards #-}
import Data.List
data Class = Class {_a :: Int, _b :: Int, _ab :: Int, _o :: Int}
data BT = A | B | AB | O deriving (Read,Show)
emptyClass :: Class
emptyClass = Class 0 0 0 0

toBT :: String -> BT
toBT = read . tail . dropWhile (/= ',')

addPerson :: Class -> String -> Class
addPerson (c@Class{..}) dat =
        case toBT dat of
            A -> c {_a = succ _a}
            B -> c {_b = succ _b}
            AB -> c {_ab = succ _ab}
            O -> c {_o = succ _o}

say :: Class -> IO()
say (Class a b o ab) = mapM_ print [a,b,o,ab]

main = getContents >>= say . foldl' addPerson emptyClass . lines

Measured memory_bytes: 3900
#include<stdio.h>
int main(){
	int a,b,num;
	scanf("%d%d",&a,&b);
	num=a-b;
	if(num<0) printf("a < b\n");
	else if(num==0) printf("a == b\n");
	else printf("a > b\n");
	return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>

using namespace std;

#define INF 1000000007

typedef long long ll;

// struct T{
//   T *l, *r, *ans;
//   int pos,num;
//   T(int newpos, int newnum): l(nullptr), r(nullptr), ans(nullptr), pos(newpos), num(newnum) {}
//
//   T* push(T *now, T *newnode){
//     if(newnode->num > now->num){
//       if(now->ans != nullptr){
//         now->ans->r = newnode;
//         newnode->ans = now->ans;
//         now->ans = newnode;
//       }
//       newnode->l = now;
//       return newnode;
//     }
//     else{
//       if(now->r != nullptr){
//         push(now->r, newnode);
//       }
//       else{
//         now->r = newnode;
//         newnode->ans = now;
//       }
//       return now;
//     }
//   }
// };
//
//
//
// ll dfs(T* now){
//   if(now->ans == nullptr){
//     ll res = 0;
//     if(now->l != nullptr) res += dfs(now->l);
//     if(now->r != nullptr) res += dfs(now->r);
//     return res;
//   }
//   else{
//
//   }
// }

// struct Node{
//   int num, pos;
// };
//
// bool operator<(const Node &a, const Node &b){
//   return a.num > b.num;
// }

int main(){
  int n;
  cin >> n;
  vector<int> pos(n);
  set<int> q;
  for(int i = 0; i < n; i++){
    int p;
    cin >> p;
    p--;
    pos[p] = i;
  }

  multiset<int> t = {-1, -1, n, n};
  long long ans = 0;
  for(int i = n-1; i >= 0; i--){
    int now = pos[i];
    auto it = t.upper_bound(now);
    int a = *prev(it,2), b = *prev(it), x = *it, y = *next(it);
    ans += (ll)(i+1)*(((ll)b-a)*(x-now) + ((ll)now-b)*(y-x));
    t.emplace(now);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5376
import math

n,d = map(int, input().split())
x=[]
y=[]
dls=[]
for i in range(n):
    xt,yt = map(int, input().split())
    x.append(xt)
    y.append(yt)

for i in range(n):
    dls.append(math.sqrt(x[i]**2 +y[i]**2))

cnt=0
#print(dls)
for i in range(n):
    if dls[i] <=d:
        cnt += 1

print(cnt)

Measured memory_bytes: 32564
n=int(input())
table=[[0]*n for i in range(60)]
for i,v  in enumerate(map(int,input().split())):
    for j in range(60):
        table[j][n-1-i]=v%2
        v//=2
        if v==0:break
#print(*table,sep='\n')
ans=0
mod1,mod2=10**9+7,998244353
mod=mod1
a=1
for t in table:
    o,z=0,0
    
    for v in t:
        if v:
            o+=1
            ans=(ans+z*a)%mod
        else:
            z+=1
            ans=(ans+o*a)%mod

    a=a*2%mod
print(ans)

Measured memory_bytes: 267704
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int a, b;
	bool first = true;
	while (cin >> a >> b, a) {
		if (!first) cout << endl;
		first = false;
		bool na = true;
		range (i, a, b + 1) {
			if (i % 4 == 0) {
				if (i % 400 == 0) {
					na = false;
					cout << i << endl;
				}
				else if (i % 100 != 0) {
					na = false;
					cout << i << endl;
				}
			}
		}
		if (na) cout << "NA" << endl;
	}
	return 0;
}


Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (long long int i = f; i < t; i++)
#define pr(i, f, t) for (long long int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
#define ce(a) cout << (a) << endl
int main()
{
    ll n;
    cin >> n;
    ll a[n];
    rp(i, 0, n) cin >> a[i];
    ll wa[n], sa[n];
    rp(i, 0, n)
    {
        wa[i] = a[i] + i + 1;
        sa[i] = i + 1 - a[i];
    }
    //  ca(n, wa);
    // ca(n, sa);
    sort(wa, wa + n);
    sort(sa, sa + n);
    map<ll, ll> wawa, sasa;
    rp(i, 0, n)
    {
        wawa[wa[i]]++;
        sasa[sa[i]]++;
    }
    ll ans = 0;
    for (auto i = wawa.begin(); i != wawa.end(); i++)
    {
        ans += i->second * sasa[i->first];
        // cout << i->first << " " << sasa[i->first] << " " << wawa[i->first] << endl;
    }
    ce(ans);
}

Measured memory_bytes: 42556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
int main()
{FAST
ll n,power1,power2;
char c='a';
vector<char> v;
cin>>n;
FOR(i,11)
{power1=pow(26,i);
power2=pow(26,i+1);
	if(n>=1&&n<=power2)
	{
     n-=1;
     
		while(i>=0)
		{
					
			v.pb(c+n/power1);
			n%=power1;
			i--;
			power1=pow(26,i);
		}
		break;
	}else
	n-=power2;

}

int k=v.size();
for(int i=0;i<=k-1;i++)
{
	cout<<v[i];
}
return  0;
}






Measured memory_bytes: 4056
import sys
input = sys.stdin.readline


def binary_search(A: [int], e: int):
    """List A must be sorted """
    left, right = 0, len(A) - 1
    while left <= right:
        mid = (left+right) // 2
        if A[mid] > e:
            right = mid - 1
        elif A[mid] < e:
            left = mid + 1
        elif A[mid] == e:
            return mid
    return None


_ = int(input())
S = [int(i) for i in input().strip().split()]
_ = int(input())
T = [int(i) for i in input().strip().split()]

ans = 0
for t in T:
    if binary_search(S, t) != None:
        ans += 1

print(ans)



Measured memory_bytes: 16896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    ll n, k;
    cin >> n >> k;

    ll a[n];
    int neg = 0;
    for (ll& e: a) {
        cin >> e;
        if (e < 0) neg++;
    }
    sort(a, a+n);

    int p=0, p2=n-1;
    if (k == 1) {
        cout << a[n-1] << "\n";
        return 0;
    }
    ll ans = 1;
    ll MOD = 1e9+7;
    if ((neg == n && k%2) || (neg%2 && n == k)) {
        for (ll& e : a) e = abs(e);
        sort(a, a+n);
        for (int i=0; i<k; i++) {
            ans = ans * a[i] % MOD;
        }
        ans *= -1;
        if (ans < 0) ans += MOD;
    } else {
        while (k > 0) {
            if (k > 3 || k == 2) {
                if (a[p] * a[p+1] > a[p2] * a[p2-1] || (k%2 && p2 > 1 && a[p2-2] <= 0)) {
                    ans = ans * a[p] % MOD;
                    ans = ans * a[p+1] % MOD;
                    p += 2;
                } else {
                    ans = ans * a[p2] % MOD;
                    ans = ans * a[p2-1] % MOD;
                    p2 -= 2;
                }
                k -= 2;
            } else {
                __int128 duh, duh2, duh3, duh4;
                duh = a[p] * a[p+1];
                duh2 = duh;
                duh3 = a[p];
                duh4 = a[p2] * a[p2-1];

                duh *= a[p+2];
                duh2 *= a[p2];
                duh3 *= a[p2] * a[p2-1];
                duh4 *= a[p2-2];

                __int128 mx = max({duh, duh2, duh3, duh4});
                mx %= MOD;
                ans = ans * mx % MOD;
                k -= 3;
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 5160
N, M, X, Y = [int(i) for i in input().split()]
x_coordinates = [int(i) for i in input().split()]
y_coordinates = [int(i) for i in input().split()]

max_x = max(x_coordinates)
min_y = min(y_coordinates)

# 条件 2,3 x 座標の最大値よりも、y 座標の最小値が大きい
if max_x >= min_y:
    print('War')
else :
    flag = False
    # 条件2 x 座標のより大きい数から、y 座標の最小値までに　X より大きく、 Y より小さい数があるかを探す
    for i in range(max_x + 1, min_y +1):
        if i > X and i <= Y:
            flag = True
            break

    if flag:
        print('No War')
    else :
        print('War')


Measured memory_bytes: 3060
def main():
    M = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
    S = input()

    S1 = S[:2]
    S2 = S[2:4]

    if S1 in M and S2 in M:
        print('AMBIGUOUS')
    elif S1 in M:
        print('MMYY')
    elif S2 in M:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
	int s,i,j,max,x,y,a,b;

	while(1){
		max=0;
		scanf("%d %d %d",&x,&y,&s);
		if(x==0 && y==0 && s==0){
			break;
		}
		for(i=1;i<=s-i;i++){
			for(j=s-i;i<=j;j--){
				a=i*(100+x)*0.01;b=j*(100+x)*0.01;
				if(a+b==s){
					a=i*(100+y)*0.01;b=j*(100+y)*0.01;
					if(a+b>max){
						max=a+b;
					}
				}
			}
		}
		printf("%d\n",max);
	}
}

Measured memory_bytes: 600
n = int(input())

def Digit_Sum(n):
	s = str(n)
	sum = 0
	for i in s:
		sum += int(i)
	return sum

ans = 100000000000000

for i in range(1, n):
	ans = min(Digit_Sum(i) + Digit_Sum(n - i), ans)

print(ans)

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


#define ll long long int
#define ld long double
#define mod 998244353
#define big 1e18+10
#define small -big
#define pb push_back
#define endl "\n"


template <typename T>

void prarr(T a)
{
     cerr << "[ ";
     
     for(auto i : a){
         cerr << i << " ";
     }
     
     cerr << "]" << endl;
}


#define trace(...) _er(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void _er(const char* name, Arg1&& arg1){
	cerr << "[" << name << " : " << arg1 << "]" << endl;
}

template <typename Arg1, typename... Args>

void _er(const char* names, Arg1&& arg1, Args&&... args){
    
	const char* comma = strchr(names + 1, ',');
	cerr << "[" ; cerr.write(names, comma - names) << " : " << arg1 << "] ";
	_er(comma+2, args...);
}






void solve() {
    
     
     ll l, r, d;
     cin >> l >> r >> d;
     
     cout << (r / d) - ((l - 1) / d) << endl;
    
    
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   

    int t=1;
    //cin >> t;

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


    return 0;
        
}


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

int digit(int n, int* two, int* five){
	while(n%2 == 0 && n != 0){
		*two = *two + 1;
		n /= 2;
	}
	while(n%5 == 0 && n != 0){
		*five = *five + 1;
		n /= 5;
	}
}

int main(){
	int n;
	int two;
	int five;
	while (cin >> n) {
		two = five = 0;
		if (n == 0) {
			break;
		}
		for (int i = 1; i <= n; i++) {
			digit(i ,&two, &five);
		}
		cout << min(two,five) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    int a, b, k;
    std::vector<int> vec;
    std::cin >> a >> b >> k;
    int min = std::min(a, b);
    for (int i = 1; i <= min; i++)
    {
        if (a % i == 0 && b % i == 0) { vec.push_back(i); }
    }
    std::sort(vec.begin(), vec.end(), [](int l, int r) { return l > r; });
    std::cout << vec[k - 1] << std::endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll ;

const ll inf = 1e8 + 7;
const int maxn = 1e5 + 10;
const int maxq = 5e2 + 10;
const int alf = 26;
const ll dlm = 1e9 + 7;
const int del = 998244353 ;
const int eps = 1e-7 ;


int dp[maxn];
int a[maxn];

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    a[0] = inf;
    for(int i=2;i<=n;i++){
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]) , dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N=0,K=0;
    cin >> N >> K;
    vector<int> h(N);
    for(int i=0; i<N; i++){
        cin >> h.at(i);
    }
    sort(h.begin(),h.end());
    int mini = h.at(h.size()-1) - h.at(0);
    for(int i=0; i<=N-K; i++){
        if( (h.at(i+K-1) - h.at(i)) < mini )mini = h.at(i+K-1) - h.at(i);
    }
    cout << mini << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>

vector<pair<ll, ll>> v;
ll func(ll k)
{
    ll n = v.size();
    ll ans = 0;
    forn(i, n)
    {
        bool flag = true;
        ll x = v[i].fi;
        forn(j, 31)
        {
#define getbit(x, i) (((x) >> (i)) & 1)
            if (!getbit(k, j) && getbit(x, j))
                flag = false;
        }
        if (flag)
            ans += v[i].se;
    }
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    v = vector<pair<ll, ll>>(n);
    forn(i, n) cin >> v[i].fi >> v[i].se;

    ll ans = func(k);
    forn(i, 31)
    {
        ll x = k;
        if (getbit(x, i))
        {
            x &= ((1LL << 32) - 1 - (1LL << i));
            x |= ((1LL << i) - 1);
            ans = max(ans, func(x));
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int N,M;
  cin>>N>>M;

  vector<int> used(N,0);
  vector<pair<int,int>> ans;
  int ps=1;
  for(int i=M;i>=1;i--){
      if(i%2==M%2){
          int a=(M-i)/2;
          ans.push_back(mkp(a,a+i));
      }else{
          int a=M+1+(M-1-i)/2;
          ans.push_back(mkp(a,a+i));
      }
  }

  for(int i=0;i<M;i++) cout<<ans[i].first+1<<" "<<ans[i].second+1<<"\n";

  return 0;
}


Measured memory_bytes: 4912
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
	ll N,M;
    cin >> N >> M;
    ll a=1;
    ll s[M];
    char c[M];
    ll i,j;
    bool flag;
    for(j=0;j<M;j++){
        cin >> s[j] >> c[j];
    }
    for(i=0;i<1000;i++){
        string str=to_string(i);
        flag=true;
        if(str.size()!=N)flag=false;
        for(j=0;j<M;j++){
            if(str[s[j]-1]!=c[j]){
                flag=false;
            }
        }
        if(flag){
            cout << i;
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
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 long Mod = (long)1e9 + 7;
        static List<Tuple<long, long>>[] graph;
        static long[] dst;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NK = Sarray();
            var N = NK[0];
            var K = NK[1];
            var c = new Combination(N, Mod);
            for (var i = 1; i <= K; ++i)
            {
                var blue = c.nCk((int)(K - i + i - 1),(int)( K - i));
                var red = c.nCk((int)(N - K - (i - 1) + i), (int)(N - K - (i - 1)));
                var ans = (blue * red) % Mod;
                WriteLine(ans);
            }
            Out.Flush();
        }

        public class Combination
        {
            readonly long mod;
            readonly long[] fac, finv, inv;
            public Combination(long n, long mod = 1000000007)
            {
                long max = n + 1;
                this.mod = mod;
                fac = new long[max];
                finv = new long[max];
                inv = new long[max];
                fac[0] = fac[1] = 1;
                finv[0] = finv[1] = 1;
                inv[1] = 1;
                for (int i = 2; i < max; ++i)
                {
                    fac[i] = fac[i - 1] * i % mod;
                    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                    finv[i] = finv[i - 1] * inv[i] % mod;
                }
            }
            public long nCk(int n, int k)
            {
                if (n < k) return 0;
                if (n < 0 | k < 0) return 0;
                return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
            }
        }
    }
}

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

signed main(){
  int h , w , n , a[10005] , i=0 , j=0 , d=1 , paint[105][105];
  cin>>h>>w;
  cin>>n;
  
  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  for(int p=0;p<n;p++){
    for(int c=0;c<a[p];c++){
      paint[i][j] = p+1;
      j+=d;
      if (j < 0){
        j=0 , d=1 , i++;
      } else if (j > w-1){
        j=w-1 , d=-1 , i++;
      }
    }
  }
  
  
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cout<<paint[i][j];
      if(j<w-1){
        cout<<' ';
      } else {
        cout<<endl;
      }
    }
  }
    
  return(0);
}

Measured memory_bytes: 384
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LS(): return input().split()
def I(): return int(input())
def F(): return float(input())
def S(): return input()


def main():
    p = F()
    n = I()
    d = collections.defaultdict(list)
    for _ in range(n-1):
        x,y,c = LI()
        d[x-1].append((y-1,c))
        d[y-1].append((x-1,c))
    f = [None] * n
    f[0] = (0,0)
    q = [(0,0)]
    while q:
        x,b = q[0]
        q = q[1:]
        for y,c in d[x]:
            if f[y]:
                continue

            q.append((y,b+1))
            f[y] = (b+1, c)

    s = 0
    for b,c in f:
        s += p**b * c
    r = s
    for b,c in f:
        r += p**b * s
    return r


print(main())

Measured memory_bytes: 70684
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int N;
    long long K;
   
    cin >> N;
    cin >> K;
    int A[N];
    bool visit[N];
    int visited_num[N];
    for (int i=0; i < N; ++i){
        cin >> A[i];
        visit[i] = false;
        visited_num[i] = 0;
    }
    //find loop
    int next_town = 0;
    int index = 1;
    int loop_size;
    
    while(1){
        if(visit[next_town] == false){
            visit[next_town] = true;
            visited_num[next_town] = index;
            ++index;
            next_town = A[next_town]-1;
            if(K==index-1){
                cout << next_town+1 << endl;
                return 0 ;
            }
        }
        else{
            loop_size = index-visited_num[next_town] ;
            break;
        }
    }
    //cout << "loop_size=" << loop_size << endl;
    int i = (K-(visited_num[next_town]-1))%loop_size;
    //cout << "i=" << i << endl;
    //cout << "next_town" << next_town << endl;
    //int ans;
    for(int j=0; j < i; ++j){
        next_town = A[next_town] -1;
    }
    cout << next_town+1 << endl;
    return 0;
}

Measured memory_bytes: 5392
x, y = map(int, input().split())

ans = 10000000000
if y >= x:
    ans = min(ans, y-x)
if y >= -x:
    ans = min(ans, y+x+1)
if -y >= x:
    ans = min(ans, 1-x-y)
if -y >= -x:
    ans = min(ans, x-y+2)
print(ans)

Measured memory_bytes: 38256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) {
        String line = readLine(System.in);
        String[] input = line.split(" ");
        int[] n = { Integer.parseInt(input[0]), Integer.parseInt(input[1]), Integer.parseInt(input[2]) };

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

        for (int i = 0; i < n.length; i++) {
            if (i > 0) {
                System.out.print(" ");
            }
            System.out.print(n[i]);
        }
        System.out.println();
    }

    private static String readLine(InputStream in) {
        String line = null;
        BufferedReader reader = null;

        try {
            reader = new BufferedReader(new InputStreamReader(in));
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        return line;
    }
}

Measured memory_bytes: 16972
import sys
sys.setrecursionlimit(10**7)

def tree(p):
    for x in neighbor[p]:
        if x==par[p]: continue
        par[x]=p
        descend[p]+=tree(x)
    return descend[p]

n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)
tree(1)

x=[descend[n]-1]
t=n
while t!=1:
    t,pret=par[t],t
    x.append(descend[t]-descend[pret]-1)

l=len(x)
p,q=sum(x[:l//2]),sum(x[l//2:])
if l%2==0: print("Fennec" if p<q else "Snuke")
else: print("Fennec" if p<=q else "Snuke")

Measured memory_bytes: 138656
li = [[[0] * 10 for i in range(3)] for j in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())

    for j in range(len(li)):
        for k in range(len(li[j])):
            for m in range(len(li[j][k])):
                if j == b-1 and k == f-1 and m == r-1:
                    li[b-1][f-1][r-1] += v

for i in range(len(li)):
    for f in li[i]:
        for r in f:
            print(" {}".format(r), end="")
        print("")
    if i != len(li)-1:
        print("#" * 20)



Measured memory_bytes: 5624
import java.util.Scanner;
public class Main{
     
    public void solve(){
        Scanner sc =new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a == b){
            System.out.println("a == b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a < b");
        }
    }
     
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 17348
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

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

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int kaijou(int a)
{
	int ans=1;
	for(int i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}			
	return ans;
}



int a[1100100];
int combi[1100100];
signed main(){
  int k;cin>>k;
  string s;cin>>s;
  int n=s.length();
  int ans=0;
  rep(i,k+1){
    if(i==0)a[0]=beki(26,k),combi[0]=1;
    else{
      a[i]=prod(a[i-1],prod(25,inv(26)));
      if(n>=1)combi[i]=prod(combi[i-1],prod(n-1+i,inv(i)));
    }
    (ans+=prod(a[i],combi[i]))%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 20060
n,m=map(int,input().split())

li=[]
for d in range(1,m+1):
    if d*d>m:
        break
    if m%d==0:
        li.append(d)
        li.append(m//d)
        
li.sort()

ans=0

for d in li:
    if d*n<=m:
        ans=d
print(ans)
        

Measured memory_bytes: 3060
open Batteries
open Printf
let () =
  let s = Scanf.scanf "%s " (fun a -> a) in
  let c_l = String.to_list s in

  let rec aux res = function
    | [] -> res
    | hd :: tl -> if hd = 'B' then
        let res = String.slice ~last:(String.length res - 1) res in
        aux res tl
      else 
        let res = res ^ (String.of_char hd) in
        aux res tl
  in

  Printf.printf "%s\n" @@
  aux "" c_l


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

S = input()
N = len(S)

cnt = 0
for i in range(N//2):
    if S[i] != S[N-i-1]:
        cnt += 1
print(cnt)


Measured memory_bytes: 3188
N,M = map(int,input().split(' '))

L,R = map(int,input().split(' '))
for i in range(M-1):
  inL,inR = map(int,input().split(' '))
  if inL > L:
    L = inL
  if inR < R:
    R = inR
    
print(max(0,R-L+1))

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

long fff(int i, int j, int k, int l, vector<vector<vector<vector<long>>>> &A) {
  if (i==0) return 1;
  if (i==1) {
    if ((k==0)&&(l==2)) return 3;
    if ((j==0)&&(l==1)) return 3;
    if ((j==0)&&(k==1)) return 3;
    if ((k==0)&&(l==1)) return 3;
    if ((k==1)&&(l==0)) return 3;
    return 4;
  }
  long s;
  s = A.at(i-1).at(k).at(l).at(0) 
    + A.at(i-1).at(k).at(l).at(3);
  if (i>1) {
    if ((k==0)&&(l==2)) {
      s += A.at(i-1).at(k).at(l).at(2);
      return s;
    }
    s += A.at(i-1).at(k).at(l).at(1);
    if ((j==0)&&(l==1)) return s;
    if ((j==0)&&(k==1)) return s;
    if ((k==0)&&(l==1)) return s;
    if ((k==1)&&(l==0)) return s;
    s += A.at(i-1).at(k).at(l).at(2);
    return s;
  }
}

int main() {
  int N;
  cin >>N;
  //long S=f(N, "");
  vector<vector<vector<vector<long>>>> A(N+1, vector<vector<vector<long>>>(4, vector<vector<long>>(4, vector<long>(4))));
  for (int i=0; i<=N; i++)
    for (int j=0; j<4; j++)
      for (int k=0; k<4; k++)
        for (int l=0; l<4; l++)
          A.at(i).at(j).at(k).at(l)=fff(i, j, k, l, A) % 1000000007;
  long S=A.at(N).at(3).at(3).at(3);
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MAXN 200000

int n;
long long v[1 + MAXN];
long long s[1 + MAXN];

inline long long sum(int i, int j){
    if(i <= j) return s[j] - s[i - 1];
    return 0;
}
inline std::pair <int, int> point(int a, int b){
    std::pair <int, int> ans;
    int st = a - 1, dr = b - 1;
    while(dr - st > 1){
        int m = (st + dr) / 2;
        if(sum(a, m) < sum(m + 1, b))
            st = m;
        else
            dr = m - 1;
    }
    if(sum(a, dr) < sum(dr + 1, b))
        ans = {dr - 1, dr + 2};
    else
        ans = {st - 1, st + 2};

    ans.first = std::max(ans.first, a);
    ans.second = std::min(ans.second, b - 1);
    return ans;
}

inline long long f(int a, int b, int c){
    std::vector <long long> V;
    V.push_back(sum(1, a));
    V.push_back(sum(a + 1, b));
    V.push_back(sum(b + 1, c));
    V.push_back(sum(c + 1, n));
    std::sort(V.begin(), V.end());
    return V.back() - V.front();
}

int main(){
    FILE*fi,*fo;
    //fi = fopen("a.in","r");
    //fo = fopen("a.out","w");
    fi = stdin;
    fo = stdout;

    fscanf(fi,"%d", &n);
    for(int i = 1; i <= n; i++){
        fscanf(fi,"%lld", &v[i]);
        s[i] = s[i - 1] + v[i];
    }

    long long min = 1000000000000000000;
    for(int i = 2; i <= n - 2; i++){
        std::pair <int, int> A = point(1, i);
        std::pair <int, int> B = point(i + 1, n);
        for(int a = A.first; a <= A.second; a++)
            for(int b = B.first; b <= B.second; b++)
                min = std::min(min, f(a, i, b));
    }
    fprintf(fo,"%lld", min);

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
  int t,n,price[4]={6000,4000,3000,2000};
  for(int i=1;i<=4;++i){
    cin>>t>>n;
    cout<<price[t-1]*n<<endl;
  }
  return 0;
}



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

int main() {
  vector<int> a(10); for (int i = 0; i < 10; ++i) cin >> a[i];
  sort(begin(a), end(a), greater<int>());
  for (int i = 0; i < 3; ++i) cout << a[i] << endl;
  return 0;
}



Measured memory_bytes: 3140
n,m,x,y = map(int,input().split())
a = list( map(int,input().split()) )
b = list( map(int,input().split()) )

ck = 0
ans = 0
for z in range(x+1,y+1):
  for i in a:
    if not i < z:
      break 
  else:
    for i in b:
      if not i >= z:
        break
    else:
      ck = 1
      ans = z
      break

print('No War' if ck else 'War')

Measured memory_bytes: 9136
#include <iostream>
#include <string>
#include <stack>
#include<cstdlib>
using namespace std;

int main (){
    int n,m;
    stack<int> operand;
    string g;

    while(cin >> g){
        if ("+" == g) {
            n = operand.top();
            operand.pop();
            m = operand.top();
            operand.pop();
            operand.push(m + n);
        }
        else if ("-" == g) {
            n = operand.top();
            operand.pop();
            m = operand.top();
            operand.pop();
            operand.push(m - n);
        }
        else if ("*" == g) {
            n = operand.top();
            operand.pop();
            m = operand.top();
            operand.pop();
            n = m * n;
            operand.push(n);
        }
        else {
            operand.push(atoi(g.c_str()));
        }
    }
    cout << operand.top() << endl;
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

int a, b, c, x, y;

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

int main() {
    cin >> a >> b >> c >> x >> y;
    int ans = INT_MAX;
    // ABピザをi組買う
    for (int i = 0; i <= max(x, y); i++) {
        int cand = 2 * c * i;
        cand += max(0, x - i) * a;
        cand += max(0, y - i) * b;
        chmin(ans, cand);
    }
    cout << ans << endl;
}

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

int main(){
    ll n,m,k,v;
    cin >> n >> m >> k;
    vector<ll> s1, s2;
    s1.push_back(0), s2.push_back(0);
    for(int i=0;i<n;i++) {
        cin >> v;
        s1.push_back(s1.back() + v);
    }
    for(int i=0;i<m;i++) {
        cin >> v;
        s2.push_back(s2.back() + v);
    }
    ll best = 0;
    // i amount on s1
    int j = m; // j on s2
    int res = 0;
    for(int i=0;i<=n;i++) {
        while(j>0 && s2[j] + s1[i] > k) {
            j--;
        }
        if(s2[j] + s1[i] <= k) {
            res = max(res, i+j);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 7996
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
    int c = 0, m = 0, p = 0, h, n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &h);
        if (p < h) m = max(m, c), c = 0;
        else ++c;
        p = h;
    }
    printf("%d\n", max(m, c));
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

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

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

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



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

	ll ss[200] = {};
	ll tt[200] = {};

	rep(i, s.size()) {
		ss[s[i]]++;
		tt[t[i]]++;
	}

	sort(ss, ss + 200);
	sort(tt, tt + 200);

	ll ans = 1;

	rep(i, 200) {
		if (ss[i] != tt[i]) { ans = 0; }
	}

	if (ans == 0) { cout << "No"; }
	else { cout << "Yes"; }

	system("PAUSE");
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tommy6073
 */

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

class CDaydream {
public:
    void solve(std::istream& in, std::ostream& out) {
        string S;
        in >> S;

        bool possible = true;
        while (possible && S.length() > 4) {
            if (S.substr(S.length() - 5) == "dream") {
                S.erase(S.length() - 5);
            } else if (S.substr(S.length() - 5) == "erase") {
                S.erase(S.length() - 5);
            } else if (S.length() > 5 && S.substr(S.length() - 6) == "eraser") {
                S.erase(S.length() - 6);
            } else if (S.length() > 6 && S.substr(S.length() - 7) == "dreamer") {
                S.erase(S.length() - 7);
            } else {
                possible = false;
            }
        }

        out << (possible ? "YES" : "NO");
    }
};


int main() {
	CDaydream solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

bool f(int x, int y)
{
	return x > y;
}
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int n, m;
int a[100][100];
int vis[100][100];
int x;
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
bool safe(int x, int y)
{
	return (x >= 0 && y >= 0 && x < n && y < m && vis[x][y] == 0 && a[x][y] == 1);
}
void dfs(int i, int j)
{
	x++;

	vis[i][j] = 1;
	int k;
	for (k = 0; k < 8; k++)
	{
		int p = i + dx[k];
		int q = j + dy[k];
		if (safe(p, q) )
			dfs(p, q);
	}


}

int32_t main()
{
	
	string s;
	cin >> s;
	int sum = 0;
	int i;
	for (i = 0; i < s.length(); i++)
	{
		sum += (s[i] - '0');
	}
	if (sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";
}





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

int main()
{
  string S;
  cin >> S;
  auto all(S);
  reverse(all.begin(), all.end());
  if (S != all)
  {
    cout << "No";
    return 0;
  }
  auto front = S.substr(0, (S.size() - 1)/2);
  auto front_rev(front);
  reverse(front_rev.begin(), front_rev.end());
  if (front != front_rev)
  {
    cout << "No";
    return 0;
  }
  auto back = S.substr((S.size() + 1)/2, (S.size() - 1)/2);
  auto back_rev(back);
  reverse(back_rev.begin(), back_rev.end());
  if (back != back_rev)
  {
    cout << "No";
    return 0;
  }
  cout << "Yes";
  return 0;
}


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

int main() {
  vector<int> a(10000);
  int N, b, c = 0;
  cin >> N;
  for (int x = 1; x < 99; x++) for (int y = 1; y < 99; y++) for (int z = 1; z < 99; z++) {
    b = x * x + y * y + z * z + x * y + y * z + z * x - 1;
    if (b < 10000) a.at(b)++;
  }
  for (; c < N; c++) cout << a.at(c) << endl; 
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<int> data(n);
    for (int i = 0; i < n; i++) {
        cin >> data[i];
    }
    sort(all(data));
    auto yui = unique(all(data));
    cout << yui - data.begin() << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if(a <= b) cout << a << endl;
    else cout << a - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    string S;
    ll n=0, i;

    cin >> S;

    for(i=0; i<4; i++){
        if(S[i]=='+') n++;
        else n--;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using Graph = vector<vector<ll>>;

int main(){
  int n;cin>>n;
  map<string, int> mp;
  mp["AC"] = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;


}

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


void solve(){
  long n,m;
  cin >> n >> m;
  vector<pair<long, long>> a;
  rep(i,n){
    long tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    a.emplace_back(tmp1, tmp2);
  }
  sort(a.begin(), a.end());
  
  long i=0;
  long sum=0;
  long k=0;
  while(k+a[i].second<m){
    k=k+a[i].second;
    sum += a[i].first*a[i].second;
    i++;
  }
  sum += a[i].first*(m-k);
  
  cout << sum << endl;
}

int main(){
  solve();
  return 0;
}
  


Measured memory_bytes: 3444
import java.util.*;

import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Main {
	
	
	
	
    public static void main(String[] args) {
    	Scanner sc=new Scanner(System.in);
    	long  n=sc.nextLong();
    	long k=sc.nextLong();
    	long min=Integer.MIN_VALUE;
    	System.out.println(Math.min(n%k, k-(n%k)));
    
    	
    	
    	
       
        
       
    	

     }
    	
    	
    	
    	
    
}



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

template<class T>
T lcm(T a,T b){
    return a/__gcd(a,b)*b;
}

int main(){
    ll n;cin >> n;
    map<ll,ll> a;
    for(int i=0;i<n;i++){
        ll b;
        cin >> b;
        a[b]++;
        a[b]=a[b]%2;
    }
    ll ans=0;
    for(auto itr=a.begin();itr!=a.end();itr=next(itr,1)){
        if(itr->second==1)ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 6528
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

#define INF 0x7f7f7f7f
#define MAXN 100005
#define N 200005
#define P 2
#define MOD 99991

typedef long long ll;

namespace fastIO {
	//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
	char buf[(1 << 22)], *p1 = buf, *p2 = buf;
	/*inline int read() {
		char c = getchar(); int x = 0, f = 1;
		while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
		while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
		return x * f;
	}*/
}

inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
using namespace fastIO;
using namespace std;

/*struct Tree {
	int l, r, max;
} tree[4 * MAXN];

inline void push_up(int x) {
	tree[x].max = max(tree[x << 1].max, tree[x << 1 | 1].max);
}

inline void build(int x, int l, int r) {
	tree[x].l = l, tree[x].r = r;
	if (l == r) {
		tree[x].max = 0;
		return;
	}
	int mid = (l + r) >> 1;
	build(x << 1, l, mid);
	build(x << 1 | 1, mid + 1, r);
	push_up(x);
}

inline void update(int x, int pos, int val) {
	int l = tree[x].l, r = tree[x].r;
	if (l == r) {
		tree[x].max = max(tree[x].max, val);
		return;
	}
	int mid = (l + r) >> 1;
	if (pos <= mid)update(x << 1, pos, val);
	else update(x << 1 | 1, pos, val);
	push_up(x);
}

inline int query(int x, int l, int r) {
	int le = tree[x].l, ri = tree[x].r;
	if (l <= le && ri <= r) {
		return tree[x].max;
	}
	int mid = (le + ri) >> 1;
	int maxm = 0;
	if (l <= mid) maxm = max(maxm, query(x << 1, l, r));
	if (r > mid) maxm = max(maxm, query(x << 1 | 1, l, r));
	return maxm;
}*/
int n, d, a[20][30];

int check(int x, int y) {
	int res = 0;
	for (int i = 1; i <= d; i++)
		res += (a[x][i] - a[y][i]) * (a[x][i] - a[y][i]);
	return (int)sqrt(res)*(int)sqrt(res) == res;
}

int main() {
	cin >> n >> d;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= d; j++)
			cin >> a[i][j];
	int res = 0;
	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			if (check(i, j))res++;
	cout << res << endl;
}

Measured memory_bytes: 256