akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

ll a[N];
int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int n,m;
        Int(n,m);

        ll k,sum=0;

        for(int i=1;i<=n;++i){
            Int(a[i]);

           sum+=a[i];
        }
        k=sum/(4*m);
        int c=0;
        for(int i=1;i<=n;++i){
            if(a[i]*4*m >=sum){
                ++c;
            }
        }
        if(c>=m){
           printf("Yes\n"); 
        }
        else{
            printf("No\n");
        }
        

        //printf("Case %d: ",++te);
    }
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dPCD1
{
    class Program
    {
        static void Main(string[] args)
        {
            long ans=0L;
            List<long> divisor = new List<long>();
            long N = long.Parse(Console.ReadLine());
            if (N < 3)
            {
                Console.WriteLine(0);
            }else  if (N == 3)
            {
                Console.WriteLine(2);
            }
            else
            {
                for (long i = 2; i <= Math.Sqrt(N); i++) //約数のうち2以上のものを求める
                {
                    if (N % i == 0)
                    {
                        divisor.Add(i);
                        divisor.Add(N / i);
                    }
                }
                divisor.Add(N);

                divisor = divisor.Distinct().ToList();//重複した数を削除した
                foreach (long item in divisor)
                {
                    if (N/(item-1)==N%(item-1))//条件に合うなら、答えに足し込む
                    {
                        ans+=(item-1);
                    }
                }
                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 13276
#include<stdio.h>

int main(void){
  int N,X,T;
  int i=0;
  int cnt=0;
  scanf("%d %d %d",&N,&X,&T);
  
  for(i=X;i<N;i=i+X){
    cnt++;
  }
  cnt++;
  printf("%d",cnt*T);
  
  return 0;
}

Measured memory_bytes: 1680
A, B, K = [int(num) for num in input().split()]
M, m = max(A, B), min(A, B)
yakusu = []
koyakusu = []
for i in range(1, m+1):
  if m % i == 0:
    yakusu.append(i)
  else:
    continue
for j in yakusu:
  if M % j == 0:
    koyakusu.append(j)
print(koyakusu[-K])
    
  

Measured memory_bytes: 3060
#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(){
	ll n;
	cin >> n;
	ll n0 = n;
	int k = 0;
	while(n0 != 0){
		n0 /= 10;
		k++;
	}
	ll ans = 0;
	int t = pow(4, 3);
	vector<int> b(4);
	b.at(0) = 0;
	b.at(1) = 3;
	b.at(2) = 5;
	b.at(3) = 7;
	for(int i=0; i>=0; i++){
		int n1 = i;
		vector<int> a(4);
		rep(i, 4) a.at(i) = 0;
		ll kl = 0;
		rep(i, k+1){
			a.at(n1%4)++;
			kl += b.at(n1%4)*pow(10, i);
			n1 /= 4;
			if(n1 == 0) break;
		}
		if(kl > n) break;
		int f = 0;
		if(a.at(0) != 0) f = 1;
		rep(i, 3) if(a.at(i+1) == 0) f = 1;
		if(f == 0) ans++;
/*		rep(i, 4) cout << a.at(i) << ' ';
		cout << ':' << kl << ' ' << f;
		cout << endl;
*/	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,m=0;string S;cin>>N>>S;
  for(int i=1;i<S.size()-1;i++){
    string X=S.substr(0,i),Y=S.substr(i);
    int c=0;
    for(char z='a';z<='z';z++){
      if(count(X.begin(),X.end(),z)*count(Y.begin(),Y.end(),z)!=0)c++;
    }
    m=max(c,m);
  }
  cout<<m<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n,d;
ll g[15][15];
ll ans;
int main(){FAST;
cin>>n>>d;
for(ll i=0;i<n;i++){
	for(ll j=0;j<d;j++){
		cin>>g[i][j];
	}
}
for(ll i=0;i<n;i++){
	for(ll j=i+1;j<n;j++){
		ll dis = 0;
		for(ll k =0 ;k<d;k++){
			dis+=(g[i][k]-g[j][k])*(g[i][k]-g[j][k]);
		}	
		ll ok = sqrtl(dis);
		if(ok*ok == dis){
			ans++;
		}
	}
}
cout<<ans;
return 0;
}

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

void solve(long long W, long long a, long long b){
    int ans = 0;
    if (a <= b) {
        if (a + W >= b) ans = 0;
        else ans = b - (a + W);
    } else {
        if (b + W >= a) ans = 0;
        else ans = a - (b + W);
    }
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long W;
    scanf("%lld",&W);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(W, a, b);
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()
max = 0

for i in range(1,N):
    dicl = {}
    dicr = {}
    for j in range(i):
        dicl[S[j]] = j
    for j in range(i,N):
        if(S[j] in dicl.keys()):
            dicr[S[j]] = j
    if len(dicr.keys()) > max:
        max = len(dicr.keys())
print(max)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll x=in();
    vector<ll>pp5(1000);for(ll i=0;i<1000;++i)pp5[i]=i*i*i*i*i;
    vector<ll>mp5(1000);for(ll i=1;i<=1000;++i)mp5[1000-i]=-(i*i*i*i*i);
    for(ll a=0;a<1000;++a){
        auto bp5=a*a*a*a*a-x;
        if(auto itr=lower_bound(pp5.begin(),pp5.end(),bp5);itr!=pp5.end()&&*itr==bp5){
            cout<<a<<' '<<itr-pp5.begin()<<endl;
            break;
        }
        if(auto itr=lower_bound(mp5.begin(),mp5.end(),bp5);itr!=mp5.end()&&*itr==bp5){
            cout<<a<<" -"<<mp5.end()-itr<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
int oldx[200050];
struct node
{
        int num;
        int i;
};
int cmp (node a, node b)
{
        return (a.num>b.num);
}
int main ()
{
        int N,l;
        node x[200050];

        while(cin>>N)
        {
                l=N/2;
                for(int i=1;i<=N;i++)
                {
                        scanf("%d",&x[i].num);
                        oldx[i]=x[i].num;
                        x[i].i=i;
                }
                sort(x+1,x+N+1,cmp);
//                for(int i=1;i<=N;i++)
//                {
//                        cout<<x[i].num<<" "<<x[i].i<<endl;
//                }
                for(int i=1;i<=N;i++)
                {


                        if(oldx[i]<x[l].num && x[l].i != i)
                        {
                                cout<<x[l].num<<endl;
                        }
                        else
                        {
                                cout<<x[l+1].num<<endl;
                        }
                }

        }

}


Measured memory_bytes: 4480
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  ll x,a,b;
  cin >> x >> a >> b;
  if(b <= a)
    cout << "delicious" << endl;
  else if(b <= a+x)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque, defaultdict


def bfs01(s, t, links):
    q = deque([(0, s, -1)])  # cost, station, last-company
    visited = set()
    while q:
        d, v, e = q.popleft()
        if v == t:
            return d
        if (v, e) in visited:
            continue
        visited.add((v, e))
        if e == 0:
            for c in links[v]:
                for u in links[v][c]:
                    if (u, c) in visited:
                        continue
                    q.append((d + 1, u, c))
        else:
            for u in links[v][e]:
                if (u, e) in visited:
                    continue
                q.appendleft((d, u, e))
            if (v, 0) not in visited:
                q.appendleft((d, v, 0))

    return -1


readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

n, m = map(int, readline().split())
links = [defaultdict(set) for _ in range(n)]
pqc = list(map(int, read().split()))
for p, q, c in zip(pqc[0::3], pqc[1::3], pqc[2::3]):
    p -= 1
    q -= 1
    links[p][c].add(q)
    links[q][c].add(p)

print(bfs01(0, n - 1, links))


Measured memory_bytes: 216480
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;
int main(){
    int n;
    string s; 
    cin>>n>>s;
    int *a=new int[n];
    int x=0,ans=0;
    for (int i=0;i<n;++i){
        a[i]=s[i]-'1';
        x|=(a[i]==1);
    }
    for (int i=0;i<n;++i) if (((n-1)&i)==i) ans^=(x?a[i]%2:a[i]/2);
    cout << ans*(x?1:2) << '\n';
    delete a;
    return 0;
}

Measured memory_bytes: 5252
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;

string rev(string s) {
    string ret = "";
    for (int i=0; i<(int)s.size(); ++i) {
        ret = s[i] + ret;
    }
    return ret;
}

int main() {
    int m;
    cin >> m;
    while (m--) {
        string s; cin >> s;
        set<string> st;
        st.insert(s);
        for (int i=1; i<(int)s.size(); ++i) {
            string s1, s2, s3, s4;
            s1 = s.substr(0,i);
            s2 = s.substr(i);
            s3 = rev(s1);
            s4 = rev(s2);
            st.insert(s3 + s2);
            st.insert(s1 + s4);
            st.insert(s3 + s4);
            st.insert(s2 + s1);
            st.insert(s4 + s1);
            st.insert(s2 + s3);
            st.insert(s4 + s3);
        }
        cout << st.size() << endl;
    }
    return 0;
}

Measured memory_bytes: 1300
# include <cstdio>

using namespace std;

int a,b,c;

int main()
{
	scanf("%1d%1d%1d",&a,&b,&c);
	if(a*100+b*10+c<=a*111) printf("%d",a*111);
    else printf("%d",(a+1)*111);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define sll set<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define fo(i,n) for(i=0;i<n;i++)
using namespace std;

sll v[200001];
int main()
{
    ios::sync_with_stdio(false);
    #ifdef UJJWAL_HOME
        freopen("000.txt","r",stdin);
    #endif // UJJWAL_HOME

    ll n,i,j,k,t,q,m,a,b;


    cin>>n>>m;

    fo(i,m)
    {
        cin>>a>>b;
        v[a].insert(b);
        v[b].insert(a);
    }

    for(auto c:v[1])
    {
        if(v[c].find(n)!=v[c].end())
        {
            cout<<"POSSIBLE";
            return 0;
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}


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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string S;
	cin >> S;
	int width; width = S.size();
	int counter = 0; int n = 0;
	
	for (int i = 0; i < width; i++){
		 if (S.at(i) == 'W') {
			 counter = counter + n;
		 }
		 else {
			 n++;
		 }
	 }
	 
	 cout << counter << endl;
}


Measured memory_bytes: 720
#include <iostream>
using namespace std;
#include <algorithm>
#include <math.h>
#include <stdio.h>
int main(void){
    long long a,b,c,i,j,k,y,z,n,m;
    scanf("%lld%lld",&n,&c);
    long long x[n],v[n];
    for(i=0;i<n;i++){
        scanf("%lld%lld",&x[i],&v[i]);
    }
    long long s[n+1],t[n+1];
    s[0]=0;
    for(i=0;i<n;i++){
        s[i+1]=s[i]+v[i];
    }
    y=0;
    for(i=0;i<n;i++){
        z=s[i+1]-x[i];
        if(y<z)y=z;
    }
    t[0]=0;
    for(i=0;i<n;i++){
        t[i+1]=t[i]+v[n-1-i];
    }
    for(i=0;i<n;i++){
        z=t[i+1]-(c-x[n-1-i]);
        if(y<z)y=z;
    }
    long long ss[n+1],tt[n+1];
    ss[0]=0;tt[0]=0;
    for(i=0;i<n;i++){
        ss[i+1]=s[i+1]-x[i];
        tt[i+1]=t[i+1]-(c-x[n-1-i]);
    }
    z=0;
    for(i=0;i<=n;i++){
        if(z<ss[i])z=ss[i];
        if(ss[i]<z)ss[i]=z;
    }
    z=0;
    for(i=0;i<=n;i++){
        if(z<tt[i])z=tt[i];
        if(tt[i]<z)tt[i]=z;
    }
    for(i=0;i<n;i++){
        z=s[i+1]-2*x[i]+tt[n-i-1];
        if(y<z)y=z;
    }
    for(i=0;i<n;i++){
        z=t[i+1]-2*(c-x[n-i-1])+ss[n-i-1];
        if(y<z)y=z;
    }
    printf("%lld\n",y);
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;

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

int h,w;
string s[22];
int dist[22][22];
int res=0;
void bfs(int sy,int sx){
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dist[i][j]=-1;
        }
    }
    dist[sy][sx]=0;
    queue<pair<int,int>> Q;
    Q.push(make_pair(sy,sx));
    while(!Q.empty()){
        auto A=Q.front();
        Q.pop();
        int y=A.first;
        int x=A.second;
        for(int i=0;i<4;i++){
            int ny=y+dy[i];
            int nx=x+dx[i];
            if(ny<0||nx<0||ny>=h||nx>=w)continue;
            if(s[ny][nx]=='#')continue;
            if(dist[ny][nx]!=-1)continue;
            dist[ny][nx]=dist[y][x]+1;
            Q.push(make_pair(ny,nx));
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            res=max(res,dist[i][j]);
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>h>>w;
    for(int i=0;i<h;i++) cin>>s[i];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='.')bfs(i,j);
        }
    }
    cout<<res<<endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<pair<int, int>> tmp;
    for (int i=1; i<N+1; i++)
    {
        int x;
        cin >> x;
        tmp.push_back(make_pair(x, i));
    }
    
    sort(tmp.begin(), tmp.end());


    for(int i=0; i<N; i++)
    {
        cout << tmp[i].second << (i==N-1 ? "\n" : " ");
    }
}


Measured memory_bytes: 1780
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>

using namespace std;

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

	int N, M;
	int X, Y;
	cin >> N >> M >> X >> Y;

	int x[100];
	int y[100];
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> y[i];
	}

	int minv = 1000;
	int maxv = -1000;
	
	for (int i = 0; i < N; i++) {
		if (x[i] > maxv) {
			maxv = x[i];
		}
	}
	for (int i = 0; i < M; i++) {
		if (y[i] < minv) {
			minv = y[i];
		}
	}

	if (minv > X && minv <= Y) {
		if (maxv > X && maxv <= Y) {
			if (maxv < minv) {
				cout << "No War" << endl;
				return 0;
			}
		}
	}
	cout << "War" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define ll long long
using namespace std;
ll ch[26];
ll nex[200010];
ll visited[200010];
ll seg[800000];
ll update(ll pos, ll val, ll node, ll x, ll y) {
	if (pos < x || y < pos)return seg[node];
	if (x == y)return seg[node]= val;
	ll mid = (x + y)/2;
	return seg[node] = update(pos, val, node * 2, x, mid) + update(pos, val, node * 2 + 1, mid + 1, y);
}
ll query(ll lo, ll hi, ll node, ll x, ll y)
{
	if (hi < x || y < lo)return 0;
	if (lo <= x&&y <= hi)return seg[node];
	ll mid = (x + y) / 2;
	return query(lo, hi, node * 2, x, mid) + query(lo, hi, node * 2 + 1, mid + 1, y);
}
int main() {
	string a;
	cin >> a;
	int t = a.size();
	for (int i = 0; i < t; i++)
		ch[a[i] - 'a']++;
	ll cnt = 0;
	ll dap = 0;
	for (int i = 0; i < 26; i++)
	{
		if (ch[i] % 2) {
			cnt++;
		}
	}
	if (cnt >= 2)
	{
		puts("-1");
		return 0;
	}
	for (int i = 0; i < 26; i++)
	{
		ll le = 0;
		ll ri = t - 1;
		while (1)
		{
			if (le >= ri)break;
			if (a[le] - 'a' != i)
				le++;
			else if (a[ri] - 'a' != i)
				ri--;
			else if (i == a[ri] - 'a'&&a[le]-'a'==i)
			{
				nex[le] = ri;
				le++; ri--;
			}
		}
	}
	for (int i = 0; i < t; i++)
		update(i, 1, 1, 0, t - 1);
	ll ooo = 0;
	ll upda = 0;
	for (int i = 0; i <t; i++)
	{
		if (visited[i])continue;
		ooo++;
		ll oo = nex[i];
		if (!oo) {
			upda = 1;
			continue;
		}
		visited[oo] = 1;
		ll gap = 0;
		if (upda)dap++;
		//cout << oo << " ";	
		if (oo + 1 <= t - 1) {
			gap = query(oo + 1, t - 1, 1, 0, t - 1);
		}
		dap += gap;
		update(oo, 0, 1, 0, t - 1);
		update(i, 0, 1, 0, t - 1);
	}
	cout <<dap;
}

Measured memory_bytes: 9348
#include <cstdio>

int c1,c5,c10,c50,c100,c500;

signed main()
{
    scanf( "%d %d %d %d %d %d\n", &c1, &c5, &c10, &c50, &c100, &c500 );
    int sum = c1 * 1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;
    if( 1000 <= sum )
    {
        printf( "%d\n", 1 );
    }else
    {
        printf( "%d\n", 0 );
    }
    return 0;
}


Measured memory_bytes: 2684
#include<bits/stdc++.h>
#include<cstdlib>
#define inf INT_MAX
using namespace std;
int main(){
int n,k;
cin>>n;
int a[n+1];
for(int i=0;i<n;i++)
{
    cin>>a[i];
}
k=2;
long long int dp[n+1]={0};
dp[1]=0;

for(int i=2;i<=n;i++)
{
	dp[i]=inf;
	for(int j=i-1;j>=1 && (i-j)<=k;j--)
	{
		//cout<<a[i-1]<<" "<<a[j-1]<<" "<<"rfg"<<endl;
		dp[i]=min(dp[i],abs(a[i-1]-a[j-1])+dp[j]);
	}

}
cout<<dp[n]<<endl;
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int R; cin >> R;
    double pi = 3.14159265;
    cout << 2* R * pi << endl;
    return 0;
}

Measured memory_bytes: 3788
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = input()
ans = ""
for c in s:
    ans += chr((ord(c)+n-ord("A"))%26 + ord("A"))
print(ans)

Measured memory_bytes: 73264
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

char ulcase(char i)
{
	return 0;
}
int main()
{
	char s[1200] = {};
	
	fgets(s, 1200, stdin);
	
	int i = 0;
	while (1)
	{
		if (i > 1200)
			break;
		if ((*(s+i)) == '\0')
			break;
		
		char c = *(s + i);
		if (c >= 0x41 && c <= 0x5a) {
			c += 0x20;
			*(s+i) = c;
		} else if (c >= 0x61 && c <= 0x7a) {
			c -= 0x20;
			*(s+i) = c;
		}
		i++;
	}
	
	for (int i = 0; i < 1200; i++)
	{
		if (s[i] == 0 || s[i] == '\0')
			break;
		cout << s[i];
	}
	
	return 0;
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define f first
#define s second

const int MOD = 1000000007;
const int N = 100005;

int add(int x, int y)
{
	x=((x%MOD)+MOD)%MOD;
	y=((y%MOD)+MOD)%MOD;
	return (x + y) % MOD;
}

int sub(int x, int y)
{
	x=((x%MOD)+MOD)%MOD;
	y=((y%MOD)+MOD)%MOD;
	return add(x, MOD - y);
}

int mul(int x, int y)
{
	x=((x%MOD)+MOD)%MOD;
	y=((y%MOD)+MOD)%MOD;
	return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
	int z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}

int inv(int x)
{
	return binpow(x, MOD - 2);
}

int fact[N];
int ifact[N];

int C(int n, int k)
{
	return mul(fact[n], (mul(ifact[k], ifact[n - k])));
}


main() {
	fact[0]=1;
	for(int i=1; i<N; i++){
		fact[i]=mul(i, fact[i-1]);
	}
	for(int i=0; i<N; i++){
		ifact[i]=inv(fact[i]);
	}
	int n, k;
	cin>>n>>k;
	int arr[n];
	vector<pair<int, int>>v;
	for(int i=0; i<n; i++){
		cin>>arr[i];
		v.pb({arr[i], i});
	}
	sort(v.begin(), v.end());
	int ans1=0;
	for(int i=0; i<v.size(); i++){
		if(i+1<k){
			continue;
		}
		ans1=add(ans1, mul(C(i, k-1), v[i].f));
	}
	
	reverse(v.begin(), v.end());
	
	int ans2=0;
	for(int i=0; i<v.size(); i++){
		if(i+1<k){
			continue;
		}
		ans2=add(ans2, mul(C(i, k-1), v[i].f));
	}
	
	int ans3=sub(ans1, ans2);
	cout<<ans3;
	return 0;
}

Measured memory_bytes: 7432
/*
  AUTHOR:SOURABH
  CREATED:21:08:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 100000000
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,m,i,j,k,ma,x,y,ans,sum,f;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>m>>k;
        vector<vll> a(n),b(m);
        fn(i,k)
        {
            cin>>x>>y;
            a[x-1].pb(y-1);
            b[y-1].pb(x-1);
        }
        ma=-1;
        fn(i,m)
        ma=max(ma,(ll)b[i].size());
        set<ll> c,d;
        set<ll>::iterator it,it1;
        fn(i,m)
        {
            if(b[i].size()==ma)
                c.insert(i);
        }
        ans=0;
        //cout<<c.size()<<endl;
        fn(i,n)
        {
            k=a[i].size();
            f=1;
            sum=k+ma;
            fn(j,k)
            d.insert(a[i][j]);

            if(d.size()>=c.size())
            {
                fit(it,c)
                {
                    if(d.find(*it)==d.end())
                    goto e;
                }
                f=0;
            }
            e:
            if(f)
            ans=max(ans,sum);
            else
            ans=max(ans,sum-1);
            //cout<<sum<<" "<<f<<endl;
            d.clear();
        }
        cout<<ans;
    }
    return 0;
}















Measured memory_bytes: 57212
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000;
vector<int> v;
int main(int argc, char const *argv[])
{
	int n;
	while (cin >> n) {
		v.clear();
		int x;
		for (int i = 1; i <= n; ++i) {
			cin >> x;
			if (x == i) v.push_back(i);
		}
		int lens = v.size();
		int ans = 0;
		int idx = v[0];
		for (int i = 0; i < lens; ++i) {
		//	cout << v[i] << " ";
			if (v[i] + 1 == v[i + 1] && (i + 1) < lens) ++i;
			++ans;
		}
	//	cout << endl;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 892
N = int(input())
A = list(map(int,input().split()))

count = N
Sum = 0
r = 1
Sum = A[0]

for l in range(0, N-1):

    while r < N and Sum + A[r] == Sum ^ A[r]:
            #print(l,r)
            Sum += A[r]
            r += 1
    count += r-l-1

    Sum -= A[l]    

print(count)

Measured memory_bytes: 32152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
const int INF = 1<<28;

int main() {
	vector<int> vi;
	int n, f; cin >> n >> f;
	vi.push_back(f);
	FOR(i, 1, n) {
		int in; cin >> in;
		if(vi[vi.size()-1] < in)
			vi.push_back(in);
		else if(in < vi[vi.size()-1]) {
			REP(j, vi.size()) {
				if(j == vi.size()-1)
					vi[j] = in;
				else if(in == vi[j])
					break;
				else if(vi[j] > in) {
					vi[j] = in;
					break;
				}
			}
		}
//		REP(j, vi.size()) cout << vi[j] << ' ';
//		cout << endl;
	}
	cout << vi.size() << endl;
	return 0;
}

Measured memory_bytes: 1672
#include <iostream>

int Cubic(int X){
    return X*X*X;
}

void HelloWorld(){
    std::cout << "Hello World" << std::endl;
}

int main() {
    // ---------------------------
    // ITP_1_1_A
    // HelloWorld();
    // ---------------------------

    // ---------------------------
    // ITP_1_1_B
    int x;
    std::cin >> x;
    std::cout << Cubic(x) << std::endl;
    // ---------------------------

    // ---------------------------
    // ITP_1_1_B
    // ---------------------------

    // ---------------------------
    // ITP_1_1_B
    // ---------------------------

    // ---------------------------
    // ITP_1_1_B
    // ---------------------------

    // ---------------------------
    // ITP_1_1_B
    // ---------------------------

    return 0;
}


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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	int n, res = 1;
	cin >> n;
	vector<int> v(n);
	REP(i, n) {
		cin >> v[i];
	}
	sort(ALL(v));
	REP(i, n - 1) {
		if (v[i] != v[i + 1]) {
			res++;
		}
	}
	cout << res << endl;
	return 0;
}

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

string str;

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

  int k;
  cin >> k;
  cin >> str;
  for (auto &c : str) {
    c = 'A' + ((c - 'A' + k) % 26);
  }
  cout << str << "\n";

  return 0;
}



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

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

   if(b-a<2){
      cout << k+1;
   }else{
      if(k+1<=a){
         cout << k+1;
      }else{
         cout << a + (k-(a-1))/2*(b-a)+(k-(a-1))%2 << endl;
      }
   }

   return 0;
}

Measured memory_bytes: 256
//Bismillah Hir Rehmanir Rahim
//Allah knows best
using namespace std;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#define endl "\n"
#define mini -10000000000000000
#define start ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#define vi              vector<int>
#define si              set<int>
#define pb              push_back
#define mp              make_pair
#define mod             1000000007
#define rr              return 0
#define ff              first
#define in              insert
#define ss              second
#define setbits(x)      __builtin_popcountll(x)
#define zrbits(x)       __builtin_ctzll(x)
#define deb(x)          cout << #x << " = " << x << endl
int main()
{
   start;
   ll i,j,k,n,m;
   cin>>n>>k>>m;
   vector<ll>ami;
   ll ans=0;
   for(i=k,j=0;j<m+5;j++)
   {
       if(j<=n-1)
       {
           ans+=(i%m);
       }
       ami.pb(i%m);
      if(j==n-1)
      {
        cout<<ans<<endl;
        rr;
       }
       i=i%m;
       i=i*i;
        i%=m;
   }
   ll ajob=ami.size();
   ll st;
   for(i=0;i<ajob;i++)
   {
       if(ami[i]==ami[ajob-1])
       {
         st=i;
         break;
       }
   }
   ll len;
   for(i=st+1;i<ajob;i++)
   {
       if(ami[st]==ami[i])
       {
           len=i-st;
           break;
       }
   }
   i-=len;
   ans=0;
   for(j=0;j<i;j++) ans+=ami[j];
   ll l_sum=0;
   for(i=st,j=0;j<len;i++,j++)
   {
       l_sum+=ami[i];
   }
   ll bad=n-st;
   ll ro=bad/len;
   ans=ans+ro*l_sum;
   bad=(n-st)%len;
    for(i=st,j=0;j<bad;i++,j++)
        ans+=ami[i];
   cout<<ans<<endl;
   rr;
}

Measured memory_bytes: 4220
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

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

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int a, b;
	std::cin >> a >> b;
	std::cout << std::max(0, a - 2 * b) << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x = 0;
  int y = 0;
  int amari = 0;
  int syou = 0;
  int i = 0;

scanf("%d%d",&x,&y);


if(x < y){
  while(1){
    amari = y % x;
    if(amari == 0){
      syou = x;
      break;
    }
    else{
      y = x;
      x = amari;
    }
  }
}

if(x > y){
  while(1){
    amari = x % y;
    if(amari == 0){
      syou = y;
      break;
    }
    else{
      x = y;
      y = amari;
    }
  }
}

else if(x == y){
  syou = x;
}
printf("%d",syou);
printf("\n");
return 0;

}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d;
  int an=0;
  cin>>a>>b>>c>>d;
  an=a/d;
  if(a%d>0){
  an=an+1;
  }
  if(an*b>=c){
   cout<<"Yes"<<endl;  
  }else{
   cout<<"No"<<endl;
  }
  
}









Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            B();
        }

        static void B()
        {
            var s = Read();
            foreach (var i in Range(1, s.Length + 1).Where(x => x % 2 != 0))
            {
                Console.Write(s[i-1]);
            }
        }

        public static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        public static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        public static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        public static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(Read());
        }

        public static long ReadLong()
        {
            return long.Parse(Read());
        }

        public static IList<string> ReadSplit()
        {
            return Read().Split().ToList();
        }

        public static IList<int> ReadSplitInt()
        {
            return Read().Split().Select(int.Parse).ToList();
        }
    }
}

Measured memory_bytes: 11488
left, right = map(int, input().split())

def isKaibun(num):
    l1 = list(str(num))
    l2 = l1[::-1]
    if l1 == l2:
        return True
    else:
        return False

count = 0
for i in range(left, right+1):
    if isKaibun(i):
        count += 1

print(count)

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

int main() {
  int N, K, KK, x, s=0;
  cin >> N >> K;
  KK=K/2;
  K*=2;
  for (; 0<N; N--) {
    cin >> x;
    if (x<=KK) s+=x*2;
    else s+=K-x*2;
    }
  cout << s << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tapp
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = Console.ReadLine();
            String[] input = num.Split(' ');
            int A = Convert.ToInt32(input[0]);
            int B = Convert.ToInt32(input[1]);
            double ans = Math.Ceiling((double)(B - 1) / (A - 1));

            Console.WriteLine(ans);
            {
                Console.Read();
            }
        }
    }
}




Measured memory_bytes: 11220
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <cstring>
#define MAX_N 1000 + 16
 
using namespace std;
 
int N, H, W;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];
int fld[2 * MAX_N][2 * MAX_N], // ??????????????¨?????£??¨??????(i, j)??????????????????????????????
dx[4] = { 1, -1, 0, 0 }, dy[4] = { 0, 0, 1, -1 };
 
// ????????????????°?????????????????????????????¬¬????§?????????????????????±???????§???????
int compress(int *x1, int *x2, int w)
{
	vector<int>xs;
 
	for (int i = 0; i < N; ++i)
	{
		int tx1 = x1[i], tx2 = x2[i];
		if (1 <= tx1 && tx1 < w) xs.push_back(tx1);
		if (1 <= tx2 && tx2 < w) xs.push_back(tx2);
	}
	xs.push_back(0);
	xs.push_back(w);
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());
	for (int i = 0; i < N; ++i)
	{
		x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
		x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
	}
	return xs.size() - 1;
}
 
int bfs()
{
	int ans = 0;
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			if (fld[i][j]) continue;
			++ans;
			queue<pair<int, int> >que;
			que.push(make_pair(j, i));
			while (!que.empty())
			{
				int nx = que.front().first, ny = que.front().second;
				que.pop();
 
				for (int i = 0; i < 4; ++i)
				{
					int tx = nx + dx[i], ty = ny + dy[i];
					if (tx < 0 || W < tx || ty < 0 || H< ty || fld[ty][tx] > 0) continue;
					que.push(make_pair(tx, ty));
					fld[ty][tx] = 1;
				}
			}
		}
	}
	return ans;
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
	while (cin >> W >> H, W | H)
	{
		cin >> N;
		for (int i = 0; i < N; ++i)
		{
			cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
		}
 
		memset(fld, 0, sizeof(fld));
 
		W = compress(X1, X2, W);
		H = compress(Y1, Y2, H);
 
		// imos-???
		for (int i = 0; i < N; i++)
		{
			fld[Y1[i]][X1[i]]++;
			fld[Y1[i]][X2[i]]--;
			fld[Y2[i]][X1[i]]--;
			fld[Y2[i]][X2[i]]++;
		}
		// ?¨?????´??§?
		for (int i = 0; i < H; i++)
		{
			for (int j = 1; j < W; j++)
			{
				fld[i][j] += fld[i][j - 1];
			}
		}
		// ???????´??§?
		for (int i = 1; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				fld[i][j] += fld[i - 1][j];
			}
		}// ?´??§??????????fld??????0??¨?????¨????????????
		cout << bfs() << endl;
	}
	return 0;
}

Measured memory_bytes: 17128
#include <stdio.h>
#include <ctype.h>

int main(void){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }else if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }
    }

    return 0;
}


Measured memory_bytes: 2604
#include <iostream>
#include <set>
#include <map>
#define ll long long
using namespace std;

int main () {
  ll n, m;
  cin >> n >> m;
  set<ll> box;
  map<ll, ll> dp;
  for (ll i = 1; i <= n; i++) dp[i] = 1;
  box.insert(1);
  for (ll i = 0; i < m; i++) {
    ll x, y;
    cin >> x >> y;
    dp[x]--;
    dp[y]++;
    if (box.count(x) == 1) {
      box.insert(y);
      if (dp[x] == 0) box.erase(x);
    }  
  }
  /*
  for (auto last : box) {
    cout << last << endl;  
  }
  */
  cout << box.size() << endl;
    
}

Measured memory_bytes: 11136
#include <stdio.h>

int main (void)
{
    
    int n, list[1000000];
    int i, j, count;
    while (scanf ("%d", &n) != EOF){
        count = 0;
        for (i = 0; i <= n; i++) list[i] = 0;

        for (i = 2; i <= n; i++){
            if(list[i] == 0){
                count++;
            
                for(j = 1; j * i <= n; j++){
                    list[j * i] = 1;
                }
            }
        }
        printf("%d\n", count);
    }
    return (0);
}


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
int main(){
	int num[100005],k,ans=0;
	int n;
	cin>>n;
	cin>>k;
	for (int i=1;i<=n;i++)
	{
		cin>>num[i];
	}
	for (int i=1;i<=n;i++)
	{
		if(num[i]>=k)
		{
			ans++; 
		}
	}
	cout<<ans;
	return 0; 
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

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

int main(){
  int n; cin >> n;
  vector<int> v(n); cin >> v;
  bool f = true;
  int x = v.back();
  for(int i = n-1; i >= 0; --i){
    f &= v[i] <= x+1;
    ChangeMin(x, v[i]);
  }
  cout << (f?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 3736
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
#h, w = map(int, input().split())
#tmp = [None]*h
# for i in range(w):
#    tmp[i] = input()
# print(tmp)
# for i in range(h):
#    for j in range(w):
#        if tmp[i][j] == '#':
#            if (i != 0 and tmp[i-1][j] == '#')or(i != h-1 and tmp[i+1][j] == '#') or(j != 0 and tmp[i][j-1] == '#')or(j != w-1 and tmp[i][j+1] == '#'):
#                continue
#
#            print('No')
#            exit()
# print('Yes')

H, W = map(int, input().split())
s = [None]*H
for i in range(H):
    s[i] = input()
    # print(s[i])
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            #print(i, j)
            if (i != 0 and s[i-1][j] == '#') or(i != H-1 and s[i+1][j] == '#')or(j != 0 and s[i][j-1] == '#') or(j != W-1 and s[i][j+1] == '#'):
                continue
            else:
                print('No')
                exit()
print('Yes')


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

/* -------------------------------- Template -------------------------------- */

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

template<typename T> T inf() { assert(false); }
template<> constexpr int inf<int>() { return 1e9; }
template<> constexpr ll inf<ll>() { return 1e18; }
template<> constexpr ld inf<ld>() { return 1e30; }

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  string s;
  cin >> s;
  int na = 0, nb = 0;
  REP(i,N) {
    bool flag = false;
    if (s[i] == 'a') {
      if (na + nb < A + B) { flag = true; ++na; }
    }
    else if (s[i] == 'b') {
      if (na + nb < A + B && nb < B) { flag = true; ++nb; }
    }
    cout << (flag ? "Yes" : "No") << endl;
  }
  return 0;
}


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

using namespace std;

int main() {
	int H, W, N;
	cin >> H >> W >> N;
	int color[N];
	for (int i = 0; i < N; i++) {
		cin >> color[i];
	}
	int ans[H][W];
	int cur = 0;
	for (int i = 0; i < H; i++) {
		if (i%2==0) {
			for (int j = 0; j < W; j++) {
				ans[i][j] = cur+1;
				color[cur]--;
				if (color[cur] == 0) cur++;
			}
		}
		else {
			for (int j = W-1; j >=0; j--) {
				ans[i][j] = cur+1;
				color[cur]--;
				if (color[cur] == 0) cur++;
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (j > 0) cout << " ";
			cout << ans[i][j];
		}
		cout << endl;
	}
	// cin >> H;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int a = in.nextInt();
		int b = in.nextInt();
		
		if (a == 1) {
			a = 14;
		}
		if (b == 1) {
			b = 14;
		}
		
		if (a < b) {
			System.out.println("Bob");
		} else if (a > b) {
			System.out.println("Alice");
		} else {
			System.out.println("Draw");
		}
	}
}

Measured memory_bytes: 22484
#include <algorithm>
#include <iostream>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>

using namespace std;

#define ll long long
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define pb push_back

ll power(int x, unsigned int y){
    ll res = 1;
    while(y > 0){
        if(y & 1) res = res * x;
        y >>= 1;
        x *= x;
    }
    return res;
}

int main(){


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

    int n; cin >> n;

    ll ans = 1;
    ll arr[n+1];
    ll zero = 0;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        if(!arr[i]) zero++;
    }

    if(zero){
        cout << "0";
        return 0;
    }
    ll p = 1;
    for(int i = 0; i < n; i++){
        if(arr[i] <= 1000000000000000000 / p){
            p *= arr[i];
        }else{
            cout << "-1";
            return 0;
        }
    }

    cout << p;
}

Measured memory_bytes: 4428
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    sort(ALL(a));
    
    int ans = a[n/2]-a[n/2-1];
    
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=105;
int a[N],b[N];
int main()
{
	int n;
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		cin>>b[i];
	 } 
	 a[1]=b[2];
	 b[1]=0;
	 for(int i=2;i<=n;i++)
	 {
	 	if(b[i]>b[i-1])
	 	{
	 		a[i]=b[i];
		 }
		 else
		 {
		 	a[i-1]=b[i];
		 	a[i]=b[i];
		 }
	  } 
	  int sum=0;
	  for(int i=1;i<=n;i++)
	  {
	  	sum=sum+a[i];
	  }
	  cout<<sum<<'\n';
   return 0;
}

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

int main(){
    long long n, i, a[200100], ans[200100]={0}, tmp=0;
    map<long long, long long> mp;
    cin >> n ;
    for(i=0;i<n;i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    for(auto x : mp){
        tmp+=x.second*(x.second-1)/2;
    }
    for(i=0;i<n;i++){
        ans[i]=tmp-mp[a[i]]+1;
    }
    for(i=0;i<n;i++){
        cout << ans[i] <<endl;
    }
    return 0;
}

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>> shop(N);
    for (int i = 0; i < N; ++i) {
        cin >> shop[i].first >> shop[i].second;
    }
    sort(all(shop));

    ll ans = 0;
    ll num = 0;
    for (int i = 0; i < N; ++i) {
        for (int k = 0; k < shop[i].second; ++k) {
            if (num == M) {
                break;
            }
            ans += shop[i].first;
            num++;
        }
        if (num == M) {
            break;
        }
    }

        cout << ans << endl;




    return 0;
}


Measured memory_bytes: 1024