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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 2019;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

long long modpow(long long m, long long p) {
    if (p == 0) return 1;
    if (p % 2)
        return m * modpow(m, p - 1) % MOD;
    else {
        long res = modpow(m, p / 2);
        return res * res % MOD;
    }
}

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

    string s;
    cin >> s;
    reverse(all(s));
    map<int, int> dict;
    dict[0]++;
    int sum = 0;
    rep(i, s.size()) {
        int d = (s[i] - '0') * modpow(10, i);
        sum = (sum + d) % MOD;
        // debug(i);
        // debug(prev);
        // debug(m);
        dict[sum]++;
    }

    ll cnt = 0;
    rep(i, 2020) {
        cnt += dict[i] * (dict[i] - 1) / 2;
    }
    out(cnt);
    return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int i,j,k;
  vector <int> v;
  string s;
  
  cin>>s;
  
  for(i=0;i<s.length()-2;i++){
    j=(s[i]-48)*100+(s[i+1]-48)*10+s[i+2]-48;
    v.push_back(abs(753-j));
  }
  sort(v.begin(),v.end());
  
  cout<<v[0]<<endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int a,b,c;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	int ma=max(a,max(b,c));
	int ans=ma*9+a+b+c;
	cout<<ans<<endl;
}

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

typedef struct price_amount{
    int price;
    int amount;
}p_a;

int mycompare(const void * a, const void * b)
{
    return ( ((p_a*)a)->price - ((p_a*)b)->price );
}

int main() {
    int N,M;
    int i;
    
    scanf("%d %d", &N, &M);
    
    p_a *pa_list = malloc(sizeof(p_a)*N);
    
    for (i=0; i<N; i++){
        scanf("%d %d", &pa_list[i].price, &pa_list[i].amount);        
    }
    
    qsort(pa_list, N, sizeof(p_a), mycompare);
    
    unsigned long long int ans = 0;
    for (i=0; M>0; i++){
        if (pa_list[i].amount >= M){
            ans += (unsigned long long)pa_list[i].price * (unsigned long long)M;
            M = 0;
            break;
        } else {
            ans += (unsigned long long)pa_list[i].price * (unsigned long long)pa_list[i].amount;
            M -= pa_list[i].amount;
        }
    }
    /*
    printf("\n\n");
    for (i=0; i<N; i++){
        printf("%d %d\n", pa_list[i].price, pa_list[i].amount);
    }
    */
    printf("%llu", ans);
    return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;
    cin >> S;

    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include <cstdio>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
#include <boost/multiprecision/cpp_int.hpp>


namespace mp = boost::multiprecision;

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// 最大公約数
ll GCD(ll a, ll b)
{
    if (a < 0)
        a = -a;
    if (b < 0)
        b = -b;
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

// 最小公倍数
ll LCM(ll a, ll b)
{
    ll g = GCD(a, b);
    return a / g * b;
}

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

    std::cout << (a*b)<< std::endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

vector<int> pri={1, 2, 3};

void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

bool VV(vector<int> vv1, vector<int> vv2) {
	if(vv1.size()!=vv2.size()) return false;
	rep(i, vv1.size()) if(vv1[i]!=vv2[i]) return false;

	return true;
}

bool VVL(vector<LLi> vv1, vector<LLi> vv2) {
	if(vv1.size()!=vv2.size()) return false;
	rep(i, vv1.size()) if(vv1[i]!=vv2[i]) return false;

	return true;
}

//n以下の素数を配列に{1, 2, 3, 5, 7, ...} make_prime_list
//i, j, flag, sqx, xを使用
void mplist(LLi x){
	int flag, sqx;

	for(int i=5;i<=x;i+=2){
		flag=0;
		sqx=(int)sqrt(x)+1;
		for(int j=1;j<(int)pri.size();j++){
			if(i%pri[j]==0){
				flag=1;
				break;
			}
			if(sqx<pri[j]) break;
		}
		if(flag==0) pri.emplace_back(i);
	}
}

//nを素因数分解 root_prime_fac
//i, tmp, bin, lmt, xを使用
map<LLi, int> rpfac(LLi x){
	int sqx=ceil(sqrt(x));
	//cout<< "sqx=" << sqx SP << sqx*sqx << endl;//
	auto bin = lower_bound(pri.begin(), pri.end(), sqx);
	int lmt=bin-pri.begin()+1;
	map<LLi, int> tmp;
	//cout<< "lmt=" << lmt SP << pri[lmt] SP << pri[lmt]*pri[lmt] <<endl;//
	if(pri.size()<lmt) cout<< "rpfac: pri size is small" <<endl;

	for(int i=1;i<lmt;i++){
		while(x%pri[i]==0){
			x/=pri[i];
			tmp[pri[i]]++;
			//cout<< x <<endl;
			//tmp[0]++;//0番に何個の積でできてるかをメモれる
		}
		if(x==1) break;
	}

	//if(x!=1) cout<< "prime_fac x=" << x <<endl;
	return tmp;
}

//約数列挙
//i, j, k, tmp, mul, mを使用
vector<LLi> getfac(map<LLi, int> mp){
	vector<LLi> tmp={1}, ad;
	LLi mul;
	
	for (auto p : mp) {
		mul=1;
		ad.clear();
  		LLi key = p.first;
  		int value = p.second;
		  
		rep(j, value){
			mul*=key;
			rep(k, tmp.size()) ad.push_back(tmp[k]*mul);
		}
		rep(j, ad.size()) tmp.push_back(ad[j]);
		//PV(tmp);//
	}

	/*for(int i=1;i<v.size();i++){
		if(v[i]==0) continue;
		mul=1;
		ad.clear();
		rep(j, v[i]){
			mul*=pri[i];
			rep(k, tmp.size()){
				ad.push_back(tmp[k]*mul);
			}
		}
		//PV(tmp);
		rep(j, ad.size()) tmp.push_back(ad[j]);
	}*/

	sort(all(tmp));
	return tmp;
}

//素因数の積を計算
//i, tmp, vを使用
LLi defac(map<LLi, int> mp){
	LLi tmp=1;

	/*for(int i=1;i<v.size();i++){
		if(v[i]!=0) tmp*=pow(pri[i], v[i]);
	}*/

	for (auto p : mp) {
  		LLi key = p.first;
  		int value = p.second;
		tmp*=pow(key, value);
	}

	return tmp;
}

//素数判定 is_prime
//ub, lb, x, iを使用
bool isp(LLi x){
	//if(x==1) return false;//1を素数としないなら有効化
	auto ub = upper_bound(all(pri), x);
	auto lb = lower_bound(all(pri), x);

	//xがでかいときは素数リストで割ってみる
	if(lb==pri.end()){
		for(int i=1;i<(int)pri.size();i++){
			if(x%pri[i]==0) return false;
			if(x<pri[i]*pri[i]) return true;
		}
		//cout<< "isp: pri size is small" <<endl;

		//priのサイズが足りないときは地道にチェックする
		for(LLi i=pri[pri.size()-1]+2;i<=ceil(sqrt(x));i+=2){
			if(x%i==0) return false;
		}
		return true;
	}

	return ub!=lb;
}

int main(){

	LLi x;

	cin>> x;

  	while(1){
      if(isp(x)){
        cout<< x <<endl;
        break;
      }
      x++;
    }
  
	return 0;
}


Measured memory_bytes: 256
//NAME-DEEPESH BHATT
//Institute-IIT Dhanbad
//MOTTO-THINK FIRST,CODE LATER
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD =998244353 ;
#define pb push_back
#define mp make_pair
#define endl '\n'
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a ,ll b)
{
    return a/gcd(a,b)*b;
}
ll power(ll a,ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}
int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    int n;
    cin>>n;
    set<string>s;
    while(n--){
        string a;
        cin>>a;
        s.insert(a);
    }
    cout<<s.size();
    return 0;
}

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

int main()
{
    int n,ans = 0;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        bool tmp = true;
        
        for(int j=2;j<=sqrt(a[i]);j++)if(a[i] % j == 0){
            tmp = false;
            break;
        }
        if(tmp)ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;

int main(){
  long N,n;
  vector<long> A;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>n;
    A.push_back(n);
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  long x,y,flag=0;
  for(int i=0;i<N-1;i++){
    /*if(i<N-3 && A[i]==A[i+3]){
      cout<<A[i]*A[i]<<endl;
      return 0;
    }else */if(A[i]==A[i+2]){
      if(flag==0){
        x=A[i];
        flag+=1;
        i +=2;
      }else{
        y=A[i];
        cout<<x*y<<endl;
        return 0;
      }
    }else if(A[i]==A[i+1]){
      if(flag==0){
        x=A[i];
        flag+=1;
        i +=1;
      }else{
        y=A[i];
        cout<<x*y<<endl;
        return 0;
      }
    }
    }
    cout<<0<<endl;
  return 0;
  }


Measured memory_bytes: 1400
#include<iostream>
#include<vector>
#include<string.h>
#include<stack>
using namespace std;

struct Node{
  vector<int> edge;
};

typedef vector<Node> Graph;
#define fi first
#define se second
#define pii pair<int,int>

bool visited[110];
int dist[110];
int exist[110];
int ne[110];

int dfs(const Graph &g, int n) {
  int tmp,res=0;
  visited[n] = true;
  exist[n] = 0;

  for(int i=0; i<g[n].edge.size(); ++i) {
    if(visited[g[n].edge[i]]) continue;
    tmp = dfs(g, g[n].edge[i]);
    if(res < tmp) res = tmp;
  }

  visited[n] = 0;
  return res+1;
}

int main() {
  int n,a,b,tmp,br;
  while(cin>>n, n) {
    Graph g(100);
    int mindegree = 100,mind = 0;

    for(int i=0; i<100; ++i) {
      visited[i] = false;
      dist[i] = 0;
      exist[i] = 0;
    }

    for(int i=0; i<n; ++i) {
      cin>>a>>b;
      a--,b--;
      g[a].edge.push_back(b);
      g[b].edge.push_back(a);
      exist[a] = exist[b] = 1;
    }

    int max = 0;
    for(int j=1;;j++) {
      for(int i=0; i<100; ++i) {
	if(g[i].edge.size() == j) {
	  tmp = dfs(g, i);
	  if(max < tmp) max = tmp;
	}
      }

      br = 1;
      for(int i=0; i<100; ++i)
	if(exist[i]) {
	  br = 0;
	  break;
	}
      if(br) break;
    }

    cout<<max<<endl;
  }
}

Measured memory_bytes: 904
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    s = input()
    ans = ""
    
    for vol in s:
        if vol == "0":
            ans += "0"
        elif vol == "1":
            ans += "1"
        else:
            if len(ans) == 0:
                pass
            else:
                ans = ans[:-1]
                
    print(ans)
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 38768
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    ll K;
    cin >> K;
    vector<ll> L;
    ll count = 0;

    // 1桁のlunlun
    for (ll i = 1; i <= 9; i++)
    {
        L.push_back(i);
        // cout << i << endl;
    }
    count += L.size();
    if (count >= K)
    {
        cout << L.at(K - 1) << endl;
        return;
    }

    // 2桁のるんるん
    while (1)
    {
        ll lsize = L.size();
        vector<ll> NL;
        for (ll i = 0; i < lsize; i++)
        {
            ll Li = L.at(i);
            ll ri = Li % 10;
            if (ri - 1 >= 0)
            {
                NL.push_back(Li * 10 + ri - 1);
                // cout << Li * 10 + ri - 1 << endl;
            }
            NL.push_back(Li * 10 + ri);
            // cout << Li * 10 + ri << endl;
            if (ri + 1 <= 9)
            {
                NL.push_back(Li * 10 + ri + 1);
                // cout << Li * 10 + ri + 1 << endl;
            }
        }
        if (count + NL.size() >= K)
        {
            cout << NL.at(K - count - 1) << endl;
            break;
        }
        count += NL.size();
        L = NL;
    }

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 2080
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        int sum = 0;
        for(int i= 0; i < n; i++) {
        	h[i] = scan.nextInt();
        	sum += h[i];
        }
        int ans = 0;
        while(true) {
        	int temp = ans;
        	boolean f = false;
        	for(int i = 0; i < n; i++) {
        		if(f == false && h[i] != 0) {
        			f = true;
        			ans ++;
        		}
        		if(f) {
        			if(h[i] > 0) {
        				h[i]--;
        				sum--;
        			}else {
        				break;
        			}
        		}
        	}
        	if(temp == ans) {
        		break;
        	}
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
l = input()
mod = 10**9 + 7
#上からi桁目まで決めて、まだl以下であることが確定していない
dp1 = [0 for i in range(len(l))]
dp1[0] = 2
#上からi桁目まで決めて、もうl以下であることが確定してる
dp2 = [0 for i in range(len(l))]
dp2[0] = 1
for i in range(1,len(l)):
    if l[i] == "0":
        #今回の桁を0にする
        dp1[i] += dp1[i-1]
        dp2[i] += dp2[i-1]
        #今回の桁を1にする
        dp2[i] += dp2[i-1] * 2
    else:
        #今回の桁を0にする
        dp2[i] += dp2[i-1] + dp1[i-1]
        #今回の桁を1にする
        dp1[i] += dp1[i-1] * 2
        dp2[i] += dp2[i-1] * 2
    dp1[i] %= mod
    dp2[i] %= mod
print((dp2[-1] + dp1[-1]) % mod)

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

int n, mx[303000], ans[303000];

inline void U(int &x,int y){
  if (y>x) x=y;
}

int main(){
  cin>>n;
  #define rint register int
  int x;
  for (int i=0;i<1<<n;++i){
    scanf("%d",&x);
    for (rint j=i;j<1<<n;j=(j+1)|i){
      U(ans[j],x+mx[j]);
      U(mx[j],x);
    }
  }
  for (int i=1;i<1<<n;++i){
    printf("%d\n",ans[i]);
    U(ans[i+1],ans[i]);
  }
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<char,int> pci;
typedef vector<pair<int,int>> vpii;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
#define sci(a) scanf("%d",&a)
#define scii(a,b) scanf("%d %d",&a,&b)
#define sciii(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sciiii(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define scl(a) scanf("%lld",&a)
#define scll(a,b) scanf("%lld %lld",&a,&b)
#define sclll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c
#define scllll(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define print(a) printf("%d ",a)
#define println(a) printf("%d\n",a)
#define ln printf("\n")
#define pb(a) push_back(a)
#define m_p(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define rep(i,s,n) for(int i=s;i<=n;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define repv(i,m) for(auto i = m.begin();i != m.end();i++)
#define FileIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const long long INF = 4000000000000000000LL;
/************************************* Chocolate *************************************/
int main(){
    int n;
    sci(n);
    vi cnt(4);
    rep(i,1,n){
        int x;
        sci(x);
        ++cnt[x];
    }
    double ev[n+1][n+1][n+1];
    for(int c=0;c<=cnt[3];++c){
        for(int b=0;b<=cnt[2]+cnt[3];++b){
            for(int a=0;a<=cnt[1]+cnt[2]+cnt[3];a++){
                if(a+b+c == 0 || a+b+c > n) continue;
                double p_waste = 1.0*n/(a+b+c);
                double p_a = 1.0*a/(a+b+c);
                double p_b = 1.0*b/(a+b+c);
                double p_c = 1.0*c/(a+b+c);
                ev[a][b][c] = p_waste;
                if(a) ev[a][b][c] += p_a*ev[a-1][b][c];
                if(b) ev[a][b][c] += p_b*ev[a+1][b-1][c];
                if(c) ev[a][b][c] += p_c*ev[a][b+1][c-1];
            }
        }
    }
    cout.precision(10);
    cout << fixed << ev[cnt[1]][cnt[2]][cnt[3]] << endl;
}

Measured memory_bytes: 111076
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#include <stdio.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>QUE;//きゅー

int main(void)
{
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B + C >= 22) {
		cout << "bust";
		return 0;
	}
	cout << "win";
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int a, b;
  cin >> a >> b;
  if (b / 100 > 0) {
    a *= 1000;
  } else if (b / 10 > 0) {
    a *= 100;
  } else {
    a *= 10;
  }

  int v = a + b;
  int k = sqrt(v);
  if (k*k == v) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int a;
int b;
int c;
int tmp;
int main(void){

	scanf("%d %d %d",&a,&b,&c);
	if(b < a){
		tmp = a;
		a = b;
		b = tmp;
		}
			if(c < b){
				tmp = b;
				b = c;
				c = tmp;
			}
					if(a > b){
						tmp = a;
						a = b;
						b = tmp;
					}
					

		printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    X = LIST()

    for i in range(5):
        if X[i] == 0: print(i+1)


if __name__ == '__main__':
    main()


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

int main(){
  long r,d,x;
  cin >> r >> d >> x;
  r(i,10){
    x=r*x-d;
    cout << x << endl;
  }
}

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

typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))
#define VI(v,n) vector<int> v(n);REP(i,n){assert(0<scanf("%d",&v[i]));}

int main(){
  priority_queue<int> pq;
  INT(n); INT(m);
  REP(n){
    INT(a); pq.push(a);
  }
  REP(m){
    int a = pq.top(); pq.pop();
    pq.push(a / 2);
  }
  ll ans = 0;
  while(!pq.empty()){
    int a = pq.top(); pq.pop();
    ans += a;
  }
  printf("%lld\n", ans);
  return 0;
}

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

using namespace std;

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

  int n, k, s;
  cin >> n >> k >> s;

  int ss = (s > (int)5e8 ? 1 : (int)1e9);
  for(int i = 0; i < k; ++i) cout << s << " ";
  for(int i = 0; i < n - k; ++i) cout << ss << " ";

  return 0;
}


Measured memory_bytes: 1280
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n = lines.next().unwrap().unwrap().parse::<usize>().unwrap();
    let s = lines.next().unwrap().unwrap();

    let s1 = &s[..n / 2];
    let s2 = &s[n / 2..];
    let ans = if s1 == s2 { "Yes" } else { "No" };

    println!("{}", ans);
}


Measured memory_bytes: 4352
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
const int N = 201234;
int a[N], b[N], c[N], d[N];
int x[N], y[N];

void solve() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		a[i] = x[i] + y[i];
		b[i] = x[i] - y[i];
		c[i] = -x[i] + y[i];
		d[i] = -x[i] - y[i];
	}
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);
	sort(d, d + n);
	cout << max({a[n - 1] - a[0], b[n - 1] - b[0], c[n - 1] - c[0], d[n - 1] - d[0]});
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	solve();
}


Measured memory_bytes: 8336
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <iostream>
#define maxn 300009
using namespace std;
char s[maxn];


int main(){
	scanf("%s", s);
	int n = strlen(s);
	bool ok = 1;
	for(int i = 0; i < n; i++){
		if(s[i] == '1'){
			ok = 0;
			break;
		}
	}
	if(ok){
		cout << n << endl;
		return 0;
	}
	int ans = n;
	for(int i = 0; i < n - 1; i++){
		if(s[i] != s[i + 1]){
			int cur = max(n - i - 1, i + 1);
			ans = min(ans, cur);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
typedef int ll;
 
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
 
 
const ll N = 100002;
const ll mod = 1000000007;
const long long int inf = INT64_MAX;
#define pp pair<ll,ll>

typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
 
const ld pi = 3.14159265359;
 
 
void fastIO(void);
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);

vector<ll> g[N];
vector<pp> blk(N);
ll cd[N],vis[N],deg[N];
ll ans[N];
void DFS(ll node, ll& cnt, vector<ll>& a)
{
	if(vis[node]==1) return;
	vis[node] = 1;
	cnt++;
	a.push_back(node);
	rep(i,g[node].size()) DFS(g[node][i],cnt,a);
	return;
}
int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	ll u,v;
	rep(i,m){
		cin>>u>>v;
		deg[u]++;
		deg[v]++;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	ll cnt = 0;
	vector<ll> a;
	rep1(i,n+1){
		if(vis[i]==1) continue;
		cnt = 0;
		a.clear();
		DFS(i,cnt,a);
		
		// if(i==1){
		// 	rep(j,a.size()) cout<<a[j]<<" ";
		// 	cout<<endl;
		// 	rep1(j,n+1) cout<<vis[j]<<" ";
		// 	cout<<endl;
		// 	cout<<cnt<<endl;
		// }
		rep(j,a.size()){
			//if(a[j]==1) cout<<i<<" dfdf"<<endl;
			ans[a[j]] = cnt-1-deg[a[j]];
			cd[a[j]] = i;
		}
		//if(i==1) cout<<ans[1]<<endl;
	}
	// rep1(i,n+1) cout<<ans[i]<<" ";
	// cout<<endl;
	rep(i,k) cin>>blk[i].first>>blk[i].second;
	rep(i,k){
		if(cd[blk[i].first]==cd[blk[i].second]){
			ans[blk[i].first]--;
			ans[blk[i].second]--;
		}
	}
	rep1(i,n+1) cout<<ans[i]<<" ";
	cout<<endl;

}


	


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}

Measured memory_bytes: 9852
def axis_parallel_rectangle(N: int, K: int, xy: list)->int:
    # 1. 座標圧縮
    sorted_x = sorted(v[0] for v in xy)
    sorted_y = sorted(v[1] for v in xy)

    XY = [(sorted_x.index(v[0]), sorted_y.index(v[1])) for v in xy]
    # 2. 圧縮された座標上で点の個数に関して累積和をとる。
    S = [[0] * (N+1) for _ in range(N+1)]
    for x, y in XY:
        S[x+1][y+1] = 1

    for x in range(N+1):
        for y in range(N):
            S[x][y+1] += S[x][y]

    for y in range(N+1):
        for x in range(N):
            S[x+1][y] += S[x][y]

    # 3. x 座標から二つを選ぶ。
    min_area = float('inf')
    for x1 in range(N):
        for x2 in range(x1+1, N):
            for y1 in range(N):
                for y2 in range(y1+1, N):
                    count = S[x2+1][y2+1]-S[x2+1][y1]-S[x1][y2+1]+S[x1][y1]
                    if count < K:
                        continue
                    xmin, xmax = sorted_x[x1], sorted_x[x2]
                    ymin, ymax = sorted_y[y1], sorted_y[y2]
                    min_area = min(min_area, (xmax-xmin)*(ymax-ymin))
    # これで O(N^3) = O(10^5) くらい ?
    return min_area


if __name__ == "__main__":
    N = 0
    N, K = map(int, input().split())
    xy = [tuple(map(int, input().split())) for _ in range(N)]
    ans = axis_parallel_rectangle(N, K, xy)
    print(ans)


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; cin >> n;
	int cntb_ = 0, cnt_a = 0, cntba = 0, sub = 0;

	rep(i, 0, n) {
		string s; cin >> s;

		rep(j, 0, sz(s) - 1) if (s.substr(j, 2) == "AB") sub++;

		if (s[0] == 'B' && s.back() == 'A') cntba++;
		else if (s[0] == 'B') cntb_++;
		else if (s.back() == 'A') cnt_a++;
	}

	cout << (sub + cntba + min(cntb_, cnt_a) - int(cntba && !cntb_ && !cnt_a)) << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ADontBeLate {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int T, D, S;
        cin >> D >> T >> S;
        cout << (T * S >= D ? "Yes" : "No") << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ADontBeLate solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3648
N, M = map(int,input().split())

L, R = 1, N

for _ in range(M):
    l, r = map(int,input().split())

    if(r < L or R < l):
        print(0)
        exit()
    else:
        L = max(l,L)
        R = min(r,R)

print(R-L+1)


Measured memory_bytes: 9188
#include<algorithm>
#include<cstdio>
#define N 100001
#define p 1000000007
using namespace std;
inline int mod(int x){return x<p?x:x-p;}
int a[N],b[N],c[N],d[N],e[N],f[N],i,j,m,n,s,t,x;
inline bool cmpd(int u,int v){return d[u]<d[v];}
inline bool cmpc(int u,int v){return c[u]==c[v]?d[v]<d[u]:c[u]<c[v];}
inline void add(int u,int v){while(u<=j)f[u]=mod(f[u]+v),u+=u&-u;}
inline int sum(int u)
{
    int v=0;
    while(u)v=mod(v+f[u]),u^=u&-u;
    return v;
}
int main()
{
    scanf("%d%d",&m,&n);
    for(i=1;i<=m;i++)scanf("%d",a+i);
    for(i=1;i<=n;i++)scanf("%d",b+i);
    for(i=1,j=0;i<=m;j&&j<n?c[++t]=a[i]-b[j],d[t]=b[j+1]-a[i],e[t]=t:0,i++)while(j<n&&b[j+1]<a[i])j++;
    for(sort(e+1,e+t+1,cmpd),i=1,j=0;i<=t;i++)d[e[i]]=d[e[i]]!=j?j=d[e[i]],d[e[i-1]]+1:d[e[i-1]];
    for(j=d[e[t]],sort(e+1,e+t+1,cmpc),i=x=1;i<=t;i++)if(c[e[i]]!=c[e[i-1]]||d[e[i]]!=d[e[i-1]])s=mod(sum(d[e[i]]-1)+1),x=mod(x+s),add(d[e[i]],s);
    return 0&printf("%d\n",x);
}

Measured memory_bytes: 2176
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := -int(1e+18)
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := int(1e+18)
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bPrint(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp1 int = 1000000007
var lp2 int = 998244353

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp1)
	sc.Split(bufio.ScanWords)
	n, a, b, k := iScan(), iScan(), iScan(), iScan()
	ans := 0
	f := make([]int, n+1)
	inv := make([]int, n+1)
	f[0], inv[0] = 1, 1
	for i := 1; i <= n; i++ {
		f[i] = f[i-1] * i % lp2
		inv[i] = modinv(f[i], lp2)
	}
	for i := 0; i <= n; i++ {
		if a*i <= k && (k-a*i)%b == 0 && (k-a*i)/b <= n {
			j := (k - a*i) / b
			ans += (f[n] * inv[n-i] % lp2 * inv[i] % lp2) * (f[n] * inv[n-j] % lp2 * inv[j] % lp2) % lp2
			ans %= lp2
		}
	}
	fmt.Println(ans)
}
func modinv(a, m int) int {
	b, u, v := m, 1, 0
	for {
		t := a / b
		a -= t * b
		u -= t * v
		a, b, u, v = b, a, v, u
		if b == 0 {
			break
		}
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}


Measured memory_bytes: 6668
/*  Isn't it lovely, all alone?             */
/*  Heart made of glass, my mind of stone   */
/*  Tear me to pieces, skin to bone         */
/*  Hello, welcome home                     */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
#define mod 998244353
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;

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


ll t=1;
//cin>>t;
while(t--)
{

ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll has[n];

has[n-1]=a[n-1];

for(i=n-2;i>=0;i--)
has[i]=max(has[i+1],a[i]);

ll ans=1000;


for(i=0;i<n-1;i++)
{
ll kh=(ans/a[i])*a[i];
ll mila=(ans/a[i])*a[i+1];

if(a[i+1]>a[i])
ans+=mila-kh;


}
cout<<ans<<endl;


}
return 0;
}








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

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

ll N,M,Q;
ll A[100],B[100],C[100],D[100];
ll now[100];
ll ans;

void dfs(int idx, int m){
    if(idx == N){
        ll sum = 0;
        for (int i = 0;i < Q;i++){
            if(now[B[i]-1]-now[A[i]-1] == C[i]) sum += D[i];
        }
        ans = max(sum,ans);
        return;
    }
    for (int i = m;i <= M;i++){
        now[idx] = i;
        dfs(idx+1,i);
    }
    return;
}

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

    cin >> N >> M >> Q;

    for (int i = 0;i < Q;i++){
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }

    dfs(0,1);

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3672
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;

int main() {
  int a;
  int b;

  int ans=0;

  cin >> a >> b;

  ans=a-b*2;

  if(ans<0){
    ans=0;
  }

  cout << ans << endl;

  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
typedef priority_queue <ll> pq;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
const ll INF = (ll)1e18;
const ll MAXN = 1000006;

ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int T=1;
    //cin >> T;
    while(T--){
        int x;
        cin>>x;
        if(x>=30) cout<<"Yes"<<el;
        else cout<<"No"<<el;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3792
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }
    val S = readLine()!!

    val pattern = String.format("\\d{%d}-\\d{%d}", a, b)
    val regex = Regex(pattern)

    val ismatched = regex.matches(S)

    if (ismatched)
        println("Yes")
    else
        println("No")
}

Measured memory_bytes: 37896
void main() {
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], t = tmp[1];
    int cost = 2000;
    foreach (i; 0 .. n) {
        tmp = readln.split.to!(int[]);
        if (tmp[1] <= t) cost = min(cost, tmp[0]);
    }
    writeln(cost != 2000 ? cost.to!string : "TLE");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.container;
import std.typecons;

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
    int d;
    int n;
    cin>>d>>n;
    if(n!=100)cout<<n*pow(100,d)<<endl;
    else cout<<(int)(101*pow(100,d))<<endl;
    return 0;
}


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

int main() {
  int N, A, R1, R2;
  cin >> N >> A;
  R1 = A % 500;
  R2 = N % 500;

  if (A >= 500) {
    cout << "Yes" << endl;
  }
  else {
    if (R2 > R1) {
      cout << "No" << endl;
    }
    else {
    cout << "Yes" << endl;
    }
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007LL;

int main() {
	int A, B;
	cin >> A >> B;
	if (A % 2 == 0 || B % 2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 3003;
ll n;
string s;
int dp[N][N],pref[N][N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>s;
    dp[1][1] = 1;
    for(int len = 2;len <= n;len += 1){
        
        for(int i = 1;i <= len - 1;i += 1)
            pref[len - 1][i] = (dp[len - 1][i] + pref[len - 1][i - 1]) % mod;
        
        for(int b = 1;b <= len;b += 1){
            int L, R;
            if(s[len - 2] == '<')
                L = 1, R = b - 1;
            else
                L = b,R = len - 1;
            if(L <= R)
                dp[len][b] = (dp[len][b] + (pref[len - 1][R] - pref[len - 1][L - 1] + mod) % mod) % mod;
        }
    }
    int ans = 0;
    for(int i = 1;i <= n;i += 1)
        ans = (ans + dp[n][i]) % mod;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 69376
#include <iostream>

using namespace std;

int median(int a, int b, int c){
  int tmp;
  if(a > b){
    tmp = a; a = b; b = tmp;
  }
  if(b > c){
    tmp = b; b = c; c = tmp;
  }
  if(a > b){
    tmp = a; a = b; b = tmp;
  }
  return b;
}

int main(){
  int n, i, ans=0;
  cin >> n;
  int p[n];
  for(i=0; i<n; i++) cin >> p[i];
  for(i=0; i<n-2; i++){
    if(p[i+1] == median(p[i], p[i+1], p[i+2])) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
using namespace std;
ll mod = 1E9+7;

int main() {
    int N, K; cin >> N >> K;
    int a[N]; REP(i, N) cin >> a[i];
    ll dp[N+1][K+1];
    REP(i, N+1) REP(j, K+1) dp[i][j] = 0;
    dp[0][0] = 1;
    REP(i, N){
        REP(j, K+1){
            dp[i+1][j] += dp[i][j];
            if (j+a[i]+1 <= K){
                dp[i+1][j+a[i]+1] -= dp[i][j];
            }
        }
        REP(j, K){
            dp[i+1][j+1] = (dp[i+1][j+1] + dp[i+1][j]) % mod;
            if (dp[i+1][j+1] < 0) dp[i+1][j+1] += mod;
        }
    }
    /*
    REP(i, N+1){
        REP(j, K+1){
            cout << dp[i][j] << ' ';
        }
        cout<< endl;
    }
    */
    cout << dp[N][K] << endl;
}

Measured memory_bytes: 79104
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 1005
#define M 200005
#define seed 23333
#define Mo 1000000007

using namespace std;
int i,j,m,n,p,k,f[N][N*2],dis[N],fa[N],Q[N],x,y,dia[N],ans,D,col[N],Dis[N],lim[N];
vector<int>v[N];
void jia(int &x,int y)
{
		x+=y; if (x>=Mo) x-=Mo;
}
void jian(int &x,int y)
{
		x-=y; if (x<0) x+=Mo;
}
int bfs(int *dis,int x)
{
		memset(fa,0,sizeof(fa));
		for (i=1;i<=n;++i) dis[i]=-1;
		dis[x]=0; Q[Q[0]=1]=x;
		int i,l;
		for (l=1;l<=Q[0];++l)
		{
				int p=Q[l];
				for (i=0;i<(int)v[p].size();++i)
				{
						int k=v[p][i];
						if (dis[k]!=-1) continue;
						dis[k]=dis[p]+1;
						fa[k]=p;
						Q[++Q[0]]=k;
				}
		}
		int now=1;
		for (i=1;i<=n;++i) if (dis[now]<dis[i]) now=i;
		return now;
}
void dfs(int x)
{
	  int i,j;
	  for (i=-n+N;i<=n+N;++i) if (abs(i-N)<=D/2-dis[x]) f[x][i]=1; 
	  for (i=0;i<(int)v[x].size();++i)
	  {
	  		int p=v[x][i];
	  		if (fa[x]==p) continue;
	  		dfs(p);
	  		for (j=-n+N;j<=n+N;++j) 
				f[x][j]=1ll*f[x][j]*(f[p][j-1]+f[p][j+1])%Mo;
	  }
}
void Dfs(int x,int tp)
{
	  int i,j;
	  for (i=-n+N;i<=n+N;++i) 
	  	if (col[x])
	  {
	  		if (abs(i-N)<=lim[x]) f[x][i]=1;
	  }
	  else if (abs(i-N-tp)<=lim[x]) f[x][i]=1;
	  for (i=0;i<(int)v[x].size();++i)
	  {
	  		int p=v[x][i];
	  		if (fa[x]==p) continue;
	  		Dfs(p,tp);
	  		for (j=-n+N;j<=n+N;++j) 
				f[x][j]=1ll*f[x][j]*(f[p][j-1]+f[p][j+1])%Mo;
	  }
}
int main()
{
		scanf("%d",&n);
		for (i=1;i<n;++i)
		{
				scanf("%d%d",&x,&y);
				v[x].pb(y); v[y].pb(x); 
		}
		int x=bfs(dis,1),y=bfs(dis,x);
		for (;y;y=fa[y]) dia[++dia[0]]=y;
		if (dia[0]&1)
		{
			 D=dia[0]-1;
			 bfs(dis,dia[D/2+1]);
			 dfs(dia[D/2+1]);
			 for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			 printf("%d\n",ans); 
		}
		else
		{
			D=dia[0]-1;
			bfs(Dis,dia[D/2+2]);
			bfs(dis,dia[D/2+1]);
			for (i=1;i<=n;++i) if (dis[i]<Dis[i]) col[i]=1; 
			for (i=1;i<=n;++i)
				if (col[i]) lim[i]=D/2+1-dis[i];
				else lim[i]=D/2-Dis[i];
			Dfs(dia[D/2+1],0);
			for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			for (i=1;i<=n;++i) 
				if (col[i]) lim[i]=D/2-dis[i];
				else lim[i]=D/2+1-Dis[i];
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],0);
			for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],-1);
			for (i=-n+N;i<=n+N;++i) jian(ans,f[dia[D/2+1]][i]);
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],1);
			for (i=-n+N;i<=n+N;++i) jian(ans,f[dia[D/2+1]][i]);
			printf("%d\n",ans); 
		}
}


Measured memory_bytes: 8192
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

void solve(void) {
  ll N;
  cin >> N;

  ll ans = 0;
  for (ll ni = 0; ni * ni <= N; ++ni) ans = ni * ni;
  cout << ans << endl;
}
int main(void) {
  solve();
  return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

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

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


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

fn main() {
    input! {
        h: usize,
        w: usize,
        a: [chars;h],
    }
    let mut a = a;

    let mut dist = vec![vec![-1; w]; h];
    let mut queue = std::collections::VecDeque::new();
    for x in 0..h {
        for y in 0..w {
            if a[x][y] == '#' {
                queue.push_back((x, y));
                dist[x][y] = 0;
            }
        }
    }

    let mut cnt = 0;
    while let Some((x, y)) = queue.pop_front() {
        for &(dx, dy) in [(-1, 0), (1, 0), (0, -1), (0, 1)].iter() {
            let nx = x as i64 + dx;
            let ny = y as i64 + dy;
            if nx < 0 || h <= nx as usize || ny < 0 || w <= ny as usize {
                continue;
            }
            let nx = nx as usize;
            let ny = ny as usize;
            if a[nx][ny] != '#' && dist[nx][ny] == -1 {
                cnt = dist[x][y] + 1;
                dist[nx][ny] = cnt;
                queue.push_back((nx, ny));
            }
        }
    }

    println!("{}", cnt);
}


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

typedef pair<int,int> Point;
#define x first
#define y second

const int N = 200010;
const int MAX = 1e8;

int n;
Point a[N];
Point p1, p2;
vector <Point> vec;
vector <int> Z;

double ans = 1e18;
const double pi = acos(-1);

// BIT
int T[N];
void upd(int x, int v) { for (; x < N; x += x & -x) T[x] = max(T[x], v); } 
int get(int x) { int res = 0; for (; x > 0; x -= x & -x) res = max(res, T[x]); return res; }
//

void solve() {
	if (p1 > p2) swap(p1, p2);
	if (p1.y > p2.y) {
		p1.y = MAX - p1.y; p2.y = MAX - p2.y;
		for (int i = 1; i <= n; ++i) a[i].y = MAX - a[i].y;
	}

	sort(a + 1, a + n + 1);
	vec.clear();

	for (int i = 1; i <= n; ++i) {
		if (a[i].x >= p1.x && a[i].x <= p2.x && a[i].y >= p1.y && a[i].y <= p2.y) {
			vec.push_back(a[i]);
		}
	}

	double res = 100.0 * (abs(p1.x - p2.x) + abs(p1.y - p2.y));

	Z.clear();
	for (auto cur: vec) Z.push_back(cur.y);
	sort(Z.begin(), Z.end());
	memset(T, 0, sizeof T);

	int mx = 0;
	for (auto cur: vec) {
		int pos = lower_bound(Z.begin(), Z.end(), cur.y) - Z.begin() + 1;
		int rr = get(pos - 1) + 1;
		upd(pos, rr);
		mx = max(mx, rr);
	}

	res -= 20.0 * mx;
	res += 5.0 * pi * mx;

	if (mx == min(p2.y - p1.y, p2.x - p1.x) + 1) {
		res += 5.0 * pi;
	}
	
	cout << res << endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	cout << setprecision(15) << fixed;
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].y;
	solve();
}

Measured memory_bytes: 6512
from math import sin, sqrt, cos, pi
a, b, C = map(int, input().split())
C = C / 180 * pi

S = a * b * sin(C) / 2
L = a + b + sqrt(a*a + b*b - 2*a*b*cos(C))
H = S * 2 / a

print(S)
print(L)
print(H)



Measured memory_bytes: 5704