akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int dp[5012];
	Pii data[3];
	data[0] = Pii(200,380);
	data[1] = Pii(300,550);
	data[2] = Pii(500,850);

	Pii s[3];
	s[0] = Pii(5,20);
	s[1] = Pii(4,15);
	s[2] = Pii(3,12);

	fill(dp,dp+5012,INF);
	
	dp[0] = 0;

	rep(i,3){
		int sum = 0;
		int cnt = 1;
		for(int j = data[i].fi; j < 5012; j += data[i].fi){
			int tmp = 0;
			sum += data[i].se;
			if(cnt%s[i].fi == 0){
				tmp = sum * (100-s[i].se) / 100;
			}
			else tmp = sum;
			dp[j] = min(dp[j],tmp);
			cnt++;
		}
	}
	int dp2[5012];
	fill(dp2,dp2+5012,INF);
	dp2[0] = 0;

	for(int i = 0; i < 5012; i+=100){
		for(int j = 0; j < 5012; j+=100){
			if(i+j < 5012 && dp2[i] != INF && dp[j] != INF)dp2[i+j] = min(dp2[i+j],dp2[i]+dp[j]);
		}
	}

	int N;
	while(scanf("%d",&N),N){
		printf("%d\n",dp2[N]);
	}
	return 0;
}

Measured memory_bytes: 1224
a = input()
b = input()

if len(a) > len(b):
    print("GREATER")
elif len(a) < len(b):
    print("LESS")
else:
    for i in range(len(a)):
        if int(a[i]) > int(b[i]):
            print("GREATER")
            break
        elif int(a[i]) < int(b[i]):
            print("LESS")
            break
    else:
        print("EQUAL")


Measured memory_bytes: 3060
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef pair<ll,ll> p;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
char x;
cin>>x;
if(isupper(x))
{
    cout<<"A"<<endl;
}else
{
    cout<<"a"<<endl;
}
return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
#include <math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h,w;
    while(cin>>h>>w,h!=0 && w!=0){
	
	reps(i,h){
	    if(i%2){
		reps(j,w){
		    if(j%2){
			cout<<'#';
		    }
		    else{
			cout<<'.';
		    }
		}
	    }
	    else{
		reps(j,w){
		    if(j%2){
			cout<<'.';
		    }
		    else{
			cout<<'#';
		    }
		}
	    }

	    cout<<'\n';
	}
	cout<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3212
#include<cstdio>
#define N 100005
using namespace std;
int n,k,q,tag,a[N];
int main()
{
	scanf("%d %d %d",&n,&k,&q);
	for(int i=1;i<=n;i++)a[i]=k;
	for(int i=1,x;i<=q;i++)
	{
		scanf("%d",&x);
		a[x]++,tag++;
	}
	for(int i=1;i<=n;i++)
		if(a[i]-tag<=0)puts("No");
		else puts("Yes");
	return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		A:switch(s.length) {
		case 2:
			if(s[0] == s[1]) {
				System.out.print("1 2");
			}else {
				System.out.print("-1 -1");
			}
			break;
		default:
			for(int i = 0; i + 2 < s.length; i++) {
				if(s[i] == s[i+1] || s[i] == s[i+2] || s[i] == s[i+2]) {
					System.out.printf("%d %d",i+1,i+3);
					break A;
				}
			}
			System.out.print("-1 -1");
		}
		sc.close();
	}

}

Measured memory_bytes: 28120
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
      for k in range(3):
        if a[j][k] == b:
          a[j][k] = 0

if a[0][0] == 0 and a[0][1] == 0 and a[0][2] == 0:
  print("Yes")
  exit()
if a[1][0] == 0 and a[1][1] == 0 and a[1][2] == 0:
  print("Yes")
  exit()
if a[2][0] == 0 and a[2][1] == 0 and a[2][2] == 0:
  print("Yes")
  exit()
if a[0][0] == 0 and a[1][0] == 0 and a[2][0] == 0:
  print("Yes")
  exit()
if a[0][1] == 0 and a[1][1] == 0 and a[2][1] == 0:
  print("Yes")
  exit()
if a[0][2] == 0 and a[1][2] == 0 and a[2][2] == 0:
  print("Yes")
  exit()
if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
  print("Yes")
  exit()
if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
  print("Yes")
  exit()

print("No")


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

vector<vector<int>> G(101010);
int H[101010];

int main(){
  int N,M; cin>>N>>M;
  rep(i,N) cin>>H[i];
  rep(i,M){
    int A,B; cin>>A>>B; A--,B--;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  int ans=0;
  rep(i,N){
    int flag=1;
    for(int j:G[i]){
      if(H[i]<=H[j]) flag=0;
    }
    ans+=flag;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 8776
#include<iostream>
#include <algorithm>
#include<queue>
#include<cmath>
#include<math.h>
using namespace std;


char s[6];
int main() 
{
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
int r;
  cin >> r;
  string ans;
  if (r < 1200) ans = "ABC";
  else if(r<2800)
    ans = "ARC";
   else
     ans = "AGC";

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


Measured memory_bytes: 256
/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
vi a;
vi dp(MX);
void SieveOfEratosthenes(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          a.pb(p); 
} 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n;
	SieveOfEratosthenes(100004);
	cin>>n;
	int val=a[lb(all(a),n)-a.begin()];
	cout<<val;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3832
import queue as que
n=int(input())
a=list(input().split())
q=que.Queue()
s=[]
i=1
if n%2:
    for A in a:
        if i%2: s.append(A)
        else: q.put(A)
        i+=1
else:
    for A in a:
        if i%2: q.put(A)
        else: s.append(A)
        i+=1
for _ in range(len(s)): print(s.pop())
while not q.empty() :print(q.get())

Measured memory_bytes: 22668
def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i).sort

  h = {}
  a.each do |v|
    if h[v] == nil then
      h[v] = 1
    else
      h[v] += 1
    end
  end

  count_double = 0
  h.each do |k, v|
    h[k] = (v % 2 == 0) ? 2 : 1

    count_double += 1 if h[k] == 2
  end

  if count_double % 2 == 0 then
    puts h.size.to_s
  else
    puts (h.size - 1).to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;

// ABC132-A

int main() {

    string S;
    cin >> S;

    rep(i,4){
        char c = S[i];
        int cnt = 0;
        rep(j,4){
            if(S[i] == S[j])    cnt++;
        }
        if(cnt!=2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){

  ll N;
  cin>>N;
  vector<ll> M;
  ll nin=9;
  ll six=6;
  M.push_back(1);
  for(ll i=1;six<=100000;i++){
    M.push_back(six);
    six=six*6;
  }
  for(ll i=1;nin<=100000;i++){
    M.push_back(nin);
    nin=nin*9;
  }
  sort(M.begin(),M.end());
  
  //for(int i=0; i<(int)M.size(); i++) cout << " " << M[i] << " ";
  vector<ll> dp(N+10000,INF);
  dp[0]=0;

  for(ll j=0;j<N+10000;j++){
  for(ll i=0;i<(ll)M.size();i++){
    if(N<j+M[i])continue;
    dp[j+M[i]]=min(dp[j+M[i]],dp[j]+1);
  }
  }
  
  cout<<dp[N]<<endl;
 
  
}


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

multiset<int> st, st2;
long long cnta, suma, sumb, sumst, q, a, b;

long long calc(long long a) {
	long long smaller = (cnta + 1) / 2;
	return ((2 * smaller - cnta) * a) + suma - (2 * sumst) + sumb;
}
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> q;
	while(q--) {
		int type;
		cin >> type;
		if (type == 1) {
			cin >> a >> b;
			cnta++;
			suma += a;
			sumb += b;
			if (a > (*st2.begin())) {
				st2.insert(a);
				a = (*st2.begin());
				st2.erase(st2.find(a));
			}
			sumst += a;
			st.insert(a);
			long long tmp = (*st.rbegin());
			if (st.size() > (cnta + 1) / 2) {
				st.erase(st.find(tmp));
				sumst -= tmp;
				st2.insert(tmp);
			}
		}
		else {
			long long tmp = (*st.rbegin());
			cout << tmp << ' ' << calc(tmp) << '\n';
		}
	}
}


Measured memory_bytes: 9600
package main

import (
	"fmt"
)

func main() {
	var a int
	var b int
	fmt.Scanf("%d %d", &a, &b)
	if (1 <= a && a <= 100) && (1 <= a && a <= 100){
		fmt.Printf("%d %d\n", Area(a, b), Perimeter(a, b))
	}
}

func Area(a int, b int) int {
	return a*b
}

func Perimeter(a int, b int) int {
	return (a + b) * 2
}


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

int main() {
    ll h, w;
    cin >> h >> w;
    ll num = h * w;
    if (num % 2) num++;
    if (h == 1 || w == 1) {
        cout << 1 << endl;
    } else {
        cout << num / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

    vector<int> v(n, 0);
    vector<int> w(n, 0);

    for (int i = 0; i < n; i++) {
        cin >> v[i] >> w[i];
    }
    
    vector<vector<int>> dp(n + 1, vector<int>(cap + 1, 0));

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= cap; j++) {
            dp[i][j] = dp[i - 1][j];
            if (j >= w[i - 1]) {
                dp[i][j] = max(dp[i][j], v[i - 1] + dp[i][j - w[i - 1]]);
            }
        }
    }

    cout << dp[n][cap] << endl;

    return 0;
}



Measured memory_bytes: 6752
#include <iostream>
using namespace std;
int main() {
	int N, M, X, Y;
	int x[100], y[100];
	bool flg = false;

	cin >> N >> M >> X >> Y;
	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
	}

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

	for (int z = X+1; z <= Y; z++)
	{
		bool xf = true;
		bool yf = true;
		for (int i = 0; i < N; i++)
		{
			if (x[i] >= z) {
				xf = false;
			}
		}
		for (int i = 0; i < M; i++)
		{
			if (y[i] < z) {
				yf = false;
			}
		}

		if (xf&&yf) {
			flg = true;
		}

	}

	if (flg) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}

	return 0;
	
}

Measured memory_bytes: 256
/// b.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    ll n,a,b,c,d;
    fi>>n>>a>>b>>c>>d;
    n -= 1;
    for (int i = 0;i <= n;++i)
    {
        ll l = c * (n - i) - d * i;
        ll r = d * (n - i) - c * i;
        if (l <= b - a && b - a <= r)
            return yes * 0;
    }
    no;
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


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

int main() {
  long long n; cin >> n;
  
  vector<long long> tp(5);
  for (int i = 0; i < 5; i++) cin >> tp[i];
  long long min = *min_element(tp.begin(), tp.end());
  
  long long ans = 4;
  if (n % min == 0) ans += n / min;
  else ans += n / min + 1;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

lim = 10**5

is_prime = [1]*(lim+1)
is_prime[0] = 0
is_prime[1] = 0

for i in range(lim+1):
	if is_prime[i] == 1:
		for j in range(2, lim//i + 1):
			is_prime[i*j] = 0

dp = [0]*(lim+1)
for i in range(lim+1):
	if is_prime[i] and is_prime[(i+1)//2]:
		dp[i] = 1

dp = list(accumulate(dp))

Q = INT()
for _ in range(Q):
	l, r = MAP()
	print(dp[r]-dp[l-1])



Measured memory_bytes: 14724
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	std::string str;
	bool okada;
	int n = 0;
	cin >> str;
	for (int i = 0; i <= 3; i++) {
		if (str[i] == 'o') {
			n += 1;
		}
	}
	std::cout << 700 + 100 * n << endl;
}

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

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

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

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

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

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


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





int main() {

	ll M, N;
	cin >> N >> M;

	vector<string> A(N);
	vector<string> B(M);
	rep(i, N) cin >> A[i];
	rep(i, M) cin >> B[i];

	string ans = "No";

	rep(i, N - M + 1)rep(j, N - M + 1) {
		bool b = 1;
		rep(k, M)rep(l, M) {
			if (B[k][l] != A[k + i][l + j]) { b = 0; }
		}
		if (b == 1) { ans = "Yes"; }
	}

	cout << ans;


	system("PAUSE");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>> v;
	for(int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		v.push_back({a, b});
	}

	sort(v.begin(), v.end(), cmp);

	int ans = 0, last = 0;
	for(int i = 0; i < M; i++) {
		if(last <= v[i].first) {
			last = v[i].second;
			ans++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 4304
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
// #include <bits/stdc++.h>


using namespace std;
typedef long long li;

struct BIT {
    int n;
    vector<li> bit;

    BIT(int _n): n(_n), bit(_n + 1) {}

    li sum(int i) {
        li s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, li x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};


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

    li n, k;
    cin >> n >> k;

    vector<li> xs(n);
    for (int i = 0; i < n; ++i) {
        cin >> xs[i];
        xs[i] -= k;
    }

    priority_queue<pair<li, li>> q;
    q.emplace(0, -1);
    li acc = 0;
    for (int i = 0; i < n; ++i) {
        acc += xs[i];
        q.emplace(-acc, -(i + 2));
    }

    li ans = 0;
    BIT bit(n + 5);
    while (!q.empty()) {
        auto t = q.top(); q.pop();
        const li v = -t.first;
        const li i = -t.second;

        ans += bit.sum(i - 1);
        bit.add(i, 1);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 8048
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int h,w,k,bcnt=0,ans=0; cin>>h>>w>>k;
    vector<string> s(h);
    rep(i,h){
        cin>>s[i];
        rep(j,w) if(s[i][j]=='#') bcnt++;
    }
    rep(i,(1<<h))rep(j,(1<<w)){
        int cnt=bcnt;
        vector<vector<int>> mp(h,vector<int>(w,0));
        rep(I,h){
            if(i&(1<<I)){
                rep(J,w){
                    if(s[I][J]=='#' && mp[I][J]==0){
                        cnt--; mp[I][J]=1;
                    }
                }
            }
        }
        rep(I,w){
            if(j&(1<<I)){
                rep(J,h){
                    if(s[J][I]=='#' && mp[J][I]==0){
                        cnt--; mp[J][I]=1;
                    }
                }
            }
        }
        if(k==cnt) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#define N 100
static const int INFTY=(1<<21);

int n,M[N][N],d[N];
int Q[N*2],head,tail;

void init(){
  head = tail = 1;
}
void enqueue(int x){
  Q[tail++] = x;
}
int empty(){
  return head == tail;
}
int dequeue(){
  int x = Q[head++];
  return x;
}
void bfs(int s){
  int i, u, v;
  init();
  enqueue(s);
  for(i=0;i<n;i++)d[i] = INFTY;
  d[s] = 0;
  while(!empty()){
    u = dequeue();
    for(v=0;v<n;v++){
      if(M[u][v] == 0) continue;
      if(d[v] != INFTY) continue;
      d[v] = d[u]+1;
      enqueue(v);
    }
  }
  for(i=0;i<n;i++){
   printf("%d %d\n",i+1,((d[i] == INFTY)?-1:d[i]));
  }
}
int main(){
  int  u, k, v, i, j;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    for (j=0;j<n;j++){
      M[i][j] = 0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for (j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
  bfs(0);
  return 0;
}




Measured memory_bytes: 2020
#include<iostream>
#include<cmath>
#include<climits>
using namespace std;

int b[1000],cur_spot,start,goal,q[1000];
bool used[1000];
int x[1000],y[1000];
double mindist[1000],cur;


void dijkstra(int s,int g,int n){
  
  int cnt=0,keiro[1000],a;
  double kyori;
  
  for(int i=0 ; i < 1000 ; i++){
    mindist[i]=1000000;
    used[i]=0;
    q[i]=-1;
  }

  for(int i=0 ; i < n ; i++){
    if(b[i] == s){
      start=i;
    }else if( b[i] == g){
      goal=i;
    } 
  }
  
  mindist[start]=0;
  
  for(int i=0 ; i < n ; i++){
    cur=INT_MAX;
    for(int j=0 ; j < n ; j++){
      if(used[j]== 0){
	if(cur >= mindist[j]){
	  cur=mindist[j];
	  cur_spot=j;
	}
      }
    }      
    used[cur_spot]=1;
    
    for(int j=0 ; j < n ; j++){
      
      if(j == cur_spot)continue;
      
      kyori=sqrt((x[j]-x[cur_spot])*(x[j]-x[cur_spot])+(y[j]-y[cur_spot])*(y[j]-y[cur_spot]));
      
      if(kyori <= 50 && used[j] == 0){
	if(mindist[j] > mindist[cur_spot]+ kyori){
	  mindist[j]=mindist[cur_spot]+kyori;
	  q[j]=cur_spot;
	}
      }
    }
  }
  
  if(q[goal] == -1){
    cout <<"NA"<<endl;
  }else{
    a=goal;
    while(1){
      keiro[cnt]=b[a];
      a=q[a];
      if(a == -1)break;
      cnt++;
    }

    for(int i=cnt ; i >= 0 ; i--){
      cout <<keiro[i];
      if(i != 0)cout <<" ";
    }
    cout <<endl;
  }
}
int main(){
  
  int n,m,s,g;
  
  while(1){

    cin >> n;
    
    if(n == 0)break;
    
    for(int i=0 ; i < n ; i++){
      cin >>b[i]>>x[i]>>y[i];
    }
    
    cin >>m;
    
    for(int i=0 ; i < m ; i++){
      cin >>s>>g;
      dijkstra(s,g,n);
    }
  } 
  
  return 0;
  
}

Measured memory_bytes: 1180
#include<cstdio>
#include<utility>
#include<algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    pair<int, int> student[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]);
        student[i].first = a[i];
        student[i].second = i;
    }
    sort(student, student + n);
    for(int i = 0; i < n; i++){
        printf("%d ", student[i].second + 1);
    }
    puts("");
    

    

}

Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <unordered_map>
#include <assert.h>
using namespace std;

#define ran(i, a, b) for ((i) = (a); (i) < (b); (i)++)
#define rep(i, a) ran ((i), 0, (a))
#define rep1(i, a) ran ((i), 1, (a)+1)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;
#define _0 first
#define _1 second
#define _pb(x) push_back(x)
#define _mp(x, y) make_pair(x, y)
#if defined(SHIROKO1_LOCAL) && !defined(NDEBUG)
#define DEBUG(...) fprintf(stderr, "[DEBUG] " __VA_ARGS__)
#else
#define DEBUG(...) ((void)0)
#endif

int main()
{
	static int d[100000];
	int n, m;
	cin >> n >> m;
	int i;
	rep (i, m) {
		int a, b;
		cin >> a >> b;
		d[a]++;
		d[b]++;
	}
	rep1 (i, n) {
		cout << d[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	A := nextInt()
	B := nextInt()
	K := nextInt()
	aEnd := min(B, A+(K-1))
	bStart := max(A, B-(K-1))

	for i := A; i <= B; i++ {
		if A <= i && i <= aEnd ||
			bStart <= i && i <= B {
			fmt.Println(i)
		}
	}
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int counter=0;
    string s;
    cin >> s;
    if(s[0]=='1'){
        counter++;
    }
    if(s[1]=='1'){
        counter++;
    }
    if(s[2]=='1'){
        counter++;
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
char s[20];
int main()
{
	scanf("%s",s);
	for(int i=0;i<4;i++)
		printf("%c",s[i]);
	printf(" ");
	for(int i=4;i<12;i++)
		printf("%c",s[i]);
	printf("\n");
	return 0;
}

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

#define int long long
#define pii pair<int, int>
#define pb push_back
 
signed main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    long long ans = 1000 * (n/500);
    n %= 500;
    ans += n - n % 5;
    cout << ans << endl;
    return 0;
}

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

const ll INF = 1e18;
const int MAX_S = 2505;
ll dp[55][MAX_S+5];

int main() {
    int n, m, s;
    cin >> n >> m >> s;
    vector<vector<tuple<int, int, int>>> E(n);
    rep(i, m) {
        int u, v, a, b;
        cin >> u >> v >> a >> b; 
        --u; --v;
        E[u].emplace_back(v, a, b);
        E[v].emplace_back(u, a, b);
    }
    vector<int> C(n), D(n);
    rep(i, n) cin >> C[i] >> D[i];
    rep(i, n) rep(j, MAX_S) dp[i][j] = INF;
    s = min(s, MAX_S);
    dp[0][s] = 0;
    priority_queue<tuple<ll, int, int>, vector<tuple<ll, int, int>>, greater<tuple<ll, int, int>>> que;
    que.push(make_tuple(0ll, s, 0));
    while (!que.empty()) {
        ll t; 
        int s, v;
        auto q = que.top(); que.pop();
        tie(t, s, v) = q;
        if (dp[v][s] < t) continue;
        int ns = min(s+C[v], MAX_S);
        ll nt = t + D[v];
        if (dp[v][ns] > nt) {
            dp[v][ns] = nt;
            que.push(make_tuple(nt, ns, v));
        }
        for (auto e: E[v]) {
            int u, a, b;
            tie(u, a, b) = e;
            ns = s - a;
            if (ns < 0) continue;
            nt = t + b;
            if (dp[u][ns] > nt) {
                dp[u][ns] = nt;
                que.push(make_tuple(nt, ns, u));
            }
        }
    }
    rep(i, n) {
        if (!i) continue;
        ll ans = INF;
        rep(j, MAX_S) ans = min(ans, dp[i][j]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 6348
import sys

sys.setrecursionlimit(10 ** 7)
n = int(input())
t = [[] for _ in range(n)]
e = []
for i in range(n - 1):
    a, b = map(int, input().split())
    t[a - 1].append([i, b - 1])
    t[b - 1].append([i, a - 1])
    e.append([a - 1, b - 1])
colors = [len(t[i]) for i in range(n)]
res1 = max(colors)
print(res1)

res = [0 for _ in range(n - 1)]
f = [False for _ in range(n)]


def dfs2(d, c):
    f[d] = True
    nc = 1
    for g in t[d]:
        if not f[g[1]]:
            if c == nc:
                nc += 1
            res[g[0]] = nc
            dfs2(g[1], nc)
            nc += 1

dfs2(0, res1+10)

print("\n".join(map(str, res)))


Measured memory_bytes: 89096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define rev(a,b,c) for(int a=b;a>=c;a--)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define F first
#define S second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define get(a) cin>>a
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n";
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll ncr(ll n, ll k)
{
    ll C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j] + C[j-1])%mod;
    }
    return C[k];
}
void solve()
{
    ll a,b;
    cin>>a>>b;
    ll xx=__gcd(a,b);
    ll an=a*b/xx;
    cout<<an;
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
       // nextl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
const ll MOD=1000000000+7;
const ll MAXN=100000+5;
const ll MAXT=MAXN*2-2+5;
ll n,m,a,b,ans;
ll t[MAXT],p[MAXT];
ll poww(ll x,int y){
    ll ret=1,r=x;
	while(y){
		if(y&1)
			ret=ret*r%MOD;
		r=r*r%MOD;
		y>>=1;
	}
	return ret;
}
ll C(ll x,ll y){
	if(x<0||y<0) return 1;
	return t[x]*p[y]%MOD*p[x-y]%MOD;
}
void Init(ll x){
	t[0]=p[0]=1;
	for(int i=1;i<=x;i++)
		t[i]=(t[i-1]*i)%MOD;
	p[x]=poww(t[x],MOD-2);
	for(int i=x-1;i>=1;i--)
		p[i]=p[i+1]*(i+1)%MOD;
}
int main(){
	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);
	Init(n+m);
	ans=C(n+m-2,n-1);
	for(int i=1;i<=b;i++){
		ans-=C(n-a+i-2,n-a-1)*C(a-1+m-i,a-1)%MOD;
		ans=(ans%MOD+MOD)%MOD;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
 
using namespace std;
int main(void){
  int N,num;
  vector<int> vec;
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> num;
    vec.push_back(num);
  }
  sort(vec.begin(), vec.end());
  cout << vec[vec.size()-1]-vec[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <cctype>
#include <cmath>
#include <cstring>
#include <climits>
#include <complex>
#include <set>
#include <deque>
#define DEBUG(x) cerr<<"line:"<<__LINE__<<", "<<#x" == "<<(x)<<endl;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(it,s) for(__typeof(s.begin()) it=s.begin();it!=s.end();it++)
#define fst first
#define snd second
#define ALL(a) a.begin(),a.end()
#define RI(x) scanf("%d",&(x))
#define RII(x,y) scanf("%d%d",&(x),&(y))
#define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define DRI(x) int (x);scanf("%d",&(x))
#define DRII(x,y) int (x),(y);scanf("%d%d",&(x),&(y))
#define DRIII(x,y,z) int (x),(y),(z);scanf("%d%d%d",&(x),&(y),&(z))
using namespace std;

typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ULL;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;
struct Point{
     int x, y;
     Point(int x = 0, int y = 0) : x(x), y(y) {}
};
typedef Point Vector;
#define INF (int)1e9
#define EPS (1.0e-8)
LL gcd(LL a, LL b) {return !b ? a : gcd(b, a % b);}
LL lcm(LL a, LL b) {return a / gcd(a,b) * b;}
LL qpow(LL a, LL b) {
    LL res = 1;
    while (b > 0) {
        if (b & 1) res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
LL qpow(LL a, LL b, LL mod) {
    a %= mod;
    LL res = 1;
    while (b > 0) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
// ------------------

set<LL> st;
int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    // freopen(".in", "r", stdin);
    // freopen(".out", "w", stdout);
#endif
    LL N; cin >> N;
    int res = 0;
    if (N == 2) {
        std::cout << 1 << endl;
        return 0;
    }
    for (LL i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            // res++;
            LL tmp = N;
            while (tmp % i == 0) {
                tmp  /= i;
                if ((tmp - 1) % i == 0)  {
                    // res++;
                    st.insert(i);
                    break;
                }
            }
            if (tmp == 1) {
                st.insert(i);
                // res++;
                // cout << "i = " << i << endl;
            } 
        }
        if ((N-1) % i == 0) {
            // res++;
            st.insert(i);
            if (i * i != (N-1)) {
                // res ++;
                st.insert((N-1)/i);
            }
            // cout << "i = " << i << " (n-1)/i = " << (N-1)/i << endl; 
        }

    }
    st.insert(N-1);
    st.insert(N);
    // res++;
    // res++;
    std::cout << st.size() << endl;
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
ret = 0
for die in range(1, n + 1):
    prob = 1 / n
    if die >= k:
        ret += prob
    else:
        cur = die
        p = 0
        while cur < k:
            cur <<= 1
            p += 1
        ret += prob * (0.5 ** p)
print(ret)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<cmath>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(i, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}

int main() {
    int N = In<int>();
    vector<int> Bs(N);
    for(int i = 0; i < N-1; i++){
        Bs[i] = In<int>();
    }
    ll ans = Bs[0] + Bs[N-2];
    for(int i = 0; i < N - 1; i++) {
        ans += min(Bs[i], Bs[i+1]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define LEN 500000

void merge(int [], int, int, int);
void merge_sort(int [], int, int);

int n, S[LEN];
int count=0;

int main()
{
  int left, right;
  int i, j, k;

  //read S
  scanf("%d", &n);
  for(i=0; i<n; i++)scanf("%d", &S[i]);

  //Sort
  left=0;
  right=n;
  merge_sort(S, left, right);

  //print
  printf("%d ", S[0]);
  for(i=1; i<n-1; i++)  printf("%d ", S[i]);
  printf("%d\n%d\n", S[n-1], count);
  return 0;
}

//Marge method
void merge(int S[], int left, int mid, int right)
{
  int i, j, k;
  int n1=mid-left;
  int n2=right-mid;
  int L[LEN], R[LEN];

  for(i=0; i<n1; i++)L[i]=S[left+i];
  for(i=0; i<n2; i++)R[i]=S[mid+i];

  L[n1]=1000000001;
  R[n2]=1000000001;
  i=0;
  j=0;
  for(k=left; k<right; k++)
    {
      if(L[i]<=R[j])
	{
	  count++;
	  S[k]=L[i];
	  i++;
	}
      else 
	{
	  count++;
	  S[k]=R[j];
	  j++;
	}
    }
}

void merge_sort(int S[], int left, int right)
{
  int mid;
  if(left+1<right)
    {
      mid=(left+right)/2;
      merge_sort(S, left, mid);
      merge_sort(S, mid, right);
      merge(S, left, mid, right);
    }
}

Measured memory_bytes: 4324
# -*- coding: utf-8 -*-
N = int(input())

ans_len = 0
ans_num = 0
zero = []
for i in range(1,N+1):
    temp = i * (i+1) // 2
    zero.append(temp)
    if temp == N:
        ans_len = i+1
        ans_num = i
        break

ans_list = [[] for _ in range(ans_len)]

if N in zero:
    print('Yes')
else:
    print('No')
    exit()


low_idx = 0
up_idx = 1
for i in range(1,N+1):
    ans_list[low_idx].append(i)
    ans_list[up_idx].append(i)
    if i in zero:
        low_idx = 0
        up_idx += 1
    else:
        low_idx += 1

# print(ans_list)
print(len(ans_list))
for a in ans_list:
    print(len(a)," ".join([str(x) for x in a]))


"""
1 2 3 4 5  6  7
2 4 6 8 10 12 14 16 18 20
2   3      4           5
1   2      3           4
0 1 0 1 2  0  1  2  3  0

12
13
23

1347
1258
2369
456 10
789 10

124
135
236
456

"""


Measured memory_bytes: 9076
n = int(input())
ren = 0
ans = 'No'

for i in range(n):
    d1, d2 = map(int, input().split())
    if d1==d2:
        ren += 1
        if ren >= 3:
            ans = 'Yes'
    else:
        ren = 0

print(ans)


Measured memory_bytes: 9156
// itne me hi thakk gaye?
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("-O3")
#define ll long long 
#define ull unsigned long long
using ld = long double;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll rk = 256;
const ll mod2 = 998244353;
const ld PI = 3.141592653589793;
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define print(a) for(auto j:a) {cout<<j<<",";} cout << "\n";
#define endl '\n'
#define whatis(x) cout << "> "<<#x << " ==> " << x << endl;
#define lwi(x) cout << " your " << #x << " is ---> " << x << " ";
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
// // Printing pair
ostream & operator << (ostream & os, pair <ll, ll> const& x) {
    os << x.first << "," << x.second;
    return os;
}
 
// printing vector
template <class T>
ostream & operator << (ostream & os, vector <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
// printing set
template <class T>
ostream & operator << (ostream & os, set <T> const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
const int mxn = 1e6+5;
int32_t main(){
    FastIO;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for(auto i: s) {if(i=='R') cnt++;};
    int r = 0;
    for(int i =0; i<cnt; i++) if (s[i] == 'R') r++;
    cout << abs(cnt-r) << endl;
    return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
struct node
{
    string p;
    int c;
}arr[100000];

int main()
{
    int n;
    cin >>n;
    int q;
    cin>>q;
    queue<node> Q;
    for(int i=0; i<n; i++)
    {
        int y;
        string s;
        cin>>s>>y;
        arr[i].p = s;
        arr[i].c =y;
        Q.push(arr[i]);
    }
   int time=0;

   while(!Q.empty())
    {
        node p = Q.front();
        Q.pop();
        if(p.c > q)
        {
            time+=q;
            p.c -=q;
            Q.push(p);

        }
        else

        {

            time +=p.c;
            p.c  -=p.c;
            if(p.c==0)
                cout<<p.p<<" "<<time<<"\n";
        }
    }


return 0;
}



Measured memory_bytes: 7772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

struct UnionFind{
    int n;
    vector<int> d;
    vector<ll> w;
    UnionFind(){}
    UnionFind(int N):n(N),d(N,-1),w(N,0){}
    int root(int v){
        if(d[v]<0) return v;
        return root(d[v]);
    }
    ll calc(int v){
        if(d[v]<0)return 0;
        return calc(d[v])+w[v];
    }
    bool unite(int X, int Y, int W){
        ll A=calc(X);
        ll C=calc(Y);
        X = root(X); Y = root(Y);
        if(X==Y) return false;
        if(size(X) < size(Y)){
            swap(X,Y);
            W=-W;
            swap(A,C);
        }
        ll B=W+A-C;
        w[Y]=B;
        d[X] += d[Y];
        d[Y] = X;
        return true;
    }
    int size(int v){ return -d[root(v)]; }
    bool same(int X, int Y){ return root(X)==root(Y); }
};

int n,q;
ll sum[100010];

int main(){
    cin>>n>>q;
    UnionFind uf(n);
    rep(i,q){
        string s;
        cin>>s;
        if(s=="COMPARE"){
            int a,b;
            cin>>a>>b;
            a--;b--;
            if(uf.root(a)!=uf.root(b)){
                cout<<"WARNING"<<endl;
                continue;
            }
            ll va=uf.calc(a)+sum[a];
            ll vb=uf.calc(b)+sum[b];
            cout<<vb-va<<endl;
        }else if(s=="IN"){
            int a,b,c;
            cin>>a>>b>>c;
            a--;b--;
            uf.unite(a,b,c-(sum[b]-sum[a]));
            sum[a]+=c;
            sum[b]+=c;
        }
    }
    return 0;
}



Measured memory_bytes: 4816
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll INF = 1e17;

template<typename T>
struct SegmentTree{
    int n, width;
    vector<T> dat;

    void init(int x){
        n = x;
        width = 1;
        while (width < n) width *= 2;
        dat.assign(2*width-1, INF);
    }

    void update(int i, T x){
        i += width - 1;
        dat[i] = x;
        while (i > 0){
            i = (i - 1) / 2;
            dat[i] = min(dat[i*2+1], dat[i*2+2]);
        }
    }

    T query(int a, int b, int k, int l, int r){
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return dat[k];
        T vl = query(a, b, k*2+1, l, (l+r)/2);
        T vr = query(a, b, k*2+2, (l+r)/2, r);
        return min(vl, vr);
    }

    // [l, r)
    T query(int l, int r){
        return query(l, r, 0, 0, width);
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    VVL l2r(n), l2c(n);
    REP(i,m){
        int l = in() - 1, r = in(), c = in();
        l2r[l].push_back(r);
        l2c[l].push_back(c);
    }

    SegmentTree<ll> seg;
    seg.init(n);
    seg.update(0, 0);

    REP(i,n-1){
        ll x = seg.query(i, n);
        if (x == INF){
            continue;
        }
        REP(j,l2r[i].size()){
            int r = l2r[i][j] - 1;
            ll c = l2c[i][j];
            if (seg.query(r, r + 1) > x + c){
                seg.update(r, x + c);
            }
        }
    }
    ll ans = seg.query(n - 1, n);
    if (ans == INF) ans = -1;
    cout << ans << endl;

    return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

struct UnionFind {
	std::vector<int> data;
	int n;
	UnionFind(int n) : n(n), data(n, -1) {}
	void unite(int a, int b) {
		a = root(a);
		b = root(b);
		if (a != b) {
			if (data[a] > data[b]) std::swap(a, b);
			data[a] += data[b];
			data[b] = a;
		}
	}
	int root(int i) {
		return data[i] < 0 ? i : root(data[i]);
	}
	int size(int i) {
		return -data[root(i)];
	}
	bool same(int a, int b) {
		return root(a) == root(b);
	}
};

bool solve() {
	int n = ri(), m = ri(), q = ri();
	int a[q], b[q], c[q];
	std::set<int> cnt2;
	UnionFind uni(n);
	for (int i = 0; i < q; i++) {
		a[i] = ri();
		b[i] = ri();
		c[i] = ri();
		if (!c[i]) uni.unite(a[i], b[i]);
		else cnt2.insert(a[i]), cnt2.insert(b[i]);
	}
	for (int i = 0; i < q; i++) if (c[i] && uni.same(a[i], b[i])) return false;
	int m_real = 0;
	for (int i = 0; i < n; i++) if (uni.root(i) == i) m_real += uni.size(i) - 1;
	int m_none = 0;
	if (cnt2.size()) m_none += cnt2.size();
	if (m_real + m_none > m) return false;
	std::cerr << m_real << " " << m_none << std::endl;
	int sz = 0;
	for (int i = 0; i < n; i++) if (uni.root(i) == i) sz++;
	if (sz == 2 && cnt2.size()) return false;
	int64_t max_hen = m_real + (int64_t) (sz - 1) * sz / 2;
	if (m > max_hen) return false;
	return true;
}

int main() {
	std::cout << (solve() ? "Yes" : "No") << std::endl;
	return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define mp make_pair
#define sqr(x) (x)*(x)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=100007;
const ll inf=0x3f3f3f3f;
const int mod=998244353;
#define rep(i,x,y) for(auto i=(x);i<=(y);++i)
#define dep(i,x,y) for(auto i=(x);i>=(y);--i)
int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int ans,A[maxn],cnt,q,n,m,a[maxn],b[maxn],c[maxn],d[maxn];
void dfs(int o,int x){
    if(o==n+1){
        int now=0;
        for(int i=1;i<=q;i++){
            if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
        }
        ans=max(ans,now);
        return;
    }
    for(int i=x;i<=m;i++){
        A[o]=i;dfs(o+1,i);
    }
}
int main(){
    n=read(),m=read(),q=read();
    for(int i=1;i<=q;i++){
        a[i]=read();b[i]=read();c[i]=read();d[i]=read();
    }
    dfs(1,1);cout<<ans;
    return 0;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
static class Program
{
    static void Main()
    {
        var p = new Problem();
        p.A();
    }
}

public class Problem
{
    public void A()
    {
        var n = long.Parse(Console.ReadLine());
        var ans = 1L;
        for (int i = 1; i <= n; i++)
        {
            ans = ans * i;

        }
        Console.WriteLine(ans);

    }

}


static public class IO
{
    static public void SetIn()
    {
        var sr = new System.IO.StreamReader("sample.txt");
        Console.SetIn(sr);
    }

    static public int IRead()
    {
        return int.Parse(Console.ReadLine());
    }
    static public int[] IARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => int.Parse(x)).ToArray();
    }
    static public long LRead()
    {
        return long.Parse(Console.ReadLine());
    }
    static public long[] LARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => long.Parse(x)).ToArray();
    }
    static public double DRead()
    {
        return double.Parse(Console.ReadLine());
    }
    static public double[] DARead(char c = ' ')
    {
        return Console.ReadLine().Split(c).Select(x => double.Parse(x)).ToArray();
    }
}


Measured memory_bytes: 5596