akhauriyash/Code-Regression huggingface dataset:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i): is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    s = IS()
    t = IS()
    n = len(s)
    if s == t[:n]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9440
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d=0;
    cin>>a>>b>>c;
    for(int i=1;i<=a;i++){
            int e=0,m=0;
            int j=i;
        while(j){
            e=j%10;
            m=m+e;
            j=j/10;
        }
        if(b<=m&&m<=c) d+=i;
    }
    cout<<d<<endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
l=a[0]//2
ll=a[0]
for i in range(1,n):
  if a[i]%2:odd=True
  else:even=True
  l=lcm(l,a[i]//2)
  ll=lcm(ll,a[i])
  if l>m:print(0);exit()
for i in range(n):
  if l%a[i]==0:print(0);exit()
print((m-l)//ll+1)

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

int main() {
  char r;
  cin >> r ;
  if (r=='a' || r=='e'|| r=='u' || r=='i' || r=='o'){
  cout << "vowel" << endl;
  }
  else {
  cout << "consonant" << endl;
  }
 }


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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}
template <typename T> 
T Min(T a,T b){ return a<b?a:b; }
template <typename T>
T Max(T a,T b){ return a>b?a:b; }

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	char x;cin>>x;
	if(x>='a') cout<<'a'<<endl;
	else cout<<'A'<<endl;
	
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



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


int main(){
    int n,ans=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
        ans+=a.at(i);
    }
    sort(a.begin(),a.end());
    ans-=a.at(n-1);
    if(ans>a.at(n-1)){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MAX 100000
typedef long long ll;
typedef pair<ll,int> P;

int d[100001];

int main(){
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    int temp;
    cin>>temp;
    d[temp]++;
  }
  int x=0,ans=0;
  for(int i=1;i<=100000;i++){
    if(x==N/2) ans++;
    else if(x>N/2) break;
    x+=d[i];
  }
  cout<<ans<<endl;
}


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, l;
	cin >> n >> l;
	VI as;
	rep (i, n) {
		int a;
		cin >> a;
		as.pb(a);
	}
	int idx = -1;
	rep (i, n - 1) {
		if (as[i] + as[i + 1] >= l) {
			idx = i;
			break;
		}
	}
	VI ans;
	ans.pb(idx);
	int b = idx, e = idx;
	while (b > 0 || e < n - 2) {
		if (b - 1 >= 0) {
			b--;
			ans.pb(b);
		}
		if (e + 1 <= n - 2) {
			e++;
			ans.pb(e);
		}
	}
	if (idx == -1) {
		cout << "Impossible" << endl;
		return 0;
	}
	cout << "Possible" << endl;
	reverse(all(ans));
	for (int a : ans) {
		cout << a + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 1784
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

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

	int ans = 1e9;
	for (int i = 0; i <= 100; i++) {
		int sum2 = 0;
		for (auto y: x) {
			sum2 += (y - i) * (y - i);
		}
		ans = min(sum2, ans);
	}

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


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

int main(){
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;


int main()
{
    int x;
    int arr[5];

    for (int i = 0; i < 5; i++) {
        cin >> x;
        arr[i] = x;
    }

    for (int i = 0; i < 5; i++) {
        if(arr[i] == 0){
            cout << i+1 << endl;
            break;
}
    }


    return 0;
}


Measured memory_bytes: 3644
# coding: utf-8
from itertools import permutations
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
res = list(range(1, n + 1))
cnt = 0
for i in permutations(res):
    cnt += 1
    if i == p:
        p_tmp = cnt
    if i == q:
        q_tmp = cnt

print(abs(p_tmp - q_tmp))


Measured memory_bytes: 3060
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  ll X, Y, r = 0;
  cin >> X >> Y;

  while (X <= Y)
  {
    X = X << 1;
    r++;
  }

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<stdio.h>

int main(){
    int H , W , HH , WW ;
    cin >> H >> W;
    while ( H > 0 && W > 0 ){

        for ( HH = H; HH > 0; HH--){
            if(HH == 1 || HH == H){
                for ( WW = W ; WW > 0 ; WW-- ){
                    cout << "#";
                }
            }else{
                cout << "#";
                for ( WW = W - 2; WW > 0 ; WW-- ){
                    cout << ".";
                }
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
}


Measured memory_bytes: 3112
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 100010;

int n, a[MAXN];

int main(void) {
  scanf("%d",&n);
  REP(i, n) scanf("%d",&a[i]);
  sort(a, a + n);

  int lo = 0, hi = n - 1, best = n;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    bool ok = true;
    
    llint sz = a[mid];
    REP(i, n) {
      if (i == mid) continue;
      if (a[i] <= 2 * sz)
	sz += a[i];
      else
	ok = false;
    }

    if (ok) {
      hi = mid - 1;
      best = mid;
    } else
      lo = mid + 1;
  }

  printf("%d\n",n-best);
  
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

double gram(int r, int d, int x1, int size){
  int x2;
  
  if(size <= 10){
    x2 = (r * x1) - d;
    printf("%d\n",x2);
    size++;
    gram(r,d,x2,size);
  }
}
  
  
int main(void){
  int r, d, x1;
  int size;
  
  size = 1;
  
  scanf("%d%d%d",&r, &d, &x1);
  gram(r,d,x1,size);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
int main(void) {
	while (1) {
		std::string Charactor;
		std::cin >> Charactor;
		if (Charactor[0]=='-') { break; }
		int shaffle;
		int count = 0;
		std::cin >> shaffle;
		for (int i = 0; i < shaffle; ++i) {
			int value;
			std::cin >> value;
			count += value;
		}
		for (int i = 0; i < Charactor.size(); ++i) {
			std::cout << Charactor[(i + count) % Charactor.size()];
		}
		std::cout << std::endl;
}
//	system("pause");
	return 0;
}

Measured memory_bytes: 3164
S=input()
T=input()
tmp=[]
for i in range(len(S)):
    flag=True
    for j in range(min(len(T),len(S)-i)):
        if S[i+j]==T[j] or S[i+j]=="?" or T[j]=="?":
            continue
        else:
            flag=False
    if flag:
        rec=S[:i]+T+S[i+len(T):]
        if len(rec)==len(S):
            rec=rec.replace("?","a")
            tmp.append(rec)
if tmp==[]:
    print("UNRESTORABLE")
    exit()
tmp.sort()
print(tmp[0])

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int a[] = new int[n];

		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}

		long sum = 0;

		for(int i = 1; i < n; i++){
			if(a[i] < a[i - 1]){
				sum += a[i - 1] - a[i];
				a[i] = a[i - 1];
			}
		}

		System.out.println(sum);
	}
}

Measured memory_bytes: 50268
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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




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



int h,n;
cin>>h>>n;

vector<int>a(n);
vector<int>b(n);

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




vector<int>dp(h+1,INT_MAX);
dp[0]=0;

 for(int i=1;i<=h;i++){
        for(int j=0;j<n;j++){
            
               dp[i]=min(dp[i],dp[max(i-a[j],0ll)]+b[j]);
             
        }
    }

cout<<dp[h]<<"\n";


  
}



Measured memory_bytes: 384
x,y = map(int,input().split())
ans = 0
if x == 1:
    ans += 300000
elif x == 2:
    ans += 200000
elif x == 3:
    ans += 100000

if y == 1:
    ans += 300000
elif y == 2:
    ans += 200000
elif y == 3:
    ans += 100000

if x == 1 and y == 1:
    ans += 400000

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> a(n-1),b(n-1);
  rep(i,n-1){
    cin >> a[i]>>b[i];
    a[i]--;
    b[i]--;
  }

  vector<vector<pair<int,int>>> edge(n);
  rep(i,n-1){
    edge[a[i]].push_back(make_pair(b[i],i));
    edge[b[i]].push_back(make_pair(a[i],i));    
  }
  vector<int> res(n-1);
  int k=0;
  rep(i,n-1){
    k = max(k,(int)edge[i].size());
  }



  vector<int> ex(n);
  vector<bool> f(n,false);
  queue<int> q;
  q.push(0);
  ex[0]=k+1;
  while(!q.empty()){
    int v=q.front();
    q.pop();
    f[v] = true;
    int kk=1;
    for(auto& w:edge[v]){
      if(f[w.first]) continue;
      if(ex[v]==kk){
	kk++;
	res[w.second] = kk;
	ex[w.first] = kk;
      }
      else{
	res[w.second] = kk;
	ex[w.first] = kk;
      }
      kk++;
      q.push(w.first);
    }
  }

  cout << k << "\n";
  rep(i,n-1){
    cout << res[i] << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 8192
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<cmath>
#include<map> 
#include<string>
#include<queue>
#include<stack> 
#include<bitset>
#include<list>
#include<set>
#include<utility>
#include<iomanip>
#define IO ios::sync_with_stdio(false)
#define eps 1e-7
#define int long long
using namespace std;
const int mod=1e9+7;
char s1[1005],s2[1005];
signed main()
{
	int len1,len2;
	IO;
	cin>>s1+1>>s2+1;
	len1=strlen(s1+1);
	len2=strlen(s2+1);
	int ans=0;
	for(int i=1;i<=len1-len2+1;i++)
	{
		int pos=i,cnt=0;
		for(int j=1;j<=len2;j++)
		{
			if(s1[pos++]==s2[j])
			{
				cnt++;
			}
		}
		ans=max(ans,cnt);
	}
	cout<<len2-ans;
}

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

const long long MOD = 1000000007;
const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> L(2*N);
    for(int i=0;i<2*N;i++){
        cin >> L[i];
    }

    sort(L.begin(), L.end());
    int ans = 0;
    for(int i=0;i<2*N;i+=2){
        ans += L[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
let pn = 1000000007

let rec pow x n =
  if n = 0 then 1
  else if n mod 2 = 0 then pow (x * x) (n / 2)
  else x * pow (x * x) (n / 2)

let fold_left f init s n =
  let rec doit i acc =
    if i = n then acc
    else doit (i + 1) (f acc s.[i]) in
  doit 0 init

let () =
  let p = read_line () in
  let t = read_line () in
  let n = String.length p in
  let m = String.length t in
  let h = Array.make (n + 1) 0 in
  String.iteri (fun i c -> h.(i+1) <- h.(i)*pn + Char.code c) p;
  let ht = fold_left (fun acc c -> acc*pn + Char.code c) 0 t m in
  let x = pow pn m in
  for i = m to n do
    if h.(i) - h.(i-m)*x = ht then Printf.printf "%d\n" (i - m);
  done

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

using namespace std;

bool exist(const string& s, char c1, char c2, char c3) {
    bool found1 = false;
    bool found2 = false;
    bool found3 = false;
    for (int i = 0; i < s.size(); ++i) {
        if (!found1) {
            if (s[i] == c1) {
                found1 = true;
            }
            continue;
        }
        if (found1 && !found2) {
            if (s[i] == c2) {
                found2 = true;
            }
            continue;
        }
        if (found2 && !found3) {
            if (s[i] == c3) {
                found3 = true;
                break;
            }
            continue;
        }
    }
    return found1 && found2 && found3;
}

int main() {
    int N;
    string S;
    cin >> N;
    cin >> S;

    int ans = 0;
    for (int i = 0; i < 10; ++i) {
        char c1 = to_string(i)[0];
        for (int j = 0; j < 10; ++j) {
            char c2 = to_string(j)[0];
            for (int k = 0; k < 10; ++k) {
                char c3 = to_string(k)[0];
                if (exist(S, c1, c2, c3)) {
                    ++ans;
                }
            }
        }
    }

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


Measured memory_bytes: 256
N,M = map(int,input().split())
H = [int(i) for i in input().split()]
chk = [1] * N
for i in range(M):
    A,B = map(int,input().split())
    if H[A-1] > H[B-1]:
        chk[B-1] = 0
    elif H[A-1] == H[B-1]:
        chk[A-1] = 0
        chk[B-1] = 0
    else:
        chk[A-1] = 0
print(sum(chk))

Measured memory_bytes: 20104
#include<bits/stdc++.h>
using namespace std;
int main()
{
 double a,b,h,m;
    cin>>a>>b>>h>>m;

    h=(360/12)*h+((m/60)*(360/12));
        m=(360/60)*m;
    double p=abs(h-m);
 // cout<<cos(1)<<endl;
//  float pi=(22.0/7.0)*precision(17);
    p=p*3.14159265358979323846/180;
   // cout<<cos(p)<<endl;

double   c=sqrt(pow(a,2)+pow(b,2)-2*a*b*(cos(p)));
cout<<fixed << setprecision(20)<<c<<endl;








    return 0;
}


Measured memory_bytes: 4192
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(1e9 + 7)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5+5)

void solve()
{
    ll n,k;
    cin>>n>>k;


    ll arr[n],dp[n];
    for(int i=0;i<n;i++)
        cin>>arr[i],dp[i]=inf;

    dp[0] = 0;
    dp[1] = abs(arr[0] - arr[1]);

    for(ll i=2;i<n;i++)
    {
        for(ll j=max(i-k,(ll)(0));j<i;j++)
        {
            dp[i] = min(dp[i] , dp[j] + abs(arr[i]-arr[j]));
        }
    }

    cout<<dp[n-1]<<"\n";
}

int main()
{
    fio;
    ll tc = 1;
   // cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 1792
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
 
#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl
 
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n;
	cin>>n;
	ll A[n];
	map<ll,ll> m;
	ll ans=0;
	rep(i,0,n){
		cin>>A[i];
		m[A[i]]++;
	}
	for(auto i:m)
		ans += i.sd*(i.sd-1)/2;
	rep(i,0,n){
		ll a = ans + ((m[A[i]]-1)*(m[A[i]]-2))/2 - ((m[A[i]])*(m[A[i]]-1))/2;
		cout << a << endl;
	}
    return 0;
}

Measured memory_bytes: 11136
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0]+list(map(int,input().split()))
c=[0]+list(map(int,input().split()))
s=0
k=-2
for i in range(1,n+1):
  s+=b[a[i]]
  if(k+1==a[i]):
    s+=c[k]
  k=a[i]
print(s)



Measured memory_bytes: 38384
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(a[0]):
	if b[i] == 1:
		c = i
k = (a[0] - 1) // (a[1] - 1)
 
if (a[0] - 1) % (a[1] - 1) != 0:
	k += 1


print(k)

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

typedef long long ll;
const int N = 54, mod = 1000000007;

int n;
int C[N][N], f[N][N];

inline void add(int &x, const int y) {x += y - mod, x += x >> 31 & mod;}
inline void fma(int &x, const int y, const int z) {x = (x + (ll)y * z) % mod;}

void init(int n) {
	int i, j;
	for (*C[0] = i = 1; i <= n; ++i)
		for (*C[i] = j = 1; j <= i; ++j)
			add(C[i][j] = C[i - 1][j], C[i - 1][j - 1]);
}

inline int C3(int a, int b, int c) {return (ll)C[a + b + c][a] * C[b + c][b] % mod;}

int main() {
	int i, j, c, r, o, e, O, E;
	scanf("%d", &n), init(n);
	f[1][0] = f[1][1] = 1;
	for (i = 1; i < n; ++i)
		for (j = 0; j <= i; ++j) if (r = f[i][j])
			for (c = o = j, e = 0; i + c <= n; c += 2, ++o, ++e) if (c)
				for (O = 0, E = c; O <= c; ++O, --E)
					fma(f[i + c][abs(O - o)], r, C3(i, O, E));
	printf("%d\n", f[n][0]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 999999999
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;

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

    int main()
    {
       llong n,m;
       cin>>n>>m;
       if(n>=m/2)
       {
           cout<<m/2<<endl;
       }else
           {
           cout<<n+(m-2*n)/4<<endl;
           }
    }

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;
const long long md = 1e9 + 7;
const int CC = 21;

int n;
long long dp[500005];
long long ans;
int a[500005], b[500005];
vector<int> v[(1 << CC) + 5];

void solve(int x) {
    long long res = 0, s = 0, ss = 0;
    long long cur = 0;
    long long xx;
    for (int i = 0; i < (int)v[x].size(); ++i) {
        xx = v[x][i];
        cur = ss * dp[xx];
        cur %= md;
        cur -= s;
        if (cur < 0) cur += md;
        ++cur;
        if (cur == md) cur = 0;
        if (xx == n) {
            ans += cur;
            if (ans >= md) ans -= md;
        } else if (b[n] == 0) {
            ans += cur;
            if (ans >= md) ans -= md;
        }
        ss += cur;
        if (ss >= md) ss -= md;
        s += cur * dp[xx];
        s %= md;
    }
    return;
}

int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    int c = 1;
    vector<int> q;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        b[i] = (a[i] ^ b[i - 1]);
        dp[i] = dp[i - 1];
        if (b[i] == 0) {
            if (i != n)
            c += c;
            if (c >= md) c -= md;
            ++dp[i];
        } else {
            v[b[i]].push_back(i);
            if ((int)v[b[i]].size() == 1) q.push_back(b[i]);
        }
    }
    if (b[n]) ans = 0;
    else ans = c;
    for (int i = 0; i < (int)q.size(); ++i)
        solve(q[i]);
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 67312
N, K = map(int, input().split())
A = tuple(map(lambda n: int(n) - 1, input().split()))
visited = [0] * N
next_town = 0
order = []
while True:
    if visited[next_town]:
        break
    order.append(next_town)
    visited[next_town] = 1
    next_town = A[next_town]
first_loop = len(order)
offset = order.index(next_town)
second_loop = first_loop - offset
if K < first_loop:
    print(order[K] + 1)
else:
    print(order[offset + (K - first_loop) % second_loop] + 1)

Measured memory_bytes: 32408
#include<iostream>

using namespace std;

int main(){
	int a,b;
	cin>>a>>b;
	if(a<=0&&b>=0){
		cout<<"Zero"<<endl;
	}
	else if(a>0){
		cout<<"Positive"<<endl;
	}
	else {
		int c=b-a;
		if(c%2==0)cout<<"Negative"<<endl;
		else cout<<"Positive"<<endl;
	}
	
}


Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

void test(vector<int> array)
{
	for (int i = 0; i < array.size(); i++)
	{
		cout << array[i];
	}

}




int main()
{
	int N;
	cin >> N;

	vector<int> a(N);

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

	sort(a.begin(), a.end(), greater<int>());

	//test(a);

	int AlicePoint = 0;
	for (int i = 0 ; i < N; i += 2)
	{
		AlicePoint += a[i];
	}

	cout << 2 * AlicePoint - sum;
}



Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <limits.h>
#include <memory.h>


using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef vector<double> vec;
typedef vector<vec> mat;

void go(int x, char c){
	FORI(0,x){
		cout << c;
	}
}

int main() {
	int sx, sy, tx, ty;
	cin>>sx>> sy>> tx>> ty;
	
	int x=tx-sx;
	int y=ty-sy;

	go(y,'U');
	go(x,'R');
	go(y,'D');
	go(x,'L');

	go(1,'L');
	go(y+1,'U');
	go(x+1,'R');
	go(1,'D');
	go(1,'R');
	go(y+1,'D');
	go(x+1,'L');
	go(1,'U');
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N,M;
int T[111],m[111][2],ans;
int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>T[i];
        ans+=T[i];
    }
    cin>>M;
    while(M--){
        int a,b;
        cin>>a>>b;
        cout<<ans+b-T[--a]<<'\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;


int main() {
    ll n,k;
    cin >> n>>k;
    cout << min(n%k,abs((n%k)-k));
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#define mpw 10080
#define mpd 1440

double max(double x,double y){
	return x>y?x:y;
}


int main(void){
	int s, n, t, p, m, i, j, k, w, d, f, e, c;
	int rw[8][2] = {{0,mpd*7},{0,mpd*1},{mpd*1,mpd*2},{mpd*2,mpd*3},{mpd*3,mpd*4},{mpd*4,mpd*5},{mpd*5,mpd*6},{mpd*6,mpd*7}};
	int rd[3][2][2] = {{{0,1440},{0,1440}},{{360,1080},{360,1080}},{{0,360},{1080,1440}}};
	char week[4], tm[6];
	double ans;
	while(1){
		scanf("%d %d %d %s %s %d %d",&s,&n,&t,week,tm,&p,&m);
		if(s == 0) return 0;
		if(!strcmp(week,"All")) w = 0;
		else if(!strcmp(week,"Mon")) w = 1;
		else if(!strcmp(week,"Tue")) w = 2;
		else if(!strcmp(week,"Wed")) w = 3;
		else if(!strcmp(week,"Thu")) w = 4;
		else if(!strcmp(week,"Fri")) w = 5;
		else if(!strcmp(week,"Sat")) w = 6;
		else if(!strcmp(week,"Sun")) w = 7;
		if(!strcmp(tm,"All")) d = 0;
		else if(!strcmp(tm,"Day")) d = 1;
		else if(!strcmp(tm,"Night")) d = 2;
		ans = 0;
		for(j = 0;j < mpw;j++){
			c = 0;
			for(k = 0;k < m;k++){
				f = (j + k * t) % mpw;
				e = f % mpd;
				for(i = 0;i < 2;i++,f = (f + s) % mpw, e = f % mpd){
					if(rw[w][0] <= f && f < rw[w][1] && ((rd[d][0][0] <= e && e < rd[d][0][1]) || (rd[d][1][0] <= e && e < rd[d][1][1]))){
							continue;
					}else{
						break;
					}
				}
				if(i == 2) c++;
			}
			ans = max(ans,1.0 - pow((1 - 1.0 / p),c * n));
		}
		printf("%.10f\n",ans);
	}
}

Measured memory_bytes: 1128
#include<iostream>
using namespace std;
#define MAX_V 110
#define MAX_E 10000
#define INF 10000
int d[MAX_V][MAX_V];
typedef struct edge{
  int f;
  int s;
  int c;
}edge;

edge e[MAX_E];

int main(void)
{
  int n, m;
  cin>>n>>m;
  for(int i=0; i<MAX_V; i++)
    for(int j=0; j<MAX_V; j++)
      if(i==j)
	d[i][j]=0;
      else
	d[i][j]=INF;
  
  for(int i=0; i<m; i++)
    {
      int a, b, c;
      cin>>a>>b>>c;
      edge x;
      x.f=a;
      x.s=b;
      x.c=c;
      e[i]=x;
      d[a][b]=c;
      d[b][a]=c;
    }

  for(int k=0; k<=n; k++)
    for(int i=0; i<=n; i++)
      for(int j=0; j<=n; j++)
	d[i][j]=min(d[i][j], d[i][k]+d[k][j]);

  int cnt=0;
  for(int i=0; i<m; i++)
    {
      edge x=e[i];
      if(d[x.f][x.s]<x.c)
	cnt++;
    }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String lines = "";
		
		while(sc.hasNext()){
		    String line = sc.nextLine();
		    
		    lines += line;
		}
		
		lines = lines.toLowerCase().replace(" ","");
		char []array_str = lines.toCharArray();
		
		for (char lit = 'a'; lit <= 'z'; lit++){
		    int count = 0;
		    
		    for (char c: array_str){
		        if (lit == c){
		            count++;
		        }
		    }
		    
		    System.out.println(lit+" : "+count);
		} 
	}
}


Measured memory_bytes: 26300
#include<stdio.h>

int main(int argc,char **argv)
{
    int a,b;
    scanf("%d%d",&a,&b);
    if((a*b)%2==0)
    {
        printf("Even\n");
    }
    else
    {
        printf("Odd\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    char s[5];
    int i,x;
    x=0;
    
    for(i=0; i<4; i++)
        scanf("%s",&s[i]);

    for(i=0; i<4; i++){
        if(s[i]=='+')
            x++;
        else
            x--;
            
    }
    printf("%d",x);
}


Measured memory_bytes: 128
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = list(map(int,input().split()))
	if(1 not in a):
		print(-1)
		return
	c = 1
	for i in a:
		if(i==c):
			c+=1
	print(n-c+1)

def factorization(n):
	if n<2:
		return []
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(math.gcd, numbers)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()


Measured memory_bytes: 100560
#include <bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
using namespace std;

const int MAX_N = 200005;
long long fact[MAX_N];
long long fact_inv[MAX_N];
long long bin_pow_mod(long long x, long long y) {
  if (x == 0)
    return 0;
  long long prod = 1;
  while (y > 0) {
    if (y & 1) {
      prod = (prod * x) % MOD;
    }
    x = (x * x) % MOD;
    y >>= 1;
  }
  return prod % MOD;
}
void init_fact() {
  fact[0] = 1, fact_inv[0] = 1;
  for (int i = 1; i < MAX_N; ++i) {
    fact[i] = (fact[i - 1] * i) % MOD;
    fact_inv[i] = bin_pow_mod(fact[i], MOD - 2);
  }
}
ll calc(ll all, ll k) {
  if (k > all || all <= 0) {
    return 0;
  }
  return fact[all] * fact_inv[all - k] % MOD * fact_inv[k] % MOD;
}

int main() {
  ll n, itr, itf;
  map<ll, ll> m;
  cin >> n;
  init_fact();
  REP(i, n + 1) {
    ll h;
    cin >> h;
    if (m[h])
      itr = i, itf = m[h] - 1;
    m[h] = i + 1;
  }
  REP(i, n + 1) {
    ll ans = 0;
    ans = calc(n + 1, i + 1);
    if (i == 0) {
      cout << ans - 1 << endl;
      continue;
    }
    ans -= calc(n - itr + itf, i);
    ans = (ans + MOD) % MOD;
    cout << ans << endl;
  }
}


Measured memory_bytes: 10624
#include<stdio.h>

long int lucas(long int a,long int b,long int n){
  if(n==-2) return a;
  if(n==-1) return b;
  if(n==0) return a+b;
  else{
    n--;
    lucas(b,a+b,n);
  }
}

int main(void){
  long int ans,n,l_0=2,l_1=1;
  scanf("%ld",&n);
  ans=lucas(l_0,l_1,n-2);
  printf("%ld\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

string str;
signed main(){
  cin >> str;
  int n = str.size();
  int cnt = 0, ans = 0;
  rep(i,n){
    if(str[i] == 'W'){
      ans += i-cnt;
      cnt++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}






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



int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	long long n, a, b;
	cin >> n >> a >> b;

	long long d = b-a;
	if (d % 2 == 0){
		cout << d/2 << "\n";
		return 0;
	}
	long long a_1 = a-1, b_1 = b-1;
	long long a_n = n-a, b_n = n-b;

	// do 1

	long long t_1 = a;
	b_1 = b-a;
	a_1 = 1;
	d = (b-a)/2;
	t_1 += d;

	// do n

	long long t_n = n-b+1;
	a_n = a+b;
	b_n = n;
	d = (b-a)/2;
	t_n += d;

	cout << min(t_1,t_n) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;
int main(void) {
  lld n, a, b, c;
  cin >> n >> a >> b;
  cout << (n / (a + b) * a + min(n % (a + b), a)) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int K;
    cin >> K;
    
    if (K%2 == 0) {
        cout << (K/2)*(K/2) << endl;
    }else{
        cout << (K/2)*(K/2+1) << endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main() {
    int N;
    cin >> N;
    vector <int> P(N);
    vector <int> Q(N);
    vector <int> R(N);
    for(int i = 0; i < N; i++){
        cin >> P[i];
    }
    for(int i = 0; i < N; i++){
        cin >> Q[i];
    }
    R = min(P , Q);
    P = max(P , Q);
    int ans = 0;
    while(R != P) {
        next_permutation(R.begin(),R.end());
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    ll arr[n] = {0};
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        ll j = 1;
        ll a = i * j;
        while (a <= n)
        {
            arr[a - 1]++;
            j++;
            a = i * j;
        }
    }
    for (ll i = 0; i < n; i++)
    {
        ans += (arr[i] * (i + 1));
    }
    cout << ans << endl;
}

Measured memory_bytes: 81720
//Author- Vaibhav singh
//will be expert soon 
// *#####################################################################################*
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define YES cout<<"YES"<<"\n";
#define NO cout<<"NO"<<"\n";
#define yes cout<<"yes"<<"\n";
#define no cout<<"no"<<"\n";
#define No cout<<"No"<<"\n";
#define Yes cout<<"Yes"<<"\n";
#define f(i,a) for(i=0;i<a;i++)
#define fo(i,a) for(i=1;i<=n;i++)
#define fa(i,a) for(auto i:a)
#define r(i,a) for(auto i=a.rbegin();i!=a.rend();i++)
#define en cout<<"\n";
#define ull unsigned long long int
#define o(x) cout<<x<<"\n";
#define o1(x) cout<<x<<" ";
#define pb push_back
#define F first
#define in insert
#define mp make_pair
#define S second
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
const ll Mod = 998244353;
#define mod 1000000007
#define re return 0;
// *#######################################################################################*
// *#########################################################################################*
    //      ll ans=0,b[5000005]={0},a[5000005],i,n,x=0;                
    

int main()
{
      
      fast
    
      ll n;
      cin>>n;
      ll a[n],i,s=0;
      fo(i,n)
      {
          cin>>a[i];
          s+=a[i];
      }
     ll m;
     cin>>m;
     ll x,y,z;
z=s;
       while(m-->0)
       { z=s;
           cin>>x>>y;
           z-=a[x];
           z+=y;
           o(z)
           
       }
         
        
        
	re
}

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

int main() {
    int n;
    std::cin >> n;

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

    // + - + 
    size_t cnt1 = 0;
    int64_t sum = 0; 
    bool plus = true;
    for (int i = 0; i < n; ++i) {
        sum += a[i];
        if (plus) {
            if (sum == 0) {
                ++cnt1;
                sum += 1;
            } else if (sum < 0) {
                cnt1 += (-sum + 1);
                sum = 1;
            } 

            plus = false;
        } else {
            if (sum == 0) {
                ++cnt1;
                sum -= 1;
            } else if (sum > 0) {
                cnt1 += (sum + 1);
                sum = -1;
            } 

            plus = true;
        }
    }

    // - + - 
    size_t cnt2 = 0;
    sum = 0; 
    plus = false;
    for (int i = 0; i < n; ++i) {
        sum += a[i];
        if (plus) {
            if (sum == 0) {
                ++cnt2;
                sum += 1;
            } else if (sum < 0) {
                cnt2 += (-sum + 1);
                sum = 1;
            } 

            plus = false;
        } else {
            if (sum == 0) {
                ++cnt2;
                sum -= 1;
            } else if (sum > 0) {
                cnt2 += (sum + 1);
                sum = -1;
            } 

            plus = true;
        }
    }


    std::cout << std::min(cnt1, cnt2) << std::endl;

    return 0;
}


Measured memory_bytes: 1024
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// solution 
use std::collections::{BinaryHeap, HashSet};
use std::cmp;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        s: chars,
        K: usize,
    }

    let mut selected: HashSet<&[char]> = HashSet::new();
    let mut idx: Vec<usize> = (0..s.len()).collect();
    idx.sort_by_key(|&ind| &s[ind..cmp::min(ind+K, s.len())]);

    for &ind in idx.iter() {
        for last in ind .. cmp::min(ind+K, s.len()) {
            selected.insert(&s[ind..last+1]);
            if selected.len() == K {
                println!("{}", &s[ind..last+1].iter().cloned().collect::<String>());
                return;
            }
        }
    }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

string s;

vector<vector<long long int> > result(100001, vector<long long int>(2, -1));

long long int solve(int index, bool alreadyLess)
{
	if(result[index][alreadyLess] >= 0) return result[index][alreadyLess];
	if(index == s.length()) return result[index][alreadyLess] = 1;
	if(alreadyLess){
		return result[index][alreadyLess] = (3 * solve(index + 1, alreadyLess)) % mod;
	} else if(s[index] == '1'){
		return result[index][alreadyLess] = (solve(index + 1, true) + 2 * solve(index + 1, false)) % mod;
	} else {
		return result[index][alreadyLess] = solve(index + 1, false);
	}
}

int main()
{
	cin >> s;
	cout << solve(0, false) << endl;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
typedef long long l;
int main(){
  l q;cin>>q;
  for(l i=0;i<q;i++){
    l x,y;
    cin>>x>>y;
    if(x>y)swap(x,y);
    long double k=sqrt(x*y-0.75)-x+0.5;
    cout<<(l)(x-1+k+(x*y-1)/(x+k))-(x!=y)<<endl;
  }
}


Measured memory_bytes: 3680