akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
int main(){
  int n;
  std::cin >> n;
  double sum=0.0;

  for(int i=0; i<n; i++){
    double x;
    std::string v;
    std::cin >> x >> v;
    if(v == "JPY"){
      sum += x;
    }else if(v == "BTC"){
      sum += x*380000.0;
    }
  }
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

signed main() {
    int N;
    cin >> N;
    set<pair<int, int>> AB;
    for (int i = 0; i < N; i++) {
        int A, B;
        cin >> A >> B;
        AB.emplace(A, B);
    }
    auto temp = *AB.rbegin();
    cout << temp.first + temp.second << endl;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    INT(k,t);
    vector<int> cake(t);
    in(cake);
    sort(rall(cake));
    int day=k-cake[0];
    int ans;
    if(cake[0]<=day+1)ans=0;
    else ans=cake[0]-day-1;
    out(ans);
}

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

const int N=1e5+5;
int n,a[N];
ll bit[N*3];

void upd(int x){
	for(;x<N*3;x+=x&(-x))
		bit[x]++;
}

ll get(int x){
	ll cnt=0;
	for(;x>0;x-=x&(-x))
		cnt+=bit[x];
	return cnt;
}

bool check(int X){
	memset(bit,0,sizeof bit);
	ll pairs=(n+1LL)*n/2LL,cnt=0;
	int pf=0;
	for(int i=0;i<n;++i){
		pf+=a[i]<X?-1:1;
		cnt+=get(pf+N);
		upd(pf+N);
		if(pf>=0) cnt++;
	}
	return cnt>=(pairs+1LL)/2LL;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	for(int i=0;i<n;++i) cin>>a[i];
	int l=1,r=1e9;
	while(l<=r){
		int m=(l+r)>>1;
		if(check(m)) l=m+1;
		else r=m-1;
	}
	cout<<r<<'\n';
}




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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);

  // sort(a.begin(), a.end());
  // reverse(a.begin(), a.end());
  double sum = 0;
  rep(i,n) sum += a.at(i);

  //cout << sum << endl;

  int count=0;
  double k = sum /(4*m);
  rep(i,n){
    if(a.at(i) >= k ) {
      count++;
      //cout << a.at(i) << endl;
    }
    
  }

  //cout << count << endl;

  if(count >= m) cout << "Yes" << endl;
  if(count < m) cout << "No" << endl;
  
}


Measured memory_bytes: 256
N = input()
ans_num = 0
# 重複を消して抽出する
set_N = list(set(N))
for i in set_N:
    if N.count(i) % 2 == 1:
        ans_num = 1
        break
    else:
        continue
if ans_num == 0:
    print('Yes')
else :
    print('No')

Measured memory_bytes: 9004
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		StringBuilder sb = new StringBuilder();
		String string, str[];
		
		int min, sum, tmp, hoge;
		int jen[] = new int[]{4, 1, 4, 1, 2, 1, 2, 1};
		while((string = reader.readLine()) != null){
			str = string.split(" ");
			min = hoge = 2 << 29;
			
			int ary[] = new int[8];
			for(int i = 0; i < 8; i++){
				ary[i] = Integer.valueOf(str[i]);
			}
			
			for(int i = 0; i < 8; i++){
				sum = 0;
				for(int j = 0; j < 8; j++){
					tmp = (i + j) % 8;
					if(jen[tmp] < ary[j]){
						sum += ary[j] - jen[tmp];
					}
				}
				if(min > sum){
					min = sum;
					
					sb.setLength(0);
					for(int j = 0; j < 8; j++){
						sb.append(String.valueOf(jen[(i + j) % 8]));
					}
					hoge = Integer.valueOf(sb.toString());
				}else if(min == sum){
					sb.setLength(0);
					for(int j = 0; j < 8; j++){
						sb.append(String.valueOf(jen[(i + j) % 8]));
					}
					if(Integer.valueOf(sb.toString()) < hoge){
						hoge = Integer.valueOf(sb.toString());
					}
				}
			}
			
			String res = String.valueOf(hoge);
			for(int i = 0; i < 8; i++){
				if(i == 7){
					System.out.println(res.charAt(i));
				}else{
					System.out.print(res.charAt(i) + " ");
				}
			}
		}
		reader.close();
	}
}

Measured memory_bytes: 25632
import java.util.*;import java.math.*;class Main{public static void main(String[]e){int n,i,j;BigInteger c,d,r;for(Scanner s=new Scanner(System.in);(n=s.nextInt())>0;){BigInteger[]a=new BigInteger[n];for(i=n,r=a[--i]=s.nextBigInteger();i-->0;){a[i]=s.nextBigInteger();for(j=n,c=d=BigInteger.ZERO;j-->i;)r=r.max(c=c.add(a[j])).max(d=d.add(a[i+n-j-1]));}System.out.println(r);}}}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int A, B;
    cin >> A >> B;
    cout << (A + B) % 24 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
using namespace std;
int dp[109][109];
int a[9][9],n,m,k,ans;
bool check(int x,int y)
{
    int c=0;
    for(int i=0;i<n;i++)
    {
        if((1<<i)&x)continue;
        for(int j=0;j<m;j++)
        {
            if((1<<j)&y)continue;
            c+=a[i][j];
        }
    }
    if(c==k){ans++;}
    if(c<k)return 1;
    else return 0;
}
void ch(int x,int y)
{
    if(dp[x][y])return;
    dp[x][y]=1;
    if(check(x,y))return;
    for(int i=0;i<n;i++)
    {
        if(x&(1<<i))continue;
        ch(x+(1<<i),y);
    }
    for(int i=0;i<m;i++)
    {
        if(y&(1<<i))continue;
        ch(x,y+(1<<i));
    }
}
int main()
{
    fast order
    cin>>n>>m>>k;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        for(int j=0;j<m;j++)if(s[j]=='#')a[i][j]=1;
    }
    ch(0,0);
    cout<<ans;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int node[2000000];
int n;

int parent(int i) {
	return i / 2;
}

int left(int i) {
	return 2 * i;
}

int right(int i) {
	return 2 * i + 1;
}

void swap(int *x, int *y) {
	int tmp;

	tmp = *x;
	*x = *y;
	*y = tmp;
}

void maxHeapify(int *A, int i) {
	int l, r, largest;

	l = left(i);
	r = right(i);

	if (l <= n && A[l] > A[i]) largest = l;
	else largest = i;

	if (r <= n && A[r] > A[largest]) largest = r;
	if (largest != i) {
		swap(&A[i], &A[largest]);
		maxHeapify(A, largest);
	}
}

void heapIncreaseKey(int *A, int i, int key) {
	if (key >= A[i]) {
		A[i] = key;
		while (i > 1 && A[parent(i)] < A[i]) {
			swap(&A[i], &A[parent(i)]);
			i = parent(i);
		}
	}
}

void maxHeapInsert(int *A, int key) {
	n++;
	A[n] = -32768;
	heapIncreaseKey(A, n, key);
}

int heapExtractMax(int *A) {
	int max;

	if (n >= 1) {
		max = A[1];
		A[1] = A[n];
		n--;
		maxHeapify(A, 1);
		return max;
	}

	return -1;
}

main() {
	int key;
	char order[8];

	while (1) {
		scanf("%s", &order);
		if (!strcmp(order, "insert")) {
			scanf("%d", &key);
			maxHeapInsert(node, key);
		}
		else if (!strcmp(order, "extract")) printf("%d\n", heapExtractMax(node));
		else if (!strcmp(order, "end")) break;
		else continue;
	}

	return 0;
}

Measured memory_bytes: 4696
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 30000 + 10;
int N;
int P[MAXN], A[MAXN], B[MAXN], R[MAXN];

int main() {
	register int i;
	scanf("%d", &N);
	for(i = 1; i <= N; ++i)
		scanf("%d", P + i), R[P[i]] = i;
	for(i = 1; i <= N; ++i)
		A[i] = 30000 * i,
		B[i] = 30000 * (N - i) + R[i];
	for(i = 1; i <= N; ++i) printf("%d%c", A[i], " \n"[i == N]);
	for(i = 1; i <= N; ++i) printf("%d%c", B[i], " \n"[i == N]);
	return 0;
}

Measured memory_bytes: 896
// ABC171D - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	int N;
	cin >> N;
	map<int, int> A;
	ull sum = 0;
	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		++A[t];
		sum += (ull)t;
	}

	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int B, C;
		cin >> B >> C;

		map<int, int>::iterator it = A.find(B);
		if (it != A.end()) {
			int t = it->second;
			it = A.erase(it);
			A[C] += t;
			sum += (ull)(C - B) * t;
		}
		cout << sum << endl;

//		for (auto it = A.begin(); it != A.end(); ) {
//			if (it->first == B) {
//				int t = it->second;
//				it = A.erase(it);
//				A[C] += t;
//				sum = sum - B * t + C * t;
//			} else {
//				it++;
//			}
//		}
//		cout << sum << endl;
	}

	return 0;
}


Measured memory_bytes: 6556
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long LL;
int main()
{
	int N,i;
	cin>>N;
	set<pair<LL,LL>> P;
	set<pair<LL,LL>>::iterator sit; 
	LL x,y;
	for (i=0;i<N;i++){
		cin>>x>>y;
		P.insert(pair<LL,LL>(x,y));
	}
	vector<LL> X,Y;
	for (sit=P.begin();sit!=P.end();sit++){
		X.push_back((*sit).first);
		Y.push_back((*sit).second);
	}
	LL MaxD=0;
	N=X.size();
	if (N==1){
		cout<<0<<endl;
		return 0;
	}
	vector<LL> XYP(N),XYM(N);
	for (i=0;i<N;i++){
		XYP[i]=X[i]+Y[i];
		XYM[i]=X[i]-Y[i];
	}
	sort(XYP.begin(),XYP.end());
	sort(XYM.begin(),XYM.end());
	cout<<max(XYP[N-1]-XYP[0],XYM[N-1]-XYM[0])<<endl;
	return 0;
}

Measured memory_bytes: 21580
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,m,c,ans;

main(){
	cin>>n>>m;
	//int a[n],b[n];
	vpint v;
	rep(i,n){
		int s,t;
		cin>>s>>t;
		v.pb({s,t});
	}
	sort(all(v));
	int itr=0;
	for(int i=0;m;i++){
		int k=min(m,v[i].se);
		ans+=v[i].fi*k;
		m-=k;
	}
	dans;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	llong n;
	cin>>n;
	
	queue<int> que;
	while(n>0){
		int num=n%26;
		que.push(num);
		n/=26;
	}
	
	string ans="";
	bool jud=false;
	while(!que.empty()){
		int num=que.front();
		que.pop();
		debug(num);
		
		num--;
		if(jud){
			num--;
			if(num==-1 and que.empty()) break;
		}
		if(num<0){
			num+=26;
			jud=true;
		}else jud=false;
		
		ans+=char('a'+num);
	}
	reverse(ALL(ans));
	
	cout<<ans<<endl;
}

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

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 1e5 + 5;

int suffix_count[MAX_N + 5];

string s;
int n;

int main() {
	FAST_IO();
	
	cin >> s;
	n = s.length();
	
	int ans = n;

	REP(i, n-1) {
		if (s[i] != s[i+1]) {
			ans = min(ans, max(n - i - 1, i + 1));
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
# include <bits/stdc++.h>
using namespace std;
long long powerexp(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
int gcd(int a, int b)
{
    int c = a % b;
    while(c != 0)
    {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}
void PrintVector(vector<long long int> v,long long int n)
{
 
    for(int i=v.size()-1;i>=0;i--)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
void Takevector(vector<long long int> &v,long long int n)
{
  for(long long int i=0;i <n;i++)
  { long long int number;
    cin>>number;
    v.push_back(number);
  }
}
typedef long long int ll;
typedef vector<long long int> vi;
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define scl(x)         ll x;       scanf("%lld", &x);
#define scll(x, y)     ll x, y;    scanf("%lld %lld", &x, &y);
#define sclll(x, y, z) ll x, y, z; scanf("%lld %lld %lld", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
#define nl cout<<"\n";
int min(int x, int y)  
{  
    return (x < y)? x: y;  
      
}  
int main()
{
  scii(n,m);
  string s[n];
rep(i,0,n-1)
{
	cin>>s[i];
}  
// rep(i,0,n-1)
// {
// 	rep(j,0,m-1)
// 	{
// 		cout<<s[i][j];
// 	}
// 	cout<<endl;
// }
// rep(i,0,n-1)
// {
// 	rep(j,0,m-1)
// 	{
// 		if(s[i][j]=='.')
// 		{
// 			int cnt=0;
// 			if(i+1<n&&j+1<m&&s[i+1][j+1]=='#') cnt++;
// 			s[i][j]='0'+cnt;
// 		}
// 	}
// }


rep(i,0,n-1)
{
	rep(j,0,m-1)
	{
		if(s[i][j]=='.')
		{
			int cnt=0;
			if(i+1<n&&j+1<m&&s[i+1][j+1]=='#') cnt++;
			if(i+1<n&&j-1>=0&&s[i+1][j-1]=='#') cnt++;
			if(j-1>=0&&s[i][j-1]=='#') cnt++;
			if(j+1<m&&s[i][j+1]=='#') cnt++;
			if(i-1>=0&&s[i-1][j]=='#') cnt++;
			if(i-1>=0&&j+1<m&&s[i-1][j+1]=='#') cnt++;
			if(i-1>=0&&j-1>=0&&s[i-1][j-1]=='#') cnt++;
			if(i+1<n&&s[i+1][j]=='#') cnt++;
			s[i][j]='0'+cnt;
		}
	}
}
rep(i,0,n-1)
{
	cout<<s[i]<<endl;
}	

    return 0;
}

Measured memory_bytes: 256
mod=10**9+7
K=list(map(int,input().strip()))
d=int(input())
l=len(K)
DP=[[[0]*d for _ in range(2)] for _ in range(l+1)]
DP[0][0][0]=1
for i,k in enumerate(K):
    for less in range(2):
        if less:
            limit=9
        else:
            limit=k
        for m in range(d):
            for l in range(limit+1):
                DP[i+1][less or l<limit][(m+l)%d]+=DP[i][less][m]
                DP[i+1][less or l<limit][(m+l)%d]%=mod
print((DP[-1][0][0]+DP[-1][1][0]-1)%mod)

Measured memory_bytes: 63068
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int n,q,l[100000],r[100000],mes=0,count[100000];
  char s[100001];
  scanf("%d%d",&n,&q);
  scanf("%s",s);
  count[0]=0;
  for (int i=1;i<n;i++){
    if (s[i-1]=='A' && s[i]=='C') mes++;
    count[i]=mes;
  }
  for (int i=0;i<q;i++){
    scanf("%d%d",&l[i],&r[i]);
    printf("%d\n",count[r[i]-1]-count[l[i]-1]);
  }
  return 0;
}

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


int main(){
    ll n,w;
    cin>>n>>w;
    vector<ll>vw(n+1),vv(n+1);
    for(ll i = 1 ; i <=n ; i++){
        cin>>vw[i]>>vv[i];
    }
    ll ans=0;
    vector<vector<ll> >dp(1e5+1,vector<ll>(n+1,INT_MAX));
    dp[0][0]=0;
    for(ll j = 1 ;j <= n ; j++ ){
        for(ll i = 0 ; i <= 1e5 ; i++ ){
            if(i==0){
                dp[i][j]=0;continue;
            }
            if(vv[j]>i)dp[i][j]=dp[i][j-1];
            else {
                dp[i][j]=min(dp[i][j-1],dp[i-vv[j]][j-1]+vw[j]);
            }

            if(dp[i][j]<=w)ans=max(ans,i);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 85336
#include <bits/stdc++.h>
#include<algorithm>
#define ll long long
#define pb push_back
#define popb pop_back
#define ull unsigned long long 
#define beg begin
using namespace std;
 
int main(void) {
     ios::sync_with_stdio(0);
     int n , k , min_pos = 0; 
     cin >> n >> k ;
     int a[n] ;
     for(int i = 0 ; i < n ; i++)
     {
          cin >> a[i] ;
     }
     if(n==k)
     {
          cout << 1 ;
          return 0 ;
     }
     n = n - k ;
     int turns = 1 ;
     while(n>0)
     {
          n = n - k + 1 ;
          turns++ ;
     }
     cout << turns ;

}

Measured memory_bytes: 640
let () =
  let n = read_int () in
  let rec doit i m ans =
    if i >= n then ans
    else let r = read_int () in doit (i + 1) (min m r) (max ans (r - m))
  in
  Printf.printf "%d\n" (doit 1 (read_int ()) min_int)

Measured memory_bytes: 4464
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(a*b,c)<<endl;
    
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
}

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

int compare_int (const void *a, const void *b){
  return *(int*)a- *(int*)b;
}



int main(void){

  int x; //scan input
  int y; //temp holder
  int i,j; //loop counter
  int counter=0;
  int counter2=0;
  int expind[30];

  //initialize array
  for (i=0; i<30; i++){
    expind[i]=0;
  }

  //input
  scanf("%d",&x);

  //count number of exponential 
  for (i=2; i<32 ; i++){
    y=0;
    j=2;
    while (y<=1000){
      y=(int)(pow((double)i,(double)j)+0.5);
      j=j+1;
      counter=counter+1;
    }
    expind[i-2]=j-1;
    counter=counter-1;
  }

  counter=counter+1;
  //allocate memory

  int *array;

  array=(int *)malloc(sizeof(int)*counter);

  //initialize
  for (i=0; i<counter; i++){
    array[i]=0;
  }
  array[counter-1]=1001;


  for (i=2; i<32; i++){
   for (j=2; j<expind[i-2]; j++){
     array[counter2]=(int)(pow((double)i,(double)j)+0.5);
     counter2=counter2+1;
   }
  }


  //sort array
  qsort(array,counter,sizeof(int), compare_int);



  //check
  if (x<4){
    printf("1\n");
  }else{
    counter2=0;
    y=0;
    while(array[counter2]<=x){
      counter2=counter2+1;
    }
    printf("%d\n",array[counter2-1]);
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

int main(){
  int n, m; cin >> n >> m;
  vector<vector<int>> s(m);
  vector<int> p(m);
  rep(i, m){
    int k;
    cin >> k;
    s[i].resize(k);
    rep(j, k){
      cin >> s[i][j];
      s[i][j]--;
    }
  }
  rep(i, m) cin >> p[i];

  int res = 0;
  for (int bit = 0; bit < (1<<n); ++bit){
    vector<int> on_sw(n, 0);
    for (int i = 0; i < n; ++i){
      if (bit & (1<<i)) on_sw[i] = 1;
    }
    int num_on_total = 0;
    rep(i, m){
      int num_on = 0;
      rep(j, s[i].size()){
        if (on_sw[s[i][j]] == 1) num_on++;
      }
      if (num_on % 2 == p[i]) num_on_total++;
    }
    if (num_on_total == m) res++;
  }
  cout << res << endl;
}


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

int main() {
  int n,m; cin >> n >> m;
  vector<vector<int>> ab(2,vector<int>(n));
  vector<vector<int>> cd(2,vector<int>(m));
  for(int i=0; i<n; i++){
    cin >> ab[0][i] >> ab[1][i];
  }
  for(int i=0; i<m; i++){
    cin >> cd[0][i] >> cd[1][i];
  }
  
  vector<int> ans(n);
  for(int i=0; i<n; i++){
    int x,y,d;
    x = ab[0][i] - cd[0][0]; if(x<0) x*=(-1);
    y = ab[1][i] - cd[1][0]; if(y<0) y*=(-1);
    d = x+y;
    ans[i] = 0;
    
    for(int j=1; j<m; j++){
      x = ab[0][i] - cd[0][j]; if(x<0) x*=(-1);
      y = ab[1][i] - cd[1][j]; if(y<0) y*=(-1);
      if(x+y < d){
        d = x+y;
        ans[i] = j;
      }
    }
    cout << ans[i] + 1 << endl;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    s = list(input())

    result = [s[0]]
    for i in range(1, n):
        if s[i] != result[-1]:
            result.append(s[i])

    print(len(result))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4652
from collections import deque
s = input()
q = int(input())

li = [input() for i in range(q)]
k = 0
ans = [s]
ans = deque(ans)

for i in li:
    if i == "1":
        k += 1
    else:
        if (int(i[2]) + k) % 2 == 0:
            ans.append(i[4])
        else:
            ans.appendleft(i[4])

ans = list(ans)
s = "".join(ans)
if k % 2 == 0:
    print(s)
else:
    print(s[::-1])

Measured memory_bytes: 19548
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define elif else if
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    ll a, b; cin >> a >> b;
    ll x = 0;
    if (a & 1)x ^= --a;
    if (~b & 1)x ^= ++b;
    print(x ^ ((b - a + 1 >> 1) & 1));

    return 0;
}

Measured memory_bytes: 3612
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m; readV(n, m);
  struct C { int p, y, i, b; }
  auto c = new C[](m);
  foreach (i; 0..m) {
    int p, y; readV(p, y);
    c[i] = C(p, y, i, 0);
  }

  c.sort!"a.y<b.y";

  auto b = new int[](n+1);
  foreach (ref ci; c) ci.b = ++b[ci.p];

  c.sort!"a.i<b.i";

  foreach (ci; c)
    writefln("%06d%06d", ci.p, ci.b);
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int num = 1;
  
  for (int i=0;i<N;i++){
    if (num+K > num*2){
      num *= 2;
    }
    else{
      num += K;
    }
  }
  cout << num << endl;
}


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

#define INF (1<<28)

int t[1000*1000+1];
int ot[1000*1000+1];

void init() {
    fill(t, t+1000*1000+1, INF);
    fill(ot, ot+1000*1000+1, INF);
    for (int i = 1; ; i++) {
        int n = i * (i+1) * (i+2) / 6;
        if (n > 1000*1000) break;
        t[n] = 1;
        if (n % 2) ot[n] = 1;
    }

    for (int i = 1; i <= 1000*1000; i++) {
        for (int j = 1; ; j++) {
            int p = j * (j+1) * (j+2) / 6;
            if (i <= p) break;
            t[i] = min(t[i], t[i-p] + 1);
            if (p % 2) ot[i] = min(ot[i], ot[i-p] + 1);
        }
    }
}

int main() {
    init();
    int n;
    while (scanf("%d", &n), n) {
        printf("%d %d\n", t[n], ot[n]);
    }
    return 0;
}

Measured memory_bytes: 8840
from collections import deque
h,w=map(int,input().split())
S=[input() for _ in range(h)]
inf=float("inf")
ans=0
for i in range(h):
   for j in range(w):
      if S[i][j]=="#":
         continue
      else:
         D=[[inf for _ in range(w)]for _ in range(h)]
         D[i][j]=0
         que=deque([(i,j)])
         while que:
            si,sj=que.popleft()
            for ni,nj in [(si+1,sj),(si-1,sj),(si,sj+1),(si,sj-1)]:
               if 0<=ni<h and 0<=nj<w and S[ni][nj]!="#":
                  if D[ni][nj]>D[si][sj]+1:
                     D[ni][nj]=D[si][sj]+1
                     que.append((ni,nj))
                     ans=max(ans,D[si][sj]+1)
print(ans)
   



Measured memory_bytes: 48476
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;

int this_max =0;

void dfs(long long sum,long long k,int an,int bn,long long  a[],long long  b[],int num){
  if(sum>k){
    if( this_max < (num-1) ) this_max=num-1;
    return;
  }
  dfs(sum+a[an],k,an+1,bn,a,b,num+1);
  dfs(sum+b[bn],k,an,bn+1,a,b,num+1);
}
int bs(long long a[],int key,int n){
  long long l = 0,r=n,mid;
  while(l<r){
    mid = (l + r)/2;
    if(r-l<=1)return mid;
    else if (key < a[mid]) {
       r = mid;
    } 
    else if (a[mid] < key) {
      l = mid + 1;
    }
  }
  return -1;

}
int main(){
  int n,m;
  long long k;
  cin>> n >> m >>k ;
  long long a[n],b[m],sum;
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  //dfs(0,k,0,0,a,b,0);
  sum=b[0];
  rep(i,m-1)sum+=b[i+1];
  int j = m;
  rep(i,n+1){
    while(j>0&&sum>k){
      j--;
      sum -= b[j];
    }
    if(sum>k)break;
    this_max  = max(this_max,i+j);
    if(i==n)break;
    sum += a[i];
  }
  cout<<this_max<<endl;
  return 0;
}


Measured memory_bytes: 6768
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 2 * (1e5 + 5);

int main()
{
    fastio;
    ll i, j, k, t, n, m,a,b,c;

    cin>>a>>b>>c;

    cin>>k;

    n=pow(2,k);

    ll z=0;
    while (b<=a)
    {
        b*=2;
        z++;
    }
    while (c<=b)
    {
        c*=2;
        z++;
    }
    if(z>k)
    cout<<"No"<<endl;
    else 
    {
        cout<<"Yes"<<endl;
    }
    
    
    

    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int ans = 0;
	if(a < 0) ans += abs(a) * c, a = 0;
	if(a == 0) ans += d;
	ans += e * (b-a);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
 main()
 {
 	int a,b;
 	cin>>a>>b;
 	if(b%a==0)
 	{
 		cout<<a+b;
 	}
 	else
 	{
 		cout<<b-a;
 	}
   return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
	operator int() const noexcept { return to; }
};

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T>
struct SCC{
	T g;
	Graph G,rG,nG;
	vector<vector<int>> scc;
	vector<int> cmp,used,vs;

	int operator[](int i) const{ return cmp[i]; }
	
	SCC(T g) : g(g),G(g.size()),rG(g.size()),cmp(g.size(),-1),used(g.size()){
		for(int i = 0;i < g.size();i++){
			for(const auto &e : g[i]){
				G[i].push_back((int)e);
				rG[(int)e].push_back(i);
			}
		}
	}

	void dfs(int v){
		used[v] = true;
		for(int to : G[v]) if(!used[to]) dfs(to);
		vs.push_back(v);
	}

	void rdfs(int v,int cnt){
		scc[cnt].push_back(v);
		cmp[v] = cnt;
		for(int to : rG[v]) if(cmp[to] == -1) rdfs(to,cnt);
	}

	void build(){
		int n = g.size(),cnt = 0;
		for(int i = 0;i < n;i++) if(!used[i]) dfs(i);
		reverse(vs.begin(),vs.end());
		for(int v : vs){
			if(cmp[v] == -1){
				scc.emplace_back();
				rdfs(v,cnt++);
			}
		}
		nG.resize(cnt);
		for(int i = 0;i < n;i++){
			for(const auto &e : g[i]){
				int u = cmp[i],v = cmp[(int)e];
				if(u != v) nG[u].push_back(v);
			}
		}
		for(int i = 0;i < cnt;i++){
			sort(nG[i].begin(),nG[i].end());
			nG[i].erase(unique(nG[i].begin(),nG[i].end()),nG[i].end());
		}
	}
};

int n;

void solve(){
	Graph G(n);
	double p[110];
	for(int i = 0;i < n;i++){
		int m;
		cin >> p[i] >> m;
		for(int j = 0;j < m;j++){
			int a;
			cin >> a; a--;
			G[i].push_back(a);
		}
	}
	SCC<Graph> scc(G);
	scc.build();
	int in[110] = {};
	for(int i = 0;i < scc.nG.size();i++){
		for(int to : scc.nG[i]) in[to]++;
	}
	double ans = 1;
	for(int i = 0;i < scc.nG.size();i++){
		if(!in[i]){
			double tmp = 1;
			for(int v : scc.scc[i]) tmp *= p[v];
			ans *= 1.0 - tmp;
		}
	}
	printf("%.14lf\n",ans);
}

signed main(){
	while(cin >> n,n) solve();
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;
    cin >> n;
  ll x[n];
  string ans = "Yes";
    for(int i=0; i<n; i++) cin >> x[i];

    for(int i=1; i<n-1; i++){
      if(x[i-1]<x[i]) x[i] -= 1;
      if(x[i+1]<x[i]){
        ans = "No";
        break;
      }

    }
    cout << ans << endl;


}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cnt;
  cin>>cnt;
  while(cnt--){
    string a,b;
    cin>>a>>b;
    int dp[1000][1000]={};
    for(int i=0;i<b.size();i++){
      int nm=0;
      for(int j=0;j<a.size();j++){
	if(a[j]==b[i])dp[i][j]=nm+1;
	if(i){
	  dp[i][j]=max(dp[i][j],dp[i-1][j]);
	  nm=max(nm,dp[i-1][j]);
	}
      }
    }
    int ans=0;
    for(int i=0;i<a.size();i++)ans=max(ans,dp[b.size()-1][i]);
    cout<<ans<<endl;
   
  }
  
  return 0;
}

Measured memory_bytes: 7048
#include <iostream>
#include <string>
#include <vector>

using namespace std;


bool kaibun(string s){
   int size = s.length();
   bool flag = true;
   for(int i = 0; i < int(size/2); ++i){
      if (s[i] != s[size-i-1]){
         flag = false;
      }
   }
   return flag;
}

int main(){
   string S, S1, S2;
   cin >> S;
   int size = S.length();
   S1 = S.substr(0, int((size-1)/2));
   S2 = S.substr(int((size+1)/2), size);
   // cout << S << endl;
   // cout << S1 << endl;
   // cout << S2 << endl;

   kaibun(S);

   if (kaibun(S) && kaibun(S1) && kaibun(S2)){
      cout << "Yes" << endl;
   }
   else{
      cout << "No" << endl;
   }

   return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, Q; std::cin >> N >> Q;
  std::string S; std::cin >> S;

  std::string ts, ds;
  for (int i = 0; i < Q; ++i) {
    char t, d; std::cin >> t >> d;
    ts += t; ds += d;
  }

  int l = 0, r = N - 1;
  for (int i = Q - 1; i >= 0; --i) {
    if (ds[i] == 'L') {
      if (ts[i] == S[l]) ++l;
      if (r < N - 1 && ts[i] == S[r+1]) ++r;
    } else {
      if (l > 0 && ts[i] == S[l-1]) --l;
      if (ts[i] == S[r]) --r;
    }
  }

  std::cout << std::max(0, r - l + 1) << std::endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

static int
search(int *arr, int size, int e) {
  int lower, upper, i;

  for (lower = 0, upper = size - 1, i = (lower + upper) / 2; lower <= upper; i = (lower + upper) / 2) {
    if (e == arr[i]) return 1;
    if (e > arr[i]) {
      lower = i + 1;
    } else {
      upper = i - 1;
    }
  }
  return 0;
}

int main(int argc, char **argv) {
  int n, q, i, e, cnt, ret;
  int s[100001];

  ret = fscanf(stdin, "%d", &n);
  if (errno != 0) perror("fscanf");
  if (ret < 1) exit(1);

  for (i = 0; i < n; ++i) {
    ret = fscanf(stdin, "%d", &s[i]);
    if (errno != 0) perror("fscanf");
    if (ret < 1) break;
  }

  ret = fscanf(stdin, "%d", &q);
  if (errno != 0) perror("fscanf");
  if (ret < 1) exit(1);

  for (cnt = 0; q > 0; --q) {
    ret = fscanf(stdin, "%d", &e);
    if (errno != 0) perror("fscanf");
    if (ret < 1) break;
    if (search(s, n, e)) ++cnt;
  }

  printf("%d\n", cnt);
  exit(0);
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    int n; cin>>n;
    int a[n];
    int sum=0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        sum += a[i];
    }
    ll ans=0;
    for(int i=0; i<n; i++){
        ans += 1ll*(sum-a[i])*a[i];
    }
    cout<<ans/2<<"\n";
}

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

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
    int N;
    cin >> N;
    vector<int> A;

    for (int i = 0; i < N; i++) {
       int x;
       cin >> x;
       A.push_back(x);
    }

    // index 0 の時
    cout << A[0];
    for (int i = 1; i < N; i++) {
        cout << " " << A[i];
    }
    cout  << endl;

    for (int i = 1; i <= N - 1; i++) {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;

        // index 1 以降の時
        cout << A[0];
        for (int i = 1; i < N; i++) {
            cout << " " << A[i];
        }
        cout  << endl;
    }

}


Measured memory_bytes: 3140
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main() {
  int N;
  cin >> N;
  vector<LL> b(N);
  vector<LL> a(N);

  REP(i,N){
    cin >> a[i];

    b[i] = a[i];
  }

  SORT(b);

  LL c1 = b[N / 2];
  LL c2 = b[N / 2-1];

  REP(i,N){
    if(a[i]<=c2){
      cout << c1 << endl;
    }else{
      cout << c2 << endl;
    }
  }
}


Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int A[] = new int[n];
		for(int i = 0;i < n;i++)A[i] = scan.nextInt();

		boolean dp[][] = new boolean[n+1][2001];
		for(int i = 0;i < n;i++)
			for(int j = 0;j <= 2000;j++)dp[i][j] = false;
		dp[0][0] = true;

		for(int j = 0;j <= 2000;j++) {
			for(int i = 0;i < n;i++) {
				dp[i+1][j] = j >= A[i] ? (dp[i][j - A[i]] || dp[i][j]) : dp[i][j];
			}
		}

		int q = scan.nextInt();
		for(int i = 0;i < q;i++) {
			int m = scan.nextInt();
			if(dp[n][m])System.out.println("yes");
			else System.out.println("no");
		}


		scan.close();
	}

}



Measured memory_bytes: 26644
class BellmanFord:
    INF = int(1e18)
    N = -1
    edge = []
    
    def __init__(self, N):
        self.N = N
        
    def add_edge(self, frm, to, cost):
        self.edge.append((frm, to, cost));
        
    def add_bi_edge(self, a, b, cost):
        self.add_edge(a, b, cost)
        self.add_edge(b, a, cost)
    
    def calcD(self, start):
        D = [self.INF] * self.N
        D[start] = 0
        update, cnt = True, 0
        flag = False
        while update:
            cnt = cnt + 1
            if cnt > self.N:
                return D if flag == False else 'NegativeCycle'
            update = False
            flag = False
            
            for frm, to, cost in self.edge:
                ncost = D[frm] + cost
                if D[frm] == self.INF or ncost >= D[to]:
                    continue
                D[to] = ncost
                update = True
                flag = flag | (to == self.N-1)
                
        return D

    
V, E = list(map(int, input().split()))
bf = BellmanFord(V)
for i in range(E):
    frm, to, cost = list(map(int, input().split()))
    bf.add_edge(frm - 1, to - 1, -cost)
    

ans = bf.calcD(0)
if ans == 'NegativeCycle':
    print("inf")
else:
    print(-ans[V-1])



Measured memory_bytes: 3316
#include"bits/stdc++.h"
using namespace std;
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b&&a!=c)||(b==c&&b!=a)||(c!=b&&c==a)){
    cout<<"Yes";
    return 0;
  }
  else{
    cout<<"No";
    return 0;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)
ll mod=1e9+7;

//cf dont use unordered map. use simply map<... , ... > m;

//They are Iterator minus v.begin() krna //lower_bound(v.begin(),v.end(),x)-v.begin()  //upper_bound(v.begin(),v.end(),x)-v.begin()
// lower bound tells greater than or equal to // upper bound tells strictly greater than
//int a[1001][1001] //aise global me hi// ll lcm(ll a, ll b){ return a / __gcd(a, b) * b; }
//memset can initialize to 0 or -1 ONLY //memset(str, 't', sizeof(str)); // string //memset(a, 0, sizeof(a));  //1D array    // memset(a,0,sizeof(a[0][0])*n*n); //2D array
// set.insert(),find() //for(auto it=set.begin();....) cout<<*it;   // sort(v.begin(),v.end(),compare)

void solve()
{

    cout << fixed << setprecision(2);
    int t;cin>>t;
    cout<<2*3.14157*t;
    

}

int main()
{

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

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


Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>

using namespace std;

int main()
{
	long N;
	long ans = LONG_MAX;
	cin >> N;

	vector<int> A(N);
	vector<long> subSum(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];

		if (i > 0)
			subSum[i] = subSum[i - 1] + A[i];
		else
			subSum[i] = A[i];
	}

	long sum = subSum[N - 1];
	for (int i = 0; i < N - 1; i++)
	{
		long num = abs(subSum[i] - (sum - subSum[i]));
		if (ans > num)
			ans = num;
	}

	cout << ans << endl;

	return 0;
}


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

int main ()
{
    int n;
    cin>>n;
    int a;
    deque<int>b;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        int it= lower_bound(b.begin(),b.end(),a)-b.begin();
        if(!it)
            b.push_front(a);
        else
            b[it-1]=a;
    }
    cout<<b.size()<<endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
set<char>s;
map<char,int>mp;
long long int a[3000000];
int main(){

 long long int n,k,m,i,c=1,x,y,z  ;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    x=a[1];
    for(i=2;i<=n;i++)
    {
        if(a[i]<=x)
        {
            c++;
        }
         x=min(x,a[i]);
    }
    cout<<c;
   return 0;

}

Measured memory_bytes: 5092