akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

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

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007
int a[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    I(n);
    Fa(n, a);
    int x = 0;
    F(i, n) x ^= a[i];
    F(i, n) printf("%d%c", x^a[i], (i == n-1 ? '\n' : ' '));

    return 0;
}


Measured memory_bytes: 4588
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>

using namespace std;

const int MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)
#define rep2(i, m, n) for(int i=m;i<n;i++)
#define rrep(i, n, m) for(int i=n;i>=m;i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main() {
    string s;
    cin >> s;
    char prev = 0;
    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == prev){
            cout << "Bad" << endl;
            return 0;
        }
        prev = s[i];
    }
    cout << "Good" << endl;

}


Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
    ll a,b,c;
    cin>>a>>b>>c;
    ll count=0;
    for(int i=a;i<=b;i++){
        if(c<i)break;
         if(c%i==0)count++;
    }
    cout<<count<<"\n";
  return 0;
}



Measured memory_bytes: 3092
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>

int n, k;
long double f[3000010];

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    std::cin >> n >> k;
    for (int i = std::max(n, k * 2); i; --i)
        f[i] = 1;
    for (int i = k - 1; i; --i)
        f[i] = 0.5 * f[i * 2];
    long double ans = 0;
    for (int i = 1; i <= n; ++i)
        ans += f[i];
    printf("%.12Lf\n", ans / (long double)n);
    return 0;
}

Measured memory_bytes: 4352
import math


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


N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = 0
even = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

ans = 0
for i in range(P, odd+1, 2):
    tmp = combination(odd, i)
    for j in range(0, even+1):
        ans += tmp * combination(even, j)
print(ans)


Measured memory_bytes: 66564
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 5121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int p[610];
long long dp[610][610];
int n;
int tot;
long long calc(int a,int b){
	if(~dp[a][b])return dp[a][b];
	long long ret=0;
	int cnt=0;
	for(int i=a;i<=b;i++){
		if(~p[i]&&(a>p[i]||b<p[i]))return dp[a][b]=0;
	}
	for(int i=a;i<=b;i++){
		if(p[i]==-1)cnt++;
	}
	ret=fact[cnt]*finv[cnt/2]%mod;
	for(int i=0;i<cnt/2;i++){
		ret=ret*inv[2]%mod;
	}

	for(int i=a+1;i<b;i+=2){
		if(p[i-1]==-1)cnt--;
		if(p[i]==-1)cnt--;
		long long L=calc(a,i);
		long long R=fact[cnt]*finv[cnt/2]%mod*pw(inv[2],cnt/2)%mod;
		ret=(ret+mod-L*R%mod)%mod;
	}
	// printf("%d %d: %lld\n",a,b,ret);
	return dp[a][b]=ret;
}
int main(){
	int a,b;scanf("%d%d",&a,&b);
	tot=a-b;
	init_C(1200);
	n=a*2;
	for(int i=0;i<a*2;i++)p[i]=-1;
	for(int i=0;i<b;i++){
		int s,t;scanf("%d%d",&s,&t);s--;t--;
		p[s]=t;
		p[t]=s;
	}
	for(int i=0;i<610;i++)for(int j=0;j<610;j++)dp[i][j]=-1;
	long long ret=0;
	for(int i=0;i<a*2;i++){
		int cnt=0;
		if(p[i]==-1)cnt++;
		for(int j=i+1;j<a*2;j++){
			if(p[j]==-1)cnt++;
			if((j-i+10000)%2==0)continue;
			long long tmp=calc(i,j)*fact[tot*2-cnt]%mod*finv[tot-cnt/2]%mod;
			tmp=tmp*pw(inv[2],tot-cnt/2)%mod;
			ret+=tmp;
		}
	}
	ret%=mod;
	printf("%lld\n",ret);
}

Measured memory_bytes: 8320
import bisect
A,B,Q =map(int, input().split())

INF = 10 ** 18
S = []
for i in range(A):
    S.append(int(input()))

S = [-INF] + S + [INF]

T = []
for i in range(B):
    T.append(int(input()))

T = [-INF] + T + [INF]


for i in range(Q):
    x = int(input())
    
    d, b = bisect.bisect_right(S, x), bisect.bisect_right(T, x)
    
    res = INF
    for s in [S[d - 1], S[d]]:
        for t in [T[b - 1], T[b]]:
            res = min(res, 
                      abs(s - x) + abs(s - t),
                      abs(t - x) + abs(s - t))
            
    print(res)

Measured memory_bytes: 13584
import java.io.*;
import java.util.Arrays;

public class Main {

	//ツ　0522JOI and IOI
	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		for(;;) {
		
		String s = reader.readLine();
		if (s == null)
			break;
		
		int joi = 0;
		int ioi = 0;
		
		for(int i = 0; i <= s.length() - 3; i++) {
			if (s.substring(i, i + 3).equals("JOI")) 
				joi++;
			if (s.substring(i, i + 3).equals("IOI")) 
				ioi++;
		}
		System.out.printf("%d\n%d\n", joi, ioi);
		}
		reader.close();
	}
}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; i>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

int main() {
    fastio;
    string s;
    cin >> s;
    ll N = s.size();
    vector<int> c(N);
    vector<int> ans(N);
    int n=0;
    rep(i,N) {
        if (s[i] == 'R') {
            ++n;
        } else if (s[i-1] == 'R') {
            c[i-1] = n;
            n = 0;
        }
    }
    n=0;
    revrep(i,N) {
        if (s[i] == 'L') {
            ++n;
        } else if (s[i+1] == 'L') {
            c[i+1] = n;
            n = 0;
        }
    }
    rep(i,N) {
        int p = c[i];
        if (p) {
            int os = s[i] == 'R' ? 1 : -1;
            ans[i] += p/2 + p%2;
            ans[i+os] += p/2;
        }
    }
    rep(i,N)
        cout << ans[i] << " ";
    cout << endl;
}


Measured memory_bytes: 4228
<?php
$s = trim(fgets(STDIN));
$l = strlen($s);
$half = (int) floor($l / 2);

$sum = 0;
for ($i=0; $i < $half; $i++) { 
	$front = $s[$i];
	$back  = $s[$l-$i-1];
	if ($front !== $back) {
		$sum += 1;
	}
}

echo $sum;

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod=1e9+7;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N=1e6+1;
    ll n;
    cin>>n;
    vector<ll>v(n),f(N);
    for(ll i=0;i<n;i++){
        cin>>v[i];
        f[v[i]]++;
    }
    bool flag=true;
    for(ll i=2;i<N;i++){
        ll cnt=0;
        for(ll j=i;j<N;j+=i){
            cnt+=f[j];
        }
        if(cnt>1){
            flag=false;
            break;
        }
    }
    if(flag){
        cout<<"pairwise coprime"<<endl;
        return 0;
    }
    ll ans=v[0];
    for(ll i=1;i<n;i++){
        ans=__gcd(ans,v[i]);
    }
    if(ans==1){
        cout<<"setwise coprime"<<endl;
    }
    else cout<<"not coprime"<<endl;
    return 0;
}



Measured memory_bytes: 18704
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
map <string, int> m;
int main() {
    cin >> n;
    long long ans = 0;
    for (int i=0; i<n; i++) {
        cin >> s;
        sort(s.begin(), s.end());
        ans += m[s];
        m[s]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
#define endl '\n'
using namespace std;
using ll = long long int;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 112345;
int main() {$
    int n, k;
    string s;
    cin >> s;
    int ans1 = 0, ans2 = 0;
    n = s.size();
    for (int i = 0; i<n; ++i) {
        if (i&1) {
            if (s[i] == '0'){
                ++ans2;
            } else {
                ++ans1;
            }
        } else {
            if (s[i] == '1') {
                ++ans2;
            } else {
                ++ans1;
            }
        }
    }
    cout << min(ans2,ans1) << endl;
}



Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int x = sc.nextInt();
		int a = sc.nextInt();
		// 出力
		if(x < a){
			System.out.println(0);
		}else{
			System.out.println(10);
		}
	}
}

Measured memory_bytes: 21588
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; }return 0; }
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 1e9 + 7;
constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }, dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    int N;
    cin >> N;
    ll sum = 0;
    int C = INT32_MAX;
    rep(i, N) {
        int A, B;
        cin >> A >> B;
        sum += A;
        
        if (A > B) {
            chmin(C, B);
        }
    }

    if (C == INT32_MAX) {
        write(0);
        return 0;
    }
    else {
        write(sum - C);
        return 0;
    }
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var n = input[0];
            var m = input[1];
            var no = Enumerable.Repeat(0, m).ToArray();
            for(var i = 0; i < n; i++)
            {
                var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                for(var j = 1; j <= a[0]; j++)
                {
                    no[a[j]-1]++;
                }
            }
            var count = 0;
            foreach(var b in no)
            {
                if(b == n)
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i, n) for( int i=0 ; i<n ; i++ )
#define f(i, a, b) for( int i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
ll fact(ll n)
{
    ll ans = 1e14;
    for(ll i = 1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            ll sol = (i - 1) + (n/i - 1);
            ans = min(ans,sol);
        }
    }
    return ans;
}
int main()
{
    ll n;
    cin>>n;
    ll ans = fact(n);
    cout<<ans<<endl;

}


Measured memory_bytes: 3608
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	int a;
	in >> a;
	N *= 10; N += a;
	in >> a;
	N *= 10; N += a;
	in >> a;
	N *= 10; N += a;
	out << (N % 4 == 0 ? "YES" : "NO") << endl;

	return 0;
}
#endif


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,c;
  cin>>s>>c;int sum=0,ma=INT_MAX;
  int res=c.length();
  for(long int i=0;i<s.length()-res+1;i++){int k=0;sum=0;
  for(long int j=i;j<i+res;j++){
  if(s[j]==c[k])
    sum++;
    k++;
  
  }
  ma=min(ma,(res-sum));
  
  }

cout<<ma;

return 0;}


Measured memory_bytes: 3636
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

LL ans = 0;
int h, w, n, y[101010], x[101010];

int main() {
	cin >> h >> w >> n;
	REP(i, n)cin >> x[i] >> y[i];
	REP(i, n) {
		if (i) {
			if((x[i-1]<x[i]&&y[i-1]>y[i])|| (x[i - 1]>x[i] && y[i - 1]<y[i])){
				ans += abs(x[i - 1] - x[i]) + abs(y[i - 1] - y[i]);
			}
			else {
				ans += max(abs(x[i - 1] - x[i]), abs(y[i - 1] - y[i]));
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3112
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007 
using namespace std;
typedef long long LL;

LL modpow(LL x, LL n) {
  LL ret = 1;
  while(n != 0) {
    if(n & 1) {
      ret = ret * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}

LL comb(int a, int b) {
  LL ret = 1, div = 1;
  REP(i, b) {
    ret = ret * (a - i) % MOD;
    div = div * (i + 1) % MOD;
  }
  return ret * modpow(div, MOD-2) % MOD;
}

int main(){
  int N, K;
  cin >> N >> K;
  LL ret = 1;
  LL pn = 1, pm = 1, pa = 1;
  for(int i=1; i <=N && i <= K ; ++i) {
    pn = pn * (N+1-i) % MOD;
    pm = pm * (N-i) % MOD;
    pa = pa * i % MOD;
    LL x1 = pn * modpow(pa, MOD-2) % MOD;
    LL x2 = pm * modpow(pa, MOD-2) % MOD;
    ret = (ret + x1 * x2) % MOD;
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define INF 1073741824
#define ll long long
#define PI (2*acos(0.0))
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> 
void dbg_out(Head H, Tail... T) { 
    cerr << ' ' << H;
     dbg_out(T...); 
}
#define dbg(...) cerr << '(' << #__VA_ARGS__ << ')'<<':', dbg_out(__VA_ARGS__)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define on(val,pos) val|(1<<pos)
#define off(val,pos) val&(~(1<<pos))
#define check(val,pos) (val&(1<<pos))
#define all(n) n.begin(),n.end()
//first four adjacent,second four corner
//int row[8]={0,-1,0,1,1,-1,-1,1};
//int col[8]={-1,0,1,0,-1,-1,1,1};
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main(){
    int i,j,k,n,m,val,t=0,test;
    //freopen("000input.txt","r",stdin);
    cin>>n;
    cout<<(!n)<<endl;
    //free();   //if pointer array
    return 0;
}


Measured memory_bytes: 3576
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 //   freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	int x[n],y[n],h[n];
	int x_t,y_t,h_t=-1;
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>y[i]>>h[i];
		if(h[i]>0)
		{
			x_t = x[i];
			y_t = y[i];
			h_t = h[i];
		}
	}
	if(h_t == -1)
	{
		x_t = x[0];
		y_t = y[0];
		h_t = h[0];
	}
	for(int i=0;i<=100;i++)
	{
		for(int j=0;j<=100;j++)
		{
			int curr_h = h_t + abs(x_t - i) + abs(y_t-j);
			bool poss = true;
			for(int k=0;k<n;k++)
			{
				if(h[k] != max(curr_h - abs(x[k] - i) - abs(y[k] - j),0))
				{
					poss = false;
					break;
				}
			}
			if(poss == true)
			{
				cout<<i<<" "<<j<<" "<<curr_h<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
from functools import partial, reduce
from operator import mul
prod = partial(reduce, mul)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from collections import Counter

fibo = [1, 1]
for i in range(2, 9):
    fibo.append(fibo[i - 1] + fibo[i - 2])

def main():
    n = II()
    S = []
    for _ in range(n):
        S.append(SI())
    cnt = Counter(S[0])
    for s in S[1:]:
        s = Counter(s)
        for x in cnt.keys():
            cnt[x] = min(cnt[x], s[x])
        cnt = +cnt
    ans = ''
    for k, v in sorted(list(cnt.items())):
        ans += k * v
    return ans

print(main())

Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	vector<pair<int,int>> ans;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(i+j!=n+1-n%2)ans.push_back({i,j});
	cout<<ans.size()<<'\n';
	for(auto x:ans)cout<<x.first<<' '<<x.second<<'\n';
}


Measured memory_bytes: 384
#include <iostream>

#include<vector>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<utility> 

#include<cstdio> 

#define vii vector< pair<int,int> >

#define vi vector<int>

#define INF 1000000007

#define ff first

#define ss second

#define lli long long int

#define ulli unsigned long long int

using namespace std;

int main() {

 ios_base::sync_with_stdio(false);

    cin.tie(NULL);

  int n;

  cin>>n;

  vector<lli> a(n);

  for(int i=0; i<n; i++)

  cin>>a[i];

 //you have to keep track of previous max element

    lli ans=0,currmax=0;

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

      currmax=max(currmax,a[i]);

      ans+=currmax-a[i];

    }

    cout<<ans<<endl;

}

Measured memory_bytes: 4740
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct st
{
	struct st* prev;
	struct st* next;
	int a;
	int b;
	int c;
} stack;

int* list;

int match(int a,int b,int c)
{
	if(list[a-1] == 2 && list[b-1] == 1 && list[c-1] == 1)
		return a;
	else if(list[a-1] == 1 && list[b-1] == 2 && list[c-1] == 1)
		return b;
	else if(list[a-1] == 1 && list[b-1] == 1 && list[c-1] == 2)
		return c;
	else
		return 0;
}

int main()
{
	int a,b,c;
	int n;
	int i,j;
	stack start = {NULL,NULL,-1,-1,-1};
	stack* pt = &start;
	while(scanf("%d %d %d",&a,&b,&c),a)
	{
		list = (int*)malloc(sizeof(int)*(a+b+c));
		for(i = 0;i < (a+b+c);i++)
		{
			list[i] = 2;
		}
		scanf("%d",&n);
		for(i = 0;i < n;i++)
		{
			int sa,sb,sc,r;
			scanf("%d %d %d %d",&sa,&sb,&sc,&r);
			if(r == 1)
			{
				list[sa-1] = 1;
				list[sb-1] = 1;
				list[sc-1] = 1;
			}
			else
			{
				pt->next = (stack*)malloc(sizeof(stack));
				pt->next->prev = pt;
				pt->next->a = sa;
				pt->next->b = sb;
				pt->next->c = sc;
				pt = pt->next;
			}
		}
		pt->next = &start;
		start.prev = pt;
		i = 0;
		while(i < 20)
		{
			if(pt->a == -1)
			{
				i++;
				pt = pt->next;
				continue;
			}
			else
			{
				int data = match(pt->a,pt->b,pt->c);
				if(data != 0)
				{
					list[data-1] = 0;
					stack* tmp = pt;
					pt->prev->next = pt->next;
					pt->next->prev = pt->prev;
					free(pt);
				}
				pt = pt->next;
			}
		}
		for(i = 0;i < (a+b+c);i++)
		{
			printf("%d\n",list[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
using namespace std;

int N, M;
string S;
long double R;
vector<int> A(M);

int main(){

    int sum = 0;
    cin >> N >> M;
    vector<int> A(M);

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

    int res = N - sum;

    if(res >= 0){
        cout << res << endl;
    } else {
        cout << -1 << endl;
    }

}

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

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

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

            long x = sc.nextLong();

            for (long j = x;j<1000000 ;j++ ) {
              int count = 0;
              for (long i = 2;i<x;i++ ) {
                if (x%i==0) {
                  count++;
                }
                }
                if(count==0){
                  System.out.println(x);
                  System.exit(0);
                }
                x++;
              }
            }


      }


Measured memory_bytes: 23124
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

  public static void main(final String[] args) {
    final var scanner = new Scanner(System.in);

    final BigDecimal A = scanner.nextBigDecimal();
    final BigDecimal B = scanner.nextBigDecimal();

    final BigDecimal C = A.multiply(B)
        .setScale(2, RoundingMode.DOWN);
    final String result = C.toPlainString()
        .replaceAll("\\.\\d*$", "");

    System.out.println(result);
  }
}


Measured memory_bytes: 37544
#include <stdio.h>
int main(void){
        int N;
        long long int ans=1;
        long long int mod = 1000000000+7;
        scanf("%d", &N);
        for (int i = 1; i < 1 + N; i++) {
                ans *= i;
                ans %= mod;
        }
        printf("%lld\n",ans);
        return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int m=sc.nextInt();
	private static String[] nstr=new String[n];
	private static String[] mstr=new String[m];
	private static char[][] a=new char[n][n];
	private static char[][] b=new char[m][m];
	public static void main(String[] args){
		for(int i=0;i<n;i++){
			nstr[i]=sc.next();
			for(int j=0;j<n;j++){
				a[i][j]=nstr[i].charAt(j);
			}
		}
		for(int i=0;i<m;i++){
			mstr[i]=sc.next();
			for(int j=0;j<m;j++){
				b[i][j]=mstr[i].charAt(j);
			}
		}
		System.out.println(check());
	}
	private static String check(){
		for(int i=0;i<=n-m;i++){
			for(int j=0;j<=n-m;j++){
				boolean com=true;
				label: for(int k=i;k<i+m;k++){
					for(int l=j;l<j+m;l++){
						if(a[k][l]!=b[k-i][l-j]){
							com=false;
							break label;
						}
					}
				}
				if(com) return "Yes";
			}
		}
		return "No";
	}
}

Measured memory_bytes: 22868
n, k = map(int, input().split())
a = list(map(int, input().split()))

low = 0
high = max(a)

while low + 1 < high:
    mid = (low + high) // 2
    m = 0
    for x in a:
        m += (x - 1) // mid
    
    if m <= k:
        high = mid
    else:
        low = mid

print(high)

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

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

    char a, b;
    cin >> a >> b;

    if(a == 'H') cout << b << endl;
    else if(b == 'H') cout << 'D' <<endl;
    else cout << 'H' << endl;
}

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

int main(void){
	int r;
	cin>>r;
	if(r<1200){
		cout<<"ABC";
	}else if(r<2800){
		cout<<"ARC";
	}else{
		cout<<"AGC";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len;
    cin >> len;
    vector<int> arr(len);
    for(int i = 0; i < len; i++) {
        cin >> arr[i];
    }
    deque<int> ans;
    for(int i = 0; i < len; i++) {
        if(i % 2 == 0) {
            ans.push_back(arr[i]);
        } else {
            ans.push_front(arr[i]);
        }
    }
    if(len % 2 == 0) {
        for(int i = 0; i < len; i++) {
            cout << ans.front() << " ";
            ans.pop_front();
        }
    } else {
        for(int i = 0; i < len; i++) {
            cout << ans.back() << " ";
            ans.pop_back();
        }
    }
}

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

int main(){	
	string s,t;
	cin >> s >> t;
	string ans = "Yes";
	if(s.length() != t.length()-1){ ans = "No";
	}else{
		rep(i,s.length()){
			if(s[i] !=t[i]) ans = "No";
		}
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#define dd long double
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<dd> arr(n+1);
    for(int i=1;i<=n;i++) cin >> arr[i];
    vector<vector<dd>> dp(n+1, vector<dd>(n+1, 0.0));
    dp[0][0] = 1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(j==0) dp[i][j] = (1-arr[i])*dp[i-1][0];
            else dp[i][j] = arr[i]*dp[i-1][j-1] + (1-arr[i])*dp[i-1][j];
        }
    }
    dd ans = 0.0;
    for(int i=n/2+1;i<=n;i++) ans+=dp[n][i];
    cout.precision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 143808
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    cout << (A == B ? 2 * A : max(A, B) * 2 - 1) << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
vector<vector<int> > dp;
string s0;
void call(int i,int j){
	if((i>s.size()-1)||(j>t.size()-1)){
		return;
	}
	if(s[i]==t[j]){
		s0+=s[i];
		call(i+1,j+1);
	}
	else{
		if(dp[i+1][j]>dp[i][j+1]){
			call(i+1,j);
		}
		else{
			call(i,j+1);
		}
	}
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
	cin>>s>>t;
	dp.resize(s.size()+1,vector<int>(t.size()+1));
	for(int i=0;i<=s.size();i++){
		dp[i][t.size()]=0;
	}
	for(int j=0;j<=t.size();j++){
		dp[s.size()][j]=0;
	}
	for(int i=s.size()-1;i>=0;i--){
		for(int j=t.size()-1;j>=0;j--){
			if(s[i]==t[j]){
				dp[i][j]=dp[i+1][j+1]+1;
			}
			else{
				dp[i][j]=max(dp[i+1][j],dp[i][j+1]);
			}
		}
	}
	call(0,0);
	cout<<s0;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans=0,a;
  for(int i=1;i<=n;i++){
    cin >> a;
    if(i%2==1 && a%2==1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != n / i) ret.push_back(n / i);
        }
    }
    return ret;
}

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

    ll n;
    cin >> n;

    vector <ll> div = divisor(n);
    sort(div.begin(), div.end());

    int sz = div.size();
    if (sz % 2 == 1) {
        cout << div[sz / 2] * 2 - 2 << '\n';
    } else {
        cout << div[sz / 2] + div[sz / 2 - 1] - 2 << '\n';
    }

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        char c;
        scanf("%c",&c);
        if(c=='Y'){
            printf("Four");
            return 0;
        }
    }
    printf("Three");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W,N;
    cin >> H >> W;
    cin >> N;
    int a[10010];
    rep(i,0,N){
        cin >> a[i];
    }
    int px = 0, py = 0;
    int end_x = W - 1;
    if(H % 2 == 0){
        end_x = 0;
    }
    int a_pos = 0;
    int ans[110][110] = {};
    while(px != end_x || py != H - 1){
        ans[py][px] = a_pos + 1;
        a[a_pos]--;
        if(a[a_pos] == 0){
            a_pos++;
        }
        if(py % 2 == 0 && px == W - 1){
            py++;
        }else if(py % 2 == 1 && px == 0){
            py++;
        }else if(py % 2 == 0){
            px++;
        }else{
            px--;
        }
    }
    ans[H-1][end_x] = N;
    rep(i,0,H){
        rep(j,0,W){
            if(j == W-1){
                cout << ans[i][j];
            }else{
                cout << ans[i][j] << " ";
            }
        }
        cout << endl;
    }

}


Measured memory_bytes: 384
N,M = map(int,input().split())
H = list(map(int,input().split()))
L = [[] for _ in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    L[A-1].append(B-1)
    L[B-1].append(A-1)
ans = 0
for i in range(N):
    a = True
    for j in L[i]:
        if H[i] <= H[j]:
            a = False
            break
    if a:
        ans += 1
print(ans)

Measured memory_bytes: 92844
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>

T calcgcd(T x, T y)
{
    if (x < y)
    {
        std::swap(x, y);
    }
    T r = x % y;
    while( r != 0 )
    {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

bool PrimeFactorization(long long n, std::map<long long, long long>& mp)
{
    if (n <= 1) return false;
    long long num = n;
    for(long long i = 2; i * i <= n; ++i)
    {
        long long r = num % i;
        while (r == 0)
        {
            ++mp[i];
            num = num / i;
            r = num % i;
        }
    }
    // 割り続けて1とならない場合,
    // numはまだ出ていない素数となる(あるいはnそのものが素数である)
    // したがって、これもカウントする
    if (num != 1)
    {
        ++mp[num]; // dic[num] = 1 でも OK 
    }
    return true;
}

int main()
{
    ll a, b;
    cin >> a >> b;
    ll g = calcgcd(a, b);
    map<ll, ll> res;
    PrimeFactorization(g, res);

    ll ans = res.size() + 1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//dlang template---{{{
import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;
import std.typecons;
import std.math;
import std.range;

// MIT-License https://github.com/kurokoji/nephele
class Scanner
{
  import std.stdio : File, stdin;
  import std.conv : to;
  import std.array : split;
  import std.string;
  import std.traits : isSomeString;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin)
  {
    this.file = file;
    this.idx = 0;
  }

  this(StrType)(StrType s, File file = stdin) if (isSomeString!(StrType))
  {
    this.file = file;
    this.idx = 0;
    fromString(s);
  }

  private char[] next()
  {
    if (idx < str.length)
    {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0)
    {
      s = file.readln.strip.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)()
  {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len)
  {
    T[] ret = new T[len];

    foreach (ref c; ret)
    {
      c = next!(T);
    }

    return ret;
  }

  void scan()()
  {
  }

  void scan(T, S...)(ref T x, ref S args)
  {
    x = next!(T);
    scan(args);
  }

  void fromString(StrType)(StrType s) if (isSomeString!(StrType))
  {
    str ~= s.to!(char[]).strip.split;
  }
}

//Digit count---{{{
int DigitNum(int num) {
  int digit = 0;

  while (num != 0) {
    num /= 10;
    digit++;
  }

  return digit;
}
//}}}
//}}}

void main() {
  Scanner sc = new Scanner;

  int K;
  sc.scan(K);

  if (K % 2 == 0) {
    writeln((K * K / 2) / 2);
  } else {
    writeln( (K - (K / 2)) * ((K - (K / 2)) - 1));
  }
}


Measured memory_bytes: 256
n = int(input())
vals = list(map(int, input().split()))
costs = list(map(int, input().split()))

if n == 1:
    print(0)
else:
    total = 0
    for v, c in zip(vals, costs):
        resale = v - c
        if resale > 0:
            total += resale
    print(total)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int s=S.size();
  int count1=0,count2=0;
  for (int i=0;i<s;i++){
    if (S[i]!=i%2+'0'){
      count1++;
    }
    else {
      count2++;
    }
  }
  int ans=min(count1,count2);
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int a;

	cin >> a;
	vector<int> V = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << V[a - 1] << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    string s; cin >> s;
    ll n = s.size();
    ll now = 0;
    ll ans = 0;
    ll yama = 0;
    int flag = 0;
    if(s[0] == '>'){
        flag = 1;
    }
    rep(i,n){
        if(flag == 0){
            if(s[i] == '<'){
                now++;
            }else{
                flag = 1;
                ans += (now - 1) * now / 2;
                yama = now;
                now = 1;
            }
        }else{
            if(s[i] == '>'){
                now++;
            }else{
                flag = 0;
                ans += (now - 1) * now / 2;
                yama = max(now, yama);
                ans += yama;
                yama = 0;
                now = 1;
            }
        }
    }

    if(flag == 0){
        ans += now * (now + 1) / 2;
    }else{
        
        ans += (now - 1) * now / 2;
        yama = max(now, yama);
        ans += yama;
        yama = 0;
        now = 1;
    }

    

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


Measured memory_bytes: 900
using System;
using System.Collections.Generic;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var SA = A.OrderBy(x => x).ToList();
            while (A.Count > 1)
            {
                int m = SA[0];
                for(int i = 1; i < A.Count; i++)
                {
                    SA[i] %= m;
                }
                SA.RemoveAll(x=>x==0);
                A = SA;
                SA=A.OrderBy(x => x).ToList();
            }
            Console.WriteLine(A[0]);
        }
        
    }
}


Measured memory_bytes: 39940
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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 $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize,
    }
    println!("{}", min(b / a, c));
}


Measured memory_bytes: 4352
import Text.Printf

icnv :: Int -> [Int]
icnv min =
  let s = min `mod` 60
      h = (min `div` 60) `mod` 60
      t = (min `div` 3600) `mod` 60
  in
    (t:(h:(s:[])))

cnv :: [Int] -> Int
cnv (t:h:s:_) = t * 3600 + h * 60 + s

ans :: [Int] -> [[Int]]
ans x = [ icnv $ (cnv [2,0,0]) - (cnv x),
          icnv $ ( (cnv [2,0,0]) - (cnv x) ) * 3 ]

main = do
  c <- getContents
  let l = map (map read) $ map words $ lines c :: [[Int]]
      i = takeWhile (/= [-1,-1,-1]) l
      o = concat $ map ans i
  mapM_ (\(t:h:s:_) -> printf "%02d:%02d:%02d\n" t h s) o
  

Measured memory_bytes: 4128
import collections
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
A.sort()

s = collections.deque([A[0]])
i = 1
j = N-1
while i <= j:
    xl = max(abs(s[0]-A[j]), abs(s[-1]-A[j]))
    xs = max(abs(s[0]-A[i]), abs(s[-1]-A[i]))
    if xl > xs:
        x = A[j]
        j -= 1
    else:
        x = A[i]
        i += 1
    if abs(s[0]-x) > abs(s[-1]-x):
        s.appendleft(x)
    else:
        s.append(x)
assert len(s) == N
ans = 0
for i in range(1, N):
    ans += abs(s[i] - s[i-1])
print(ans)


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

double f(double x1, double y1, double x2, double y2, double xp, double yp) {
    return (y2 - y1) * xp + (-x2 + x1) * yp - x1 * (y2 - y1) + y1 * (x2 - x1);
}


int main(void) {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double a, b, c;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        a = f(x1, y1, x2, y2, xp, yp);
        b = f(x2, y2, x3, y3, xp, yp);
        c = f(x3, y3, x1, y1, xp, yp);
        if((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 3200