akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
using namespace std;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define app push_back
#define elif else if
#define int long long
#define free ferer465346
#define rt return
const int MAXN = 1e6 + 7;
int a[2][MAXN];
int f2[MAXN];
int cnk(int n, int k) {
    return !(f2[n] - f2[n - k] - f2[k]);
}
int f(int* a, int n) {
    int ans = 0;
    for (int i = 0; i < n; ++i)
        ans += a[i] * cnk(n - 1, i);
    return ans % 2;
}
void solve() {
    f2[0] = 0;
    for (int i = 1; i < MAXN; ++i) {
        int x = i;
        f2[i] = f2[i - 1];
        while (x % 2 == 0)
            f2[i]++, x /= 2;
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        char x;
        cin >> x;
        a[0][i] = x - '0';
    }
    for (int i = 1; i < 2; ++i)
        for (int j = 0; j < n - i; ++j)
            a[i][j] = abs(a[i - 1][j] - a[i - 1][j + 1]);
    int one = find(a[1], a[1] + n - 1, 1) != a[1] + n - 1;
    int mul;
    if (one) {
        mul = 1;
        for (int i = 0; i < n - 1; ++i)
            a[1][i] &= 1;
    } else {
        mul = 2;
        for (int i = 0; i < n - 1; ++i)
            a[1][i] /= 2;
    }
    cout << f(a[1], n - 1) * mul;
    return;
}

signed main() {
    ios::sync_with_stdio(false);

    solve();

    return 0;
}

Measured memory_bytes: 23680
#include<stdio.h>
#define MAX 250



int main(){
  int i,n;
  int a[MAX];

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,a[i]);
    if(i/2>=1 && i/2<=n){
      printf("parent key = %d, ",a[i/2]);
    }
    if(2*i<=n){
      printf("left key = %d, ",a[2*i]);
    }
    if(2*i+1<=n){
      printf("right key = %d, ",a[2*i+1]);
    }
    printf("\n");
    
  }

  



  return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

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;
}
template<class T>inline int cmp(vector<T>&v,T &a){
	return lower_bound(all(v),a)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
string S[105];
int A[105];
signed main(){
	cin>>N;
	rep(i,N)cin>>S[i]>>A[i];
	vector<int>v(N);
	iota(v.begin(),v.end(),0);
	auto comp=[&](int a,int b){
		if(S[a]!=S[b])return S[a]<S[b];
		return A[a]>A[b];
	};
	sort(v.begin(),v.end(),comp);
	for(int i:v)cout<<i+1<<"\n";
}


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

using namespace std;

int main(int argc, const char *argv[])
{
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) {
    cout << s << "\n";
  } else {
    cout << "red\n";
  }

  return 0;
}

Measured memory_bytes: 256
N, A, B = list(map(int, input().split()))
S = input()
b_rank = 1
total = A + B
for char in S:
    if total <= 0:
        print('No')
    else:
        if char == 'a':
            print('Yes')
            total -= 1
        elif char == 'b':
            if b_rank <= B:
                print('Yes')
                b_rank += 1
                total -= 1
            else:
                print('No')
        else:
            print('No')

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

int main() {
    string S;
    double w;
    cin >> S;
    cin >> w;

    double length_s = S.length();
    double length_new_s;

    length_new_s = ceil(length_s / w);

    for (int i=0;i<length_new_s;i++)
    {
        cout <<S[i*w];
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int W, H, x, y, r, i, j;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	i = x - r;
	j = x + r;
	if (i >= 0 && j <= W){
		i = y - r;
		j = y + r;
		if (i >= 0 && j <= H){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}
	else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 584
using System;
using System.Collections;
using System.Linq;
namespace AGC013A
{
    class Program
    {
        static void ShowAL(ArrayList al)
        {
            for (int i = 0; i < al.Count; i++)
                Console.Write("{0} ", (int)al[i]);
            Console.WriteLine();
        }
        static int Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int ans = 0;
            ArrayList al = new ArrayList();
            for (int i = 0; i < n - 1; i++)
                if (a[i] != a[i + 1])
                    al.Add(a[i]);
            al.Add(a[n - 1]);
            //ShowAL(al);
            a = (int[])al.ToArray(typeof(int));
            al = new ArrayList();
            for (int i = 0; i < a.Length; i++)
            {
                if (al.Count < 2)
                {
                    al.Add(a[i]);
                    continue;
                }
                if ((int)al[al.Count - 2] < (int)al[al.Count - 1] && (int)al[al.Count - 1] > a[i])
                {
                    ans++;
                    //ShowAL(al);
                    al = new ArrayList();
                    al.Add(a[i]);
                    continue;
                }
                if ((int)al[al.Count - 2] > (int)al[al.Count - 1] && (int)al[al.Count - 1] < a[i])
                {
                    ans++;
                    //ShowAL(al);
                    al = new ArrayList();
                    al.Add(a[i]);
                    continue;
                }
                al.Add(a[i]);
            }
            //ShowAL(al);
            ans++;
            Console.WriteLine(ans);
            return 0;
        }
    }
}

Measured memory_bytes: 33884
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {
	
	static Map<Integer, Card> cardMap = new HashMap<Integer, Card>();
	static Map<Integer, Integer> numMap = new HashMap<Integer, Integer>();
	
	//?????????????´?????????????????????????????????????????????????????????§?????????????????????????????????????????????Map???????????§??????????????????????????????????????????????????????
	//?????????????????¨?????????????????????int???????????°??¨?????????????????????????????£????°????????????????
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();
		int n = Integer.parseInt(br.readLine());
		//???????´?????????°????????¨??????Card????????????????????????????????????
		//CardMap<?????????,??????????????????????????????>???NumMap<?????????,???????????????????????°???)>
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			String[] str = br.readLine().split(" ");
			Card card = new Card(str[0], Integer.parseInt(str[1]), i);
			cardMap.put(i, card);
			numMap.put(i, card.num);
			a[i] = i;
		}
		quickSort(a, 0, n - 1);
		
		//?????????????????????????????????????????????????????????????????¨??§??????
		//
		boolean flag = true;
		Card card = cardMap.get(a[0]);
		int num = card.num;
		int order = card.order;
		sb.append(card.mark + " " + card.num + "\n");
		for (int i = 1; i < n; i++) {
			int k = a[i];
			card = cardMap.get(k);
			if(num == card.num && card.order < order){
				flag = false;
			}
			num= card.num;
			order = card.order;
			sb.append(card.mark + " " + card.num + "\n");
		}
		if(flag == true){
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}
		//?????????????????????????????????
		System.out.print(sb.toString());
	} 
//??\???????????????partition????????????????????¨??????Card?????????????????°?????????????????¨??§???????????£???????????¨?????????????????????????????°??§??????int???????????????Card???????????????????????????????´?????????????
	static int partition(int[] a, int p, int r) {
		int x = numMap.get(a[r]);
		int i = p - 1;
		int tmp;
		for (int j = p; j < r; j++) {
			if (numMap.get(a[j]) <= x) {
				i = i + 1;
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
		tmp = a[i + 1];
		a[i + 1] = a[r];
		a[r] = tmp;
		return i + 1;
	}
	//?????????????????????
	static void quickSort(int[] a, int p, int r){
		int q = 0;
		if(p < r){
			q = partition(a, p, r);
			quickSort(a, p, q-1);
			quickSort(a, q+1, r);
		} else {
			return;
		}
	}
}
//??????????????????????????????????????????
//???????????????????????????????????????????????????????????????????????????????????????????´???????(order)??????????????????
class Card{
	
	String mark;
	int num;
	int order;
	
	Card(String mark, int num, int order){
		this.mark = mark;
		this.num = num;
		this.order = order;
	}
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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() {
  string w; cin >> w;
  map<char, int> m;
  REP(i, w.size()) {
    m[w[i]]++;
  }

  string str = "Yes";
  for(auto x: m) {
    if(x.second % 2 == 1) {
      str = "No";
      break;
    }
  }

  cout << str << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef priority_queue<long long> prque;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define aout(i,n,a) for(long long i=0;i<(long long)(n);i++){if(i){cout<<" ";}cout<<a[i];if(i==n-1){cout<<endl;}}
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define vsort(v) sort((v).begin(),(v).end())
#define vrsort(v) sort((v).rbegin(),(v).rend())
#define vreverse(v) reverse((v).begin(),(v).end())
#define pf(a) push_front(a)
#define pb(a) push_back(a)
#define INF 1998021900
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll m,d;cin>>m>>d;ll ans=0;
  for(ll i=1;i<=m;i++){
    for(ll j=10;j<=d;j++){
      if((j%10)>1){
      if((j/10)>1){
        if((j%10)*(j/10)==i){ans++;}
      }
      }
    }
  }
  //caricurate
  //output
cout<<ans<<endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

signed main(){
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n;i+=2){
        int cnt=0;
        for(int j=1;j<=i;j++)if(i%j==0)cnt++;
        if(cnt==8)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n; double k, t, ans = 9999999999;
double safe(double x)
{
	return max(x, (double)0);
}
int main()
{
	scanf("%d%lf", &n, &k); k--;
	for (int i = 1; i <= n; i++)
	{
		int a;
		scanf("%d", &a);
		if (a == 1) t = i;
	}
	for (int i = 0; i <= k; i++)
		ans = min(ans, ceil(safe(t - 1 - i) / k) + ceil(safe(n - t -k + i) / k));
	printf("%.0lf", ans + 1);
	return 0;
}

Measured memory_bytes: 128
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F(i,a,b) for(int i=(a);i<=(b);++i)
#define F2(i,a,b) for(int i=(a);i<(b);++i)
#define dF(i,a,b) for(int i=(a);i>=(b);--i)
#define dF2(i,a,b) for(int i=(a);i>(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define INF 0x3f3f3f3f
#define INFll 0x3f3f3f3f3f3f3f3f
#define y0 _lxybz_
#define y1 _ljmnzyzhhhoscartxdy_
typedef long double ld;
typedef long long ll;
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
#define lo(x) ((x)&(-(x)))
#define trav(a, x) for (auto &a : x)
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
const ld Pi = 4*atan((ld)1);
template<class T> void chmin(T &a,const T&b) { a = min(a, b); }
template<class T> void chmax(T &a,const T&b) { a = max(a, b); }
namespace IO{
template<class T> inline void read(T&ret)
{
	ret=0; int f=1; char c=getchar();
	while(c<48||c>57){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	ret*=f;
}
template<class T> inline void prin(const T&ret)
{
	if(!ret){putchar(48);return;} static T o; o=ret;
	if(o<0){putchar('-');o=-o;}
	static int op[25],tt; tt=0;
	while(o){
		op[++tt]=o%10;
		o/=10;
	}
	for(int i=tt;i;--i)putchar(op[i]+48);
}
template<class T> inline void pri_(const T&ret)
{
	prin(ret);putchar(' ');
}
template<class T> inline void priE(const T&ret)
{
	prin(ret);putchar('\n');
}
}
using namespace IO;

#define N 300005
#define MO 
ll a[N],n,k,ss;
inline void _Sol_()
{
	read(n);read(k);
	F(i,1,n)read(a[i]);
	sort(a+1,a+n+1);
	F(i,1,n-k)ss+=a[i];
	prin(ss); 
}

int main()
{
	int T=1; //read(T);
	while(T--)_Sol_();
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s=="ARC")
  {
    cout<<"ABC";
  }
  else if(s=="ABC")
  {
    cout<<"ARC";
  }
  else
  {
    return 0;;
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    rep(i,n){
        cout << s[i];
        cout << t[i];
    }
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) (v.begin(), v.end())
#define dump(v)              \
  cerr << #v ":[ ";          \
  for (auto macro_vi : v) {  \
    cerr << macro_vi << " "; \
  }                          \
  cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
  string s, t;
  cin >> s >> t;
  cout << t + s << endl;
  return 0;
}

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

const long long mod = 1e9 + 7;

long long power(long long a, long long k) {
	long long res = 1;
	while (k) {
		if (k & 1) res = (long long)res * a % mod;
		a = (long long)a * a % mod;
		k >>= 1;
	}
	return res;
}


int C(int a, int b) {
	int res = 1;
	for (int i = 1, j = a; i <= b; i++, j--) {
		res = (long long)res * j % mod;
		res = (long long)res * power(i, mod - 2) % mod;
	}
	return res;
}


int lucas(long long a, long long b) {
	if (a < mod && b < mod) return C(a, b);
	return (long long)C(a % mod, b % mod) * lucas(a / mod, b / mod) % mod;
}

int main() {
	long long n, a, b;
	cin >> n >> a >> b;

	cout << (power(2, n) + mod * 2 - 1 - lucas(n, a) - lucas(n, b)) % mod << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
const int MAXN = 1005;
const int MAXV = MAXN * (MAXN - 1) / 2;
vector<int> to[MAXV];
int id[MAXN][MAXN];

int toId(int i, int j)
{
    if (i > j)
    {
        swap(i, j);
    }
    return id[i][j];
}

bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV]; // dp[v] := vからの最長経路
int dfs(int v)
{
    if (visited[v])
    {
        if (!calculated[v])
        {
            return -1;
        }
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for (int u : to[v])
    {
        int res = dfs(u);
        if (res == -1)
        {
            return -1;
        }
        chmax(dp[v], res + 1);
    }
    calculated[v] = true;
    return dp[v];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 1; j++)
        {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i < j)
            {
                id[i][j] = V++;
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 1; j++)
        {
            a[i][j] = toId(i, a[i][j]);
        }
        for (int j = 0; j < n - 2; j++)
        {
            to[a[i][j + 1]].push_back(a[i][j]);
        }
    }
    int ans = 0;
    for (int i = 0; i < V; i++)
    {
        int res = dfs(i);
        if (res == -1)
        {
            cout << -1 << endl;
            return 0;
        }
        chmax(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 38528
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        System.out.println(prod(n));
    }

    static long prod(int n) {
        long total = 1;
        for (int i = 1; i <= n; i++) {
            total = (total * i) % 1000000007;
        }
        return total;
    }
}


Measured memory_bytes: 23892
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc151A
{
    class Class 
    {
        private static char[] c;
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            c = str.ToCharArray();
            char x = c[0];
            int ans = (int)x;
            ans++;
            x = (char)ans;
            Console.WriteLine(x.ToString());
        }
    }
}


Measured memory_bytes: 11092
s = input()
d = {}

for letter in s:
  if letter in d:
    d[letter] += 1
  else:
    d[letter] = 1
flag = 1  
for key in d:
  if d[key]%2 != 0:
    flag = 0
	
if flag == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 8976
A, B = map(int, input().split())

ca_min = 100*A / 8
ca_max = 100*(A+1) / 8

cb_min = 10*B
cb_max = 10*(B+1)

# ca_min<= ca < ca_max
# cb_min<= cb < cb_max

AA = []
BB = []

for i in range(1, 1001):
  if ca_min<= int(i) < ca_max:
    AA.append(int(i))

for i in range(1, 1001):
  if cb_min<= int(i) < cb_max:
    BB.append(int(i))

CC = set(AA) & set(BB)

if CC == set():
  print(-1)
else:
  print(min(CC))




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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (int)(1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define PI 3.1415926535898

//------------------------------------------------------

int main() {
    int w, a, b;
    cin >> w >> a >> b;
    if (b + w < a) cout << a - (b + w) << endl;
    else if (a + w < b) cout << b - (a + w) << endl;
    else cout << 0 << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    long long int a[n],m=-1112,min=1228131,count=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(min>a[i])
         {

            min=a[i];   
            count++;    
         }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main(){
    int n;
    scanf("%d",&n);
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9) printf("hon\n");
    else if(n%10==0||n%10==1||n%10==6||n%10==8) printf("pon\n");
    else if(n%10==3) printf("bon\n");
    return 0;
}


Measured memory_bytes: 1644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MOD = 1000000000 + 7;

typedef int Matrix[2][2];
typedef int Vector[2];

Matrix UNIT = {{1, 0}, {0, 1}};

void mul(const Matrix &a, const Matrix &b, Matrix &c)
{
	static Matrix ret;
	memset(ret, 0, sizeof(ret));
	for(int i = 0; i < 2; i++)
		for(int j = 0; j < 2; j++)
			for(int k = 0; k < 2; k++)
				ret[i][j] = (ret[i][j] + (long long)a[i][k] * b[k][j]) % MOD;
	memcpy(c, ret, sizeof(ret));
}

void pow(const Matrix &a, long long p, Matrix &c)
{
	static Matrix ret, cur;
	memcpy(ret, UNIT, sizeof(ret));
	memcpy(cur, a, sizeof(cur));
	for(; p; p >>= 1, mul(cur, cur, cur))
		if(p & 1)
			mul(ret, cur, ret);
	memcpy(c, ret, sizeof(ret));
}

int fpow(int x, long long p)
{
	int ret = 1;
	for(; p; p >>= 1, x = (long long)x * x % MOD)
		if(p & 1)
			ret = (long long)ret * x % MOD;
	return ret;
}

const int MAXN = 1000 + 100;

int n, m;
long long k;
char s[MAXN][MAXN];
int num = 0, hlink = 0, vlink = 0, hcnt = 0, vcnt = 0;

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m >> k;

	if(k == 0)
	{
		cout << 1 << endl;
		return 0;
	}

	for(int i = 1; i <= n; i++)
		cin >> (s[i] + 1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			num += s[i][j] == '#';
	for(int i = 1; i <= n; i++)
	{
		hcnt += (s[i][1] == '#' && s[i][m] == '#');
		for(int j = 2; j <= m; j++)
			hlink += (s[i][j - 1] == '#' && s[i][j] == '#');
	}
	for(int i = 1; i <= m; i++)
	{
		vcnt += (s[1][i] == '#' && s[n][i] == '#');
		for(int j = 2; j <= n; j++)
			vlink += (s[j - 1][i] == '#' && s[j][i] == '#');
	}
	if(!hcnt && !vcnt)
	{
		cout << fpow(num, k - 1) << endl;
	}
	else if(hcnt && vcnt)
	{
		cout << 1 << endl;
	}
	else if(hcnt && !vcnt)
	{
		Matrix T = {{num, MOD - hlink}, {0, hcnt}};
		pow(T, k - 1, T);
		int ans = (T[0][0] + T[0][1]) % MOD;
		cout << ans << endl;
	}
	else if(!hcnt && vcnt)
	{
		Matrix T = {{num, MOD - vlink}, {0, vcnt}};
		pow(T, k - 1, T);
		int ans = (T[0][0] + T[0][1]) % MOD;
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1280
N = int(input())
L = list(map(int, input().split()))
L.sort()

cnt = 0

for a in range(len(L)-2):
    for b in range(a+1, len(L)-1):
        if L[a] != L[b]:
            for c in range(b+1, len(L)):
                if L[b] != L[c]:
                    if L[a] +L[b] > L[c]:
                        cnt += 1
            


print(cnt)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  double a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<a*b/2.000000<<' ';
  if(c==a/2.000000&&d==b/2.0000000)
    cout<<1<<endl;
  else
    cout<<0<<endl;
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n = int(input())
a = make_divisors(n)
b = [ int(i + n / i)  for i in a]
#print(a)
#print(b)
ans = min(b) - 2
print(ans)

Measured memory_bytes: 3424
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


from collections import defaultdict

N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(int)
for i in range(N):
    S[i] = sorted(S[i])
    d["".join(S[i])] += 1
ans = 0
for i in d.values():
    if i >= 2:
        ans += cmb(i, 2)

print(ans)


Measured memory_bytes: 125528
#include <iostream>
#include <vector>
#include <set>

int main() {
    int N;
    std::cin >> N;
    std::cin.ignore();
    int n = N;
    std::vector<int> A;
    A.reserve(N);
    while(n-->0){
        int v;
        std::cin >> v;
        A.push_back(v);
        std::cin.ignore();
    }
    std::vector<int> vals;
    vals.reserve(N);
    vals.push_back(*A.rbegin());
    for(auto it = A.rbegin() + 1; it!=A.rend();++it) {
        auto upper = std::upper_bound(vals.begin(),vals.end(),*it);
        if(upper == vals.end()) {
            vals.push_back(*it);
        } else {
            *upper = (*it);
        }
    }
    
    std::cout << vals.size() << std::flush;  
}

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

using namespace std;

const int MAX_N = 100;
const int MAX_W = 10000;

int N,W;
int v[MAX_N],w[MAX_N];
int dp[MAX_N+1][MAX_W+1];

int solve(){
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j <= W ; j++){
      if(j < w[i]){
        dp[i+1][j] = dp[i][j];
      }else{
        dp[i+1][j] = max(dp[i][j],dp[i+1][j-w[i]]+v[i]);
      }
    }
  }
  return dp[N][W];
}

int main(){
  cin >> N >> W;
  for(int i = 0 ; i < N ; i++){
    cin >> v[i] >> w[i];
  }
  cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 5072
import java.util.Scanner;

public class Main {
		
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		
		for(int i=0;i<n;i++) {
			a[i] = sc.nextInt();
		}
		int[] c = new int[10000 + 1];
//		for(int i=0;i<=10000;i++) {
//			c[i] = 0;
//		}
		for(int i=0;i<n;i++) {
			c[a[i]]++;
		}
		for(int i=1;i<=10000;i++) {
			c[i] += c[i-1];
		}
		for(int i=n-1;i>=0;i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}
		StringBuilder ans = new StringBuilder();
		ans.append(b[0]);
		for(int i=1;i<n;i++) {
			ans.append(" ").append(b[i]);
		}
		System.out.println(ans);
	}
	
}


Measured memory_bytes: 517192
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int c = sc.nextInt();
		int s =0;
      if(c-a+b > 0){
        s=c-a+b;
        }
        
		// 出力
		System.out.println(s);
	}
}

Measured memory_bytes: 23764
x = gets.to_i
num = 0
if x < 7
  num = 1
elsif x < 11
  num = 2
else
  num = (x / 11) * 2
  y = x % 11
  if y == 0
  elsif y < 7
    num += 1
  else
    num += 2
  end
end
puts num

Measured memory_bytes: 14316
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { A: number, B: number } => {
  const [A, B] = lines[0].split(' ').map(line => +line)
  const obj = { A, B }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { A, B } = parseLines(lines)
  const min = B - (A - 1)
  const max = B + (A - 1)
  const result = []
  for (let i = min; i <= max; i++) {
    result.push(i)
  }
  return result.join(' ')
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7628
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        int N = cin.Nextint;
        var A = cin.Scanlong;
        var G = A.Select((x, y) => new { x, y }).OrderByDescending(z => z.x).ThenByDescending(z => z.y).ToArray();

        var ans = new long[N];
        int min = G[0].y;
        for (int i = 1; i < N; i++)
        {
            ans[min] += i * (G[i - 1].x - G[i].x);
            min = Math.Min(min, G[i].y);
        }
        ans[0] = A.Sum() - (ans.Sum() - ans[0]);

        foreach (var v in ans)
        {
            WriteLine(v);
        }

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 35804
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    map<int,int> m;
    m[a]++;
    m[b]++;
    m[c]++;
    if(m[a]==1) cout<<a<<endl;
    if(m[b]==1) cout<<b<<endl;
    if(m[c]==1) cout<<c<<endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000021
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 5010



int main() {
	long long dp[N];
	long long a[N];
	long long llc[N];
	long long n;
	long long x, y, z, ca, cb;
	scanf("%lld %lld %lld", &n, &ca, &cb);
	f(i, n)scanf("%lld", &a[i]);
	f(i, N)dp[i] = 100000000000000000;
	dp[0] = 0;
	f(i,n) {	
		x = 100000000000000000;
		f(j, a[i]) {
			x = min(x, dp[j]);
		}
		dp[a[i]] = x;
		f(j, a[i])dp[j] += ca;
		for (long long j = a[i] + 1; j <= n; j++) {
			dp[j] += cb;
		}
	}
	x = 100000000000000000;
	f(i, n + 1)x = min(x, dp[i]);
	printf("%lld\n", x);
	return 0;
}

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

using namespace std;

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

  vector<int> a(3 * n);
  for (int i = 0; i < 3 * n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  long long ans = 0;
  for (int i = 1; i < 2 * n; i += 2) {
    ans += a[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1408
n = int(input())
s = list(input())

min = n
count = 0
for i in range(1, n):
    if s[i] == "E":
        count += 1
min = count

for i in range(1, n):
    if s[i] == "E":
        count -= 1
    if s[i-1] == "W":
        count += 1

    if count < min:
        min = count

print(min)


Measured memory_bytes: 5792
N, A, B, C = gets.chomp.split.map(&:to_i)
ABC = [A, B, C]
bs = readlines.map(&:to_i)

def calc_cost(total, bs)
  (bs.length - 1) * 10 + (total - bs.reduce(&:+)).abs
end

min = 100000
(0..(4**N-1)).each do |i|
  tmp_is = i.to_s(4).split('').map(&:to_i)
  is = [0] * (N - tmp_is.length) + tmp_is
  bis = bs.zip(is)
  cost = 0
  (0..2).each do |j|
    j_bs = bis.find_all{|b, i| i == j}.map{|b, i| b}
    if j_bs.empty? then cost = 1000000; break end
    cost += calc_cost(ABC[j], j_bs)
  end
  if cost < min then min = cost end
end

ans = min
print("#{ans}\n")

Measured memory_bytes: 4092
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	
	private static BufferedReader br;
	private static StringTokenizer tokenizer;
	public static String next() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null)
                throw new IOException();
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    } 
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    } 
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    } 
    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    
	public static void main(String[] args) throws IOException {		
		
		br = new BufferedReader(new InputStreamReader(System.in));
		long h = nextLong();
		long n=1,sum = 0;
		while(h>0) {
			sum += n;
			h = h/2;
			n *= 2;
		}
		System.out.println(sum);
	}
}






















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

int main(){
    int64_t N;
    cin >> N;
    int64_t ans = N + 1;
    for (int64_t i = 1;i <= sqrt(N); i++){
        if(N % i == 0){
            int64_t sum = 0;
            sum = i + N/i;
            ans = min(ans, sum);
        }
    }
    cout << ans-2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define fi first
#define se second
using namespace std;
short n,t;
typedef pair<short,short> td;
td a[3003];
int dp[3003],ans;
bool vis[3003];
int main(){
    scanf("%hd%hd",&n,&t);
    for (short i=1;i<=n;++i) scanf("%hd%hd",&a[i].fi,&a[i].se);
    sort(a+1,a+1+n);
    vis[0]=true;
    int tmp;
    for (short i=1;i<=n;++i)
    for (short j=t-1;j>=0;--j)
    if (vis[j]){
        tmp=dp[j]+a[i].se;
        ans=max(ans,tmp);
        if (j+a[i].fi<t) dp[j+a[i].fi]=max(dp[j+a[i].fi],tmp),vis[j+a[i].fi]=true;
    }
    printf("%d",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <numeric> //lcm

#define ERROR() cout << "ERROR!!" << endl; return 0;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 29; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

inline bool maxch(int &a, int b) { if (a < b) {a = b; return true;} else return false;}


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

  int h, w;
	cin >> h >> w;

	vector<vector<char>> field(h, vector<char>(w));

	rep(i, h) rep(j,w) cin >> field[i][j];

	vector<vector<int>> l(h, vector<int>(w));
	vector<vector<int>> r(h, vector<int>(w));
	vector<vector<int>> u(h, vector<int>(w));
	vector<vector<int>> d(h, vector<int>(w));

	rep(i, h) rep(j,w) {
	  if (j == 0) { 
			if (field[i][j] == '.') {
				l[i][j] = 1;
			}
			if (field[i][j] == '#') {
			  l[i][j] = 0;
			}
		  
		}
		else if (field[i][j] == '.') {
			l[i][j] = l[i][j - 1] + 1;
		}
		else if (field[i][j] == '#') {
			l[i][j] = 0;
		}
	}

	rep(i, h) rrep(j, w) {
		if (j == w-1) {
			if (field[i][j] == '.') {
				r[i][j] = 1;
			}
			if (field[i][j] == '#') {
				r[i][j] = 0;
			}

		}
		else if (field[i][j] == '.') {
			r[i][j] = r[i][j + 1] + 1;
		}
		else if (field[i][j] == '#') {
			r[i][j] = 0;
		}
	}

	rep(i, h) rep(j, w) {
		if (i == 0) {
			if (field[i][j] == '.') {
				u[i][j] = 1;
			}
			if (field[i][j] == '#') {
				u[i][j] = 0;
			}

		}
		else if (field[i][j] == '.') {
			u[i][j] = u[i-1][j] + 1;
		}
		else if (field[i][j] == '#') {
			u[i][j] = 0;
		}
	}

	rrep(i, h) rep(j,w) {
		if (i == h - 1) {
			if (field[i][j] == '.') {
				d[i][j] = 1;
			}
			if (field[i][j] == '#') {
				d[i][j] = 0;
			}

		}
		else if (field[i][j] == '.') {
			d[i][j] = d[i+1][j] + 1;
		}
		else if (field[i][j] == '#') {
			d[i][j] = 0;
		}
	}

	int ans = 0;
	rep(i, h) rep(j, w) {
	  if (field[i][j] == '.') maxch(ans, l[i][j] + r[i][j] + d[i][j] + u[i][j] - 3);
	}

	cout << ans << endl;
}




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

#define ll long long

int main()
{
    ll N;
    ll K;

    scanf("%lld %lld", &N, &K);

    ll h[N];
    for(ll i = 0;i < N;i++) {
        scanf("%lld", &h[i]);
    }

    sort(h, h + N);

    ll dh_min = 1145141919810;
    for(ll i = K - 1;i < N;i++) {
        dh_min = min(dh_min, h[i] - h[i - K + 1]);
    }

    printf("%lld\n", dh_min);
    return 0;
}


Measured memory_bytes: 1024
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define debug(x)			{ cerr << #x << " = " << x << endl; }
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define vi					vector<int>
#define vii					vector<vi>
#define max(x,y)			(x>y)?x:y
#define min(x,y)			(x<y)?x:y
#define mid(s,e)			(s+(e-s)/2)

using namespace std;

int main() {
	int r;
	cin>>r;
	cout<<3*r*r;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

struct E {
	int d;
	int e;
};

void process(vector<int>& ns, vector<bool>& is_searched, queue<int>& search, const pair<int, E>& e)
{
	if (is_searched[e.second.d]) return;

	ns[e.second.d] = ns[e.first] ^ e.second.e;
	is_searched[e.second.d] = true;
	search.push(e.second.d);
}

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

	int n; cin >> n;

	unordered_multimap<int, E> edges;
	FOR_LT(i, 0, n - 1) {
		int v, w, d; cin >> v >> w >> d;

		edges.insert(make_pair(v, E{ w, (d & 1) }));
		edges.insert(make_pair(w, E{ v, (d & 1) }));
	}

	vector<int> ns(n + 1);
	vector<bool> is_searched(n + 1);

	queue<int> search;
	ns[1] = 1;
	is_searched[1] = true;
	search.push(1);

	while (!search.empty()) {
		int i = search.front();
		search.pop();

		auto e = edges.find(i);
		while (e != edges.end() && e->first == i) {
			process(ns, is_searched, search, *e);
			e++;
		}
	}

	FOR_LE(i, 1, n) {
		cout << ns[i] << endl;
	}

	return 0;
}

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

int main() {

    int X;
    cin >> X;

    int now = 0;

    int i;
    for (i = 0; now < X; i++) {
        now += i;
    }

    cout << i - 1 << endl;

    return 0;
}

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

using namespace std;

int main() 
{
	int a, b, c, d;
	cin >> a >> b >> c >>d;

	int cnt = 0;

	int e = abs(c - a);
	int f = abs(b - a);
	int j = abs(c - b);

	if (e <= d) {
		cnt = cnt + 1;
	}
	if (j <= d && f <= d) {
		cnt = cnt + 1;
	}
	if (cnt > 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}

Measured memory_bytes: 256
n,k = map(int, input().split())
A = list(map(int, input().split()))

for i in range(k):
    imo = [0] * (n + 1)
    for j in range(n):
        tmp = j-A[j]
        if tmp < 0:
            tmp = 0
        imo[tmp] += 1
        tmp2 = j+A[j]+1
        if tmp2 > n:
            tmp2 = n
        imo[tmp2] -=1
    if imo[0] == n and imo[n] == -n:
        A = [n] * n
        A = map(str, A)
        print(' '.join(A))
        exit()
    else:
        temp = 0
        for k in range(n):
            temp += imo[k]
            A[k] = temp
A = map(str, A)
print(' '.join(A))


Measured memory_bytes: 162156
h,w,a,b = map(int,input().split())
mod = 10 ** 9 + 7

def inv(a,mod):
    r = [1,0,a]
    w = [0,1,mod]
    while w[2]!=1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = w
        w = r_new
    x,y = w[0],w[1]    # a*x+y*mod = 1
    return (mod+x%mod)%mod

max_num = 2*10**5+1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]

fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1

for i in range(2,max_num):
    fact[i] = fact[i-1] * i % mod
    ifact[i] = ifact[i-1] * inv(i,mod) % mod

def cmb(x,y):
    return fact[x] * ifact[y] * ifact[x-y] % mod

ans = 0

j = 0
while j < min(w-b,h-a):
    ans += cmb(b+h-a-1,b+j)*cmb(a+w-b-1,a+j)
    ans %= mod
    j += 1

print(ans)

Measured memory_bytes: 56012
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int[] a = in.Int(3);
            Arrays.sort(a);
            out.println(a[0] * a[1] / 2);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



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

int main()
{
  ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  rep(i,h){
    cin>>s[i];
  }
  vector<bool>col(h, false);
  vector<bool>row(w, false);
  rep(i,h){
    rep(j,w){
      if(s[i][j] == '#'){
        row[i] = true;
        col[j] = true;
      }
    }
  }
  rep(i, h){
    if(row[i]){
      rep(j,w){
        if(col[j]){
          cout << s[i][j];
        }
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[10];
	int b[10];
	int c[10];
	int i, j;
	int n;
	int b1, c1;
	
	scanf("%d", &n);

	while (n != 0){
		for (i = 0; i < 10; i++){
			a[i] = b[i] = c[i] = 0;
		}
		for (j = 0; j < 10; j++){
			scanf("%d", &a[j]);
		}
		b[0] = a[0];
		b1 = 0;
		c1 = 0;
		for (i = 1; i < 11; i++){
			if (i == 10){
				printf("YES\n");
			}
			else if (b[b1] < a[i]){
				b1++;
				b[b1] = a[i];
			}
			else if (c[c1] < a[i]){
				c1++;
				c[c1] = a[i];
			}
			else {
				printf("NO\n");
				break;
			}
		}
		n--;
	}
	return (0);
}

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

using namespace std;
//first : cost ,second : index
using P = pair<long long,int>;

using graph = vector<vector<P>>;

vector<long long> dijkstra(const graph &g , int n, int start,long long inf){
  vector<long long> dist(n,inf);
  priority_queue<P,vector<P>,greater<P>> queue;
  int size = 0;
  queue.emplace(make_pair(0,start));

  while(queue.size() > 0 && size < n){
    P now = queue.top() ; queue.pop();

    long long cost = now.first;
    int v = now.second;

    if(inf > dist[v])continue;

    dist[v] = cost;

    size++;

    for(auto e : g[v]){
      if(cost + e.first < dist[e.second]){
        queue.emplace(make_pair(cost + e.first,e.second));
      }
    }
  }

  return dist;
}

int main() {
  int n,m,s,t;
  cin >> n >> m >> s >> t;
  s--;t--;
  vector<vector<P>> yen(n,vector<P>(0));
  vector<vector<P>> snuuk(n,vector<P>(0));
  int u,v,a,b;
  for(int i=0;i<m;i++){
    cin >> u >> v >> a >> b;
    u--;v--;
    yen[u].emplace_back(make_pair(a,v));
    yen[v].emplace_back(make_pair(a,u));
    snuuk[v].emplace_back(make_pair(b,u));
    snuuk[u].emplace_back(make_pair(b,v));
  }

  long long inf = 1'000'000'000'000'000LL;
  vector<long long> yen_val = dijkstra(yen,n,s,inf);
  vector<long long> snuuk_val = dijkstra(snuuk,n,t,inf);
  vector<pair<long long , int>> total(n);
  for(int i=0;i<n;i++){
    total[i] = make_pair(yen_val[i] + snuuk_val[i],i);
  }

  sort(total.begin(),total.end());
  int idx = 0;

  for(int i=0;i<n;i++){
    while(total[idx].second <= i-1){
      idx++;
    }
    cout << inf - total[idx].first << endl;
  }
  
  return 0;
}


Measured memory_bytes: 21432
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	string s;
	cin>>s;
	int ans=700;
	rep(i,3)if(s[i]=='o')ans+=100;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256