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

struct Node{
int key;
Node *next,*prev;
};

Node *nil;

Node* listSearch(int key){
Node *cur=nil->next;
while(cur!=nil&&cur->key!=key){
cur=cur->next;
}
return cur;
}

void init(){
nil=(Node *)malloc(sizeof(Node));
nil->next=nil;
nil->prev=nil;
}

void printList(){
Node *cur=nil->next;
int isf=0;
while(1){
if(cur==nil) break;
if(isf++>0) printf(" ");
printf("%d",cur->key);
cur=cur->next;
}
printf("\n");
}

void deleteNode(Node *t){
if(t==nil) return;
t->prev->next=t->next;
t->next->prev=t->prev;
free(t);
}

void deleteFirst(){
deleteNode(nil->next);
}

void deleteLast(){
 deleteNode(nil->prev);
 }
 
 void deleteKey(int key){
 
 deleteNode(listSearch(key));
 }
 
 void insert(int key){
 Node *x=(Node *)malloc(sizeof(Node));
 x->key=key;
 x->next=nil->next;
 nil->next->prev=x;
 nil->next=x;
 x->prev=nil;
 }
 
 int main(){
 int key,n,i;
 int size=0;
 char com[20];
 int np=0,nd=0;
 scanf("%d",&n);
 init();
 	for(i=0;i<n;i++){
 scanf("%s%d",com,&key);
 if(com[0]=='i'){ insert(key);np++;size++;
}
else if(com[0]=='d'){
if(strlen(com)>6){
if(com[6]=='F') deleteFirst();
else if(com[6]=='L') deleteLast();
}else{
deleteKey(key);nd++;
}
size--;
}
}

printList();

return 0;
}

Measured memory_bytes: 33868
#include<bits/stdc++.h>
using namespace std;
#define MN 200005
#define LL long long
#define mp make_pair
#define fir first
#define sec second
#define pii pair<int,int>
inline void chkmax(int &a,int b){if(a<b)a=b;}
inline void chkmin(int &a,int b){if(a>b)a=b;}
inline int read(){
	   int a=0,fh=1;char c=getchar();
	   while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
	   while('0'<=c&&c<='9'){
		   a=a*10+c-48;
		   c=getchar();
	   }
	   return a*fh;
}
LL n,a[MN],f[MN][3];
int main(){
	n=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
	}
	if(n%2==0){
		LL tmp=0,tmp1=0;
		for(int i=2;i<=n;i+=2)tmp+=a[i];
		for(int i=1;i<=n;i+=2)tmp1+=a[i];
		tmp=max(tmp,tmp1);
		memset(f,-0x3f,sizeof(f));
		f[1][0]=a[1];f[1][1]=0;
		f[0][0]=0;
		f[2][1]=a[2];f[2][2]=0;
		for(int i=3;i<=n;++i){
			f[i][0]=f[i-2][0]+a[i];
			f[i][1]=f[i-3][0]+a[i];
			f[i][1]=max(f[i][1],f[i-2][1]+a[i]);
			f[i][2]=max(f[i-2][2]+a[i],f[i-3][1]+a[i]);
		}
		printf("%lld\n",max(f[n][1],max(f[n][0],tmp)));
	}
	else{
		LL tmp=0;
		for(int i=2;i<=n;i+=2)tmp+=a[i];
		memset(f,-0x3f,sizeof(f));
		f[1][0]=a[1];f[1][1]=0;
		f[0][0]=0;
		f[2][1]=a[2];f[2][2]=0;
		for(int i=3;i<=n;++i){
			f[i][0]=f[i-2][0]+a[i];
			f[i][1]=f[i-3][0]+a[i];
			f[i][1]=max(f[i][1],f[i-2][1]+a[i]);
			f[i][2]=max(f[i-2][2]+a[i],f[i-3][1]+a[i]);
		}
		tmp=max(tmp,f[n-1][1]);tmp=max(tmp,f[n-1][0]);
		printf("%lld\n",max(f[n][1],max(tmp,f[n][2])));
	}
	return 0;
}

Measured memory_bytes: 9996
#include<bits/stdc++.h>
using namespace std;
#define nn 65536*8
int w,h,n,xi[nn],yi[nn];
int ans=0;

#define mid (l+r)/2
#define lc id<<1
#define rc id<<1|1
int tree[nn*2],tag[nn*2];
void build(int l,int r,int id){
	tree[id]=-1e9;tag[id]=0;
	if(l==r) return ;
	build(l,mid,lc);build(mid+1,r,rc);
}
void up(int id){
	tree[id]=max(tree[lc],tree[rc]);
}
void sub(int id,int y){
	tree[id]+=y,tag[id]+=y;
}
void down(int id){
	sub(lc,tag[id]);sub(rc,tag[id]);tag[id]=0;
}
void modi(int x,int l,int r,int id){
	if(l==r) {
		tree[id]=0;return ;
	}
	down(id);
	if(x<=mid) modi(x,l,mid,lc);
	else modi(x,mid+1,r,rc);
	up(id);
}
void upd(int a,int b,int l,int r,int id,int y){
	if(l>=a and r<=b){
		sub(id,y);return ;
	}
	down(id);
	if(a<=mid) upd(a,b,l,mid,lc,y);
	if(b>mid) upd(a,b,mid+1,r,rc,y);
	up(id);
}
int ask() {return tree[1];}
	
int ch[nn],cl[nn],hi[nn],li[nn],sh,sl;int id[nn];
int cmp(int x,int y){
	return xi[x]<xi[y];
}
void solve(){
	for(int i=1;i<=n;i++) id[i]=i;sort(id+1,id+n+1,cmp);
	build(1,nn,1);
	for(int i=1;i<=n;i++) hi[i]=xi[i],li[i]=yi[i];
	for(int i=1;i<=n;i++) xi[i]=hi[id[i]],yi[i]=li[id[i]];
	
	sh=sl=0;
	int lim=h/2;
	for(int i=1;i<=n;i++){
		ans=max(ans,xi[i]+ask());
		hi[sh+1]=li[sl+1]=i;
		if(yi[i]>lim){
			int flg=i;
			while(sh and ch[sh]>yi[i]){
				upd(hi[sh],hi[sh+1]-1,1,nn,1,yi[i]-ch[sh]);
				flg=hi[sh];sh--;
			}
			if(flg<i) hi[++sh]=flg,ch[sh]=yi[i];
		}
		else{
			int flg=i;
			while(sl and cl[sl]<yi[i]){
				upd(li[sl],li[sl+1]-1,1,nn,1,cl[sl]-yi[i]);
				flg=li[sl];sl--;
			}
			if(flg<i) li[++sl]=flg,cl[sl]=yi[i];
		}
		hi[++sh]=i;ch[sh]=h;
		li[++sl]=i;cl[sl]=0;
		modi(i,1,nn,1);upd(i,i,1,nn,1,h-0-xi[i]);
	}
	
	
	int m1=0,m2=h;
	for(int i=1;i<=n;i++){
		ans=max(m2-m1+xi[i],ans);
		if(yi[i]<=lim) m1=max(m1,yi[i]);
		else m2=min(m2,yi[i]);
	}
	
	m1=0,m2=h;
	for(int i=n;i>=1;i--){
		ans=max(w+m2-m1-xi[i],ans);
		if(yi[i]<=lim) m1=max(m1,yi[i]);
		else m2=min(m2,yi[i]);
	}
}

int main(){
	scanf("%d%d%d",&w,&h,&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&xi[i],&yi[i]);
	solve();
	swap(h,w);swap(xi,yi);
	solve();
	printf("%d\n",ans*2);
	return 0;
}


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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;

    for(int i=2; i<=n; i++) F[i] = F[i-1] + F[i-2];
    cout << F[n] << endl;

    return 0;
}



Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        int answer = 0;
        for (int i = 0; i < s.Length; i++)
        {
            int count = 0;
            int tmpI = i;
            while (s[tmpI] == 'A' || s[tmpI] == 'C' || s[tmpI] == 'G' || s[tmpI] == 'T')
            {
                count++;
                tmpI++;
                if (tmpI == s.Length)
                {
                    break;
                }
            }
            answer = Math.Max(answer, count);
        }

        Console.WriteLine(answer);
    }

    private static int GetDivisorCount(int n)
    {
        int count = 0;
        for (int i = 1; i <= n; i++)
        {
            if (n % i == 0)
            {
                count++;
            }
        }
        return count;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

int main(){
  string S;
  cin >> S;
  char tmp = S[0];
  int count=0;
  for(int i=0; i<S.size(); i++){
    if(tmp==S[i]) continue;
    count++;
    tmp=S[i];
  }
  cout << count << endl;
}

Measured memory_bytes: 512
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 1 << 30

int MOD = 1000000007;



int main(){
    std::ios_base::sync_with_stdio(false);

    int T,X; cin >> T >> X;

    cout << std::setprecision(10) << (T+0.0)/(X+0.0) << endl;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int ll
using namespace std;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!isdigit(c);c = getchar()) if (c == '-') f ^= 1;
	for (; isdigit(c);c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}

signed main() {
	int a = read(), b = read();
	int d = __gcd(a, b);
	int cnt = 1;
	for (int i = 2; i * i <= d; ++ i) {
		if (d % i == 0) {
			++ cnt;
			while (d % i == 0) d /= i;
		}
	}
	if (d > 1) ++ cnt;
	printf("%lld\n", cnt);
	return 0;
}


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

signed main(void)
{
	ll a, b, ans;	
	cin >> a >> b;

	if (b % 2 == 0)
		b = (b / 2 % 2) ^ b;
	else
		b = (b + 1) / 2 % 2;
	a--;
	if (a % 2 == 0)
		a = (a / 2 % 2) ^ a;
	else
		a = (a + 1) / 2 % 2;
	ans = b ^ a;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}

template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){
    vector<pair<T,T>> out(input.size()-1);
    rep(i,input.size()-1){
        out[i].first =input[i  ];
        out[i].second=input[i+1];
    }
    return(out);
}
vector<char> String_to_vector_char(const string& input){
    vector<char> out(input.size());
    rep(i,input.size()){
        out[i]=input[i];
    }
    return out;
}

ll n ,x;
vector<ll> D,L;
void input(){
    cin>>n>>x;
    D.resize(n+1,0);
    L.resize(n+1,0);
    rep(i,n)
        cin>>L[i];
}
void src(){
    repi(i,1,n+1){
        D[i]=D[i-1]+L[i-1];
    }
    cout<<count_if(D.begin(),D.end(),[](auto d){return d<=x;});

}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n, x;
	
    while (1) {
	scanf("%d %d", &n, &x);
    if (n == 0 && x == 0)
    break;
    int count = 0;
    int i, j, k;
    for (i = 1; i <= n-2; i++){
        for (j = i+1; j <= n-1; j++){
            for (k = j+1; k <= n; k++){
            if (i + j + k == x){
            count++;}
            }
        }
    }
    printf("%d\n", count);


    }



    return 0;
}


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

#define PI acos(-1)
#define all(a) a.begin(), a.end()
#define full(a, n) a, a + n
#define ma(type, size) (type *)malloc(sizeof(type) * size)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define f0n(i, n) for (i = 0; i < (n); i++)
#define f1n(i, n) for (i = 1; i <= (n); i++)
#define fab(i, a, b) for (i = (a); i <= (b); i++)
#define fr(i, b, a) for (i = (b); i >= (a); i--)

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
	tree_order_statistics_node_update> indexed_set;
//*/
typedef long long int ll;
typedef long int lo;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

//* utility function
inline bool compare(ll i, ll j)
{
    return i < j;
}
//*/

//* function prototypes
template< typename T>
T gcd(T a, T b);
//*/

//int row, column;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
#ifdef DEBUG
#endif // DEBUG

int main()
{
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll number_of_test_case = 1, test_case;
    //cin >> number_of_test_case;
    for (test_case = 1; test_case <= number_of_test_case; test_case++)
    {
        ll n;
        cin >> n;
        if (n&1)cout << n*2 << endl;
        else cout << n << endl;
    }
    return 0;
}
template< typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a%b);
}


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

namespace _093_LeapYear
{
	class Program
	{
		static void Main ( string[] args )
		{
			List<int> leapYearList = new List<int> (3000 / 4);

			for (int lp = 4; lp < 3000; lp += 4)
			{
				if (lp % 100 == 0)
				{
					if (lp % 400 == 0)
					{
						leapYearList.Add (lp);
					}
				}
				else
				{
					leapYearList.Add (lp);
				}
			}

			string inputStr;
			StringBuilder output = new StringBuilder (4 * 10 * 50);

			while ((inputStr = Console.ReadLine ()) != "0 0")
			{
				int[] split = Array.ConvertAll (inputStr.Split (' '), int.Parse);

				int flontIndex = leapYearList.BinarySearch (Ceiling (split[0]));
				int backIndex = leapYearList.BinarySearch (Floor (split[1]));

				if (flontIndex <= backIndex && 0 <= flontIndex && 0 <= backIndex)
				{
					IEnumerable<int> result = leapYearList.Skip (flontIndex).Take (backIndex - flontIndex + 1);

					foreach (var item in result)
					{
						output.Append (item);
						output.AppendLine ();
					}
				}
				else
				{
					output.AppendLine ("NA");
				}

				output.AppendLine ();
			}

			Console.Write (output.ToString (0, output.Length - 1));
		}

		//????????????
		static int Ceiling ( int year )
		{
			int tmp = year % 4 != 0 ? 4 : 0;
			int ceiling = year + tmp - year % 4;

			while (ceiling % 100 == 0 && ceiling % 400 != 0)
			{
				ceiling += 4;
			}

			return ceiling;
		}

		//????????¨???
		static int Floor ( int year )
		{
			int floor = year - year % 4;

			while (floor % 100 == 0 && floor % 400 != 0)
			{
				floor -= 4;
			}

			return floor;
		}
	}
}

Measured memory_bytes: 9952
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;

int n,a[100000];

int _abs(int a) {
	return a<0 ? -a : a;
}
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",a+i);

	sort(a,a+n);
	int mx=a[n-1]+1,ai=-1;
	for(int i=0;i<n-1;i++) {
		int v=max(a[i],a[n-1]-a[i]);
		if(v < mx) {
			mx=v; ai=i;
		}
	}
	printf("%d %d\n",a[n-1],a[ai]);

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p, q, r;
    cin >> p >> q >> r;
    cout << min(p + q, min(q + r, r + p)) << endl;
    return 0;
}

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

int main(){
	int n, b, f, r,v;
	int R[5][4][11];
	cin >> n;
	for(int i=1 ;i<5; i++){
		for(int j=1 ;j<4; j++){
			for(int k=1 ;k<11; k++){
				R[i][j][k]=0;
			}
		}
	}
	for(int l=0 ;l<n; l++){
	    cin >> b >> f >>r >>v;
		R[b][f][r]+=v;
	}
	for(int i=1 ;i<5; i++){
		for(int j=1 ;j<4; j++){
			for(int k=1 ;k<11; k++){
				cout <<" "<< R[i][j][k];
				if(k==10){
					cout << endl;
					if(j==3){
						if(i==1||i==2||i==3){
						cout << "####################" << endl;
					    }
					}
			    }
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3072
def foo
  while input = gets
    inputs = input.split(',').map(&:to_i)
    sections = inputs[0..9]
    v1, v2 = inputs[10..11]
    time = sections.inject(:+).to_f / (v1 + v2)
    vkm = time * v1
    sections.each.with_index do |e, i|
      vkm -= e
      if vkm <= 0
        puts i + 1
        break
      end
    end
  end
end

foo

Measured memory_bytes: 8612
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"

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

long long int N,X;
long long int num[2000];
long long int small[2000];
long long int ans;
long long int box;

int main() {
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> num[i];
		small[i] = num[i];
		box += num[i];
	}
	ans = box;
	for (int i = 1; i < N; i++) {
		box = 0;
		for (int j = 0; j < N; j++) {
			if (small[j] > num[(j + N - i) % N] ) {
				small[j] = num[(j + N - i) % N] ;
			}
			box += small[j];
		}
		box += i*X;
		ans = min(ans, box);
	}
	cout << ans << endl;
	return 0;
}

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


Measured memory_bytes: 2760
n, m = map(int, input().split())
ab = [ list(map(int, input().split())) for _ in range(m) ]

graph = [ [False] * 8 for _ in range(8) ]
visited = [False] * n

def dfs(a, N, visited):
    finish = True
    for i in range(N):
        if not visited[i]:
            finish = False
    if finish:
        return 1
    ans = 0
    for i in range(N):
        if not graph[a][i] or visited[i]:
            continue
        visited[i] = True
        ans += dfs(i,N,visited)
        visited[i] = False
    return ans

for i in range(m):
    graph[ab[i][0]-1][ab[i][1]-1], graph[ab[i][1]-1][ab[i][0]-1] = True, True

visited[0] = True
print(dfs(0,n,visited))

Measured memory_bytes: 3064
#include<stdio.h>

int dirichlet(int a,int d,int n,int sosu_c[]){
  int count = 0;
  while(1){
    if(sosu_c[a]==1)count++;
    if(count==n)return a;
    a = a + d;
  }
}

int main(void){
  int a[1024],d[1024],n[1024];
  int i,j;
  int count;
  int sosu_c[1000000] = {};

  sosu_c[2] = 1;

  for(i=3;i<1000000;i=i+2){
    sosu_c[i] = 1;
  }
  for(i=3;i*i<1000000;i=i+2){
    if(sosu_c[i]==1){
      for(j=i*i;j<1000000;j=j+(i*2)){
	sosu_c[j] = 0;
      }
    }
  }

  for(i=0;i>=0;i++){
    scanf("%d%d%d",&a[i],&d[i],&n[i]);
    if(a[i]==0&&d[i]==0&&n[i]==0)break;
  }
  count = i;

  for(i=0;i<count;i++){
    printf("%d\n",dirichlet(a[i],d[i],n[i],sosu_c));
  }
  return 0;
}

Measured memory_bytes: 4524
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cctype>
#include <queue>
#define ll long long 
#define ri register int 
using namespace std;
template <class T>inline void read(T &x){
    x=0;int ne=0;char c;
    while(!isdigit(c=getchar()))ne=c=='-';
    x=c-48;
    while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
    x=ne?-x:x;return ;
}
int x,r,d;
int main(){
	read(r),read(d),read(x);
	for(ri i=1;i<=10;i++){
		x=r*x-d;
		printf("%d\n",x);
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;
  vector<pair<int, int>> v;
  cin >> n;
  for(int i=1;i<=n;i++){
    int a;
    cin >> a;
    v.push_back(make_pair(a, i));
  }
  sort(v.begin(), v.end());
  for(int i=0;i<n;i++){
    cout << v[i].second << (i!=n-1?" ": "\n");
  }
}

Measured memory_bytes: 1780
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n){
		cin >> a[i];
	}
	int ans = 0;
	ll minus = 0;
	priority_queue<ll> plus;
	rep(i,n){
		cin >> b[i];
		if(a[i] < b[i]){
			++ans;
			minus += b[i] - a[i];
		}
		else{
			plus.push(a[i] - b[i]);
		}
	}
	while(!plus.empty() && minus > 0){
		ll p = plus.top();
		plus.pop();
		minus -= p;
		++ans;
	}
	if(minus <= 0) cout << ans << endl;
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
#define INF 0X3f3f3f3f
#define M 1000000007
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define mp make_pair
#define pb push_back 
#define fi first
#define se second
#define endl "\n"
#define PI acos(-1)
#define fastcin ios_base::sync_with_stdio(false);
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int,int> ii;
typedef complex<double> base;

string a, b;

int main(void){
	cin >> a >> b;
	string c;
	c += a;
	c += b;

	int x = stoi(c);
	int s = sqrt(x);

	if(s*s == x){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}

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

int main() {
  int N,Y;
  cin >> N >> Y;
  bool a = false;
  for(int x=0;x<=N;x++){
   for(int y=0;y<=N-x;y++){
	int z = N - x -y;
     if(Y == 10000*x + 5000*y + 1000*z){
    a = true;
       cout << x <<" " << y <<" " <<z <<endl;
       break;
   
     } 
     
   }
    if(a == true)
       break;
   }
  
  if(a == false){
   cout <<-1 <<" " <<-1 << " " << -1 <<endl;
  }
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define pb push_back
const ll mod = 1e9 + 7;
int a, b; string s;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>a>>b>>s;
    for(int i=0; i<a; i++){if(s[i]!='0' && s[i]!='1' && s[i]!='2' && s[i]!='3' && s[i]!='4' && s[i]!='5' && s[i]!='6' && s[i]!='7' && s[i]!='8' && s[i]!='9') rc("No");}
    for(int i=a+1; i<s.sz; i++){if(s[i]!='0' && s[i]!='1' && s[i]!='2' && s[i]!='3' && s[i]!='4' && s[i]!='5' && s[i]!='6' && s[i]!='7' && s[i]!='8' && s[i]!='9') rc("No");}
    if(s[a]!='-') rc("No"); cout<<"Yes";

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


int main(){

    int k;
    cin >> k;

    int res;
    if (k%2==0) res = (k/2) * (k/2);
    else res = (k/2) * (k/2+1);

    cout << res << endl;
}





//              g++ -std=c++1z

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int s, former, rear;
    scanf("%d",&s);
    former = s/100;
    rear = s%100;
    if(former <= 12 && former >= 1) {
        if(rear <= 12 && rear >= 1) {
            printf("AMBIGUOUS\n");
        }
        else {
            printf("MMYY\n");
        }
    }
    else {
        if (rear <= 12 && rear >=1) {
            printf("YYMM\n");
        }
        else {
            printf("NA\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

typedef pair<ll,const char*> parsed;

parsed expr(const char*);
parsed term(const char*);
parsed fact(const char*);

parsed expr(const char* s)
{
	//cout<<"expr(\""<<s<<"\")"<<endl;
	parsed now=term(s);
	while(*now.second=='+' || *now.second=='-'){
		char op=*now.second;
		parsed next=term(now.second+1);
		if(op=='+')
			now=parsed(now.first+next.first,next.second);
		else
			now=parsed(now.first-next.first,next.second);
	}
	//cout<<"expr(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed term(const char* s)
{
	//cout<<"term(\""<<s<<"\")"<<endl;
	parsed now=fact(s);
	while(*now.second=='*' || *now.second=='/'){
		char op=*now.second;
		parsed next=fact(now.second+1);
		if(op=='*')
			now=parsed(now.first*next.first,next.second);
		else
			now=parsed(now.first/next.first,next.second);
	}
	//cout<<"term(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed fact(const char* s)
{
	//cout<<"fact(\""<<s<<"\")"<<endl;
	//if(s[0]=='('){
	//	parsed res=expr(s+1);
	//	res.second++;
	//	return res;
	//}
	//else{
	//	const char* p=s;
	//	if(*p=='-')
	//		p++;
	//	ll n=0;
	//	while(isdigit(*p)){
	//		n=n*10+*p-'0';
	//		p++;
	//	}
	//	return parsed(n,p);
	//}
	
	if(isdigit(s[0])){
		const char* p=s;
		//if(*p=='-')
		//	p++;
		ll n=0;
		while(isdigit(*p)){
			n=n*10+(*p-'0');
			p++;
		}
		return parsed(n,p);
	}
	else if(s[0]=='('){
		parsed res=expr(s+1);
		if (*res.second!=')') exit(0);
		res.second++;
		return res;
	}
	else
		exit(0);
}

//parsed fact(const char *p)
//{
//  if (isdigit(*p)){
//    int t=0;
//    while(isdigit(*p)) t=t*10+*(p++)-'0';
//    return parsed(t,p);
//  }
//  else if (*p=='('){
//    parsed r=expr(p+1);
//    if (*r.second!=')') exit(0); // invalid input
//    return parsed(r.first,r.second+1);
//  }
//  else
//    exit(0); // invalid input
//}

int main()
{
	string s;
	getline(cin,s);
	while(getline(cin,s))
		cout<<expr(s.c_str()).first<<endl;
	
	return 0;
}

Measured memory_bytes: 0
N = int(input())
p = list(map(float, input().split()))

dp = [[0 for i in range(N+1)] for j in range(N+1)]
dp[0][0] = 1

for i in range(1,N+1):
  for j in range(i+1):
    if j == 0:
      dp[j][i] = (1-p[i-1])*dp[j][i-1]
    else:
      dp[j][i] = (1-p[i-1])*dp[j][i-1] + p[i-1]*dp[j-1][i-1]

sum_ = 0
for i in range(N//2+1, N+1):
  sum_ += dp[i][-1]

print(sum_)

Measured memory_bytes: 223816
n = int(input())
A = list(map(int, input().split()))
A = [a-1 for a in A]

P = [-1]*n
for i, a in enumerate(A):
    P[a] = i

#print(P)

R = [[n]*2 for _ in range(n)]
q = []
import heapq
heapq.heapify(q)
for i in range(n):
    temp = []
    while q:
        if q[0][0] < A[i]:
            v, j = heapq.heappop(q)
            R[v][j] = i
            if j == 0:
                temp.append((v, j+1))
        else:
            break
    heapq.heappush(q, (A[i], 0))
    for v, j in temp:
        heapq.heappush(q, (v, j))

#print(R)

L = [[-1]*2 for _ in range(n)]
q = []
import heapq
heapq.heapify(q)
for i in reversed(range(n)):
    temp = []
    while q:
        if q[0][0] < A[i]:
            v, j = heapq.heappop(q)
            L[v][j] = i
            if j == 0:
                temp.append((v, j+1))
        else:
            break
    heapq.heappush(q, (A[i], 0))
    for v, j in temp:
        heapq.heappush(q, (v, j))

#print(L)
ans = 0
for i in range(n-1):
    p = P[i]
    l1 = L[i][0]
    l2 = L[i][1]
    r1 = R[i][0]
    r2 = R[i][1]
    ans += ((l1-l2)*(r1-p)+(r2-r1)*(p-l1))*(i+1)
print(ans)


Measured memory_bytes: 108516
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>
#include<set>
 
#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
#define Sort(X) sort(X.begin(), X.end())
#define RSort(X, T) sort(X.begin(), X.end(), greater<T>())
//#define MOD 998244353
#define MAX 100000
 
typedef long long int ll;
typedef unsigned long long int ull;
 
using namespace std;
 
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }
 
 
int main() {

	ll N, K;
	cin >> N >> K;

	vl H(N);
	ll cnt = 0;
	rep(i, N) {
		cin >> H[i];
		if (H[i] >= K)cnt++;
	}


	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1024
n = gets.to_i
ms = n.times.map { gets.split.map(&:to_i) }
dp = Array.new(n+1) {|i| Array.new n-i+1 }
dp[1].map! { 0 }
for i in 2..n
  for j in 0..n-i
    for k in 1..i-1
      c = dp[k][j] + dp[i-k][j+k] + ms[j][0] * ms[j+k-1][1] * ms[j+i-1][1]
      dp[i][j] = c if !dp[i][j] || c < dp[i][j]
    end
  end
end
p dp.last.last

Measured memory_bytes: 8828
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//typedef long long  MOD=1000000009;
ll MOD=998244353;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

void iofoj(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
// bool visi[200005];
// vector<ll>v[200005];

// ll value[100005],sum[100005],coun[100005];
// ll ans;
// // ll n,m,k,w;
// // ll siz[300005],par[300005];
// ll maxi;
// void dfs(ll u)
// {
//     visi[u]=true;
//     maxi=max(maxi,u);
//     for(auto i:v[u])
//     {
//         if(visi[i]==false)
//         {
//             dfs(i);
//         }
//     }
// }
ll BIT[600000];
ll last[600000];
ll ans[500008];

struct Q{
    ll l,r,dx;
};

bool comp(Q a,Q b)
{
    return a.r<b.r;
}

void update(ll i,ll val)
{
    i++;
    while(i<600000)
    {
        BIT[i]+=val;
        i+=i&(-i);
    }
}

ll sum(ll i)
{
    ll ans=0;
    i++;
    while(i>0)
    {
        ans+=BIT[i];
        i-=i&(-i);
    }
    return ans;
}

void solution()
{
    ll k,i,j,h,d,n,m;
    cin>>n>>m;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    memset(last,-1,sizeof(last));
    Q q[m];
    for(i=0;i<m;i++)
    {
        cin>>q[i].l>>q[i].r;
        q[i].l--;
        q[i].r--;
        q[i].dx=i;
    }
    sort(q,q+m,comp);
    ll count=0;
    for(i=0;i<n;i++)
    {
        if(last[a[i]]!=-1)
        {
            update(last[a[i]],-1);
        }
        update(i,1);
        last[a[i]]=i;
        //cout<<i<<" "<<sum(i)<<"\n";
        while(count<m && q[count].r==i)
        {
            if(q[count].l==0)
            ans[q[count].dx]=sum(q[count].r);
            else
            ans[q[count].dx]=sum(q[count].r)-sum(q[count].l-1);
            //cout<<q[count].l<<" "<<q[count].r<<"\n";
            count++;
        }
        if(count>=m)
        break;
    }
    for(i=0;i<m;i++)
    cout<<ans[i]<<"\n";
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // while(t--)
    solution();
    return 0; 
}





Measured memory_bytes: 31900
//submitted by Himj
  #include<bits/stdc++.h>
  #define ll long long
  #define mod 1000000007
  #define pb push_back
  #define fi first
  #define se second
  #define fr(i,s,e) for(i=s;i<e;i++)
  #define ms(arr,val) memset(arr,val,sizeof(arr))
  using namespace std;

  const int mxn=2e5+1;

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

    int t=1;
    //cin>>t;
      while(t--){
        string s;
        cin>>s;
        int arr[]={2019,4,30};
        int n=s.size(),j=0,i;
        string temp;
        fr(i,0,n)
        {
          if(s[i]=='/')
          {
            int num=stoi(temp);
            temp="";
            if(num<arr[j])
            {
              cout<<"Heisei";
              return 0;
            }
            else if(num>arr[j])
            {
              cout<<"TBD";
              return 0;
            }
            j++;
          }
          else temp+=s[i];
        }
        cout<<"Heisei";
        
         
      }
    return 0;
    }



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    map<ll,bool> mp;
    ll n;cin>>n;
    bool ans=true;
    ll a[n];
    
    rep(i,0,n-1){
        cin>>a[i];
        auto itr=mp.find(a[i]);
        if(itr!=mp.end()){
            ans=false;
        }else{
            mp[a[i]]=true;
        }
        
    }
    if(ans){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}



Measured memory_bytes: 14336
NUM="0123456789"

def atama(x):
    return [e for e in set(x) if x.count(e)>=2]

def koutu(x,i):
    return x.count(i)>=3

def shuntu(x,i):
    return i<8 and x.count(i)>0 and x.count(i+1)>0 and x.count(i+2)>0

def make(x):
    return [int(c) for c in x]

def check(x):
    for e in set(x):
        if koutu(x,e):
            y = [NUM[e]*3]
            x1=x+[]
            x1.remove(e)
            x1.remove(e)
            x1.remove(e)
            if len(x1)==0: return y
            else:
                y1 = check(x1)
                if len(y1)>0: return y+y1
        elif shuntu(x,e):
            x1=x+[]
            y = [NUM[e:e+3]]
            x1.remove(e)
            x1.remove(e+1)
            x1.remove(e+2)
            if len(x1)==0: return y
            else:
                y1 = check(x1)
                if len(y1)>0: return y+y1
    return ""

try:
    while True:
        s = raw_input()
        y = []
        for e in NUM[1:]:
            if s.count(e)>=4: continue
            x = make(s+e)
            for e0 in atama(x):
                s0= [ NUM[e0]*2]
                x1 = x+[]
                x1.remove(e0)
                x1.remove(e0)
                s0 += check(x1)
                if len(s0)==5:
                    y.append(e)
                    break
        if len(y)==0: print 0
        else:
            for e in y:
                print e,
            print
except:
    pass

Measured memory_bytes: 4332
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n,m,k,t,ans=0;
int dp[4400][2200];
inline void add(int &a,int b)
{
	a+=b;
	if(a>=MOD)a-=MOD;
}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	t=(n+m-1)/(k-1);
	dp[0][0]=1;
	for(int i=0;i<t;i++)
	{
		for(int sum=0;sum<=m;sum++)
		{
			for(int cur=0;cur<k&&sum+cur<=m;cur++)
			{
				add(dp[i+1][sum+cur],dp[i][sum]);
			}
		}
	}
	for(int i=0;i<t;i++)
	{
		for(int sum=0;sum<m;sum++)
		{
			int osum=i*(k-1)-sum;
			if(osum<n)add(ans,dp[i][sum]);
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

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



string str[3] = { "Sunny", "Cloudy", "Rainy" };

int main()
{
	string s;
	cin >> s;
	rep(i, 3)
	{
		if (str[i] == s)
		{
			cout << str[(i + 1) % 3] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_*N+i], ymemo[yi*N+i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

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

namespace Thumbnail
{
    class Program
    {
        static void Main(string[] args)
        {
            const double eps = 1.0e-20;
            var n = int.Parse(Console.ReadLine());
            var line2 = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var data = new int[n];
            for (var i = 0; i < n; i++)
            {
                data[i] = int.Parse(line2[i]);
            }
            var average = data.Average();
            var residual = new List<double>();
            for (var i = 0; i < n; i++)
            {
                residual.Add(Math.Abs(data[i] - average));
            }
            var minimum = residual.Min();
            var result = residual.FindIndex(x => Math.Abs(x - minimum) < eps);
            Console.WriteLine(result);
        }
    }
}


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

int main() {
	int x, a = 1, b = 1;
	cin >> x;
	if(x == 1){
		cout << 1 << endl;
		return 0;
	}
	for(int i = 2; i < 35; i++){
		for(int j = i * i; j <= x; j = j * i){
			if(j > a){
				a = j;
			}
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
#define NMAX 100000

int K = 1;
vector<vector<int>> tree(NMAX);
int colors[NMAX];

void dfs(int p, int p_color){
	int color = 1;
	for(int c:tree[p]){
		if(colors[c]) continue;
		colors[c] = color==p_color? ++color: color;
		K = max(K, color);
		dfs(c, color++);
	}
}

int main(){
	int N; cin>>N;
	int C[N-1];
	for(int i=0; i<N-1; ++i){
		int p; scanf("%d%d", &p, C+i); p--,C[i]--;
		tree[p].push_back(C[i]);
	}
	colors[0] = NMAX;
	dfs(0, -1);
	printf("%d\n", K);
	for(int c:C) printf("%d\n", colors[c]);
}

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

int main()
{
  string s1, t1;
  cin >> s1 >> t1;
  int s=s1.length(), t=t1.length(), count;
  for(int i=0;i<t;i++)
  {
    if(s1[i]==t1[i])count++;
  }
  if(t==s+1 && count==s)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3632
/*
	Name: Hopscotch Addict
	Author: Jerryjiang090210 
	Date: 30/06/19 12:51
	Description: ChenRui Zhou's code <Hopscotch Addict>
*/
#include<bits/stdc++.h>
#define inf ((int)(1e9))
using namespace std;
const int maxn=(1e5+10);
int n,m,s,t;
bool vis[3][maxn];
int dist[3][maxn];
int main()
{
	cin>>n>>m;
	vector<vector<int> > graph(n);
	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		--u,--v;
		graph[u].push_back(v);
	}
	cin>>s>>t;
	--s,--t;
	vector<int> d(n*3,inf);
	queue<int> q;
	q.push(s);
	q.push(0);
	while(!q.empty())
	{
		int now=q.front();
		q.pop();
		int move=q.front();
		q.pop();
		if(vis[move%3][now])
			continue;
		vis[move%3][now]=true;
		dist[move%3][now]=move;
		for(int i=0;i<graph[now].size();i++)
		{
			int to=graph[now][i];
			q.push(to);
			q.push(move+1);
		}
	}
	if(!vis[0][t])
		cout<<-1<<endl;
	else
		cout<<dist[0][t]/3<<endl;
	return 0;
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
     
    using namespace std;
     
    typedef long long ll;
     
    const int N = 11;
     
    ll dp[N][2];
     
    int main()
    {
      int n;
      cin >> n;
      for (int i = 0; i < n; i++)
      {
        int x;
        cin >> x;
        for (int cur = x - 1; cur <= x + 1; cur++)
        {	
          int ch = abs(cur % 2);
          for (int t = 0; t < 2; t++)
          {
            if (i != 0)
            	dp[i + 1][t * ch] += dp[i][t];
            else if (t == 0)
              	dp[i + 1][ch]++;
          }
        }
      }
      cout << dp[n][0] << '\n';
    }

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

int main(){
    long long A, B; cin >> A >> B;
    auto GCD = __gcd(A, B);
    //cout << GCD << endl;
    long count = 0;
    for(long long i = 2; i * i <= GCD; i++){
        long check=false;
        while(GCD%i==0){
            GCD /= i;
            if(!check){
                count++;
                check = true;
            } 
        }
    }
    if(GCD!=1) count++;
    cout << count + 1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#define MAX 300

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

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

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

int main()
{
	int n;
	int A[MAX];
	scanf("%d", &n);
	for(int i=1; i<=n; i++)
		scanf("%d", &A[i]);

	for(int i=1; i<=n; i++)
	{
		printf("node %d: key = %d, ",i,A[i]);
		if(parent(i) >= 1)
			printf("parent key = %d, ", A[parent(i)]);
		if(left(i) <= n)
			printf("left key = %d, ", A[left(i)]);
		if(right(i) <= n)
			printf("right key = %d, ", A[right(i)]);
		printf("\n");
	}

	return 0;		
}


Measured memory_bytes: 2764
#include <stdio.h>
#include <math.h>
int main(void){
	double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%f\n",sqrt(pow(x2-x1,2) + pow(y2-y1,2)) );
	return 0;
}

Measured memory_bytes: 652
n, q = map(int, input().split())
P = []
for i in range(n):
    P.append(input().split())
for i in range(n):
    P[i][1]=int(P[i][1])

def RRSchedule(Que,q):
    n = len(Que)
    t = 0
    while len(Que) != 0:
        if Que[0][1] > q:
            t += q
            Que[0][1] -= q
            Que.append(Que[0])
            del Que[0]
        else:
            t += Que[0][1]
            print(Que[0][0], end=" ")
            print(t)
            del Que[0]

RRSchedule(P,q)



Measured memory_bytes: 17112
//
//  main.cpp
//  Problem Code
//
//  Created by Algo张伯威 on 2020/4/24.
//  Copyright © 2020 Algo张伯威. All rights reserved.
//

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <iostream>
using namespace std;

map<string, int> mp;

int main() {
    int n;
    cin>>n;
    string t;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        cin>>t;
        if(mp[t] == 0) {
            mp[t] = 1;
            ans++;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}
























Measured memory_bytes: 19228
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

best = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for j in range(M):
    b.append(b[j] + B[j])

ans , j = 0, M

for i in range(N +1):
    if a[i] > K:
        break
    while b[j] > K -a[i]:
        j -= 1
    ans = max(ans, i +j)
print(ans)

Measured memory_bytes: 47516
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  char c;
  cin >> c;
  cout << (char)(c+1) << endl;
}

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

const int N = 1e5 + 10;
string inp, inp1, inp2;
map<pair<string, string>, int> mp;
int n, _2n;
long long ans;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	cin >> inp;
	
	for (int i = 0; i < n; i++)
		inp1 += inp[i];	
	for (int i = n; i < 2 * n; i++)
		inp2 += inp[i];
	reverse(inp2.begin(), inp2.end());
	
	_2n = pow(2, n);
	for (int mask = 0; mask < _2n; mask++){
		string s, t;
		
		for (int i = 0; i < n; i++)
			if(((mask >> i) & 1) == 1)
				s += inp2[i];
		for (int i = 0; i < n; i++)
			if(((mask >> i) & 1) == 0)
				t += inp2[i];
		
		//cout << "added " << s << ' ' << t << endl;
		mp[{s, t}]++;
	}
	
	for (int mask = 0; mask < _2n; mask++){
		string s, t;
		
		for (int i = 0; i < n; i++)
			if(((mask >> i) & 1) == 1)
				s += inp1[i];
		for (int i = 0; i < n; i++)
			if(((mask >> i) & 1) == 0)
				t += inp1[i];
		
		ans += mp[{t, s}];
	}
	
	cout << ans;
}

Measured memory_bytes: 91904
import sys
input = sys.stdin.readline

def main():
	N, M = map(int, input().split())
	AB = [0] * N
	for i in range(N):
		AB[i] = list(map(int, input().split()))
	AB.sort()
	MONEY = 0
	for i in range(N):
		if M == 0:
			break
		else:
			if M < AB[i][1]:
				MONEY += M * AB[i][0]
				M = 0
			else:
				M -= AB[i][1]
				MONEY += AB[i][1] * AB[i][0]
	print(MONEY)

if __name__ == '__main__':
	main()


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

int main(){
  int n;
  cin >> n;
  vector<int> R(n);
  for (int i = 0; i < n; i++){
    cin >> R.at(i);
  }

  int maxv = R.at(1) - R.at(0);
  int minv = R.at(0);

  for (int j = 1; j < n; j++){
    maxv = max(maxv, R.at(j) - minv);
    minv = min(minv, R.at(j));
  }
  cout << maxv << endl;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define int long long
#define Int int32_t
#define all(c) c.begin(), c.end()
#define FAST ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pii pair< int , int >
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define bitcnt(n) __builtin_popcountll(n)
#define setpre(n) cout << fixed << setprecision(n)
#define tr(c) for(auto x : c )cout << x << " ";
#define ol(c , s , e ) for(int pos=s; pos<e ; pos++) cout << c[pos] << " ";
#define inf 1e18;
#define PI acos(-1)
const int M = 1000000007;
const int N=1e5+5;

//#define rohit
#ifdef rohit
template<typename... T >
void bug(T... __VA_ARGS__) {
    ((cerr << __VA_ARGS__ << " ") , ...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", bug(__VA_ARGS__) , cerr << endl;
#endif

void solve() {
    int x;
    cin >> x;
    int ans = 0;
    int st = 100;
    int i=1;
    while(st < x )
    {
        st+=st/100;
        ans++;
    }
    cout << ans << endl;

}

signed main()
{
    FAST;
    //TODO:  check test cases are there or not?
    int tc=1;
//    cin >> tc;
    for(int t = 1 ; t <= tc ; t++)
    {
        solve();
    }
}

Measured memory_bytes: 3620