akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll a; cin>>a;
  cout<<3*a*a<<endl;
  
}

Measured memory_bytes: 3604
#pragma GCC optimize("O3") 
#include<bits/stdc++.h>
#define ll      				long long int
#define vi      				vector<int>
#define ii      				pair<int,int>
#define iii     				pair<ii,int>
#define iiii    				pair<ii,ii>
#define fi      				first
#define se      				second
#define unord_map				unordered_map
#define nxt_pmt					next_permutation
#define clr					clear()
#define ALL(x) 					x.begin(),x.end()


#define pb      				push_back
#define pob     				pop_back

#define all(x)  				x.begin(), x.end()
#define len     				length()

#define db(x)					  cout << "!!!!!! " << #x << " => " << x << "\n"

#define fori(i, s, N)     for (int i = s; i <= N; i++)
#define ford(i, s, N)     for (int i = s; i >= N; i--)
using namespace std;

void init(int precision){
  	ios_base::sync_with_stdio(0);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

int t;
double d;
void cjam(int z){
	cout<<"Case #"<<z<<": ";
	
}

int main(){
//	init(10);
	cin>>t>>d;
	int ans = 0;
	double xi,yi;
	for(int z = 1;z<=t;z++){
		cin>>xi>>yi;
		if(xi*xi + yi*yi <= d*d) ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3780
#include<cstdio>
#include<string>
#include<cstdlib>
#include<iostream>
using namespace std;

struct Node{
    int key;
    Node *parent,*left,*right;
};

Node *root,*NIL;

void insert(int k){
Node *y=NIL;
Node *x=root;
Node *z;

z=(Node *)malloc(sizeof(Node));
z->key=k;
z->left=NIL;
z->right=NIL;

while(x!=NIL){
    y=x;
    if(z->key<x->key){
        x=x->left;
    }
    else x=x->right;
}
z->parent=y;
if(y==NIL){
    root=z;
}
else{
    if(z->key<y->key){
        y->left=z;
    }
    else y->right=z;
}
}

void inorder(Node* u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(Node* u){
    if(u==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
int main(){
    int n,i,x;
    char str[10];

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s",str);
       
        if(str[0]=='i'){
            scanf("%d",&x);
            insert(x);
        }
        
        else if(str[0]=='p'){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}




Measured memory_bytes: 26540
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

using ll = long long;
using ull = unsigned long long;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

int main() {
	ll n, d;
	cin >> n >> d;
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t N, H, Amax = 0, count = 0;
    cin >> N >> H;
    vector<Pll> BA(N);
    for (int i = 0; i < N; i++) {
        cin >> BA.at(i).second >> BA.at(i).first;
        Amax = max(Amax, BA.at(i).second);
    }
    sort(rALL(BA));
    for (int i = 0; i < N; i++) {
        if (H > 0 && BA.at(i).first > Amax) {
            H -= BA.at(i).first;
            count++;
        }
        if (H <= 0) {
            cout << count << endl;
            return 0;
        }
    }
    cout << (H + Amax - 1) / Amax + count << endl;



}


Measured memory_bytes: 1792
#include <iostream>
#include <string>

int main() {
    std::string a, b, c;

    std::cin >> a >> b >> c;

    if (a.back() == b.front() && b.back() == c.front()) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair< ll, ll > P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007    //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

// debug
#define DEBUG(x) cout << #x << ": " << x << endl
#define DEBUG2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << endl
#define DEBUG_VEC(v)   \
  cout << #v << ":";   \
  REP(i, v.size())     \
  cout << " " << v[i]; \
  cout << endl
#define DEBUG_ARR(v, n) \
  cout << #v << ":";    \
  REP(i, n)             \
  cout << " " << v[i];  \
  cout << endl

ll N, M, X;
vector< ll > C;
vector< vector< ll > > A;

bool is_ok(vector< ll > &v)
{
  REP(i, M)
  {
    if (v[i] < X)
    {
      return false;
    }
  }
  return true;
}

void add(vector< ll > &v1, vector< ll > &v2)
{
  for (ll i = 0; i < v1.size(); ++i)
  {
    v1[i] += v2[i];
  }
}

void sub(vector< ll > &v1, vector< ll > &v2)
{
  for (ll i = 0; i < v1.size(); ++i)
  {
    v1[i] -= v2[i];
  }
}

ll f(ll i, ll cost, vector< ll > &c)
{
  if (i >= N)
  {
    return cost;
  }

  vector< ll > next_c = c;
  sub(next_c, A[i]);

  if (is_ok(next_c))
  {
    return min(f(i + 1, cost - C[i], next_c), f(i + 1, cost, c));
  }
  else
  {
    return f(i + 1, cost, c);
  }
}

signed main()
{

  cin >> N >> M >> X;

  C.resize(N);
  A.resize(N, vector< ll >(M, 0));

  REP(i, N)
  {
    cin >> C[i];
    REP(j, M)
    {
      cin >> A[i][j];
    }
  }

  // 全部購入する
  vector< ll > v(M);
  ll cost = 0;
  REP(i, N)
  {
    cost += C[i];
    add(v, A[i]);
  }

  // 理解度が足りない場合は -1
  if (!is_ok(v))
  {
    cout << -1 << endl;
    return 0;
  }

  // そうでない場合は
  // ある参考書を抜くを理解度が足りなくなるまで全探索する
  ll min_cost = f(0, cost, v);
  cout << min_cost << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define has(c,i) 		((c).find(i) != end(c))
#define UNIQUE(v)       sort(all(v));v.erase(unique(all(v)),v.end());s
#define has_str(s, c)	((s).find(c) != string::npos)
typedef long long ll;
int main() {
#ifdef online_judge
    freopen("input.txt", "rt", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    int ans = 0, mx = 0;
    for(int i = 0; i < SZ(s); ++i) {
        if(s[i] == 'R') {
            mx++;
            ans = max(ans, mx);
        } else {
            mx = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    StringBuilder ans =  new StringBuilder();
    while(N > 0){
      N--;
      ans.append((char) (N % 26 + 'a'));
      N /= 26;
    }
    System.out.println(ans.reverse());
  }
}

Measured memory_bytes: 35716
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		sb.append("");
		int m, f, r;
		while (true) {
			m = scan.nextInt();
			f = scan.nextInt();
			r = scan.nextInt();
			if (m == -1 && f == -1 && r == -1) {
				break;
			}else if (m == -1 || f == -1) {
				sb.append("F" + "\n");
			}else if (m + f >= 80) {
				sb.append("A" + "\n");
			}else if (m + f >= 65) {
				sb.append("B" + "\n");
			}else if (m + f >= 50) {
				sb.append("C" + "\n");
			}else if (m + f >= 30) {
				if (r >= 50) {
					sb.append("C" + "\n");
				}else {
					sb.append("D" + "\n");
				}
			}else {
				sb.append("F" + "\n");
			}
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 26352
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

const int mxn = 1e6+1;
bool w[mxn];
void solve(){
  ll n;
  cin >> n;
  ll x = n;
  w[n] = 1;
  rep(i, 2, 1e6+1){
    if (x&1){
      x = 3 * x + 1;
    } else {
      x /= 2;
    }
    if (w[x]) {
      cout << i;
      return;
    }
    w[x] = 1;
  }
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    r, d, x = rli()
    nx = x
    for i in range(10):
        nx = r*nx-d
        print(nx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A, B, C, D, N, M;
	string S, T;
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5]) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;


	return 0;
}



Measured memory_bytes: 256
def mismatch(x, y) :
    m = 0
    for i in range(len(x)):
        if x[i] != y[i] :
            m += 1
    return m

s = str(input())
t = str(input())


ans = len(t)
for i in range(0, len(s)-len(t)+1) :
    s2 = s[i:i+len(t)]
    ans = min(mismatch(s2, t), ans)

print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
  {
int n;
cin>>n;
vector<pair<int,int> >v(n);
long long a;
for(int i=0;i<n;i++) {
    cin>>a;
    v[i]=make_pair(a,i+1);
}
sort(v.begin(),v.end());
for(int i=0;i<n;i++) {
 
    cout<<v[i].second<<" ";
}

   }









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


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

    int N;
    cin >> N;
    string W[N];
    rep(i,N){
        cin >> W[i];
    }
    bool z=true;
    rep(i,N-1){
        if(W[i].back() != W[i+1].front()) z=false;
    }
    sort(W,W+N);
    rep(i,N-1){
        if(W[i]==W[i+1]) z=false;
    }
    if(z) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,c,d;
string s;
signed main()
{
	cin>>a;
	rep(i,a){
		int b=(i+1)*1.08;
		if(b==a){
			cout<<(i+1);
			return 0;
		}
	}
	cout<<":(";
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://abc063.contest.atcoder.jp/tasks/arc075_a

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    N = int(input())
    scores = [int(input()) for _ in range(N)]

    possible_results = set([0])
    for s in scores:
        temp = set()
        for p in possible_results:
            temp.add(p + s)
            temp.add(p)
        possible_results = temp

    results = [x for x in possible_results if x%10 != 0]
    results.sort()
    if len(results) == 0:
        print(0)
    else:
        print(results[-1])


if __name__ == '__main__':
    main(sys.argv[1:])

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

signed main(){
  int n;cin>>n;
  vector<int> p(n);
  for(int i=0;i<n;i++){cin>>p[i];p[i]--;}
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++)a[i]=(i+1)*30000;
  for(int i=0;i<n;i++)b[n-1-i]=(i+1)*30000;
  for(int i=0;i<n;i++)a[p[i]]+=i;
  for(int i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;
  for(int i=0;i<n;i++)cout<<b[i]<<" ";cout<<endl;
}


Measured memory_bytes: 896
h,w,n=map(int,input().split())
d={}
s=set()
for _ in range(n):
  a,b=map(int,input().split())
  a-=1
  b-=1
  for dy in [-2,-1,0]:
    for dx in [-2,-1,0]:
      ny,nx=a+dy,b+dx
      if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:
        if (ny,nx) in s:
          d[(ny,nx)]+=1
        else:
          d[(ny,nx)]=1
          s.add((ny,nx))
cnt=[0]*10
q=0
for v in d.values():
  cnt[v]+=1
cnt[0]=(h-2)*(w-2)-len(s)
for i in cnt:
  print(i)

Measured memory_bytes: 199616
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

bool a[5][5], seen[102];
int x[102], y[102];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    for (int i = 0; i < 3; ++i)
        for (int j = 0; j < 3; ++j) {
            int d;
            cin >> d;
            seen[d] = true;
            x[d] = i;
            y[d] = j;
        }
	
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int d;
        cin >> d;
        if (seen[d])
            a[x[d]][y[d]] = true;
    }

    bool ans = (a[0][0] && a[1][1] && a[2][2]) || (a[2][0] && a[1][1] && a[0][2]);
    for (int i = 0; i < 3; ++i)
       if ((a[i][0] && a[i][1] && a[i][2]) || (a[0][i] && a[1][i] && a[2][i])) {
           ans = true;
       }
    
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m,i,a,b,c,j,k,d[100010]={};
  scanf("%d %d",&n,&m);
  n=(1<<n);//printf("%d\n",n);
  for(i=1;i<n;i++)d[i]=1e9+10;
  while(m--){//printf("%d\n",m);
    scanf("%d %d",&a,&b);
    k=0;
    while(b--){//printf("!%d\n",b);
      scanf("%d",&c);
      k+=(1<<(c-1));
    }//printf("!!\n");
    for(j=0;j<n;j++)d[j|k]=MIN(d[j|k],d[j]+a);
  }
  if(d[n-1]>1e9)d[n-1]=-1;
  printf("%d\n",d[n-1]);
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF ll(1e18)
///#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 1000000007

int main() {
	ll n;
	cin>>n;
	ll arr[n];
	for (ll i=0;i<n;i++) {
		cin>>arr[i];
	}
	sort(arr,arr+n);
	ll sum=arr[n-1];
	if (n%2) {
		for (ll i=1;i<n/2;i++) {
			sum+=arr[n-i-1]*2;
		}
		sum+=arr[n-n/2-1];
		
	}
	else {
		for (ll i=1;i<n/2;i++) {
			sum+=arr[n-i-1]*2;
		}
	}
	cout<<sum;
}


Measured memory_bytes: 5200
import java.util.*;

public class Main {
  private static int N;
  private static long K;
  private static int[] A;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    K = sc.nextLong();
    A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    Arrays.sort(A);
    
    long ok = -1_000_000_000_000_000_005L;
    long ng = 1_000_000_000_000_000_005L;
    while (ok+1 < ng) {
      long m = (ok+ng)/2;
      if (isOk(m)) {
        ok = m;
      } else {
        ng = m;
      }
    }
    System.out.println(ok);
  }
  private static boolean isOk(long x) {
    long count = 0;
    for (int i = 0; i < N; i++) {
      count += calcCount(i, x);
      if (count >= 2*K) return false;
    }
    return count/2 < K;
  }
  private static int calcCount(int idx, long x) {
    int ok;
    int ng;
    if (A[idx] >= 0) {
      long max = (long)A[idx]*A[N-1];
      long min = (long)A[idx]*A[0];
      if (max < x) {
        return N-1;
      }
      if (x <= min) {
        return 0;
      }
      ok = 0;
      ng = N-1;
    } else {
      long max = (long)A[idx]*A[0];
      long min = (long)A[idx]*A[N-1];
      if (max < x) {
        return N-1;
      }
      if (x <= min) {
        return 0;
      }
      ok = N-1;
      ng = 0;
    }
    while ((A[idx] >= 0 && ok+1 < ng)
          || (A[idx] < 0 && ng+1 < ok)) {
      int m = (ok+ng)/2;
      if ((long)A[idx]*A[m] < x) {
        ok = m;
      } else {
        ng = m;
      }
    }
    if (A[idx] >= 0) {
      return idx <= ok ? ok : ok+1;
    } else {
      return idx >= ok ? N-ok-1 : N-ok;
    }
  }
}

Measured memory_bytes: 65840
N = int(input())
BB = input()

B = [int(b) for b in BB.split()]

b1 = B[0]
sumax = b1
aimax = b1
# print(aimax)

for i in range(1,N-1):
    bi = B[i]
#     print(i)
#     print(bi)
#     print((aimax, bi))
    if bi > aimax:
        sumax += aimax
    else:
        sumax += bi
    
#     print(sumax)
    aimax = bi

sumax += B[len(B)-1]

print(sumax)
        
        

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  int myh, mya, myd, mys;
  cin >> myh >> mya >> myd >> mys;
  VI h(n), t(n), d(n);
  int ret = 0;
  bool able = true;
  REP(i, n) {
    int a, dd, s;
    cin >> h[i] >> a >> dd >> s;
    d[i] = max(0LL, a - myd);
    int tmp = max(0LL, mya - dd);
    if(tmp == 0 && d[i] > 0) {
      able = false;
    } else if(tmp == 0) {
      t[i] = 0;
    } else {
      t[i] = ceil(h[i], tmp);
    }
    if(s > mys) ret += d[i];
  }

  if(!able || ret >= myh) {
    cout << -1 << endl;
    return 0;
  }

  vector<pair<double, int>> idx(n);
  REP(i, n) {
    if(d[i] == 0) {
      idx[i] = {INF, i};
    } else {
      idx[i] = {(double)t[i]/d[i], i};
    }
  }
  sort(ALL(idx));
  // cout << idx << endl;

  int turn = 0;
  REP(i, n) {
    int j = idx[i].second;
    if(t[j] == 0) continue;
    // cout << i << " " << j << " " << ret << " " << turn << endl;
    ret += (turn + t[j] - 1) * d[j];
    turn += t[j];
    if(ret >= myh) {
      cout << -1 << endl;
      return 0;
    }
  }

  if(ret >= myh) cout << -1 << endl;
  else cout << ret << endl;

  return 0;
}



Measured memory_bytes: 4404
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);
template <class T1, class T2> void vadd(vector<T1> &v, T2 x);

#define int long long int
int h, w;
int sx, sy;
int gx, gy;
char f[1003][1003];
int mem[1003][1003];
struct dijkstra {
  using lli = int;
  vector<vector<pair<lli, lli>>> e;
  int n;
  lli inf = 1e18;
  dijkstra(int n) : n(n) { e.resize(n); }
  void add(int a, int b, lli c) { e[a].push_back(make_pair(b, c)); }
  void biadd(int a, int b, lli c) {
    add(a, b, c);
    add(b, a, c);
  }
  vector<lli> get(int s) {
    vector<lli> dist(n, inf);
    dist[s] = 0;
    using p = pair<lli, lli>;
    priority_queue<p, vector<p>, greater<p>> que;
    que.push(make_pair(0, s));
    while (!que.empty()) {
      lli d = que.top().first;
      lli cur = que.top().second;
      que.pop();
      if (dist[cur] < d)
        continue;
      dist[cur] = d;
      for (auto s : e[cur]) {
        lli wei = s.second;
        lli to = s.first;
        if (dist[to] > dist[cur] + wei) {
          dist[to] = dist[cur] + wei;
          que.push(make_pair(dist[cur] + wei, to));
        }
      }
    }
    return dist;
  }
};
signed main() {
  cin >> h >> w >> sx >> sy >> gx >> gy;
  rep(i, 1003) rep(j, 1003) mem[i][j] = 1e9;
  rep(i, h) rep(j, w) cin >> f[i][j];
  sx--, sy--, gx--, gy--;
  dijkstra dij(h * w);
  auto get = [=](int i, int j) {
    if (i < 0 || j < 0 || i >= h || j >= w)
      return -1ll;
    return i * w + j;
  };
  rep(i, h) rep(j, w) {
    if (f[i][j] == '#')
      continue;
    for (int x = -2; x <= 2; x++) {
      for (int y = -2; y <= 2; y++) {
        int sx = x + i;
        int sy = y + j;
        if(x==0&&y==0)continue;
        if (get(sx, sy) >= 0 && f[sx][sy] == '.') {
          if (abs(x) + abs(y) <= 1)
            dij.add(get(i, j), get(sx, sy), 0);
          else
            dij.add(get(i, j), get(sx, sy), 1);
        }
      }
    }
  }
  auto res = dij.get(get(sx, sy))[get(gx, gy)];
  cout << (res <= 1e7 ? res : -1) << endl;
  // Failed to predict input format
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2> void vadd(vector<T1> &v, T2 x) {
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 175420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    vector<P> ab;
    rep(i,n){
        int a,b;cin>>a>>b;
        ab.emplace_back(make_pair(a,b));
    }
    sort(ab.begin(), ab.end());
    ll ans = 0;
    int cnt = 0;
    for(P p : ab){
        while(p.second!=0) {
            ans += p.first;
            cnt++;
            p.second--;
            if(cnt==m) break;
        }
        if(cnt==m) break;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

int main() {
	int N;
	cin >> N;
	vi A(N);
	vector<vector<pii>> xy;
	rep(i, N) {
		cin >> A[i];
		vector<pii> xytmp;
		rep(j, A[i]) {
			pii xytmptmp;
			cin >> xytmptmp.first >> xytmptmp.second;
			xytmptmp.first--;
			xytmp.push_back(xytmptmp);
		}
		xy.push_back(xytmp);
	}
	int N2 = 1;
	rep(i, N) {
		N2 *= 2;
	}
	int ans = 0;
	rep(bittmp, N2) {
		bool can = 1;
		int anstmp = 0;
		vb is_true(N);
		rep(i, N) {
			is_true[i] = (bittmp >> i) % 2;
		}
		rep(i, N) {
			if (is_true[i]) { // 正直者
				anstmp++;
				rep(j, A[i]) {
					int x = xy[i][j].first;
					int y = xy[i][j].second;
					if (is_true[x] != y)
						can = 0;
				}
			}
		}
		if (can) {
			ans = max(ans, anstmp);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
int a,b;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	if((a+b)%2==0)
		cout<<(a+b)/2<<endl;
	else
		cout<<"IMPOSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 256
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

void dfs(int node, int from, int len, vector<vector<pair<int, int>>> &edges, vi &col) {
  if (from == -1) {
    col[node] = 0;
  } else {
    col[node] = len % 2 == 0 ? col[from] : !col[from];
  }
  rep(i, edges[node].size()) {
    if (edges[node][i].first == from) continue;
    dfs(edges[node][i].first, node, edges[node][i].second, edges, col);
  }
}

int main() {
  init();

  int N;
  cin >> N;
  vector<vector<pair<int, int>>> edges(N, vector<pair<int, int>>(0));
  rep(i, N - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    edges[u - 1].push_back(make_pair(v - 1, w));
    edges[v - 1].push_back(make_pair(u - 1, w));
  }

  vi col(N);
  dfs(0, -1, 0, edges, col);
  rep(i, N) out(col[i]);
}


Measured memory_bytes: 9728
#include <iostream>
#include <string>
#include <cstdlib>
#include <bits/stdc++.h>
#include <algorithm>
#include <cctype>
using namespace std ;

int main(){
    long long int  a ;
    cin >> a ;
    cout << a/500*1000 + (a%500)/5*5 ;
    return  0 ;
    }

    


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
 
  	string s; int n; cin >> s, n = s.size();
  
  	for(int j = n-1, i = j-1; i >= 0; j = i--)
      	if(j < s.size() and s[i] != s[j])
        	s.erase(s.begin()+j), s.erase(s.begin()+i);

  	cout << n-s.size(); 
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    if(0<=x&&x<=W&&0<=y&&y<=H){
        if(x>=r&&W-x>=r&&y>=r&&H-y>=r){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


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

int main() {
  int64_t n;
  cin >> n;
  
  vector<int64_t> L(86+1);
  L[0] = 2;
  L[1] = 1;
  for (int i=2; i<86+1; i++) L[i] = L[i-1] + L[i-2];
  cout << L[n] << endl;
}


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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 n;
    cin >> n;
    vector<i64> a(n);
    for (auto& e : a) cin >> e;

    vector<vector<i64>> dp(n + 1, vector<i64>(n + 1, -1));
    auto f = [&](auto g, i64 l, i64 r) -> i64 {
        if (l < 0 || l > n || r < 0 || r > n) return 0;
        if (l == r) return 0;
        if (dp[l][r] != -1) return dp[l][r];

        return dp[l][r] = (n - (r - l)) % 2
            ? min(g(g, l + 1, r) - a[l], g(g, l, r - 1) - a[r - 1])
            : max(g(g, l + 1, r) + a[l], g(g, l, r - 1) + a[r - 1]);
    };
    cout << f(f, 0, n) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 73928
A,B,C=map(int,input().split())
remainders=[]
n=1
while True:
    tmp=(A*n)%B
    if not tmp in remainders:
        remainders.append(tmp)
        n+=1
    else:
        break

remainders.sort()
if C==0:
    print("YES")
else:
    if len(remainders)==1:
        print("NO")
    else:
        if remainders[1]==1:
            print("YES")
        else:
            if C%remainders[1]==0:
                print("YES")
            else:
                print("NO")

Measured memory_bytes: 3064
mod = 10 ** 9 + 7

SIZE = 5 * 10 ** 5 + 1
fact = [0] * SIZE
inv = [0] * SIZE
finv = [0] * SIZE
fact[0], fact[1] = 1, 1
inv[1] = 1
finv[0], finv[1] = 1, 1
for i in range(2, SIZE):
    fact[i] = fact[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def nCr(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fact[n] * (finv[r] * finv[n - r] % mod) % mod


def nPr(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fact[n] * finv[n - r] % mod


n, m = map(int, input().split())
ans = 0
for i in range(n+1):
    ans += (-1)**i * nCr(n, i) * nPr(m, i) * nPr(m-i, n-i) ** 2 % mod
    ans %= mod

print(ans)


Measured memory_bytes: 67948
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i < S.size(); ) {
    int j = i+1;
    while (j < S.size() && S[j] == S[i]) ++j;
    ++ans;
    i = j;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
#define F first
#define S second
#define MAX 1000003
using namespace std;
 
const long long  mod = 1000000007;
 
long long  prime[MAX];
map<ll , ll > max_map;
 
// Function to return a^n
ll  power(ll a, ll  n)
{
    if (n == 0)
        return 1;
    ll  p = power(a, n / 2) % mod;
    p = (p * p) % mod;
    if (n & 1)
        p = (p * a) % mod;
    return p;
}
 
ll power2(ll x,ll n,ll M){
//(x^n)%M
ll result=1;
 
    while(n){
        if(n%2)
            result=(result*x)%M;
        x=(x*x)%M;
        n/=2;
    }
    return result;
}
 
ll inverseMod(ll x,ll M){
 
return power2(x,M-2,M);
}
 
// Function to find the smallest prime factors
// of numbers upto MAX
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll  i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (ll  j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}
 
// Function to return the LCM modulo M
ll lcmModuloM(const ll * ar, ll n)
{
 
    for (ll  i = 0; i < n; i++) {
        ll  num = ar[i];
       map<ll , ll> temp;
 
        // Temp stores mapping of prime factor to
        // its power for the current element
        while (num > 1) {
 
            // Factor is the smallest prime factor of num
            ll  factor = prime[num];
 
            // Increase count of factor in temp
            temp[factor]++;
 
            // Reduce num by its prime factor
            num /= factor;
        }
 
        for (auto it : temp) {
 
            // Store the highest power of every prime
            // found till now in a new map max_map
            max_map[it.first] = max(max_map[it.first], it.second);
        }
    }
 
    ll ans = 1;
 
    for (auto it : max_map) {
 
        // LCM is product of primes to their highest powers modulo M
        ans = (ans * power(it.F, it.S)) % mod;
    }
 
    return ans;
}
 
int   main() {
    fast
    sieve();
    ll  n;
    cin>>n;
 
    ll arr[10002];
    for(ll  i=0;i<n;i++){
        cin>>arr[i];
 
    }
 
    //long long  n = sizeof(arr) / sizeof(arr[0]);
    ll lcm=lcmModuloM(arr, n);
 
    ll ans=0;
 
    for(ll  i=0;i<n;i++){
 
        ans=(ans%mod+(lcm*inverseMod(arr[i],mod)))%mod;
 
    }
 
    cout<<ans;
	return 0;
}

Measured memory_bytes: 8832
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
    string s;
    map<char, int> D;
    int N, my_g, my_p, score;
    cin >> s;
    N = s.length();
    for (int i=0; i<N; i++){
        if (D.find(s[i]) != D.end()){
            D[s[i]]++;
        }else{
            D[s[i]] = 1;
        }
    }
    my_g = (N+1)/2;
    my_p = N/2;
    score = my_p - D['p'];
    cout << score << endl;
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    rep(i, N) cin >> P[i];
    rep(i, N) cin >> Q[i];
    vector<int> A(N);
    copy(all(P), A.begin());
    sort(all(A));

    int i = 0;
    int a;
    int b;
    do {
        i++;
        if (equal(P.cbegin(), P.cend(), A.cbegin())) a = i;
        if (equal(Q.cbegin(), Q.cend(), A.cbegin())) b = i;
    } while (next_permutation(A.begin(), A.end()));

    cout << abs(a - b) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define forn(x, n)              for (int x = 0; x < n; x++)
#define forr(x, n)              for (int x = n; x >= 0; x--)
#define fore(x, a, b, c)        for (int x = a; x <= b; x += c)
#define forre(x, a, b, c)       for (int x = a; x >= b; x -= c)
#define clr                     cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define all(container)          (container).begin(), (container).end()
#define rall(container)         (container).rbegin(), (container).rend()
#define FILL(x, val)            memset(x, val, sizeof(x))
#define pb                      push_back
#define eb                      emplace_back
#define fi                      first
#define se                      second
#define mod                     (int)1000000007
#define INF                     (int)0x3f3f3f3f

using namespace std;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }  

typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifndef ONLINE_JUDGE
    freopen("errlog", "w", stderr);
#endif
    int a, b; char op;
    cin >> a >> op >> b;
    if (op == '+') cout << a + b << '\n';
    else cout << a - b << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
//二項係数 nCr
const int MAX = 700000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
  COMinit();
  ll n,k;
  cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  sort(all(a));
  ll ans=0;
  for(int i=n-1;i>=k-1;i--){
    ans+=a[i]*COM(i,k-1);
    ans%=MOD;
  }
  for(int i=0;i<=n-k;i++){
    ans-=a[i]*COM(n-i-1,k-1);
    ans%=MOD;
    if(ans<0) ans+=MOD;
  }
  COUT(ans);
}

Measured memory_bytes: 20408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> A(n);
  for(int i=0;i<n;i++){
    cin >> A.at(i) ;
  }
  bool ok = true;
  for(int i=0;i<n;i++){
    if(A.at(i)=="Y"){
      ok = false;
    }
  }
  if(ok) cout << "Three" <<endl;
  else cout << "Four" <<endl;
}
  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
/* Main */
void cubedNum(void)
{
    int inputNum = -1;
    int result = 1;
     
    while(1)
    {
        cin >> inputNum;
        /* input check */
        if( (1 <= inputNum) && (inputNum <= 100) )
        {
            break;
        }
    }
    for(int i=3; i >= 1; --i)
    {
        result *= inputNum;
    }
    cout << result << endl;
     
    return;
}
 
/* Driver */
int main(void){
    cubedNum();
    return 0;
}

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

using namespace std;
using i64 = int64_t;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; ++i)
        cin >> a[i] >> b[i];
    
    vector<vector<int>> fl(301, vector<int>(301, -1));
    function<int(int,int)> f = [&](int x, int y){
        if(fl[x][y] != -1)
            return fl[x][y];
        set<int> s;
        if(x)
            s.emplace(f(x - 1, y));
        if(y)
            s.emplace(f(x + 1, y - 1));
        for(int i = 1; i <= min(x, y); ++i)
            s.emplace(f(x, y - i));
        int idx = 0;
        while(s.find(idx) != s.end())
            ++idx;
        return fl[x][y] = idx;
    };
    int x = 0;
    for(int i = 0; i < n; ++i)
        x ^= f(a[i], b[i]);
    cout << !bool(x) << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

// #define DEBUG

#ifdef DEBUG
#define dump(...) fprintf(stderr, __VA_ARGS__)
#else
#define dump(...)
#endif

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;

const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}

random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
	int n; cin >> n;
	vi d(n);
	for(auto & e : d) cin >> e;
	string ds;
	for(auto & e : d) ds.push_back('0' + e);

	set<string> s;
	rep(i, n){
		rep(j, n){
			s.insert(ds.substr(i, j));
		}
	}

	int res;
	rep(i, 1e8){
		stringstream ss;
		ss << i;
		if(s.find(ss.str()) == end(s)){
			res = i;
			break;
		}
	}
	cout << res << endl;

    return 0;
}

Measured memory_bytes: 209464