akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
# define rep(i, a, b) for (int i = (a); i < (int)(b); i++)

int main() {
    int a, b;
    cin >> a >> b;
    
    int res = 0;
    rep(x, a, b+1) {
        int x_1 = x % 10;
        int x_10 = (x/10)%10;
        int x_1000 = (x/1000)%10;
        int x_10000 = (x/10000)%10;
        if (x_1 == x_10000 && x_10 == x_1000) {
            res++;
        }     
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
    #include <string>
    #include <set>  
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <queue>
    #include <deque>
    #include <cstring>
    #include <cstdio>
    #include <map>
    #include <numeric>
    #include <cassert>
    #include <iomanip>
    #include <sstream>
    #include <ctime>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,N) FOR(i,0,N)
#define FORD(i,b,a) for(int i=(int)(b)-1;i>=a;--i)
typedef long long LL;
typedef pair<int,int> PII;
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define dprintf(...) printf(__VA_ARGS__)
const int maxn=2e5+10;
LL sum[maxn],_xor[maxn];
int n;
LL a[maxn];
int main()
{
	scanf("%d",&n);
	REP(i,n)
	{
		scanf("%d",a+i);
		sum[i]=a[i]+(i==0?0:sum[i-1]);
		_xor[i]=a[i]^(i==0?0:_xor[i-1]);
	}
	int l=0,r=0,md=0,res=0;
	LL ans=0;
	REP(i,n)
	{
		l=max(i,res);
		r=n-1;
//		cout<<i<<endl;
		while(l<=r)
		{
			md=(l+r)>>1;
	//		cout<<l<<" "<<md<<" "<<r<<endl;
	//		cout<<(sum[md]-(i==0?0:sum[i-1]))<<" "<<(_xor[md]^(i==0?0:_xor[i-1]))<<endl;
	//		system("pause");
			if((sum[md]-(i==0?0:sum[i-1]))==(_xor[md]^(i==0?0:_xor[i-1])))l=md+1,res=md;
			else r=md-1;
		}
//		cout<<l<<" "<<r<<endl;
		ans+=res-i+1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, M, D;
    cin >> N >> M >> D;
    vector<string> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= M - D; j++) {
            bool put = 1;
            for (int k = j; k < j + D; k++) {
                if (v[i][k] == '#') {
                    put = 0;
                    break;
                }
            }
            if (put) ++cnt;
        }
    }

    for (int j = 0; j < M; j++) {
        for (int i = 0; i <= N - D; i++) {
            bool put = 1;
            for (int k = i; k < i + D; k++) {
                if (v[k][j] == '#') {
                    put = 0;
                    break;
                }
            }
            if (put) ++cnt;
        }
    }
    
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 3152
N,M = map(int,input().split())
SC=[list(map(int,input().split())) for i in range(M)]

for ans in range(1000):
  if len(str(ans))!=N:
    continue
  f=1
  for i in range(M):
    if str(ans)[SC[i][0]-1]!=str(SC[i][1]):
      f=0
      break
  if f==1:
    print(ans);exit()
  
print(-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repr(i, a, b) for (int i = (int)a; i > (int)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 1e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    vll a(3*n);
    rep(i,3*n)cin>>a[i];
    vll mae(n+1,0),ushiro(n+1,0);
    multiset<int> num1,num2;
    ll ss=0;
    rep(i,n){
        num1.insert(a[i]);
        ss+=a[i];
    }
    mae[0]=ss;
    rep(i,n){
        num1.insert(a[i+n]);
        ss+=a[i+n];
        ss-=*num1.begin();
        num1.erase(num1.begin());
        mae[i+1]=ss;
    }
    ss=0;
    rep(i,n){
        num2.insert(a[3*n-1-i]);
        ss+=a[3*n-1-i];
    }
    ushiro[0]=ss;
    rep(i,n){
        num2.insert(a[2*n-1-i]);
        ss+=a[2*n-1-i];
        auto itr=num2.end();
        itr--;
        ss-=*itr;
        num2.erase(itr);
        ushiro[i+1]=ss;
    }
    ll ans=-infl;
    rep(i,n+1){
        ans=max(ans,mae[i]-ushiro[n-i]);
    }
    cout<<ans<<ENDL;
}


Measured memory_bytes: 13568
local N, D = io.read("n","n")
local X = {}
for i=1,N do
    local p = {}
    for j=1,D do
        table.insert(p, io.read("n"))
    end
    table.insert(X, p)
end
local function d(i,j)
    local sq = 0
    for k=1,D do
        sq = sq + (X[i][k] - X[j][k])^2
    end
    return math.sqrt(sq)
end
local function is_int(x)
    return x - math.floor(x) == 0
end
local ans = 0
for i=1,N-1 do
    for j=i+1, N do
        if is_int(d(i,j)) then
            ans = ans + 1
        end
    end
end
print(ans)

Measured memory_bytes: 1136
n=int(input())
d={}
for i in range(n):
    l=list(map(int,input().split()))
    d[i]=l

bl={}
for i in range(n):
    bl[i]=0
l=[0]*n

ans_pl=[]




def qpl(index):
    global l
    if index==n:
        ans_pl.append(list(l))
        return
    for i in range(n):
        if bl[i]==0:
            l[index]=i
            bl[i]=1
            qpl(index+1)
            bl[i]=0
qpl(0)


# for item in ans_pl:
    # print(item)




summ=0
for i in range(len(ans_pl)):
    ll=ans_pl[i]
    pre_x,pre_y=d[ll[0]][0],d[ll[0]][1]
    for j in range(1,n):
        x,y=d[ll[j]][0],d[ll[j]][1]
        summ+=((x-pre_x)**2+(y-pre_y)**2)**0.5
        pre_x,pre_y=x,y

print(summ/len(ans_pl))




Measured memory_bytes: 10228
import math
import numpy as np

a, b, h, m = map(int, input().split())
hma = math.pi*2/(12*60)*m
ha = (math.pi*2/12)*(h%12)+hma
ma = (math.pi*2/60)*m

getvec = lambda r, angle: np.array([r*math.cos(angle), r*math.sin(angle)])
hvec = getvec(a, ha)
mvec = getvec(b, ma)
vv = hvec - mvec
print(math.sqrt(vv[0]**2+vv[1]**2))

Measured memory_bytes: 27152
import java.util.Scanner;

public class Main {
	private String a, b;
	private StringBuffer str;

	public static void main(String[] args) {
		new Main().run();
	}
	
	private void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		while (n-- > 0) {
			a = scan.next();
			b = scan.next();
			
			 int aDigit = a.length();
			 int bDigit = b.length();
			 
			 if (aDigit > 80 || bDigit > 80) {
				 System.out.println("overflow");
				 continue;
			 }
			 
			 int up = 0;
			 str = new StringBuffer();
			 for (int i = aDigit-1, j = bDigit-1; i >= 0 || j >= 0; i--, j--) {
				 if (i >= 0 && j >= 0) {
					 int p = Integer.parseInt(a.substring(i, i + 1)) + Integer.parseInt(b.substring(j, j + 1)) + up;
					 int q = p % 10;
					 up = p / 10;
					 str.insert(0, q);
				 }else if (i < 0){
					 int p = Integer.parseInt(b.substring(j, j + 1)) + up;
					 int q = p % 10;
					 up = p / 10;
					 str.insert(0, q);
				 }else {
					 int p = Integer.parseInt(a.substring(i, i + 1)) + up;
					 int q = p % 10;
					 up = p / 10;
					 str.insert(0, q);
				 }
			 }
			 if (up > 0) {
				 str.insert(0, up);
				 if (aDigit == 80 || bDigit == 80) {
					 System.out.println("overflow");
					 continue;
				 }
			 }
			 System.out.println(str);
		}
	}
	
	private void debug() {
		System.out.println();
	}

}

Measured memory_bytes: 17280
// Coordinate compression

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
 
#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 tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)

int a[100010],n,k;
int dp[100010];

int fun(int x)
{
  if(x>n)return 1e9;
  if(x==n)return 0;
  if(dp[x]!=-1)return dp[x];
  int ret=0;
  ret=fun(x+1)+abs(a[x+1]-a[x]);
  for(int i=2;i<=k;i++)
  ret=min(ret,fun(x+i)+abs(a[x+i]-a[x]));
  dp[x]=ret;
  return ret;
}


int solve(){     

memset(dp,-1,sizeof(dp));
cin>>n>>k;
rep(i,1,n+1)cin>>a[i];
cout<<fun(1);

return 0;
}

 
signed main()
{    

   

   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);  

 
 int t=1;                                                                                                                  
 //cin>>t;
    while(t--)
     {
      solve();
     }
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
typedef     long long    ll;
typedef     vector<int> vi;
typedef     vector<long long> vl;
typedef     pair<int, int>pi;
typedef     pair<long long, long long>pl;
#define F   first
#define S   second
#define pb  push_back
#define     all(x)      x.begin() , x.end()
#define mp  make_pair
#define       FOR(i,a,b) for(i=a;i<=b;i++)
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
int main()
{
  int t=1;
  //cin>>t;
  while(t--)
  {
     int n;
     cin>>n;
     if(n==0) cout<<"1"<<endl;
     else cout<<"0"<<endl;
 }
  return 0;
}

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

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

  if ((a % 2) == 1 && (b % 2) == 1) {
    cout << "Odd" << endl;
  }else {
    cout << "Even" << endl;
  }
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define sp cout << " ";
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';				

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


clock_t time_p = clock();

void ktj(){
    time_p = clock() - time_p;
	cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

const ll mod = 1e9 + 7;

const ll N = 2000 + 5;

ll dp[N][N], a[N], b[N];

ll n,m;

ll solve(ll i,ll j){
	if(i >= n or j >= m)
		return 0;
	if(dp[i][j] != -1)
		return dp[i][j];

	ll ans = 0;

	if(a[i] == b[j])
		ans = (1 + solve(i + 1, j) % mod + solve(i, j + 1) % mod);
	else
		ans = (solve(i + 1, j) % mod + solve(i, j + 1) % mod - solve(i + 1,j + 1) % mod + mod) % mod;

	return (dp[i][j] = ans);
}

int main(){
	IOS

	memset(dp,-1,sizeof dp);

	cin >> n >> m;

	for(ll i = 0;i < n;i++){
		cin >> a[i];
	}
	for(ll i = 0;i < m;i++){
		cin >> b[i];
	}

	ll ans = 1;
	ans = (ans % mod + solve(0,0) % mod) % mod;

	cout << ans << '\n';

	ktj();
}



Measured memory_bytes: 32000
k = int(input())
a,b = map(int,input().split())

#k=4
#a , b = 5,7

if(a%k):
  x = int(a/k)*k+k
else:
  x = int(a/k)*k

if(x>=a and x<=b):
  print('OK')
else:
  print('NG')

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

struct TNode
{
	int Value;
	TNode* Next;
	TNode* Prev;
	
	TNode(int AValue);
};

TNode::TNode(int AValue)
{
	Value = AValue;
	Next = NULL;
	Prev = NULL;
}

class TList
{
	TNode* FFirst;
	TNode* FEnd;
public:
	TList();
	~TList();
	
	void PushFront(int Value);
	void PopFront();
	void PopBack();
	TNode* Search(int Value)const;
	void Delete(int Value);
	void Show()const;
};

TList::TList()
{
	FFirst = NULL;
	FEnd   = NULL;
}

TList::~TList()
{
	while(FFirst != NULL)
	{
		PopFront();
	}
}

void TList::PushFront(int Value)
{
	TNode* Node = new TNode(Value);
	Node->Next = FFirst;
	if(FFirst != NULL)
	{
		FFirst->Prev = Node;
	}else{
		FEnd = Node;
	}
	FFirst = Node;
}

void TList::PopFront()
{
	TNode* NewFirst = FFirst->Next;
	if(NewFirst != NULL)
	{
		NewFirst->Prev = NULL;
	}else{
		FEnd = NULL;
	}
	delete FFirst;
	FFirst = NewFirst;
}

void TList::PopBack()
{
	TNode* NewEnd = FEnd->Prev;
	if(NewEnd != NULL)
	{
		NewEnd->Next = NULL;
	}else{
		FFirst = NULL;
	}
	delete FEnd;
	FEnd = NewEnd;
}

TNode* TList::Search(int Value)const
{
	for(TNode* Node = FFirst;Node != NULL;Node = Node->Next)
	{
		if(Node->Value == Value) return Node;
	}
	return NULL;
}

void TList::Delete(int Value)
{
	TNode* Node = Search(Value);
	if(Node == NULL) return;
	if(Node->Next != NULL)
	{
		Node->Next->Prev = Node->Prev;
	}else{
		FEnd = FEnd->Prev;
	}
	if(Node->Prev != NULL)
	{
		Node->Prev->Next = Node->Next;
	}else{
		FFirst = FFirst->Next;
	}
	delete Node;
}

void TList::Show()const
{
	TNode* Node = FFirst;
	while(Node->Next != NULL)
	{
		std::cout << Node->Value << " ";
		Node = Node->Next;
	}
	std::cout << Node->Value << std::endl;
}

class TDoublyLinkedList
{
	TList Data;
	
	void InsertInput();
	void DeleteInput();
	void DeleteFirst();
	void DeleteEnd();
public:
	void Manupulate(int Command);
	void Output() const;
};

void TDoublyLinkedList::InsertInput()
{
	int Number = 0;
	std::cin >> Number;
	Data.PushFront(Number);
}

void TDoublyLinkedList::DeleteInput()
{
	int Number = 0;
	std::cin >> Number;
	Data.Delete(Number);
}

void TDoublyLinkedList::DeleteFirst()
{
	Data.PopFront();
}
void TDoublyLinkedList::DeleteEnd()
{
	Data.PopBack();
}

void TDoublyLinkedList::Output()const
{
	Data.Show();
}

void TDoublyLinkedList::Manupulate(int Command)
{
	switch(Command)
	{
		case 0 : InsertInput();break;
		case 1 : DeleteInput();break;
		case 2 : DeleteFirst();break;
		case 3 : DeleteEnd();break;
	}
}

int CommandToIndex(std::string Command)
{
	if(Command == "insert") return 0;
	if(Command == "delete") return 1;
	if(Command == "deleteFirst") return 2;
	if(Command == "deleteLast") return 3;
	return -1;
}

int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int Count = 0;
	std::cin >> Count;
	
	TDoublyLinkedList List;
	for(int i=0;i<Count;i++)
	{
		std::string Command;
		std::cin >> Command;
		List.Manupulate(CommandToIndex(Command));
	}
	List.Output();
	
	return 0;
}

Measured memory_bytes: 32484
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
char a;
cin>>a;
string s="aiueo",ans="consonant";
for(int i=0;i<5;i++){
    if(s[i]==a){
        ans="vowel";
    }
}

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


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

#define ll long long 
#define sz(x) (int)x.size()

using namespace std;

const int maxN=1e7+1;
ll cnt[maxN];
int main(){
	ll n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j*i<=n;j++){
			cnt[j*i]++;
		}
	}
	for(int i=1;i<=n;i++){
		ans+=i*cnt[i];
	}
	cout<<ans;
}





Measured memory_bytes: 81748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
struct LazySegmentTree{
private:
    int siz;
    vector<ll> node,lazy;
public:
    LazySegmentTree(int n){
        siz=1;
        while(siz<n)siz*=2;
        node.resize(2*siz-1);
        lazy.resize(2*siz-1);
    }
    void eval(int k){
        node[k]+=lazy[k];
        if(k<siz-1){
            lazy[2*k+1]+=lazy[k];
            lazy[2*k+2]+=lazy[k];
        }
        lazy[k]=0;
    }
    void update(int a,int b,ll x,int k,int l,int r){
        eval(k);
        if(b<=l||r<=a)return;
        if(a<=l&&r<=b){
            lazy[k]+=x;
            eval(k);
        }else{
            update(a,b,x,2*k+1,l,(l+r)/2);
            update(a,b,x,2*k+2,(l+r)/2,r);
            node[k]=min(node[2*k+1],node[2*k+2]);
        }
    }
    ll query(int a,int b,int k,int l,int r){
        eval(k);
        if(b<=l||r<=a)return INF;
        if(a<=l&&r<=b)return node[k];
        ll vl=query(a,b,2*k+1,l,(l+r)/2);
        ll vr=query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
    void add(int a,int b,ll x){
        update(a,b,x,0,0,siz);
    }
    ll getmin(int a,int b){
        return query(a,b,0,0,siz);
    }
};

int main(){
    int n,q;cin>>n>>q;
    LazySegmentTree tree(n);
    while(q--){
        int a;cin>>a;
        int s,t,x;
        if(a==1){
            cin>>s>>t;
            cout<<tree.getmin(s,t+1)<<endl;
        }else{
            cin>>s>>t>>x;
            tree.add(s,t+1,x);
        }
    }
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	ll n;
	getline(cin, s);
	cin >> n;
	
	if (n <= 100)
	{
		bool one = true;
		for (int i = 0; i < n; i++)
		{
			if(s[i] != '1')
			{
				one = false;
				break;
			}
		}
		if (one && s[n - 1] == '1')
		{
			cout << '1' << endl;
			return 0;
		}
	}
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != '1')
		{
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << '1' << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;
int main(){
    int  L,R;
    cin >> L >> R;
    if(R-L>=2019)cout << 0<< endl;
    else{
        ll mi = 2018;
        L %= 2019;
        R %= 2019;
        for(ll i=L;i<=R;i++){
            for(ll j=i+1;j<=R;j++){
                if(i>=j)continue;
                mi = min(mi,i*j%2019);
            }
        }
        cout << mi << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI (acos(-1))
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using Complex = std::complex<double>;
using namespace std;


int N;


string tobin(int x){
	string ret;
	rep(i, 0, 16) ret.pb(((x>>i)&1)+'0');
	return ret;
}


int todec(string s){
	int ret = 0;
	rep(i, 0, SIZE(s)) ret += (s[i]-'0')*POW(-2, i);
	return ret;
}


string solve(){
	vector<pair<int, string>> l, u;
	rep(i, 0, 1<<16) l.pb({ todec(tobin(i)), tobin(i) });
	rep(i, 0, 1<<16) u.pb({ todec("0000000000000000"+tobin(i)), tobin(i) });
	sort(ALL(u));
	string ans;
	for(pair<int, string> p : l){
		int d = distance(u.begin(), lb(ALL(u), mp(N-p.fi, ""), [](pair<int, string> e1, pair<int, string> e2){ return e1.fi < e2.fi; }));
		if(p.fi+u[d].fi == N){
			ans = p.se+u[d].se;
			break;
		}
	}
	reverse(ALL(ans));
	int i = 0;
	while(i != SIZE(ans)-1 && ans[i] == '0') i++;
	ans.erase(ans.begin(), ans.begin()+i);
	return ans;
}


int main(){
	cin >> N;

	cout << solve() << endl;

	return 0;
}

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

int main()
{
      int a,b,i,j;
      while(~scanf("%d%d",&a,&b))
      {
          if(a==1||a==3||a==5||a==7||a==8||a==10||a==12)
          {
              i=1;
          }
          if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)
          {
              j=1;
          }
          if(a==4||a==6||a==9||a==11)
          {
              i=2;
          }
          if(b==4||b==6||b==9||b==11)
          {
              j=2;
          }
          if(a==2)
          {
              i==3;
          }
          if(b==2)
          {
              j==3;
          }
          if(i==j)
          {
              printf("Yes\n");
          }
          else
          {
              printf("No\n");
          }
      }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long  
#define mod 1000000007
#define am 998244353
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
int abs(int a,int b){ 
  int c=max(a,b)-min(a,b);
  return c;
}
int gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
bool IsPrime(int num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for(int i=3;i<=sqrtNum;i+=2){
    if(num%i==0){
      return false;
    }
  }
}
int lcm(int a,int b){//最小公倍数
    return (a*b)/gcd(a,b);
}	    
string w[1000];
queue<pair<int,int> > q;
signed main(){
// __builtin_ctz(N);      Nを２で何回割り切れるかを返す
//(n+1)*n/2;              １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a,d=1;
    double b[100],c[100];
    double q=0;
    cin>>a;
    for(int i=0;i<a;i++){
	cin>>b[i]>>c[i];
    }
    for(int i=2;i<=a;i++) d*=i;
    for(int i=0;i<a;i++){
	for(int j=0;j<a;j++){
	    q=sqrt(((b[i]-b[j])*(b[i]-b[j]))+((c[i]-c[j])*(c[i]-c[j])))+q;
	}
    }
    // cout<<q<<"\n"<<d/2<<"\n";
    
    cout<<fixed<<q/a<<"\n";
}


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

using namespace std;

using ll = long long;
constexpr ll inf = 1<<20;
int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<ll,int>> ab(n);
    for(int i=0;i<n;++i){
        cin>>ab[i].first>>ab[i].second;
    }
    sort(ab.begin(),ab.end());
    ll ret =0;
    for(auto & cur : ab){
        if(m == 0) break;
        int num = min(m,cur.second);
        ret += cur.first * num;
        m -= num;
    }
    cout << ret <<endl;
    return 0;
}


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

using namespace std;

int N;
const int SIZE = 100005;
int h [SIZE];
int mem [SIZE];

int dp (int i) {

  if (i == N-1) return 0;
  
  if (i == N-1) return 0;
  
  if (mem[i] != -1) return mem[i];

  int ret = INT_MAX;
  if (i+1 < N) 
    ret = min (ret,  abs (h[i] - h[i+1])  + dp (i+1));
  if (i+2 < N)
    ret = min (ret,  abs (h[i] - h[i+2])  + dp (i+2)); 
  return  mem[i] = ret;

}
int main() {
  
  cin >>N;

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

  memset(mem, -1, sizeof mem);

  cout << dp(0);

}



Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n, a, b, c;
int perm[214514];
void init() {
	perm[0] = 1;
	REP(i, 214514) {
		perm[i] = perm[i - 1] * i;
		perm[i] %= mod;
	}
}
int comb_(int x, int y) {
	return perm[x] * mod_pow(perm[x - y], mod - 2) % mod * mod_pow(perm[y], mod - 2) % mod;
}
int solve() {
	init();
	int ans = 0;
	for (int i = n; i <= 2 * n - 1; i++) {
		int d = comb_(i - 1, n - 1);
		int s = ((mod_pow(a, n) * mod_pow(b, i - n) + mod_pow(a, i - n) * mod_pow(b, n)) % mod) * i % mod;
		int k = mod_pow(100, i - 1) * (100 - c) % mod;
		ans += d * s % mod * mod_pow(k, mod - 2); ans %= mod;
	}
	return ans;
}
signed main() {
	cin >> n >> a >> b >> c;
	a = a * 100 * mod_pow(100 - c, mod - 2) % mod;
	b = b * 100 * mod_pow(100 - c, mod - 2) % mod;
	cout << solve() << endl;
}


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

using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0 ; i < (int)(n) ; ++i)
#define rep2(i, n, a) for (int i = a ; i < (int)(n) ; ++i)

#define per(i, n) for (int i = n ; i >= 0 ; --i)

ll calc(ll a, ll b, ll c) {
  ll side1, side2, rect1, rect2;
  if (a > b) {
    side1 = floor(a / 2);
    side2 = a - side1;

    rect1 = side1 * b * c;
    rect2 = side2 * b * c;
  } else {
    side1 = floor(b / 2);
    side2 = b - side1;

    rect1 = a * side1 * c;
    rect2 = a * side2 * c;
  }

  return abs(rect1 - rect2);
}

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

  ll a, b, c;
  cin >> a >> b >> c;

  cout << min(calc(a, b, c), calc(b, c, a)) << '\n';

  return 0;
}

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

using namespace std;

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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

int h,w,k;
ll dp[100+1][10];

int main() {
    cin>>h>>w>>k;
    memset(dp,0,sizeof(dp));
    dp[0][1]=1;
    map<int,int> d;
    d[-2]=0;
    d[-1]=1;
    d[0]=1;
    d[1]=2;
    d[2]=3;
    d[3]=5;
    d[4]=8;
    d[5]=13;
    d[6]=21;
    if (w==1){
        cout<<1<<endl;
        return 0;
    }
    for (int i=1;i<h+1;i++){
        for (int j=1;j<w+1;j++){
            if (j==1){
                ll ans1=dp[i-1][j]*d[w-2];
                ll ans2=dp[i-1][j+1]*d[w-3];
                dp[i][j]=(ans1+ans2)%MOD;
            }
            else if (j==w){
                ll ans1=dp[i-1][j]*d[w-2];
                ll ans2=dp[i-1][j-1]*d[w-3];
                dp[i][j]=(ans1+ans2)%MOD;
            }
            else if (j==2){
                ll ans1=dp[i-1][j]*d[w-3];
                ll ans2=dp[i-1][j-1]*d[w-3];
                ll ans3=dp[i-1][j+1]*d[w-4];
                dp[i][j]=(ans1+ans2+ans3)%MOD;
            }
            else if (j==w-1){
                ll ans1=dp[i-1][j]*d[w-3];
                ll ans2=dp[i-1][j-1]*d[w-4];
                ll ans3=dp[i-1][j+1]*d[w-3];
                dp[i][j]=(ans1+ans2+ans3)%MOD;
            }
            else{
                ll ans1=dp[i-1][j]*d[j-2]*d[w-j-1];
                ll ans2=dp[i-1][j-1]*d[j-3]*d[w-j-1];
                ll ans3=dp[i-1][j+1]*d[j-2]*d[w-j-2];
                dp[i][j]=(ans1+ans2+ans3)%MOD;
            }
            
        }
    }
    cout<<dp[h][k]<<endl;
    return 0;
}

Measured memory_bytes: 256
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

string s ; 
int cnt [ 2 ] ; 

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s ;
	for ( auto x : s )
		cnt [ x == 'p' ] ++ ;
	cout << ( ( cnt [ 0 ] - cnt [ 1 ] ) >> 1 ) << endl ; 
}


Measured memory_bytes: 512
for($n=<>;$n--;){
	<>=~/ (.+) /;$dt=$`-$t;$dx=$1-$x;$dy=$'-$y;
	if($dx+$dy>$dt || ($dt-$dx-$dy)%2){
		print'No';
		exit
	}
	$t=$`;
	$x=$1;
	$y=$';
}
print'Yes'

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
		long int cost=0;
	if(x>y)
	 {
	 
		 if((a+b)>2*c)
		  cost=2*c*y;
		else
		 cost=(a+b)*y;
		 x=x-y;
		 if(a>2*c)
		  cost+=2*c*x;
		  else
		  cost+=a*x;
		  cout<<cost;
	 }
	 else
	 {
	 	if((a+b)>2*c)
		  cost=2*c*x;
		else
		 cost=(a+b)*x;
		 y=y-x;
		 if(b>2*c)
		  cost+=2*c*y;
		  else
		   cost+=b*y;
		  cout<<cost;
	 	
	 }
}

Measured memory_bytes: 256
import math

N, K = map(int, input().split())

out = 0
#for i in range(K, N+2):
    #out += int(math.factorial(N+1)/(math.factorial(i) * math.factorial((N + 1 - i))))

for i in range(K, N+2):
    out += (i * (N - i + 1)) + 1



print(out % (pow(10, 9) + 7))

Measured memory_bytes: 9176
while True:
    try:
        line = input()
        l = list(map(int, line.split(',')))[0:10]
        v1, v2 = list(map(int, line.split(',')))[10:12]
    except:
        break
    l = list(map(lambda x: x / sum(l), l))
    x = v1 / (v1 + v2)
    for i in range(10):
        if x <= sum(l[:i + 1]):
            print(i + 1)
            break

Measured memory_bytes: 7656
a, b, k = map(int, input().split())

answer = []
for i in range(0,k):
  if a+i <= b:
    answer.append(a+i)
  else:
    break
  
for i in range(0,k):
  if b-i >= a:
    answer.append(b-i)
  else:
    break  
    
answer = list(set(answer))  
answer.sort()

for a in answer :
  print(a)

Measured memory_bytes: 9188
#include <cstdio>
#include <cstring>
#include <algorithm>

template <typename Tp>Tp Max(const Tp &a, const Tp &b) {return a > b ? a : b;}
template <typename Tp>Tp Min(const Tp &a, const Tp &b) {return a < b ? a : b;}

template <typename Tp>void Read(Tp &x) {
	Tp in = 0, f = 1; char ch = getchar();
	while(ch<'0' || ch>'9') {if(ch=='-') f = -1; ch = getchar();}
	while(ch>='0' && ch<='9') {in = in*10+ch-'0'; ch = getchar();}
	x = in*f;
}

const int SN = 100000 + 10;

int max[SN], v[SN], c[SN], deep[SN], head[SN], finl[SN], n, m, q;

int num;

struct Edge {
	int v, next;
}E[SN<<1];

void Add(int u, int v) {
	E[++num].v = v, E[num].next = head[u], head[u] = num;
}

void Dfs(int now, int fa, int d, int c) {
	if(max[now] >= d) return ;

	max[now] = d;

	if(!finl[now]) finl[now] = c;
	
	if(!d) return ;
	
	for(int i = head[now]; i; i = E[i].next) {
		int to = E[i].v;
		if(to != fa) Dfs(to, now, d-1, c);
	}
}

int main() {
	int x = 0, y = 0, z = 0;

	memset(max, -1, sizeof max);
	
	Read(n), Read(m);

	for(int i = 1; i <= m; i++) Read(x), Read(y), Add(x, y), Add(y, x);

	Read(q);
	
	for(int i = 1; i <= q; i++) Read(v[i]), Read(deep[i]), Read(c[i]);

	for(int i = q; i >= 1; i--) Dfs(v[i], 0, deep[i], c[i]);

	for(int i = 1; i <= n; i++) printf("%d\n", finl[i]);

	return 0;
}


Measured memory_bytes: 4480
#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 ll MOD = 1e9 + 7;

//二項係数 nCk mod p
//aのp乗を求める
ll modpow(ll a, int p) {
   if(p == 0) return 1;
   if(p % 2 == 0) {
      int halfP = p / 2;
      ll half = modpow(a, halfP);
      //a^(p/2)をhalfとして、half*halfを計算
      return half * half % MOD;
   } else {
      //pが奇数のときは偶数にするために1減らす
      return a * modpow(a, p-1) % MOD;
   }
}
//二項係数の計算
//10C3 (10*9*8) / (3*2*1)
//(10*9*8):ansMul (3*2*1):ansDiv
ll calcComb(int a, int b) {
   if(b > a - b) return calcComb(a, a - b);

   ll ansMul = 1;
   ll ansDiv = 1;
   rep(i, b) {
       ansMul *= (a - i);
       ansDiv *= (i + 1);
       ansMul %= MOD;
       ansDiv %= MOD;
   }
   //ansMul / ansDiv をしたい
   //ansDivの逆元を求める
   ll ans = ansMul * modpow(ansDiv, MOD - 2) % MOD;

   return ans;
}

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

    int ans = 0;
    if(n > 1) ans += calcComb(n, 2);
    if(m > 1) ans += calcComb(m, 2);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 764
n = int(input())
w = [input() for i in range(n)]
c = 0
for i in range(1,n):
    if w[i][0] == w[i-1][-1]:
        if not w[i] in w[:i]:
            c += 1
if c == n-1:
    print('Yes')
else:
    print('No')           


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> vs(n);
	for(int i = 0; i < n; ++i){ cin >> vs[i]; }
	int answer = 0, a = 0, b = 0, f = 1;
	for(const auto& s : vs){
		const int m = s.size();
		for(int i = 0; i + 1 < m; ++i){
			if(s[i] == 'A' && s[i + 1] == 'B'){ ++answer; }
		}
		if(s[0] == 'B' || s[m - 1] == 'A'){
			if(s[0] == 'B'){
				++b;
			}else{
				f = 0;
			}
			if(s[m - 1] == 'A'){
				++a;
			}else{
				f = 0;
			}
		}
	}
	if(a > 0 && b > 0){ answer += min(a, b) - f; }
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 768
i = list(map(int, input().split()))
 
A_list = [1, 3, 5, 7, 8, 10, 12]
B_list = [4, 6, 9, 11]
C_list = [2]
 
if i[0] in A_list and i[1] in A_list:
    print("Yes")
elif i[0] in B_list and i[1] in B_list:
    print("Yes")
elif i[0] in C_list and i[1] in C_list:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
using namespace std;

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

    long long ans;
    if(b >= a + w) ans = b - (a+w);
    else if(a-w < b and b < a+w) ans = 0;
    else if(b <= a-w) ans = a-w - b;

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

Measured memory_bytes: 3624
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Graph Start
struct edge {
    int from, to;
    long long cost;
};
/// Graph End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Ciniii(a,b,c);
    if(a<=c&&c<=b) cout << "Yes" << nn;
    else cout << "No" <<nn;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

double l;

void solve() {
	cin >> l;
	cout << fixed << setprecision(8) << pow(l/3.0, 3) << "\n";
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 4188
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, Y;
  cin >> N >> Y;
  bool flg = false;
  for (int i = 0; i <= Y / 10000; i++){
    for (int j = 0; j <= Y / 5000; j++){
      int k = (Y - i * 10000 - j * 5000) / 1000;
      if (i + j + k == N && k >= 0 && !flg){
        cout << i << ' ' << j << ' ' << k << endl;
        flg = true;
      }
    }
  }
  if (!flg){
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  }
}

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

using namespace std;


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

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = IMIN;
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = IMIN;
	int dst2 = IMIN;
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){
	int N;
	cin >> N;
	int p[N];
	int max = IMIN;
	int sum = 0;
	rep(i, N) {
		cin >> p[i];
		sum += p[i];
		max = (p[i] >= max)? p[i] : max;
	}
	cout << sum - max / 2 << endl;


	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pii pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define traceloop(x,a) {for(ll i=0;i<x;i++) cerr<<a[i]<<" "; cerr<<endl;}
ll ab(ll x) {return x>0LL?x:-x;}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string a,b;
	cin>>a>>b;
	int dp[(int)a.length()+1][(int)b.length()+1];
	memset(dp,0,sizeof(dp));
	
	
	for(int i=0; i<a.length(); i++)
		for(int j=0; j<b.length(); j++)
		{	//trace4(i,j,a[i],b[j]);
			if(a[i]==b[j])
				dp[i+1][j+1] = 1+dp[i][j];
			else
			{
				dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
			}
		}

	// for(int i=0; i<=a.length(); i++)
	// {
	// 	for(int j=0; j<=b.length(); j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }
	string ans = "";
	int i=a.length();
	int j=b.length();
	int cnt = dp[i][j];
	while(cnt>0)
	{
		if(dp[i-1][j]==dp[i][j])
			i=i-1;
		else if(dp[i][j-1] == dp[i][j])
			j=j-1;
		else
		{
			i-=1;
			j-=1;
			cnt--;
			ans+=a[i];
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
	return 0;
}
	

Measured memory_bytes: 35456
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define fromto(i,a,b) for(int i=(a);i<=(b);++i)
#define out(v) cout<<v<<"\n"

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

  for (int k = 0; k * (k-1) / 2 <= N; ++k) {
    if (k * (k-1) / 2 == N) {
      out("Yes");
      out(k);
      rep(i, k-1) {
        cout << k-1;
        int start = 1, row = 1;
        rep(j, i) start += j + 1;
        rep(j, i) {
          cout << " " << start;
          start += 1;
          ++row;
        }
        rep(j, k-1-i) {
          cout << " " << start;
          start += row;
          ++row;
        }
        cout << "\n";
      }
      int start = 1;
      cout << k-1;
      rep(i, k-1) {
        cout << " " << start;
        start += i+2;
      }
      cout << "\n";
      return 0;
    }
  }
  out("No");

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;
int n,m,k,ok;

signed main()
{
    cin>>n;
    ok = 0;
    while(n)
    {
        if(n%10 == 7)
        {
            ok = 1;
        }
        n /= 10;
    }
    if(ok) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 3624
/*
Author: Babin Dutta
*/

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define endl "\n"

int dp[3001][3001];

void solve(){
	string s1,s2; cin>>s1>>s2;
	int n = s1.length();
	int m = s2.length();
	f(i,n+1){
		f(j,m+1){
			if(i==0 || j==0) continue;
			else if(s1[i-1] == s2[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
			else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}
	string s = "";
	int i=n, j=m;
	while(i>0 && j>0){
		if(s1[i-1] == s2[j-1]){
			s = s1[i-1] + s;
			i--;
			j--;
		}
		else{
			if(dp[i][j] == dp[i-1][j]) i--;
			else j--;
		}
	}
	cout<<s<<endl;
}

int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 35456
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int n;
    cin >> n;
    int count=0;
    double ans=1.0;
    for(int i=1; i<=n; i++){
        if(i%2==1)count++;
    }
    ans*=(double)count/n;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
temp = 1000000000000

for i in range(n):
  if temp > abs(a*1000-1000*t+h[i]*6):
    temp = abs(a*1000-1000*t+h[i]*6)
    ans = i+1

print(ans)

Measured memory_bytes: 9184
import java.io.IOException;
import java.util.Scanner;


public class Main{
	public static void main(String args[]) throws IOException{
		Scanner bf = new Scanner(System.in);
		int N = bf.nextInt();
		int T = bf.nextInt();
		int H = bf.nextInt();
		int L = bf.nextInt();
		int[][] list = new int[N][];
		for(int i=0; i<N; i++){
			list[i] = new int[2];
			list[i][0] = bf.nextInt();
			list[i][1] = bf.nextInt();
		}
		int current = 0;
		for(int i = 0; ;i = (i+1) % N){
			if(list[i][0]>0){
				list[i][0]--;
				current = (current+1)%9;
				T++;
				if(T>L){
					System.out.println(i+1);
					return;
				}
			}else if(list[i][1]>0){
				list[i][1]--;
				H++;
				list[i][0] += (current+1);
				T -= (current+1);
				current = 0;
				if(T<0){
					System.out.println(i+1);
					return;
				}
			}else{
				System.out.println(i+1);
				return;
			}
		}
	}
}

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

int main() {
  int n; cin >> n;
  for(int i = 0; i < n; i++) {
    int X, Y, W, H; cin >> X >> Y >> W >> H;
    int cat; cin >> cat;

    int cnt = 0;
    for(int j = 0; j < cat; j++) {
      int x, y; cin >> x >> y;
      if(X <= x && x <= X+W && Y <= y && y <= Y+H) cnt++;
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 1160
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end

N,d=gets.chomp.split(' ').map{|n| n.to_i}
R = Array.new(N)
B = Array.new(N)
f_B = Array.new(N){false}

# x=[x_i,y_i]
0.upto(N-1){|i|
	x = gets.chomp.split(' ').map{|n| n.to_i}
	R[i] = x
}
0.upto(N-1){|i|
	x = gets.chomp.split(' ').map{|n| n.to_i}
	B[i] = x
}

sum = 0
sortedR = R.sort{|x1,x2| x1[0] <=> x2[0]}
dpp sortedR
(sortedR.size-1).downto(0){|i|
	xr = sortedR[i]
	dputs "test"
	dputs "#{xr}"
	dpp "#{f_B}"
	xb_sel = nil
	xb_sel_i = nil
	for j in 0..(B.size-1)
		xb = B[j]
		if(xb[0] > xr[0] && xb[1] > xr[1] && !f_B[j])
			if(xb_sel.nil? || xb[1] < xb_sel[1])
				xb_sel = xb
				xb_sel_i = j
			end
		end
	end
	if(! xb_sel.nil?)
		dputs "matched"
		dputs "red:"
		dpp xr
		dputs "blue:"
		dpp xb_sel
		f_B[xb_sel_i]=true
		sum += 1
	end
}
puts sum


Measured memory_bytes: 2428
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();



            if (a<3200)
            {
                Console.WriteLine("red");
            }
            else if (a>=3200)
            {
                Console.WriteLine(S);
            }
            
        }
    }
}

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

int main()
{
	int N,R;
	cin >> N >> R;
	if (N >= 10)
	{
		cout << R << endl;
	}
	else
	{
		cout << R + 100 * (10 - N) << endl;
	}
	return 0;
}

Measured memory_bytes: 256