akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

#define X 55440 // lcm({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 18, 20, 21, 22, 24})

ll sum[24][X];

bool solve() {
  int N;

  cin >> N;
  debug(N);

  if (!N) return false;

  memset(sum, 0, sizeof(sum));

  for(int i=0; i<N; i++) {
    int d, t, q[24], loop;

    cin >> d >> t;

    for(int j=0; j<d; j++)
      cin >> q[(j+d-t) % d];

    int id;

    if (d == 13 || d == 17 || d == 19 || d == 23) {
      id = d;
      loop = d;
    } else {
      id = 0;
      loop = X;
    }

    for (int j=0; j<loop; j++) {
      sum[id][j] += q[j%d];
    }
  }

  ll ans = 0;

  for (int i=0; i<24; i++) {
    ll maxVal = 0;
    for (int j=0; j<X; j++)
      maxVal = max(maxVal, sum[i][j]);
    ans += maxVal;
  }

  cout << ans << endl;

  return true;
}

int main(){

  while(solve());

  return 0;
}



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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

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

    string s, t;
    cin >> s >> t;

    string tmp1 = s, tmp2 = t;
    sort(all(tmp1));
    sort(all(tmp2), greater<char>());

    //cout << tmp1 <<  " " << tmp2 << endl;
    int n = s.size(), m = t.size();
    if(s == tmp1 && n != 1) swap(tmp1[n-1], tmp1[n-2]);
    if(t == tmp2 && m != 1) swap(tmp2[m-1], tmp2[m-2]);

    bool ok = true;
    if(tmp1 >= tmp2){
        ok = false;
    }

    //cout << tmp1 << " " << tmp2 << endl;
    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}



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

using namespace std;

template<typename T>
vector<vector<T>> make_2d_vector(size_t rows, size_t cols, T init)
{ return vector< vector<T> >(rows, vector<T>(cols, init)); }

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

typedef long long ll;

#define MAX_H 1400
#define MAX_W 1400
int fld[MAX_H][MAX_W];

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

  int H, W;
  cin >> H >> W;

  for(int i = 0; i < H; i++ ) {
    for(int j = 0; j < W; j++ ) {
      cin >> fld[i][j];
    }
  }

  auto dp = make_2d_vector(H+1, W+1, 0);
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(fld[i][j]) {
        dp[i+1][j+1] = 0;
      } else {
        dp[i+1][j+1] = min(dp[i+1][j], min( dp[i][j], dp[i][j+1] ) ) + 1;
      }
    }
  }

  int res = 0;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      res = max(dp[i+1][j+1], res);
    }
  }
  cout << res  *  res << "\n";

  return 0;
}

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

int main(){
    int N;
    vector<int> ans;

    while(cin>>N,N!=0){
        vector<int> point(N);
        for(int &i : point) cin>>i;

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

        int ave = 0;

        for(int i = 1; i < N-1;i++) ave += point[i];

        ans.push_back(ave/(N-2));
    }

    for(int i:ans) cout<<i<<endl;

}


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

const int nm = 2e5;
int n, a[nm];

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a, a + n, greater<int>());
	ll ans = a[0];
	for (int i = 1; i <= (n - 1) / 2; ++i)
		ans += a[i] * 2;
	if (n & 1)
		ans -= a[n / 2];
	cout << ans << endl;
}


Measured memory_bytes: 4416
#include<stdio.h>
int main(void){
    
    long long int X,Y;
    scanf("%lld %lld",&X,&Y);
    
    int ans=1;
    long long int i=X;
    
    while(1){
        i=i*2;
        if(i>Y){
            break;
        }
        ans++;
    }
    printf("%d",ans);
    
    
    return 0;
}

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

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

using namespace std;

int MOD;
class mint{
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long x,const mint& m){ return mint(x)+m; }
mint operator-(long long x,const mint& m){ return mint(x)-m; }
mint operator*(long long x,const mint& m){ return mint(x)*m; }
mint operator/(long long x,const mint& m){ return mint(x)/m; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

int ask(int t,int l,int b,int r){
	printf("? %d %d %d %d\n",t,l,b,r);
	fflush(stdout);
	int res; scanf("%d",&res);
	return res;
}

int main(){
	int h,w,n; scanf("%d%d%d%d",&h,&w,&n,&MOD);

	mint ans=0;
	rep(i,h) rep(j,w) if(ask(i,j,i,j)>0) ans+=pow(mint(2),i*w+j);
	printf("! %d\n",ans.to_int());

	return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    int even=1;
    rep(i,n){
        cin>>a[i];
        if(a[i]%2==0) even=even*2;
    }
    cout<<pow(3,n)-even;
}

Measured memory_bytes: 4140
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int x,y,z;
	int ans=0;
	int k,s;
	cin>>k>>s;
	for(x=0;x<=k;x++)
		for(y=0;y<=k;y++)
		{
			z=s-x-y;
            if(z<=k&&z>=0)ans++;}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int K = sc.nextInt();
    	String S = sc.next();
    	if (S.length() <= K) {
    		System.out.println(S);
    	} else {
    		String ans = S.substring(0, K) + "...";
    		System.out.println(ans);
    	}
    }
}

Measured memory_bytes: 38648
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
 size_t strlen(const char *s);
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=100010;
const int P=1000000007;
long long int compare_int(const void *a, const void *b)
{
    return *(long long int*)a - *(long long int*)b;//a-b昇順
}
//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ
//	cout<<(n-2)*180<<endl;
//	string s="hoge";
//	cout<<ans<<endl;
//	int  n  ,a  ,b  ,c  ,d  ,e  ,f  ;
//	cin  >>n  >>a  >>b  >>c  >>d  >>e  >>f  ;

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	len = strlen(s);
文字列長さ*/


/*
	string s;
	s.size()
*/


/*ソート
	qsort(b, 10, sizeof(int), compare_int);
*/


/*
	char s[N];
	strlen(s)
/*
	if(  <  )puts("Yes");
	else puts("No");
*/
/*文字列比較
if(strcmp(name[i],s)==0)
*/
/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
	int n;
	char name[1010][101];
	int jikan[1010];
	cin>>n;
	rep(i,n){
		cin>>name[i];
		cin>>jikan[i];
	}
	
	char s[1010];
	cin>>s;
	int ans=0;
	int num=0;
	rep(i,n){
		if(num==0){
			if(strcmp(name[i],s)==0){
				num++;
			}
		}else{
			ans=ans+jikan[i];
		}
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    int m = 1000000;
    for(int i = 0; i < n; i++) {
      int p = sc.nextInt();
      m = Math.min(m, p);
      if(p == m) ans++;
    }
    System.out.println(ans);
  }
}



Measured memory_bytes: 62736
#include<stdio.h>
#include<math.h>

int main(){
    long long S;
    long long x1, x2, x3, y1, y2, y3;
    long long i, j, k;

    scanf("%lld", &S);
    x1=0;
    y1=0;
    x2=1000000000;
    y2=1;
    x3=(x2-S%x2)%x2;
    y3=(S+x3)/x2;

    printf("%lld %lld %lld %lld %lld %lld", x1, y1, x2, y2, x3, y3);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
  int zorome[] = {
      111, 222, 333, 444, 555, 666, 777, 888, 999,
  };
  int N;
  cin >> N;

  for(int i = 0; i < 9; ++i) {
    if(N <= zorome[i]) {
      cout << zorome[i] << endl;
      return 0;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int s[m],c[m],ans[n+1]={0,0};
	int q=1,d=0;
	if(n!=1&&m==0)
	ans[1]=1;
	for(int i=0;i<m;i++)
	{
		cin>>s[i]>>c[i];
		if(ans[s[i]]!=0&&ans[s[i]]!=c[i])
		{
			q=0;
			break;
		}
		else
		{
			if(s[i]==1&&c[i]==0)
			d=1;
			ans[s[i]]=c[i];
		}
	}
	if(q==0)
	cout<<-1<<endl;
    else if(d&&ans[1]==0&&n!=1)
	cout<<-1<<endl;
	else
	{
		if(ans[1]==0&&!d&&n!=1)
		ans[1]=1;
		for(int i=1;i<=n;i++)
		cout<<ans[i];
	}
	return 0;
}

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

ll a[2005],b[2005][2005],n,x,ans=9e18;
int main()
{
	scanf("%lld%lld",&n,&x);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		b[i][i]=a[i];
		for(int j=i+1;j<=n;j++)
		{
			b[i][j]=min(b[i][j-1],a[j]);
		}
	}
	for(ll i=0;i<n;i++)
	{
		ll temp=i*x;
		for(ll j=1;j<=n;j++)
		{
			int k=j-i;
			if(k<=0)temp+=min(b[k+n][n],b[1][j]);
			else temp+=b[k][j];
		}
		ans=min(ans,temp);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 31104
#include <stdio.h>
#include <stdlib.h>
typedef struct{

int price;
int maximum;


}store;
int com(const void *a,const void *b){
 int n=((store *)a)->price;
 int m=((store *)b)->price;
 if(n<m)
    return -1;
 if(n>m)
    return 1;
 return 0;
}
int main(void){
 int n;
 int m;
 store a[100000];
 long long minimum=0;
 int i;
 scanf("%d %d",&n,&m);
 for(i=0;i<n;i++){
    scanf("%d %d",&a[i].price,&a[i].maximum);
 }
 qsort(a,n,sizeof(store),com);
 for(i=0;i<n;i++){
    if(a[i].maximum>=m){
        minimum+=(long long)a[i].price*m;
        break;
    }
    minimum+=(long long)(a[i].price)*a[i].maximum;
    m-=a[i].maximum;
 }
printf("%lld",minimum);
}



Measured memory_bytes: 1788
#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil

using namespace std;

int main() {

	int a;
	cin >> a;

	cout << a + a * a + a * a * a << endl;

	return 0;

}

Measured memory_bytes: 3604
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll H,W;
int main(){
    cin>>H>>W;
    if(H==1 || W==1){
        cout<<1;
        return 0;
    }    
    cout<<(H*W+1)/2;

    return 0;
}

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
# import math
import sys
import collections

from math import gcd
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

K = int(input())
""" answer 1
ans = 0
tmp = {}
for i in range(201):
    tmp[i] = 0

for i in range(1, K +1):
    for j in range(1, K +1):
        tmp[math.gcd(i, j)] += 1

for k in range(1, K +1):
    for key in tmp.keys():
        ans += math.gcd(key, k) * tmp[key]
print(ans)

"""

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K +1):
            ans += gcd(gcd(i,j), k)
print(ans)

Measured memory_bytes: 10940
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

#define rep(i, n) for (long long i = 0; i < n; i++)

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
  ins(A, B, C);
  out(A.back() == B.front() && B.back() == C.front() ? "YES" : "NO");
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

template<typename T>
struct BellmanFord{
	struct Edge{
		int  from,to; ll cost;
		Edge(){}
		Edge(int from,int to,ll cost):from(from),to(to),cost(cost){}
	};

	int n;
	vector<vector<int> >G;
	vector<int> used,reach;
	BellmanFord(int n):n(n),G(n),used(n,0),reach(n,0){}

	vector<Edge> es;
	void add_edge(int from,int to,ll cost){
		es.push_back(Edge(from,to,cost));
		G[from].push_back(to);
	}

	void dfs(int v){
		if(used[v])return ;
		used[v]=1;
		for(int u:G[v]){
			dfs(u);
		}
	}
	ll build(int from,int to,int &neg_loop){
		for(int i=0;i<n;i++){
			fill(used.begin(),used.end(),0);
			dfs(i);
			reach[i]=used[to];
		}
		vector<ll> ds(n,1e18);
		ds[from]=0;
		for(int i=0;i<n;i++){
			bool update=0;
			for(auto e:es){
				if(!reach[e.from]||!reach[e.to]||ds[e.from]==1e18) continue;
				if(ds[e.to]>ds[e.from]+e.cost){
					ds[e.to]=ds[e.from]+e.cost;
					update=1;
				}
			}
			if(!update)break;
			if(i==n-1){
				neg_loop=1;
				return 1e18;
			}
		}
		neg_loop=0;
		return ds[to];
	}
};

int main(){
	int n,m,p; cin >> n >> m >> p;
	BellmanFord<int> G(n);
	for(int i=0;i<m;i++){
		int a,b,c; cin >> a >> b >> c;
		a--; b--;
		G.add_edge(a,b,p-c);
	}
	int neg_loop;
	int res=G.build(0,n-1,neg_loop);
	if(neg_loop){
		cout << -1 << endl;
		return 0;
	}
	else{
		cout << max((ll)0,(ll)-res) << endl;
		return 0;
	}
}

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

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

	if (N % 2 != 0) {
		cout << "No" << endl;
	}
	else {
		rep(i, N / 2) {
			if (S[i] != S[i + N / 2]) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
		return 0;
	}

}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a, b, d, r;
  double f;
  scanf("%d %d", &a, &b);
  d = a / b;
  r = a % b;
  f = (double)a/b;
  printf("%d %d %f", d, r, f); 
  return 0;
}

Measured memory_bytes: 636
#include<stdio.h>
int main(){
    int n,k,x,y,a;
    scanf("%d%d%d%d",&n,&k,&x,&y);
    if(n<=k){
        a=n*x;
    }else{
        a=k*x;
        a+=(y*(n-k));
    }
    printf("%d\n",a);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
  
  public static void main (String[] args){
  
  	Scanner scanner = new Scanner (System.in);
    ArrayList <String> list = new ArrayList <String> ();
    
  	int numA = scanner.nextInt();
    int numB = scanner.nextInt();
   	int count = 0;
    
    for (int i=numA; i<=numB; i++){
      list.clear();
      String phraseA = String.valueOf(i);
      String[] templist = phraseA.split("");
      for (int j=0; j<phraseA.length(); j++){
        list.add(templist[j]);
      }
      
      boolean flag = true;
      for (int j=0; j<(phraseA.length())/2; j++){
        String temp = list.get(j);;
        String temp2 = list.get(phraseA.length()-1-j);
        if (temp.equals(temp2)){
        } else {
          flag = false;
        }
      }
      if (flag == true){
        count++;
      }
    }	
   	System.out.println(count);
  }
}

Measured memory_bytes: 61164
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

int main() {
    string S;
    cin >> S;
    reverse(begin(S), end(S));

    int len = S.size();

    string T;
    int ind = 0;
    while (S != T) {
        if (ind + 5 <= len && S.substr(ind, 5) == "maerd") {
            T += "maerd";
            ind += 5;
        } else if (ind + 7 <= len && S.substr(ind, 7) == "remaerd") {
            T += "remaerd";
            ind += 7;
        } else if (ind + 5 <= len && S.substr(ind, 5) == "esare") {
            T += "esare";
            ind += 5;
        } else if (ind + 6 <= len && S.substr(ind, 6) == "resare") {
            T += "resare";
            ind += 6;
        } else {
            break;
        }
    }

    cout << (S == T ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 764
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   string s;
   cin>>s;
   ll n=s.size();
   cout<<string(n,'x');
}



Measured memory_bytes: 3580
#include <stdio.h>
int main()
{
	int a,b,h,S=0;
	//1<=a<=100,1<=b<=100,1<=h<=100 
	scanf("%d\n",&a);
	scanf("%d\n",&b);
	scanf("%d",&h);
	//h为偶数 
	S=(a+b)*h*1/2;
	printf("%d",S); 
	
	
	return 0;
	
	
	
	
 } 

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main ()
{
  int n;
  cin>>n;
  if(n%2==0)
  {
    float res=0.5000000000;
    cout<<res<<endl;
  }
  else
  {
    double res=double((n/2)+1)/n;
    printf("%.10f",res);
  }
  return 0;
}

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

int main() {
  int n, m, temp = 0, yen = 0;
  
  std::cin >> n;
  
  std::vector<std::string> s(n);
  
  for (int i = 0; i < n; i++) {
    std::cin >> s.at(i);
  }
  
  std::cin >> m;

  std::vector<std::string> t(m);
  
  for (int i = 0; i < m; i++) {
    std::cin >> t.at(i);
  }
  
  std::vector<std::string> cards;
  cards.reserve(s.size() + t.size());
  cards.insert(cards.end(), s.begin(), s.end());
  cards.insert(cards.end(), t.begin(), t.end());
  std::sort(cards.begin(), cards.end());
  cards.erase(std::unique(cards.begin(), cards.end()), cards.end());
  
  for (int i = 0; i < cards.size(); i++) {
    temp = std::count(s.begin(), s.end(), cards.at(i)) -
      std::count(t.begin(), t.end(), cards.at(i));
    if (yen < temp) yen = temp;
  }

  std::cout << yen << std::endl;
  return 0;
}



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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    int n;
    cin >> n;
    int now_x = 0;
    int now_y = 0;

    REP(i, n) {
        int t, x, y;
        cin >> t >> x >> y;
        int kyori = abs(x - now_x) + abs(y - now_y);

        if(kyori > t) {
            cout << "No" << endl;
            return 0;
        } else {
            if((t - kyori) % 2 != 0) {
                cout << "No" << endl;
                return 0;
            }
        }

    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int k;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin >> k;
  cout << a[k - 1] << '\n';

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const int SIZEN = 3010;
int f[SIZEN][SIZEN * 2];
int A[SIZEN],B[SIZEN];
int id[SIZEN] = {0};
int N,T;
bool Cmp(const int &a,const int &b){return A[a]<A[b];}
int main(){
    scanf("%d%d",&N,&T);T--;
    for(int i = 1;i <= N;i++)scanf("%d%d",&A[i],&B[i]);
    for(int i = 1;i <= N;i++)id[i] = i;
    sort(id + 1,id + 1 + N,Cmp);
    memset(f,-1,sizeof f);
    f[0][0] = 0;
    int lim = 0;
    for(int i = 1;i <= N;i++){
        int x = id[i];
        f[i][0] = 0;
        for(int j = 1;j <= T + A[x];j++){
            f[i][j] = f[i-1][j];
            if(j >= A[x])f[i][j] = max(f[i][j],f[i-1][j-A[x]] + B[x]);
        }
    }
    int ans = 0;
    for(int i = 1;i <= T+A[id[N]];i++)ans = max(ans,f[N][i]);
    printf("%lld\n",ans);
}

Measured memory_bytes: 72548
#include <iostream>

int main()
{
    long long a,b,x;
    std::cin >> a >> b >> x;
    long long suma,sumb;
    if(a == 0){
        suma = -1;
    }
    else{
        suma = (a-1)/x;
    }
    sumb = b/x;

    std::cout << sumb - suma;
    return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  while(cin>>n&&n) {
    string s[5];
    for(int i=0; i<5; i++) cin >> s[i];
    int r=0;
    for(int i=0; i<5; i++) {
      for(int j=0; j<n; j++) {
        for(int k=j+1; k<n; k++) {
          if(s[i][j]=='X'&&s[i][k]=='X') r|=1<<(k-j-1);
        }
      }
    }
    int mod=1<<n,dp[1<<n][11];
    for(int i=0; i<(1<<n); i++)for(int j=0; j<11; j++)dp[i][j]=1<<29;
    dp[0][0]=0;
    for(int i=0; i<10; i++) {
      for(int k=0; k<3; k++) {
        for(int t=0; t<(1<<n); t++) {
          if(dp[t][i]==1<<29) continue;
          dp[t*2%mod][i]=min(dp[t*2%mod][i],dp[t][i]+1);
          bool f=1;
          for(int j=0; j<n; j++) {
            if((t&(1<<j))&&(r&(1<<j))) f=0;
          }
          if(f) dp[(t*2|1)%mod][i+1]=min(dp[(t*2|1)%mod][i+1],dp[t][i]+1);
        }
      }
    }
    int ans=1<<29;
    for(int t=0; t<(1<<n); t++) ans=min(ans,dp[t][10]+n-1);
    cout<<ans<<endl;
  }
  return 0;
}


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

using namespace std;

#define int long long

int n,k;
int a[200001];

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


	cin >> n >> k;
	for (int i=1;i<=n;i++)
		cin >> a[i];
	sort(a+1,a+1+n);
	int res = 0;
	for (int i=1;i<=max(0LL,n-k);i++)
		res += a[i];
	cout << res;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    scanf("%d",&n);
    ll x=1,y=1,mid;
    while(n--)
    {
        ll a,b;
        scanf("%lld%lld",&a,&b);
        mid=max(x/a,y/b);
        while(mid*a<x||mid*b<y) mid++;
        x=mid*a;
        y=mid*b;
    }
    printf("%lld\n",x+y);
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func divmod(a, b int) (int, int) {
	q := math.Floor(float64(a / b))
	r := a % b
	return int(q), r
}

func main() {

	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var res, q, r, tot int
	for i := 1; i <= n; i++ {
		q = i
		tot = 0
		for q != 0 {
			q, r = divmod(q, 10)
			tot += r
		}
		if a <= tot && tot <= b {
			res += i
		}
	}
	fmt.Println(res)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll llinf = 999999999999999999ll;
ll aps(ll x){
	return x > 0 ? x : -x;
}
int main(){
	ll sm = 0;
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		sm += a[i];
	}
	ll mn = llinf;
	ll cur_sm = 0;
	for(int i = 0; i < n - 1; i++){
		cur_sm += a[i];
		mn = min(mn, aps(cur_sm - (sm - cur_sm)));
	}
	cout << mn << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
int n,m,a,b,c,d;
string s,w;

int main(){
	cin >> a >> b >> c;
	
	if(a==b) cout << c;
	else if(b==c) cout << a;
	else cout << b;
	
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>           // printf(), scanf(), getchar()
#include <cctype>           // isdigit()
#include <algorithm>        // min(), lower_bound()

using namespace std;
static const int MAX_N = 100000;

int a[MAX_N];
int S;
int n;

int
solve()
{
	int sum[MAX_N + 1];

	sum[0] = 0;
	for (int i = 0; i < n; ++i)
		sum[i + 1] = sum[i] + a[i];

	if (sum[n] < S)
		return 0;

	int res = n;
	for (int s = 0; sum[s] + S <= sum[n]; ++s)
	{
		int t = lower_bound(sum + s, sum + n, sum[s] + S) - sum;
		res = min(res, t - s);
	}

	return res;
}

int
main(int argc, char** argv)
{
	int c;

	scanf("%d %d", &n, &S);
	c = getchar();
	for (int i = 0; i < n; ++i)
	{
		while (c == ' ' || c == '\n')
			c = getchar();

		int d = 0;
		while (isdigit(c))
		{
			d = d * 10 + c - '0';
			c = getchar();
		}

		a[i] = d;
	}

	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 3508
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
S = input()

b = [0]*(N+1)
w = [0]*(N+1)

tmp_b = 0
for i in range(N):
	if S[i] == "#":
		tmp_b += 1
	b[i+1] = tmp_b


tmp_w = 0
for i in range(N-1, -1, -1):
	if S[i] == ".":
		tmp_w += 1
	w[i] = tmp_w

ans = min([b[i]+w[i] for i in range(N+1)])
#print(b)
#print(w)
print(ans)


Measured memory_bytes: 23092
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
	int N; cin >> N;
	string S; cin >> S;
	int sum = 0;
	string ans;
	for (int i = 0; i < N; ++i)
	{
		if (S[i] == '(') ++sum;
		else --sum;
		if (sum < 0)
		{
			ans = '(' + ans + ')';
			sum = 0;
		}
		else
		{
			ans += S[i];
		}
	}
	while (sum > 0)
	{
		ans += ')';
		--sum;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3628
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# 文字列の入力
X = input()
one = 0
intX = 0
bitnow = 1
for i in reversed(range(len(X))):
    if X[i] == '1':
        one += 1
        intX += bitnow
    bitnow *= 2
hi = one + 1
lo = one - 1
hirembase = intX % hi
lorembase = 0
if lo != 0:
    lorembase = intX % lo
# print(intX)
# print(hi)
# print(lo)
# print(hirembase)
# print(lorembase)
bo = []
for i in range(200010):
    num = 0
    while i != 0:
        bit = bin(i)
        bitnum = 0
        for j in range(len(bit)):
            if j == 0 or j == 1:
                continue
            if bit[j] == '1':
                bitnum += 1
        i = i % bitnum
        num += 1
    bo.append(num)
ans = []
hirem = 1
lorem = 1
for i in reversed(range(len(X))):
    if X[i] == '0':
        num = (hirembase + hirem + hi) % hi
        ans.append(bo[num] + 1)
    else:
        if one == 1:
            ans.append(0)
        else:
            num = (lorembase - lorem + lo) % lo
            ans.append(bo[num] + 1)
    hirem = (hirem * 2) % hi
    if one != 1:
        lorem = (lorem * 2) % lo
# print(ans)
# 出力
for i in reversed(range(len(ans))):
    print(ans[i])

Measured memory_bytes: 12944
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;
typedef long long ll;
int main() {
	//file("a");
	int a,b;
	cin>>a>>b;
	cout<<a+b*0.5;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
	string str;
	int n;
	cin>>n;
	cin>>str;
	string s;
	s=str;
	int count=0;
	int idx=0;
	while(idx=(int)str.find("()")+1){
		str.replace(idx-1,2,"");
		count++;
	}
	int a=0;
	while(idx=(int)str.find(")")+1){
		str.replace(idx-1,1,"");
		a++;
	}
	rep(i,a)s="("+s;
	rep(i,n-count*2-a)s+=")";
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

    bool cond1 = std::abs(c - a) <= d;
    bool cond2 = std::abs(b - a) <= d && std::abs(c - b) <= d;
    if (cond1 || cond2) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << 0.5 << endl;
    } else {
        cout << fixed << setprecision(10) << (1.0 + floor(n / 2.0)) / (double)n
             << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

    int a;

    cin >> a;
    if(a - 1){
        int c,d;
        cin >> c >> d;
        cout << c + d << endl;
    }else{
        cout << "Hello World" << endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;

# define var auto

int main() {
    int num,k;
    cin >> num >> k;
    vector<int> ar(num);
    for(var i=0;i<num;i++)
        cin >> ar[i];
    vector<int> dp(num);
    for(var i=1;i<num;i++)
        dp[i]=INT_MAX;
    for(var i=1;i<num;i++)
        for(var j=i-1;j>=max(0,i-k);j--)
            dp[i]=min(dp[i],dp[j]+abs(ar[i]-ar[j]));
    cout << dp[num-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
using namespace std;
int main(){
    std::stack<int> stack;
    string n;
    cin >> n;
    string ans = "No";
    for(int i = 0; i < 3; i++){
        if(n[i] == '7'){
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl; 
    return 0;
}
    



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

using namespace std;

int N, A[100004],dp[100004];

int f(int i){
    if(i >= N-1){
        return 0;
    }
    if(dp[i] != -1){
        return dp[i];
    }
    int one = abs(A[i]-A[i+1]) + f(i+1);
    int second = i+2 < N ? abs(A[i]-A[i+2])+f(i+2) : one+1;
    dp[i] = min(one,second);
    return dp[i];
}

int main() {
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        dp[i] = -1;
    }
    printf("%d",f(0));
}

Measured memory_bytes: 4096
#include <iostream>
#include <stdlib.h>
using namespace std;
int int_cmp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int main(){
int i,j,n,t[10010];
while(cin>>n,n){
long long int s=0;
for(i=0;i<n;i++)cin>>t[i];
qsort(t,n,sizeof(int),int_cmp);
for(i=0;i<n;i++)s+=t[i]*(n-i-1);
cout<<s<<endl;
}
}

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

typedef int i32;
typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;


template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};


#define debug(x)  cerr<<x<<"\n";
#define loop(i,n) for(i32 i = 0; i < n; ++i)
#define pi  pair<int,int>
#define ti  tuple<int,int,int>
#define mt  make_tuple
#define mk  make_pair
#define vi  vector<int>
#define vll vector<i64>
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pr(a) for(auto x:a) cout<<x<<" ";
#define prmap(m) for(auto x:m) cout<<x.first<<" "<<x.second<<"\n";
using namespace std;

i64 n,k,m;
int main()
{ 
    fastInOut
    cin>>n;
    map<string,int>mp;
    string s;
   cin>>s;
   mp[s]++;
   n--;
    string temp=s;
    bool f=true;
    while(n--){
      cin>>s;
      if(mp[s]>=1||temp[temp.size()-1]!=s[0]){
         f=false;
      }
      mp[s]++;
      temp=s;
    }
    if(f)
    cout<<"Yes";
   else 
      cout<<"No";
  return 0;
}















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

typedef long long ll;
int n,a,b;
ll f[100010];

int main()
{
	scanf("%d%d%d", &n, &a, &b);
	for (int i = 1; i <= n; i++) scanf("%lld", &f[i]);
	ll l=1;
	ll r=0x7fffffff;
	while (l < r)
	{
		ll mid=(l+r) >> 1;
		ll c=0;
		for (int i = 1; i <= n; i++)
            if ((f[i] - mid * b) > 0)
                c += ((f[i]-mid*b+a-b-1)/(a-b));
		if (c <= mid) r=mid;
                    else l=mid+1;
	}
	cout<<l<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(X,A,B) for(int X=A;X<=B;X++)
#define tep(X,A,B) for(int X=A;X>=B;X--)
#define LL long long
#define DB double
const int N=4000010;
using namespace std;

int n;
int tot=0,num=0,top,p[N];
int u[N],v[N],w[N],cnt=0;

void PRT(int x){
	if(x==0){
		printf("0\n");return;
	}
	int pos=0,t[N];
	while(x)t[++pos]=x%2,x/=2;
	tep(i,pos,1)printf("%d",t[i]);
	printf("\n");
}

void ADD(int x,int y,int z){
//	printf("%d %d ",x,y);PRT(z);
	cnt++;u[cnt]=x;v[cnt]=y;w[cnt]=z;
}

void INIT(){
	n--;
	tep(i,20,0){
		if(n&(1<<i)){
			top=i;
			break;
		}
	}
	num=(1<<top);
	top--;
	tot=1;
	tep(i,top,0){
		int las=tot;tot++;
		ADD(las,tot,(1<<i));
		ADD(las,tot,0);
		p[i+1]=las;
	}
}

void SOLVE(){
	tep(i,top,0){
		if(!(n&(1<<i)))continue;
		if(i==0)ADD(1,tot,num);
		else ADD(1,p[i],num);
		num|=(1<<i);
	}
	ADD(1,tot,num);
	printf("%d %d\n",tot,cnt);
	rep(i,1,cnt)printf("%d %d %d\n",u[i],v[i],w[i]);
}

int main(){
	scanf("%d",&n);
	if(n==2){
		printf("2 2\n");
		printf("1 2 0\n1 2 1\n");
		return 0;
	}
	/*if(n==4){
		printf("2 4\n");
		rep(i,0,3){
			printf("1 2 %d\n",i);
		}
		return 0;
	}*/
	INIT();
	SOLVE();
	return 0;
}

Measured memory_bytes: 6400
import java.util.*;

public class Main {

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

    for (int i = 1; i <= n; i++) {
      if (n <= i * 1.08 && i * 1.08 < n+1) {
        System.out.println(i);
        return;
      }
    }

    System.out.println(":(");

  }

}


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

using namespace std;
using ll = long long;
const ll MOD = 1000000007;

void solve(long N, long K) {
  // for i = K ~ N + 1
  // min = sum (0 ~ i - 1)
  // max = sum (N - i + 1 ~ N)
  ll ans = 0;
  for (long i = K; i <= N + 1; i++) {
    ll min = (0 + (i - 1)) * i / 2;
    ll max = ((N - i + 1) + N) * i / 2;
    ans += max - min + 1;
  }
  cout << ans % MOD << endl;
}

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

  long N, K;
  cin >> N >> K;
  solve(N, K);
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	int v[n]; rep(i,n)cin>>v[i];
	sort(v, v+n);
	double ans=v[0];
	for(int i=1;i<n;++i){
		ans+=v[i];
		ans/=2.0;
	}
	printf("%.10f\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=1; i<=n; i++)

int main(){
    int n; 
    cin >> n;
    rep(i,n){
        if(i%3 == 0)
            cout << " " << i;
        else{
            int j=i;
            do{
                if(j%10 == 3){
                    cout << " " << i;
                    j=0;
                }
                else
                    j/=10;
            }while(j);
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
using namespace std;
#include<map>
#include<cmath>
#include<algorithm>
#define int long long int
bool prime(int x)
{
	if(x==1||x==4)
	    return false;
	if(x==2||x==3||x==5)
	    return true;
   else if(x%2==0||x%3==0||x%5==0)
        return false;
    for(int i=7;i*i<=x;i++)
    {
		if(x%i==0)
		   return false;
	}
	return true;
}
int32_t main()
{
    int r;
    cin>>r;
    cout<<(3*r*r)<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define INF 99999
using namespace std;

int G[110][110] = {};

int prim(int n)
{
    int mini[110];
    int used[110];

    //init
    for(int i = 0;i < n;i++){
        mini[i] = INF;
        used[i] = 0;
    }
    mini[0] = 0;
    int ans = 0;

    while(true)
    {
        int v = -1;
        for(int i = 0;i < n;i++){
            if(!used[i] && (v == -1 || mini[i] < mini[v])) v = i;
        }
        if(v == -1) break;
        //ans = -1;

        used[v] = 1;
        ans += mini[v];
        //cout << ans << endl;

        for(int i = 0;i < n;i++){
            mini[i] = min(mini[i], G[v][i]);
        }
    }
    return ans;
}

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

    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            int cost;
            cin >> cost;
            if(cost == -1) G[i][j] = INF;
            else G[i][j] = cost;
        }
    }

    cout << prim(n) << endl;
    return 0;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0&&c>0)
    {
        c=c-b;
        a=a-d;
    }
    if(c<=0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>



using namespace std;



int main() {
	
	long long x;
	cin >> x;

	double max_i = sqrt(x)+1;

	long long num = x - 1;
	for (int i = 1; i < max_i; i++) {
		if ((x / i)*i == x) {
			long long candidate = (i - 1) + (x / i - 1);
			if (candidate < num) {
				num = candidate;
			}
		}
	}
		
	cout << num << endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll x;
    cin >> n >> x;

    vector<ll> b(n), l(n), u(n);
    vector<int> ord;
    ll sum = 0;
    ll cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> b[i] >> l[i] >> u[i];
        ord.push_back(i);
        sum += b[i] * l[i];
        cnt += b[i];
    }

    sort(ord.begin(), ord.end(), [&](const int i1, const int i2){
        return b[i1] * l[i1] + (x - b[i1]) * u[i1] > b[i2] * l[i2] + (x - b[i2]) * u[i2];
    });

    vector<ll> memo(n + 1, 0);
    for (int i = 0; i < n; i++) {
        int j = ord[i];
        memo[i + 1] = memo[i] + b[j] * l[j] + (x - b[j]) * u[j];
    }

    ll ok = cnt, ng = -1;
    while (ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        ll need = mid / x;
        ll rest = mid % x;

        bool f = false;
        for (int ii = 0; ii < n; ii++) {
            int i = ord[ii];
            ll hoge = 0;
            if (ii <= need) hoge = memo[ii] + memo[need + 1] - memo[ii + 1];
            else hoge = memo[need];
            hoge += min(b[i], rest) * l[i] + max(rest - b[i], 0LL) * u[i];

            if (hoge >= sum) {
                f = true;
                break;
            }
        }

        (f ? ok : ng) = mid;
    }

    cout << ok << endl;
    return 0;
}

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

int a[510][510];
int s[510][510];

int main(){
  int n, m, Q; cin >> n >> m >> Q;
  rep(i,m) {
    int l, r; cin >> l >> r;
    l--; r--;
    a[l][r]++;
  }
  rep(i,n) rep(j,n) {
    s[i+1][j+1] = s[i+1][j] + s[i][j+1] - s[i][j] + a[i][j];
  }

  while(Q--){
    int p, q; cin >> p >> q;
    p--; q--;
    cout << s[q+1][q+1] - s[q+1][p] - s[p][q+1] + s[p][p] << endl;
  }
}


Measured memory_bytes: 2944
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<int> a(n);
		REP(i,n) cin >> a[i];
		vector<int> h, t;
		REP(i,n){
			if(n&1){
				if(i&1){
					t.push_back(a[i]);
				}else{
					h.push_back(a[i]);
				}
			}else{
				if(i&1){
					h.push_back(a[i]);
				}else{
					t.push_back(a[i]);
				}
			}
		}
		reverse(ALL(h));
		REP(i,SZ(t)) h.push_back(t[i]);
		REP(i,SZ(h)){
			if(i != SZ(h)-1) cout << h[i] << ' ';
			else cout << h[i] << endl;
		}
		// REP(i,SZ(t)){
		// 	if(i != SZ(t)-1){
		// 		cout << t[i] << ' ';
		// 	}else{
		// 		cout << t[i] << endl;
		// 	}
		// }
	}
	return 0;
}


Measured memory_bytes: 4336