akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int main() {
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) a[i] = in();
    sort(ALL(a));

    int ma = a[n-1];
    int x, d = 1e9 + 10;
    REP(i,n-1){
        int p;
        if (ma % 2){
            if (a[i] <= ma/2){
                p = ma/2 - a[i];
            }else{
                p = a[i] - ma/2 - 1;
            }
        }else{
            p = abs(a[i] - ma/2);
        }
        // cout << p << endl;
        if (p < d){
            x = a[i];
            d = p;
        }
    }
    cout << a[n-1] << " " << x << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int t[111];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>t[i];
	}
	a=1e9;
	for(i=0;i<=100;i++){
		b=0;
		for(j=0;j<n;j++){
			b+=(t[j]-i)*(t[j]-i);
		}
		a=min(a,b);
	}
	cout<<a<<endl;
}

Measured memory_bytes: 256
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e5+6;



int main() {
    
    string s;
    cin >> s;
    ll S=0,T=0;
    for(int i=0;i<s.size();i++){
        
        if(s[i]=='T' && S > 0)
            S--;
        else if(s[i] == 'S')
            S++;
        else
            T++;
//    cout << "After i: " << i << "S is " << S << "\n";
    }
    cout << S+T;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define DEBUG 1

main()
{
	int input;
	int i;
	double ans = 1;


	scanf("%d", &input);
	
	for(i = 1; i <= input; i++)
	{
		ans *= i;
	}
	
#ifdef DEBUG
	printf("%.0f\n", ans);
#endif
	return 0;
}

Measured memory_bytes: 632
#include <stdio.h>

int main(void){
	int m,f,r;
	char s;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1)break;
		if(m+f>=80)s='A';
		if(m+f>=65&&m+f<80)s='B';
		if(m+f>=50&&m+f<65)s='C';
		if(m+f>=30&&m+f<50){
			if(r>=50)s='C';
			else s='D';
		}
		if(m+f<30)s='F';
		if(m==-1||f==-1)s='F';
		printf("%c\n",s);
	}
	return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < s.size(); i++){
        if (s.at(i) + n <= 'Z') s.at(i) += n;
        else{
            int back = n - ('Z' - s.at(i)) -1;
            s.at(i) = 'A' + back;
        }
    }

    cout << s << endl;
}

Measured memory_bytes: 3604
import java.util.Scanner;

/**
 * Solution for AtCoder Regular Contest 098.
 * Problems are available at: https://arc098.contest.atcoder.jp/tasks/arc098_a
 */
public class Main {

    public static int findMinTurns(int n, String s) {

        int eastTotal = 0;
        int westTotal = 0;

        for (char ch : s.toCharArray()) {
            if (ch == 'E') {
                eastTotal++;
            } else if (ch == 'W') {
                westTotal++;
            }
        }

        int eastPassed = 0;
        int westPassed = 0;

        int currentTurns;
        int leastTurns = n;

        for (char ch : s.toCharArray()) {
            currentTurns = westPassed + eastTotal - eastPassed;

            if (ch == 'E') {
                currentTurns--;
                eastPassed++;

            } else if (ch == 'W') {
                westPassed++;
            }

            if (currentTurns < leastTurns) {
                leastTurns = currentTurns;
            }
        }
        return leastTurns;
    }

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

        int n = sc.nextInt();
        sc.nextLine();

        String s = sc.nextLine();
        System.out.println(findMinTurns(n, s));

        sc.close();

    }
}


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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, K, S;
    cin >> N >> K >> S;
    for (int i = 0; i < K; i++)
        cout << S << " ";
    S = (S + 1) % 1000000000;
    for (int i = 0; i < N - K; i++)
        cout << S << " ";
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> nums(n);
    for(int i = 0; i < n; i++)
        cin >> nums[i];
    sort(nums.begin(), nums.end());
    cout << nums[nums.size() / 2] - nums[nums.size() / 2 - 1] << "\n";
    return 0;
}


Measured memory_bytes: 3696
import sys
import collections

(n, quantum) = map(int, input().split())
processes = [input().split() for i in range(n)]
for p in processes:
    p[1] = int(p[1])
queue = collections.deque(processes)
elapsed = 0
while queue:
    head = queue.popleft()
    if head[1] > quantum:
        head[1] -= quantum
        queue.append(head)
        elapsed += quantum
    else:
        elapsed += head[1]
        print(head[0], elapsed)

Measured memory_bytes: 20292
def myFunc(i,Score,depth):
  tmp_score=Score
  tmp_max_choice=0
  for j in c:
    tmp_score-=j
  tmp_max_score=tmp_score
  for k,j in enumerate(s[i]):
    if tmp_max_score<tmp_score+j+c[k]:
      tmp_max_choice=k
      tmp_max_score=tmp_score+j+c[k]
  return tmp_max_score,tmp_max_choice
  

D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(list(map(int,input().split())))
Score=0
for i in range(D):
  score,choice=myFunc(i,Score,1)
  Score=score
  print(choice+1)
  


Measured memory_bytes: 9400
#include <stdio.h>
int main(void){
    char x[364364]={};
    int A=-1;int Z;
    scanf("%s",x);
    for(int i=0;i<300000;i++){
        if(x[i]=='A'&&A==-1)A=i;
        if(x[i]=='Z')Z=i;
        
    }
    printf("%d",Z-A+1);
    return 0;
}

Measured memory_bytes: 512
// Problem : B - Go to Jail
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 	
int mod=1e9+7;
int po(int x,int y,int m)  { if (y==0) return 1; int t=po(x,y/2,m)%m; t=(t*t)%m; if (y&1) return (t*x)%m;	return t%m; }

signed main() {

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

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

    int n;
    cin>>n;
    vector<array<int,2>> v(n);
    for(int i=0;i<n;++i)
    	cin>>v[i][0]>>v[i][1];
    int f=0;
    for (int i=2;i<n;++i){
    	if (v[i][0]==v[i][1] && v[i-1][0]==v[i-1][1] && v[i-2][0]==v[i-2][1]){
    		f=1;
    		break;
    	}
    }
   	if (f)
   		cout<<"Yes"<<endl;
   	else
   		cout<<"No"<<endl;
   
   	return 0;
}

Measured memory_bytes: 3652
def main():
  import sys
  input=sys.stdin.buffer.readline
  n=int(input())+1
  data=[[0]*n*2for _ in range(26)]
  def update(i,x):
    i+=n
    for d in data:
      j=i
      if d[j]:
        d[j]=0
        j//=2
        while j:
          d[j]=d[j+j]|d[j-~j]
          j//=2
        break
    d=data[x]
    d[i]=1
    i//=2
    while i:
      d[i]=d[i+i]|d[i-~i]
      i//=2
  def query(l,r):
    l+=n
    r+=n
    s=[0]*26
    while l<r:
      if l&1:
        for i,d in enumerate(data):
          s[i]|=d[l]
        l+=1
      if r&1:
        r-=1
        for i,d in enumerate(data):
          s[i]|=d[r]
      l//=2
      r//=2
    return sum(s)
  for i,c in enumerate(input()[:-1]):
    update(i,c-97)
  s=[]
  for _ in range(int(input())):
    q,a,b=input().split()
    if q[0]>49:
      s+=query(int(a)-1,int(b)),
    else:
      update(int(a)-1,b[0]-97)
  print('\n'.join(map(str,s)))
main()

Measured memory_bytes: 258492
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

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

  map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;  
  }

  int ans = 0;
  for (auto kv : cnt) {
    if (kv.second >= kv.first) {
      ans += min(kv.second, kv.second - kv.first);
    } else {
      ans += kv.second;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4736
def main():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]

    g = [set() for _ in [0]*n]
    for a, b in ab:
        g[a-1].add(b-1)
        g[b-1].add(a-1)

    mod = 10**9+7
    fact = [1, 1]
    inv = [pow(i, mod-2, mod) for i in range(n+1)]
    for i in range(2, n+1):
        fact.append(fact[-1]*i % mod)

    class rerooting():
        # addは頂点iに頂点jを根とする部分木（DPの値：x）をくっつけるときの補正
        def __init__(self, tree, ini):
            # merge:頂点aにbをマージするときのモノイド
            # adj_bu:ボトムアップ時の調整（a:値,i:頂点）
            # adj_td:トップダウン時の調整（a:値,i:頂点,p:親）
            # adj_fin:最終調整（a:値,i:頂点）
            def merge(a, b): return a * b % mod
            def adj_bu(a, i): return a * inv[size[i]] % mod
            def adj_td(a, i, p): return a * inv[n-size[i]] % mod
            def adj_fin(a, i): return a * fact[n-1] % mod

            # トポロジカルソートをする
            # T:木の隣接グラフ表現をset化
            # P:親
            # q:キュー
            # order:トポソしたもの
            T = g
            P = [-1]*n
            q = [0]
            order = []
            while q:
                i = q.pop()
                order.append(i)
                for a in T[i]:
                    if a != P[i]:
                        P[a] = i
                        T[a].remove(i)
                        q.append(a)

            # Tをリストに変換
            T = [list(i) for i in T]

            # サイズの処理を先に行う
            # size[i]:0を根とする根付き木における、iを根とする部分木の大きさ
            size = [1]*n
            for i in order[1:][::-1]:
                size[P[i]] += size[i]

            # ボトムアップ処理をする
            # ME:マージした値を一時保存
            # DP:DP値、MEを調整したもの
            ME = [ini]*n
            DP = [0]*n
            for i in order[1:][::-1]:
                DP[i] = adj_bu(ME[i], i)
                p = P[i]
                ME[p] = merge(ME[p], DP[i])
            DP[order[0]] = adj_fin(ME[order[0]], order[0])
            TD = [ini]*n

            # トップダウン処理をする
            for i in order:
                # 左からDP（結果はTDに入れている）
                ac = TD[i]
                for j in T[i]:
                    TD[j] = ac
                    ac = merge(ac, DP[j])
                # 右からDP（結果はacに入れている、一度しか使わないのでacで問題ない）
                ac = ini
                for j in T[i][::-1]:
                    TD[j] = adj_td(merge(TD[j], ac), j, i)
                    ac = merge(ac, DP[j])
                    DP[j] = adj_fin(merge(ME[j], TD[j]), j)
            for i in DP:
                print(i)

    rerooting(g, 1)


main()


Measured memory_bytes: 148024
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	x,k,d=MI()
	x=abs(x)
	a=x%d
	b=d-a

	ans=0

	t=k-(x-a)//d

	if t<0:
		ans=x-k*d
	else:
		if t%2:
			ans=b
		else:
			ans=a
	print(ans)






if __name__ == "__main__":
	main()


Measured memory_bytes: 9256
l, r = map(int, input().split())

lis = []
if r - l > 2000:
    print(0)
    exit()
    
for i in range(l, r+1):
    for j in range(l,r+1):
        if i != j:
            lis += [i * j % 2019]
print(min(lis))

Measured memory_bytes: 10632
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>

using namespace std;

#define rep(a) _rep(0,int(a))
#define repj(a) for(int j=0;j<int(a);j++)
#define repk(a) for(int k=0;k<int(a);k++)
#define _rep(a,b) for(int i=int(a);i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)
#define l_b lower_bound
#define u_b upper_bound
#define b_s binary_search

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}
int keta(int num) {
	int n = 0;
	if (num == 0) {
		return 1;
	}
	while (num != 0) {
		num /= 10;
		n++;
	}
	return n;
}

int n, a;
signed main() {
	cin >> n;
	int ans = 0;
	rep(n) {
		cin >> a;
		int t = 0;
		while (a % 2 == 0) {
			a /= 2;
			
			t++;
		}ans += t;
	}cout << ans << endl;
}


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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}



void solve(){
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


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

ll solve() {
    ll x, a;
    for ( int i = 0; i < 5; i++ ) {
        cin >> x;
        if ( x == 0 ) a = i+1;
    }
    
    return a;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cctype>
#include<queue>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cstdlib>
#include<map>
#include<utility>
#include<iomanip>
#include<set>
#include<stack>
//#include<Windows.h>
using namespace std;
typedef long long ll;typedef pair<int,int> pii;
typedef pair<ll,ll> pll;typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef vector<ll> vll;typedef vector<pll> vpl;typedef long double ld;
typedef unsigned long long ul;typedef queue<int> qii;typedef queue<pii> qpi;
int n,a[105],b[105],pa[105],pb[105],res;
int main()
{
// 	freopen("","r",stdin);
// 	freopen("","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>b[i];
	for(int i=1;i<=n;i++) pa[i]=pa[i-1]+a[i];
	for(int i=n;i>=1;i--) pb[i]=pb[i+1]+b[i];
	for(int i=1;i<=n;i++)
		res=max(res,pa[i]+pb[i]);
	cout<<res<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
 
using namespace std;
const int N=2e3+1, mod= 1e9+7;

const long double PI= acos(-1);

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	
	long double h,b,x;
	cin>>b>>h>>x;
	long double hh= x/(b*b);
	if( hh > h/2 ){
		cout<<fixed<<setprecision(10)<< atan( ( h-x/(b*b) )*(2/b) )*180.0/PI ;
	}else{
		cout<<fixed<<setprecision(10)<< 90.0 - atan( (2*b*hh)/(h*h) )*180.0/PI;
	}
	
    yogeshk972();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, k;
  scanf("%d%d%d%d", &a, &b, &c, &k);
  if (a >= b && a >= c) {
    printf("%d\n", a * int(pow(2, k)) + b + c);
  } else if (b >= a && b >= c) {
    printf("%d\n", b * int(pow(2, k)) + a + c);
  } else {
    printf("%d\n", c * int(pow(2, k)) + b + a);
  }
}

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

constexpr int64_t mod = 1000000007;

int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t res = power(n * n % mod, k / 2);
  if (k % 2) {
    res = res * n % mod;
  }
  return res;
}

int main() {
  int64_t n, k;
  cin >> n >> k;
  vector<int64_t> a(n), aplus, aminus;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int64_t x : a) {
    if (x >= 0) {
      aplus.push_back(x);
    } else {
      aminus.push_back(x);
    }
  }
  sort(aplus.rbegin(), aplus.rend());
  sort(aminus.begin(), aminus.end());
  int64_t ans = 1;
  int64_t l = min<int>(k, aminus.size()), lminus = l / 2 * 2;
  if ((int) aplus.size() < k - lminus) {
    int s = min<int>(k, aminus.size());
    for (int i = 0; i < s; i++) {
      ans *= mod + aminus[(int) aminus.size() - (i + 1)];
      ans %= mod;
    }
    for (int i = 0; i < k - s; i++) {
      ans *= aplus[(int) aplus.size() - (i + 1)];
      ans %= mod;
    }
    ans += mod;
    ans %= mod;
    cout << ans << endl;
    return 0;
  }
  for (int i = 0; i < lminus; i++) {
    ans *= mod + aminus[i];
    ans %= mod;
  }
  for (int i = 0; i < k - lminus; i++) {
    ans *= aplus[i];
    ans %= mod;
  }
  if (ans == 0) {
    cout << ans << endl;
    return 0;
  }
  for (int i = lminus - 2; i >= 0; i -= 2) {
    if (k - i - 1 >= (int) aplus.size()) {
      break;
    }
    int64_t m_old = aminus[i] * aminus[i + 1];
    int64_t m_new = aplus[k - i - 1] * aplus[k - i - 2];
    if (m_old >= m_new) {
      break;
    }
    ans *= power(m_old % mod, mod - 2);
    ans %= mod;
    ans *= m_new % mod;
    ans %= mod;
  }
  ans += mod;
  ans %= mod;
  cout << ans << endl;
}


Measured memory_bytes: 6856
N=int(input())
H=list(map(int,input().split()))
depth=[0]*(N+1)
depth[0]=1
if N==0:
    if H[0]!=1:
        print(-1)
        exit()
    else:
        print(1)
        exit()
else:
    if H[0]!=0:
        print(-1)
        exit()
    for i in range(1,N+1):
        depth[i]=(depth[i-1]-H[i-1])*2
        if depth[i]<0:
            print(-1)
            exit()
    if depth[N-1]*2<H[N]:
        print(-1)
        exit()
    else:
        depth[N]=min(depth[N],H[N])
    for i in range(N - 1, -1, -1):
        if depth[i + 1] == 0:
            if H[i] != 0:
                depth[i] = H[i]
            else:
                depth[i] = 0
            if i == 0:
                depth[i] = 1
        else:
            depth[i] = min(depth[i + 1] + H[i], depth[i])
    print(sum(depth))

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>a(3*N);
  for(int i=0;i<3*N;i++)cin>>a[i];
  sort(rng(a));
  ll ans=0;
  for(int i=0;i<2*N;i++)if(i%2)ans+=a[3*N-1-i];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1536
//#include<iostream>
//#include<cstdio>
//#include<string>
//#include<string>
//#include<algorithm>
//#include<ctime> printf("\n%lldms",clock());
//#include<cmath>
//#include<vector>
//#include<queue>
#include <bits/stdc++.h>
#define lijyya 300010
#define oo 0x3f3f3f3f
#define emmm 100003
#define f1(i,a,b) for (register int i=a;i<=b;++i)
#define f2(i,a,b) for (register int i=a;i<b;++i)
#define f3(i,a,b) for (register int i=a;i>=b;--i)
#define f4(i,a,b) for (register int i=a;i>b;--i)
using namespace std;
typedef long long ll;
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
inline int read(){
	int f=1,x=0;char ch;
	do{
		ch=getchar();if(ch=='-') f=-1;
	}while(ch<'0'||ch>'9');
	do{
		x=x*10+ch-'0';ch=getchar();
	}while(ch>='0'&&ch<='9');
	return f*x;
}

int n,a;
int main(){
	n=read();
	a=read();
	n%=500;
	if(n<=a) printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef float Item;
static Item *s;
static int N;
void STACKinit(int);
int STACKempty(void);
void STACKpush(Item);
Item STACKpop(void);
int main(void){
  char a[400];
  int i=0;
  scanf("%[^\n]",a);
  int n=strlen(a);
  int stackin=0;
  STACKinit(214748364);
  for(i=0;i<n;i++){
    if(a[i]=='+'){
      STACKpush(STACKpop()+STACKpop());
      stackin--;
    }
    if(a[i]=='-'){
      int l=STACKpop();
      STACKpush(STACKpop()-l);
    }
    if(a[i]=='*'){
      STACKpush(STACKpop()*STACKpop());
    }
    if((a[i]>='0')&&(a[i]<='9')){
      STACKpush(0);
    }
    while((a[i]>='0')&&(a[i]<='9')){
      STACKpush(10*STACKpop()+(a[i++]-'0'));
      stackin++;
    }
  }
  printf("%d\n",(int)STACKpop());
  return 0;
}
void STACKinit(int maxN){
  s=malloc(maxN*sizeof(Item));
  N=0;
}
int STACKempty(void){
  return N==0;
}
void STACKpush(Item item){
  s[N++]=item;
}
Item STACKpop(void){
  return s[--N];
}

Measured memory_bytes: 1760
#!/usr/bin/env python3
from collections import Counter


stdin = open(0)

N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Measured memory_bytes: 38476
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N1 = sc.nextInt();
        int N2 = sc.nextInt();
        int N3 = sc.nextInt();
        int[] N = { N1, N2, N3 };
        int count_5 = 0;
        int count_7 = 0;
      
        for(int i=0; i<3; i++){
          if(N[i] == 5){
            count_5++;
          }else{
            count_7++;
          }
        }
      
        if(count_5==2 && count_7==1){
          System.out.println("YES");
        }else{
          System.out.println("NO");
        }
          
    }
}

Measured memory_bytes: 23124
n = int(input())
a = list(map(int, input().split()))
color = [0] * 8
tmp = 0
for i in range(n):
  if a[i] < 400:
    color[0] = 1
  elif a[i] < 800:
    color[1] = 1
  elif a[i] < 1200:
    color[2] = 1
  elif a[i] < 1600:
    color[3] = 1
  elif a[i] < 2000:
    color[4] = 1
  elif a[i] < 2400:
    color[5] = 1
  elif a[i] < 2800:
    color[6] = 1
  elif a[i] < 3200:
    color[7] = 1
  else:
    tmp = tmp + 1
l = color.count(1)
if l == 0:
  print("1 {}".format(tmp))
else:
  print("{} {}".format(l, l + tmp))

Measured memory_bytes: 3064
import math

str = input().split(' ')
x1 = float(str[0])
x2 = float(str[1])
y1 = float(str[2])
y2 = float(str[3])

result = (x1-y1)*(x1-y1) + (x2-y2)*(x2-y2)
result = math.sqrt(result) if result != 0 else 0

print('%.6f'%result)

Measured memory_bytes: 7536
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


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

    ll a[3];
    F0R(i,3) cin >> a[i];
    sort(a,a+3);
    ll sum = 0;
    F0R(i,2) sum += abs(a[i] - a[i+1]);
    
    cout << sum << endl;



    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

int main() {

  int N;
  cin >> N;
  double T, A;
  cin >> T >> A;

  vector<double> H(N);
  for(int i = 0; i < N; i++){
    cin >> H.at(i);
    H.at(i) = std::pow((T - H.at(i) * 0.006) - A,2.0);
  }
  
  int minIndex = std::min_element(H.begin(),H.end()) - H.begin();
  cout << minIndex + 1  << endl;

  return 0;
}




Measured memory_bytes: 256
from random import randint
import sys
input = sys.stdin.readline


def calc_score(D, C, S, T):
    """
    開催日程Tを受け取ってそこまでのスコアを返す
    """
    contest_last_opened = [0]*26  # コンテストiを前回開催した日
    score = 0
    for d, t in enumerate(T, start=1):
        get_score = S[d-1][t-1]
        score += get_score
        contest_last_opened[t-1] = d
        loss_score = 0
        for i in range(26):
            ld = contest_last_opened[i]
            loss_score += C[i]*(d-ld)
        score -= loss_score
    return score


def update_score(D, C, S, T, score, ct, ci):
    """
    ct日目のコンテストをコンテストciに変更する
    スコアを差分更新する

    ct: change t 変更日
    ci: change i 変更コンテスト
    """
    contest_last_opened = [0]*26  # コンテストiを前回開催した日
    for d in range(1, ct):
        contest_last_opened[T[d-1]-1] = d

    prei = T[ct-1]  # 変更前に開催する予定だったコンテストi
    prei_ld = contest_last_opened[prei-1]  # preiが前回開催した日
    preci_ld = contest_last_opened[ci-1]  # ciが前回開催した日
    score -= S[ct-1][prei-1]
    score += S[ct-1][ci-1]

    for d in range(ct, D+1):
        if d != ct and T[d-1] == prei:
            break
        score += C[prei-1]*(d - ct)
        score -= C[prei-1]*(d - prei_ld)

    for d in range(ct, D+1):
        if d != ct and T[d-1] == ci:
            break
        score += C[ci-1]*(d - preci_ld)
        score -= C[ci-1]*(d - ct)
    T[ct-1] = ci
    return score, T


def local_search():
    pass


def main(D, C, S):
    T = []
    for d in range(1, D+1):
        # d日目に一番満足度が高いコンテストを開催する 1-indexed
        # S[d-1]で最大のコンテストiを選ぶ　→ 0点！w
        # d日目にコンテストiを選んだ時に一番スコアが高くなるiを選ぶ
        today_score = calc_score(D, C, S, T + [1])
        today_contest = 1
        for i in range(2, 26 + 1):
            tmp_score = calc_score(D, C, S, T + [i])
            if today_score < tmp_score:
                today_score = tmp_score
                today_contest = i
        T.append(today_contest)
    return T


if __name__ == '__main__':
    D = int(input())
    C = [int(i) for i in input().split()]
    S = [[int(i) for i in input().split()] for j in range(D)]
    T = [int(input()) for i in range(D)]
    M = int(input())
    DQ = [[int(i) for i in input().split()] for j in range(M)]
    score = calc_score(D, C, S, T)
    for d, q in DQ:
        score, T = update_score(D, C, S, T, score, d, q)
        print(score)


Measured memory_bytes: 94568
#include <bits/stdc++.h>
#define rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)


#define SZ(x) ((int)(x).size())


typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
struct Vec{
    double x, y;
};

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>
T min(T a, T b)
{
    if (a < b) return a;
    return b;
}

template<class T>
T max(T a, T b)
{
    if (a > b) return a;
    return b;
}

using namespace std;

int main()
{
    int L, R, d, cnt = 0;
    cin >> L >> R >> d;
    repi(i, L, R + 1){
        if (i % d == 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int x, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x >> t;
    cout << max(x - t, 0LL) << endl;  

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 100007
#define inf 1e9+7
using namespace std;
typedef pair<int,int> ii;
int n;
int a[N];
int dj[N];

int dsj(){
    priority_queue <ii> pq;
    pq.push(ii(0,1));
    dj[1] = 0;
    while(!pq.empty()){
        int val = pq.top().first;
        int pos = pq.top().second;
        pq.pop();
        if (pos == n){
            return val;
        }
        if (pos + 1 <= n){
            if (dj[pos+1] > dj[pos] + abs(a[pos] - a[pos+1])){
                dj[pos+1] = dj[pos] + abs(a[pos] - a[pos+1]);
                pq.push(ii(dj[pos+1],pos+1));
            }
        }
        if (pos + 2 <= n){
            if (dj[pos+2] > dj[pos] + abs(a[pos] - a[pos+2])){
                dj[pos+2] = dj[pos] + abs(a[pos] - a[pos+2]);
                pq.push(ii(dj[pos+1],pos+1));
            }
        }
    }
    return dj[n];
}

int main(){
    cin >> n;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
        dj[i] = inf;
    }
    cout << dsj();
}


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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }

const int mod = 1000*1000*1000+7;

int n;
int m;
int res[110][110];
int h[110];
vi w;

int power (int a, int b) {
	int c = 1;
	while (b) {
		if (b & 1) c = ((ll)c * a) % mod;
		a = ((ll)a * a) % mod;
		b /= 2;
	}
	re c;
}

int main () {
	scanf ("%d", &n);
	h[0] = 1;
	w.pb (1);
	for (int i = 1; i <= n; i++) {
		scanf ("%d", &h[i]);
		w.pb (h[i]);
	}
	sort (all (w));
	w.resize (unique (all (w)) - w.begin ());
	res[0][0] = 1;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < sz (w); j++) {
			if (j == 0) {
				res[i + 1][0] = (res[i + 1][0] + (ll)res[i][j] * 2) % mod;
				for (int k = 1; k < sz (w); k++) {
					int a = max (h[i], w[k - 1]);
					int b = min (h[i + 1], w[k]);
//					printf ("%d %d\n", a, b);
					if (a <= b) {
						ll tmp = power (2, h[i + 1] - a) - power (2, h[i + 1] - b);
						if (tmp < 0) tmp += mod;
						res[i + 1][k] = (res[i + 1][k] + (ll)res[i][j] * 2 * tmp) % mod;
					}
				}	
			} else {
				if (w[j] <= h[i + 1]) {
					res[i + 1][j] = (res[i + 1][j] + (ll)res[i][j] * power (2, max (0, h[i + 1] - h[i]))) % mod;
				} else {
					res[i + 1][0] = (res[i + 1][0] + (ll)res[i][j] * 2) % mod;
				}
			}
//			printf ("%d,%d : %d = %d\n", i, h[i], w[j], res[i][j]);
		}
	int ans = 0;
	for (int i = 0; i < sz (w); i++) {
//		printf ("%d = %d\n", i, res[n][i]);
		ans = (ans + res[n][i]) % mod;
	}	
	printf ("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector < ll >
#define vvll vector < vll >
#define vld vector < ld >
#define pll pair < ll,ll > 
#define pld pair < ld,ld > 
#define vpll vector < pll >
#define vpld vector < pld >
#define all(X) X.begin(),X.end()
#define endl "\n"
#define sz(x) ((ll)((x).size()))
vll emptyVector;
const ll MAX = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884197169399375105;

ll binaryExpo(ll x, ll n)
{
	if(n == 0)
		return 1;
	if(n % 2 == 0)
		return binaryExpo((x*x) % MOD, n/2);
	return (x*binaryExpo((x*x) % MOD, n/2)) % MOD;
}

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
/*-------------------------------------------		CODE STARTS FROM HERE		------------------------------------------*/

ll fac[MAX] = {1}, inv[MAX] = {1}, dp[3005] = {0};

ll ncr(ll a, ll b)
{
	if(a < 0 || b < 0)
		return 0;
	ll x = (ll)(fac[a + b]*inv[a]) % MOD;
	x = (ll)(x*inv[b]) % MOD;
	return x % MOD;
}

void solve(void)
{
	ll h, w, n;
	cin >> h >> w >> n;
	h--,w--;

	vvll point(n, vector < ll > (2));

	for(int i = 0; i < n; i++)
	{
		cin >> point[i][0] >> point[i][1];
		point[i][0]--, point[i][1]--;
	}

	sort(point.begin(), point.end());

	// for(int i = 0; i < n; i++)
	// 	cout << point[i][0] << " " << point[i][1] << endl;
	
	ll ans = 0;
	for(int i = 0; i < n; i++)
	{
		dp[i] = ncr(point[i][0], point[i][1]);
		dp[i] %= MOD;
		// cout << "1 dp[" << i << "] = " << dp[i] << endl;
		for(int j = 0; j < i; j++)
		{
			ll x = (ll)(dp[j]*ncr(point[i][0] - point[j][0], point[i][1] - point[j][1])) % MOD;
			// cout << "x = " << x << endl;
			dp[i] -= x;
			dp[i] += MOD;
			dp[i] %= MOD;
			// cout << "2 j = " << j << " dp[" << i << "] = " << dp[i] << endl;
		}
		ans += (ll)(dp[i]*ncr(h - point[i][0], w - point[i][1])) % MOD;
		ans %= MOD;
		// cout << "ans = " << ans << endl;
	}

	// cout << "ncr(" << h << ", " << w << ") = " << ncr(h, w) << endl;
	cout << (MOD + ((ncr(h, w) - ans) % MOD)) % MOD << endl;

	
}


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

	for(int i = 1; i < MAX; i++)
		fac[i] = (fac[i - 1]*i)%MOD;

	for(int i = 1; i < MAX; i++)
		inv[i] = binaryExpo(fac[i], MOD - 2);

	// for(int i = 1; i < 6; i++)
	// 	cout << "fac[" << i << "] = " << fac[i] << " inv[" << i << "] = " << inv[i] << endl;

	// int t;
	// cin >> t;
	// while(t--)
	{	
		solve();
	}




	return 0;
}

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

int main() {
	int n;
	vector<int> train;
	
	while (cin >> n) {
		if (n != 0) {
			train.push_back(n);
		}
		else {
			cout << train.back() << endl;
			train.pop_back();
		}
	}

	return 0;
}

Measured memory_bytes: 1212
N = gets.to_i

strs = (0..N).map{ [] }
strs[0] = [""]

Chars = [""] + "abcdefghijklmn".split("")
N.times{
  (0...N).reverse_each{ |i|
    ss = strs[i]
    strs[i] = (1..i).flat_map{ |j| ss.map{ |s| s + Chars[j] } }
    strs[i+1] += ss.map{ |s| s + Chars[i+1] }
  }
}

puts strs[1..-1].flatten.sort!


Measured memory_bytes: 13456
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

const double PI=acos(-1.0);

int main() {
    int n, m;
    cin >> n >> m;
    int sum = 0;
    rep(i, m) {
        int a;
        cin >> a;
        sum += a;
    }

    cout << (n - sum >= 0 ? n - sum : -1) << endl;
    
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;

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

	vector<int> A(N);
	rep(i, N) cin >> A[i];
	
	double inv = 0.0;
	rep(i, N) {
		inv += 1.0/((double)A[i]);
	}
	double ans = 1.0/inv;
	cout.precision(20);
	cout << ans << endl;

	return 0;
}

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

int main() {
    //変数宣言
    int a, b, c;

    //入力受付
    cin >> a >> b >> c;
    
    //計算
    int x = (a * 100) + (b * 10) + c;

    //出力
    if (x % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
ll n, k, ans, a[N];
int add(ll a, ll b){
    return (a + b) % mod;
}
int mul(int a, int b){
    return (1ll * a * b) % mod;
}
ll fp(ll b, ll p){
    if(!p) return 1;
    ll res = fp(b, p / 2);
    res = mul(res, res);
    if(p & 1) res = mul(res, b);
    return res;
}
ll sum(int l, int r){
    if(!l) return a[r];
    return a[r] - a[l - 1];
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        a[i] = a[i - 1] + i;
    for(int i = k; i <= n + 1; i++)
        ans = add(ans, sum(n - i + 1, n) - sum(0, i - 1) + 1);
    cout << ans << '\n';
    return 0;
}


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

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

string s1, s2;
ll hs[26][100002];
ll counter[26];
int main(){
    cin >> s1 >> s2;

    ll len1 = s1.length(), len2 = s2.length();
    ll i=0, pre_i=0, j=0, cnt=0;
    bool flg=false;

    for(int i=0; i<26; i++){
        counter[i]=0;
        for(int j=0; j<100002; j++){
            hs[i][j] = 0;
        }
    }
    for(int i=0; i<len1; i++){
        int tmp = s1[i] - 'a';
        hs[tmp][counter[tmp]] = i;
        counter[tmp]++;
    }
    ll pt=0;
    for(int i=0; i<len2; i++){
        int tmp = s2[i] - 'a';
        if( counter[tmp] == 0){
            cnt = -1;
            break;
        }
        j=0;
        if( pt > hs[tmp][counter[tmp]-1]){
            cnt++;
            pt = hs[tmp][0]+1;
        }else{
            ll* ii = upper_bound(&hs[tmp][0], &hs[tmp][counter[tmp]], pt-1);
            pt = (*ii) + 1;
        }
        cerr << tmp << ", " << pt << ", " << cnt << endl;
        /*
        while(true){
            if( j >= counter[tmp] ){
                cnt++;
                pt = hs[tmp][0]+1;
                //cerr << pt << ", " << tmp << ", " << j << endl;
                break;
            }else if( pt <= hs[tmp][j] ){
                pt = hs[tmp][j]+1;
                //cerr << pt << ", " << tmp << ", " << j << endl;
                break;
            }else{
                j++;
            }
        }
        */

    }
     
    for(int i=0; i<26; i++){
        char tmp = 'a'+i;
        cerr << tmp << " " << counter[i] << " : ";
        for( int j=0; j<counter[i]; j++){
            cerr << " "  << hs[i][j];
        }
        cerr << endl;
    }
    
    /* 
    while(true){
        if( (flg==true)&&(i==pre_i) ){
            cnt=-1;
            break;
        }
        if( s1[i]==s2[j] ){
            if( j+1==len2 ) break;
            else{
                j++;
                pre_i = i;
            }
        }
        if( i+1 < len1 ) i++;
        else{
            i=0; cnt++;
        }
        flg=true;
    }
    */
   //cerr << cnt << ", " << pt << endl;
    if( cnt<0 ) cout << -1 << endl;
    else cout << cnt*len1+pt << endl;

    return 0;
}


Measured memory_bytes: 20864
N = int(input())
A = [0] + list(map(int,input().split())) + [0]
total = 0
for i in range(1,N+2):
    total += abs(A[i]-A[i-1])
X = [total for i in range(N+2)]
for i in range(1,N+1):
    X[i] += abs(A[i-1]-A[i+1])-abs(A[i]-A[i-1])-abs(A[i]-A[i+1])
for i in range(1,N+1):
    print(X[i])

Measured memory_bytes: 14048
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,int> pii;
const int N = 1e5+5;
const int M = 5e5+5;
#define pi acos(-1)
#define INF 1e18
#define INM INT_MIN
#define pb(a)  push_back(a)
#define mk(a,b) make_pair(a,b)
#define dbg(x) cout << "now this num is " << x << endl;
#define met0(axx) memset(axx,0,sizeof(axx));
#define metf(axx) memset(axx,-1,sizeof(axx));
#define sd(ax) scanf("%d",&ax)
#define sld(ax) scanf("%lld",&ax)
#define sldd(ax,bx) scanf("%lld %lld",&ax,&bx)
#define sdd(ax,bx) scanf("%d %d",&ax,&bx)
#define sddd(ax,bx,cx) scanf("%d %d %d",&ax,&bx,&cx)
#define sfd(ax) scanf("%lf",&ax)
#define sfdd(ax,bx) scanf("%lf %lf",&ax,&bx)
#define pr(a) printf("%d\n",a)
#define plr(a) printf("%lld\n",a)
int main()
{
	int r;sd(r);
	printf("%.10f\n",2*pi*double(r));
	//system("pause");
	return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  while(k--)
  {
    int x;
    cin>>x;
    if((n-=x)<=0)
    {
      cout<<"Yes"<<endl;
      return 0;
    }
    
  }
  cout<<"No"<<endl;
      }

Measured memory_bytes: 256
// Problem : C - Low Elements
// Contest : AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_c
// Memory Limit : 1024,000000 MB
// Time Limit : 2000,000000 milisec
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <cmath>
#include <cstdio>

#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <map>
#include <set>
#include <vector>

using namespace std;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int n;

vector<int> a;

void input() {
  cin >> n;

  a = vector<int>(n);
  for (auto&& i : a)
    cin >> i;
}

void solve1() {
  vector<int> b(n, a[0]);
  for (int i = 1, mino = a[0]; i < n; ++i) {
    mino = min(mino, a[i]);

    b[i] = mino;
  }

  int ans = 1;

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

  cout << ans;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


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

int main() {
    int ans = 0;
    int N, K;
    string S;
    cin >> N >> K >> S;
    vector<int> T;
    T.push_back(S[0]);
    for(int i = 1; i < N; i++) {
        if(S[i - 1] != S[i]) {
            T.push_back(S[i]);
        }
    }
    for(int i = 0; i < K; i++) {
        if(T.size() > 2)
            T.erase(T.begin() + 1, T.begin() + 3);
        else if(T.size() == 2)
            T.erase(T.begin() + 1);
    }
    ans = N - 1;
    ans -= T.size() - 1;
    cout << ans << endl;
}

Measured memory_bytes: 3944