akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	string s;
	cin >> s;

	bool strong = true;
	int len = s.length();

	string ss = s;
	reverse(ss.begin(), ss.end());
	if (s != ss) strong = false;

	string ls = s.substr(0, (len - 1) / 2);
	string rls = ls;
	reverse(rls.begin(),rls.end());
	if (ls != rls) strong = false;

	string rs = s.substr((len + 3)/2 -1 , (len - 1) / 2);
	string rrs = rs;
	reverse(rrs.begin(), rrs.end());
	if (rs != rrs) strong = false;

	if (strong) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
#define en "\n"
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>


using namespace std;
const ll maxn=1e5+100,inf=1e18,LOG=23,mod=1e9+7;
int block = 300, timer = 0;
const ld EPS = 1e-7;

#define bt(i) (1 << (i))
//#define int ll

int n, m, a[maxn], S;

main()
{
	cin >> n >> m;
	forn(1, i, n)
	{
		cin >> a[i];
		S += a[i];
	}
	sort(a + 1, a + 1 + n);
	reverse(a + 1, a + 1 + n);
	forn(1, i, n)
	{
		if(1.0*S / (1.0*4*m) <= 1.0*a[i])
		{
			if(i >= m)
			{
				cout << "Yes";
				return 0;
			}
			continue;
		}
	}
	cout << "No";
	return 0;
}

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

int main() {
  int N;
  cin>>N; 
  string s;
  cin>>s;
  
  int ri=0;//"("
  int le=0;//")"
  rep(j,s.size()){
    if(s.at(j)=='('){
      ri++;
    }
    if(s.at(j)==')'&&ri>0){
      ri--;
    }
    else if(s.at(j)==')'&&ri==0){
      le++;
    }
  }
  
  while(ri--){
    s=s+')';
  }
  while(le--){
    s='('+s;
  }
  
  cout<<s<<endl; 
}

Measured memory_bytes: 256
class Main{public static void main(String[]z)throws Exception{String r;for(byte[]x=new byte[12];System.in.read(x)>11;System.out.println(r)){r="NA";for(String y:"b w".split(" "))for(int i=0;i<5;++i)if(i!=1&&new String(x).replaceAll("\n"," ").matches(String.format(".*%1$s.{%2$s}%1$s.{%2$s}%1$s.*",y, i)))r=y;}}}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
ll a[maxn];
ll cnt[maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	rept(i,0,n) cin>>a[i];
	if(a[n]==0)
	{
		cout<<"-1\n";
		return 0;
	}
	for(int i=n;i>=0;i--)
	{
		cnt[i]=cnt[i+1]+a[i];
	}
	if(n==0)
	{
		if(a[0]==1) cout<<"1\n";
		else cout<<"-1\n";
		return 0;
	}
	if(a[0])
	{
		cout<<"-1\n";
		return 0;
	}
	ll cntp=1,ans=1;
	for(int i=1;i<=n;i++)
	{
		cntp*=2;
		if(cntp<a[i])
		{
			cout<<"-1\n";
			return 0;
		}
		cntp=min(cnt[i],cntp);
		ans+=cntp;
		cntp-=a[i];
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 5216
#include<bits/stdc++.h>
using namespace std;
int A[26];
bool used[26];
inline string getstr()
{
	string res="";
	for(int i=0;i<26;i++)
		res+=(char)(A[i]+'a');
	return res;
}
int main()
{
	string S;
	cin>>S;
	if(S=="zyxwvutsrqponmlkjihgfedcba")
	{
		cout<<-1<<endl;
		return 0;
	}
	if(S.length()==26)
	{
		for(int i=0;i<26;i++)
			A[i]=S[i]-'a';
		next_permutation(A,A+26);
		string S1=getstr();
		for(int L=1;L<=26;L++)
			if(S<S1.substr(0,L))
			{
				cout<<S1.substr(0,L)<<endl;
				return 0;
			}
	}
	for(int i=0;i<S.length();i++)
		used[S[i]-'a']=true;
	cout<<S;
	for(int i=0;i<26;i++)
		if(!used[i])
		{
			cout<<(char)(i+'a')<<endl;
			return 0;
		}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
#include <fstream>
#include <bitset>
#include <time.h>
#include <assert.h>

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

using namespace std;


int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M, R;
    cin >> N >> M >> R;

    vector<int> v;
    FOR(_, 0, R) {
        int r;
        cin >> r;
        --r;
        v.push_back(r);
    }
    sort(ALL(v));

    vector<vector<int>> dp(N, vector<int>(N, INT_MAX));
    FOR(_, 0, M) {
        int A, B, C;
        cin >> A >> B >> C;
        --A; --B;
        dp[A][B] = C;
        dp[B][A] = C;
    }
    FOR(i, 0, N) {
        dp[i][i] = 0;
    }

    int size = dp.size();
    for(int m = 0; m < size; ++m) {
        for(int s = 0; s < size; ++s) {
            for(int e = 0; e < size; ++e) {
                if (dp[s][m] != INT_MAX && dp[m][e] != INT_MAX) {
                    dp[s][e] = min(dp[s][e], dp[s][m] + dp[m][e]);
                }
            }
        }
    }

    int ans = INT_MAX;
    do {
        int total = 0;
        FOR(i, 0, v.size() - 1) {
            total += dp[v[i]][v[i + 1]];
        }
        ans = min(ans, total);

    } while(next_permutation(ALL(v)));

    cout << ans << endl;

    return 0;
}

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

class Main{
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        	String strArr[] = br.readLine().split(" ");
        	int[] a=new int[4];

        	for(int j=0; j<4; j++){
        		a[j]=Integer.parseInt(strArr[j]);
        	}

        	for(int i=0;i<4-1;i++){
        	      for(int j=4-1;j>i;j--){

        		if(a[j]<a[j-1]){
        		  int t=a[j];
        		  a[j]=a[j-1];
        		  a[j-1]=t;
        		}
        	  }
        	}

        	if(a[0]==a[1] && a[2]== a[3]){
        		System.out.println("yes");
        	}
        	else{
        		System.out.println("no");
        	}
    }
}

Measured memory_bytes: 24352
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    string A,B,C;
    cin >> A >> B >> C;
    ll a = A.length();
    ll b = B.length();
    ll c = C.length();
    ll i = 0;
    ll j = -1;
    ll k = -1;
    string str = A;
    string out = "";
    ll cnt = i;
    while(i<a&&j<b&&k<c){
        if(str[cnt]=='a'){
            str = A;
            out = "A";
            i++;
            cnt = i;
        }else if(str[cnt]=='b'){
            str = B;
            out  = "B";
            j++;
            cnt = j;
        }else{
            str = C;
            out = "C";
            k++;
            cnt = k;
        }
    }
    cout << out << endl;
    return 0;
}


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

using namespace std;

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

  int d, x; cin >> d >> x;
  int a[x];
  int ret = 0;
  for(int i = 0; i<x; ++i) {
    cin >> a[i];
    if(i != 0)
      ret = max(ret, a[i] - a[i-1]);
  }
  ret = max(ret, d+a[0] - a[x-1]);
  cout << d-ret << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
ll func(ll a)
{
    ll cnt=0;
    while(true)
    {
        if(a%2!=0)
            break;
        else
        {
            cnt++;
            a=a/2;
        }
    }
    return cnt;
}
int main()
{
     ll t,mn=INT_MAX,v,kk;
     cin>>t;
     for(int i=0;i<t;i++)
     {
         cin>>v;
         kk=func(v);
         if(kk<mn)
            mn=kk;
     }
     cout<<mn<<endl;
}



Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
static const double EPS = 1e-8;
typedef long long ll;

const int MAX = 400010;
int bit[MAX];

int size, last, Q, lim;

void add(int i, int x)
{
	while (i <= Q)
	{
		bit[i] += x;
		i += i & -i;
	}
}
int sum(int i)
{
	int res = 0;
	while (i)
	{
		res += bit[i];
		i ^= i & -i;
	}
	return res;
}
int find_by_num(int n)
{
	int l = 1, u = last;
	while (l < u)
	{
		int m = (l + u) / 2;
		int s = sum(m);

		if (s < n)
			l = m + 1;
		else
			u = m;
	}
	return l;
}
int main()
{
	while (scanf("%d%d", &Q, &lim), Q | lim)
	{
		fill(bit, bit+Q+1, 0);
		size = last = 0;
		map<int, int> no, pos;
		for (int count = 0; count < Q; ++count)
		{
			int q, x;
			scanf("%d%d", &q, &x);

			if (q == 0)
			{
				++last;
				++size;

				add(last, 1);
				no[last] = x;
				pos[x] = last;
				if (size > lim)
				{
					add(find_by_num(1), -1);
					--size;
				}
			}
			else if (q == 1)
			{
				add(find_by_num(x), -1);
				--size;
			}
			else if (q == 2)
			{
				printf("%d\n", no[find_by_num(x)]);
			}
			else
			{
				add(pos[x], -1);
				--size;
			}
		}

		puts("end");
	}

	return 0;
}

Measured memory_bytes: 0
fun main(args: Array<String>) {
    while (true) {
        val nmtp = readLine()!!.split(' ').map{ it.toInt() }
        if (nmtp.filter { it != 0 }.isEmpty()) break

        var a = Array(nmtp[1]) { Array(nmtp[0]) { 1 } }

        (0 until nmtp[2]).forEach {
            val dc = readLine()!!.split(' ').map{ it.toInt() }

            var na = Array(nmtp[1]) { Array(nmtp[0]) { 0 } }

            if (dc[0] == 1) {
                (0 until dc[1]).forEach { j ->
                    (0 until nmtp[1]).forEach { k ->
                        na[k][j] = a[k][dc[1] - j - 1]
                    }
                }
                (0 until (nmtp[0] - dc[1])).forEach { j ->
                    (0 until nmtp[1]).forEach { k ->
                        na[k][j] += a[k][dc[1] + j]
                    }
                }
            } else {
                (0 until dc[1]).forEach { j ->
                    (0 until nmtp[0]).forEach { k ->
                        na[j][k] = a[dc[1] - j - 1][k]
                    }
                }
                (0 until (nmtp[1] - dc[1])).forEach { j ->
                    (0 until nmtp[0]).forEach { k ->
                        na[j][k] += a[dc[1] + j][k]
                    }
                }

            }

            a = na
        }

        (0 until nmtp[3]).forEach {
            val xy = readLine()!!.split(' ').map{ it.toInt() }

            println(a[xy[1]][xy[0]])
        }

    }
}



Measured memory_bytes: 46936
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;
#define INF 999999999
#define int64 long long
#define rep(i, n) for(int i = 1; i <= (int)(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int len = S.length();
    int ans = 0;
    int stack = 0;
    for(int i=0; i<=len-1; ++i){
        if (S[i]=='#') ++stack;
        else if (stack > 0){
            ++ans;
            --stack;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast","no-stack-protector","unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx,tune=naive")
//#pragma GCC diagnostic ignored "-W"
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
int main(){
        int k,x;
        while(~getII(k,x)){
                FE(i,x-k+1,x) printf("%d ",i);
                F(i,x+1,x+k) printf("%d ",i);
                puts("");
        }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    int n;
    cin >> n;
    if(n%2==1){
        cout << 0 << endl;
    }
    else{
        int x = 10;
        int cnt = 0;
        while (x<=n)
        {
            cnt += n / x;
            x *= 5;
        }
        cout << cnt << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
  int N,M;
  cin >> N >> M;
  int t = (1900 * M + 100*(N-M));
  int mul = 1;
  int i;
  for(i=0;i<=M-1;i++)
    mul *= 2;
  cout << mul * t << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
	for(int i=1;i<=9;i++){
		{
			for(int j=1;j<=9;j++){
				Console.WriteLine(i+"x"+j+"="+i*j);
			}
		}
	}
	}
}


Measured memory_bytes: 9052
using System;
using System.Collections.Generic;
class Program{
	public static void Main(string[] args){
    	string[] input = Console.ReadLine().Split(' ');
      	int A = int.Parse(input[0]);
      	int B = int.Parse(input[1]);
        int K = int.Parse(input[2]);
      
      	List<int> list = new List<int>();
      	for(int i = 1;i <= Math.Min(A,B);i++){
        	if(A%i == 0&&B%i ==0){
            	list.Add(i);
            }
        }
      
      	Console.WriteLine(list[list.Count - K]);
      	//Console.WriteLine(list.Count);
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<mint> dp(s+1);
    mint ans = 0;
    rep(i,n) {
        dp[0] += 1;     // Lがここからを足す
        vector<mint> dpNext(s+1);
        rep(j,s+1) {
            dpNext[j] += dp[j];                         // a[i]を選ばない
            if (j+a[i] <= s) dpNext[j+a[i]] += dp[j];   // a[i]を選ぶ
        }
        dp = dpNext;
        ans += dp[s];   // Rがここまでを足す
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
abc = list(map(int,input().split()))
odd = []
even = []
for i in abc:
    if i%2==0:
        even.append(i)
    else:
        odd.append(i)
if (not odd) or (not even):
    print(sum([(max(abc)-x)//2 for x in abc]))
else:
    if len(odd) ==1:
        even = [x+1 for x in even]
    else:
        odd = [x+1 for x in odd]
    abc = odd+even
    print(sum([(max(abc)-x)//2 for x in abc])+1)

Measured memory_bytes: 3064
a, b = gets.chomp.split(' ').map(&:to_i)
s = gets.chomp.split('')

if s.length != a + b + 1
    puts("No")
elsif s[a] != '-'
    puts("No")
else 
  flag = true
  s.each_with_index do |c, i|
    if i != a and (c < '0' || '9' < c)
      flag = false
      break
    end
    if i == a and c != '-'
      flag = false
      break
    end
  end
  if flag
    puts "Yes"
  else
    puts "No"
  end
end


Measured memory_bytes: 1788
#!/usr/bin/env python3
import sys
from bisect import bisect_right


def cal_prime(N):
    prime_list = set()
    ans_list = set()
    for i in range(2, N):
        flag = True
        for j in range(2, int(i**0.5)+1):
            if i % j == 0:
                flag = False
                break
        if flag:
            prime_list.add(i)
            if i > 2 and (i+2) // 2 in prime_list:
                ans_list.add(i)
    return sorted(ans_list)


def main():
    Q = int(input())
    ans_list = cal_prime(10**5)

    for i in range(Q):
        l, r = map(int, input().split())
        print(bisect_right(ans_list, r)-bisect_right(ans_list, l-1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4084
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

const ll INF=1e13+7;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
    int N,Q,A[100020],B[100020];
    string S;
    cin>>N>>Q>>S;
    rep(i,Q)cin>>A[i]>>B[i];
    int t[100020];
    t[0]=0;
    for(int i=0;i<N-1;i++){
        if(S[i]=='A'&&S[i+1]=='C')t[i+1]=t[i]+1;
        else t[i+1]=t[i];
    }
    for(int i=0;i<Q;i++){
        cout<<t[B[i]-1]-t[A[i]-1]<<endl;
    }
    cout<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 2176
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Point p1 = new Point(0, 0);
		Point p2 = new Point(100, 0);
		print(p1);
		kock(n, p1, p2);
		print(p2);
	}
	static void kock(int n, Point p1, Point p2){
		if(n == 0) return;

		Point s = new Point(
			p1.x<p2.x?	p1.x+(p2.x-p1.x)/3:
						p1.x-(p1.x-p2.x)/3,

			p1.y<p2.y?	p1.y+(p2.y-p1.y)/3:
			p1.y>p2.y?	p1.y-(p1.y-p2.y)/3:
						p1.y);

		Point u = new Point(
			(p1.x<p2.x&&p1.y<p2.y)||(p1.x>p2.x&&p1.y>p2.y)?	p1.x:
			(p1.x<p2.x&&p1.y>p2.y)||(p1.x>p2.x&&p1.y<p2.y)?	p2.x:
			p1.x<p2.x&&p1.y==p2.y?							p1.x+(p2.x-p1.x)/2:
															p1.x-(p1.x-p2.x)/2,

			p1.x<p2.x&&p1.y<p2.y?	p1.y+(p2.y-p1.y)/3*2:
			p1.x>p2.x&&p1.y<p2.y?	p1.y+(p2.y-p1.y)/3:
			p1.x<p2.x&&p1.y>p2.y?	p1.y-(p1.y-p2.y)/3:
			p1.x>p2.x&&p1.y>p2.y?	p1.y-(p1.y-p2.y)/3*2:
			p1.x<p2.x&&p1.y==p2.y?	p1.y+(p2.x-p1.x)/6*Math.tan(Math.PI/3):
									p1.y-(p1.x-p2.x)/6*Math.tan(Math.PI/3));

		Point t = new Point(
			p1.x<p2.x?	p1.x+(p2.x-p1.x)/3*2:
						p1.x-(p1.x-p2.x)/3*2,

			p1.y<p2.y?	p1.y+(p2.y-p1.y)/3*2:
			p1.y>p2.y?	p1.y-(p1.y-p2.y)/3*2:
						p1.y);

		kock(n-1, p1, s);
		print(s);
		kock(n-1, s, u);
		print(u);
		kock(n-1, u, t);
		print(t);
		kock(n-1, t, p2);
	}
	static void print(Point d){
		System.out.println(d.x+" "+d.y);
	}
}
class Point{
	double x;
	double y;
	public Point(double x, double y){
		this.x = x;
		this.y = y;
	}
}

Measured memory_bytes: 29416
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main(){
  int A;
  cin >> A;
  double B;
  cin >> B;
  cout << (int)(A*B) << endl;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e14;
using Graph = vector<vector<int>>;

signed main(){
  int N, K, A, B, C;
  cin >> N >> K >> A >> B >> C;
  string T;
  cin >> T;

  int ans = 0;
  vector<bool> win(N);
  for( int i = 0; i < N; i++ ){
    int now = -1;
    if( T[i] == 'r' ) now = C;
    else if( T[i] == 's' ) now = A;
    else now = B;

    if( i < K ){
      ans += now;
      win[i] = 1;
    }else if( T[i] != T[i-K] ){
      ans += now;
      win[i] = 1;
    }else if( win[i-K] == 0 ){
      ans += now;
      win[i] = 1;
    }
  }
  cout << ans << endl;


}


Measured memory_bytes: 3748
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

template <typename T> void output(T, int);
template <typename T> T max(T, T);
int gcd(int a, int b);

int main() {
    // source
    int r;
    cin >> r;
    if (r < 1200) {
        cout << "ABC" << endl;
    } else if (r < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T max(T a, T b) {

    if (a > b) {
        return a;
    } else {
        return b;
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}


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

using namespace std;

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<pii>;
using vl = vector<ll>;
using vll = vector<pll>;
using ld = long double;
#define ff first
#define ss second
const ld pi = acosl(-1);
const ll prime = 1000000000 + 7;
const ll INF = 1000000000;

struct UnionFind{
    vl pai;
    vl rank;
    vl sum;
    UnionFind(ll n): pai(n), rank(n), sum(n){
        iota(pai.begin(), pai.end(), 0);
        fill(rank.begin(), rank.end(), 1);
        fill(sum.begin(), sum.end(), 1);
    }
    ll Find(ll x){
        if(x == pai[x]){
            return x;
        }
        return pai[x] = Find(pai[x]);
    }
    void Union(ll a, ll b){
        a = Find(a);
        b = Find(b);
        if(a == b){
            return;
        }
        if(rank[a] == rank[b]){
            rank[a]++;
        }
        if(rank[a] < rank[b]){
            sum[b] += sum[a];
            pai[a] = b;
        } else{
            sum[a] += sum[b];
            pai[b] = a;
        }
    }
};


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

    // ll n, m;
    // while(cin >> n >> m){

    //     UnionFind uf(n*m);
    //     vector<string> vet(n);
    //     for(int i = 0; i < n; ++i){
    //         cin >> vet[i];
    //     }
    //     for(int i = 0; i < n; ++i){
    //         for(int j = 0; j < m; ++j){
    //             if(vet[i][j] == vet[i][(j+1)%m]){
    //                 uf.Union(m*i + j, m*i + (j+1)%m);
    //             }
    //             if(vet[i][j] == vet[(i+1)%n][j]){
    //                 uf.Union(m*i + j, m*((i+1)%n) + j);
    //             }
    //         }
    //     }
    //     ll x, y, res = 0;
    //     cin >> x >> y;
    //     if(vet[x][y] == 'l'){
    //         ll aux = uf.Find(m*x + y);
    //         res = uf.sum[aux] ;
    //     }
    //     cout << res << endl;
    // }
    ll n, m;
    cin >> n >> m;
    UnionFind uf(n+1);
    for(int i = 0; i < m; ++i){
        ll a, b;
        cin >> a >> b;
        uf.Union(a, b);
    }
    ll res = 0;
    for(int i = 1; i <= n; ++i){
        ll aux = uf.Find(i);
        res = max(res, uf.sum[aux]);
    }
    cout << res << endl;

    
    return 0;
}

Measured memory_bytes: 7964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int X, A;

int main() {
  cin >> X >> A;
  cout << (X < A ? 0 : 10) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 1000000

int isprime[N];

void gen(void) {
  int i, j;
  for(i = 0; i < N; i++) {
    isprime[i] = 1;
  }
  for(i = 2; i < N; i++) {
    if(isprime[i]) {
      for(j = 0; i * (j + 2) < N; j++) {
        isprime[i * (j + 2)] = 0;
      }
    }
  }
}

int main(int ac, char **av) {
  char buf[256];
  int n, i, s;

  gen();

  while(fgets(buf, 256, stdin) != NULL) {
    sscanf(buf, "%d", &n);
    for(i = 2, s = 0; i <= n; i++) {
      s += isprime[i];
    }
    printf("%d\n", s);
  }
  return 0;
}

Measured memory_bytes: 4508
#include<stdio.h>
int main(){
	int a[20];
	int n,js=0;
	scanf("%d",&n);
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for (int i=1;i<n-1;i++){
		if ( (a[i-1] > a[i] && a[i] > a[i+1]) || ((a[i-1] < a[i] && a[i] < a[i+1]))){
			js++;
		}
	}
	printf("%d",js);
	return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int now[4],L[4],S[4];
int ans[10000] = {0},cor = 0,mode[10000];	//mode[i] : 1 = int,0 = char
char *ansc[10000];

void acpy(int *p,int *q,int size){
	for(int i = 0;i < size;i++)
		p[i] = q[i];
}
int main(){
	char str[6];
	int i;
	while(cin >> str){
		for(i = 0;i < 4;i++){
			if(str[i] != '0')
				break;
		}
		if(i == 4)
			break;
		//ここから開始
		for(i = 0;i < 3;i++){
			if(str[i] != str[i+1])
				break;
		}
		if(i == 3){
			ansc[cor] = "NA";
			cor++;
			continue;
		}
		for(i = 0;i < 4;i++){
			now[i] = str[i]-48;
		}
		while(now[0] != 6 || now[1] != 1 || now[2] != 7 || now[3] != 4){
			sort(now,now+4,greater<int>());
			acpy(L,now,4);
			sort(now,now+4);
			acpy(S,now,4);
			for(i = 3;i >= 0;i--){
				now[i] = L[i]-S[i];
				if(now[i] < 0){
					now[i] += 10;
					L[i-1]--;
				}
			}
			ans[cor]++;
		}
		mode[cor] = 1;
		cor++;
	}
	for(i = 0;i < cor;i++){
		if(mode[i])
			cout << ans[i] << endl;
		else
			cout << ansc[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}






int main(){
	ll D;
	cin >> D;
	vector<ll> c(26);
	FOR(i,0,26) cin >> c[i];
	vector<ll> last(26,0),s(26);



	FOR(i,0,D){
		FOR(j,0,26) cin >> s[j];
		ll score=-INF,res;
		ll sc = 0;
		FOR(j,0,26){
			sc -= c[j]*(i+1-last[j]);
		}
		FOR(j,0,26){
			ll sc_j = c[j]*(i+1-last[j]) + s[j];
			if(sc+sc_j > score){
				score = sc + sc_j;
				res = j;
			}
		}
		last[res] = i+1;
		cout << res+1 << endl;
	}

}



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

int main(){
  int N;  
  cin>>N;
  vector<int> A(3);
  set<vector<int>> st;
  for(int i = 0;i < N;i++){
      cin>>A[0]>>A[1]>>A[2];
      sort(A.begin(),A.end());
      st.insert(A);
  }
  cout<<N-st.size()<<endl;
}


Measured memory_bytes: 3212
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++){
		if (to_string(i).length()%2) ans++;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt64(scanner)
	ans := 0
	cmp := 0
	for n >= 10 {
		ans += 9
		cmp += int(n % 10)
		n /= 10
	}
	if ans == cmp {
		ans += int(n % 10)
	} else {
		ans += int(n%10) - 1
	}
	fmt.Println(ans)
	writer.Flush()
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end(), greater<int>());
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (i % 2)
        {
            ans -= a.at(i);
        }
        else
        {
            ans += a.at(i);
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int main(){
  int M[N][N];
  int i, j, n, u, k, v;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++)
      M[i][j]=0;
	}
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }

  return 0;
  
}
    



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

public class Main {
	public static void main(String args[]) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String str = br.readLine();
			String[] w_h = str.split(" ", 0);
			int h = Integer.parseInt(w_h[0]);
			int w = Integer.parseInt(w_h[1]);
			if (w == 0 && h == 0) {
				break;
			}
			for (int j = 0; j < h; j++) {
				for (int i = 0; i < w; i++) {
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 32688
#include<bits/stdc++.h>
using namespace std;
const int N=2005,mod=1e9+7;
unsigned long long a[N],n,k,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		unsigned long long s1=0,s2=0;
		for(int j=1;j<=n;j++)
		{
			if(a[i]>a[j])
			{
				if(j<i) s1++;
				else s2++;
			}
		}
		ans=(ans+k*(k-1)/2%mod*s1%mod)%mod;
		ans=(ans+k*(k+1)/2%mod*s2%mod)%mod;
	}
	cout<<ans<<endl;
	return 0;
}


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

void p(char c){ cout<<c<<endl; }

int main(void)
{
 string a,b,c;
 cin>>a>>b>>c;
 int i=1,j=0,k=0;
 char cc=a[0];
 while(1){
  switch(cc){
  case 'a':
   if(i==a.length()) {p('A'); return 0;}
   cc=a[i++];
   break;
  case 'b':
   if(j==b.length()) {p('B'); return 0;}
   cc=b[j++];
   break;
  case 'c':
   if(k==c.length()) {p('C'); return 0;}
   cc=c[k++];
   break;
  }
 }
 return 0;
}

Measured memory_bytes: 256
m, d = map(int, input().split())
cnt = 0
for i in range(4, m+1):
  for j in range(10, d+1):
    d10, d1 = j//10, j%10
    if d1 < 2 or d10 < 2:
      continue
    if i == d10 * d1:
      #print(i, '月', d10*10+d1, '日')
      cnt += 1
print(cnt)

Measured memory_bytes: 2940
n=int(input())
br=[]
re=[]
for i in range(n):
    s=input()
    br.append(s)

m=int(input())
for i in range(m):
    t=input()
    re.append(t)
count=[0]
for i in range(n):
    brcou=0
    for j in range(n):
        if br[i]==br[j]:
            brcou+=1
    for k in range(m):
        if br[i]==re[k]:
            brcou-=1
    count.append(brcou)
print(max(count))


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

int main(){
	double x[4], y[4];
	int n;
	cin >> n;
	for( int i=0; i<n; i++ ){
		for( int j=0; j<4; j++ )
			cin >> x[j] >> y[j];
		double ab = (y[1]-y[0])/(x[1]-x[0]);
		double cd = (y[3]-y[2])/(x[3]-x[2]);
		cout << (ab==cd?"YES":"NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
def find_lr(H):
    max_length = 0
    max_right = 0
    seq_cnt = 0
    for i, h in enumerate(H):
        if h > 0:
            seq_cnt += 1
            if i == len(H) - 1:
                if seq_cnt > max_length:
                    max_length = seq_cnt
                    max_right = i
        else:
            if seq_cnt > max_length:
                max_length = seq_cnt
                max_right = i - 1
            seq_cnt = 0
    return (max_right - max_length + 1, max_right)


def main():
    N = int(input())
    H = list(map(int, input().split(' ')))
    cnt = 0
    while sum(H) > 0:
        l, r = find_lr(H)
        for i in range(l, r + 1):
            H[i] -= 1
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main () {
    int W, H, N;
    cin >> W >> H >> N;
    int list[N][3];
    for(int i = 0; i < N; i++) cin >> list[i][0] >> list[i][1] >> list[i][2];

    int x_min = 0, x_max = W, y_min = 0, y_max = H;
    for(int i = 0; i < N; i++) {
        if(list[i][2] == 1) { x_min = max(list[i][0], x_min);
        } else if(list[i][2] == 2) { x_max = min(list[i][0], x_max);
        } else if(list[i][2] == 3) { y_min = max(list[i][1], y_min);
        } else if(list[i][2] == 4) { y_max = min(list[i][1], y_max);
        }
    }
    int res_x = max(0, x_max - x_min);
    int res_y = max(0, y_max - y_min);
    cout << res_x * res_y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define MAX 50 
using namespace std; 
  
// Function to print Excel column name for a given column number 
void printString(long long n) 
{ 
    char str[MAX]; // To store result (Excel column name) 
    int i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
  
    return; 
} 
  
// Driver program to test above function 
int main() 
{ 
   long long n;
  cin>>n;
  printString(n);
  return 0;
} 

Measured memory_bytes: 3616
N = int(input())
A, B = map(int, input().split())
C = int(input())
D = [None] * N
for i in range(N):
    D[i] = int(input())

D.sort(reverse = True)
numer = C
denom = A
ratio = numer / denom

for i in range(N):
    numer += D[i]
    denom += B
    next_ratio = numer / denom
    if next_ratio <= ratio:
        break
    ratio = next_ratio

print(int(ratio))

Measured memory_bytes: 7684
#include<bits/stdc++.h>
#define pb push_back
typedef long long goo;
using namespace std;
int read(){
    char ch;
    int input = 0, num = 1;
    do{
        ch = getchar();
        if(ch == '-') num=-1;
    }
    while(ch < '0' or ch > '9');
    while(ch >= '0' and ch <= '9'){
        input = input * 10 + ch - '0';
        ch = getchar();
    }
    return input * num;
}
int main()
{
    int n=read(),k=read();
    int ans=k;
    for(int i=2;i<=n;i++)
        ans*=k-1;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string s; cin >> s;
    
    int cLen = 0;
    int cLen_tmp=1;
    for(uint i=1; i<s.size(); ++i){
        if( s[i-1]==s[i] ){ ++cLen_tmp; }else{ cLen_tmp=1; }
        cLen = max(cLen, cLen_tmp);
    }
    
    cout << (cLen>=3 ? "Yes":"No") << endl;
    
    return 0;
}

Measured memory_bytes: 3648
import sys


n=int(input())

if n==1:
    print('Yes')
    print(2)
    print(1,1)
    print(1,1)
    sys.exit()

k=3
while True:
    if (k-1)*k//2<n:
        k+=1
    elif (k-1)*k//2==n:
        break
    else:
        print('No')
        sys.exit()

print('Yes')
print(k)

def divide(x,y):#x=n,y=k
    if x==3:
        return [[1,2],[2,3],[3,1]]
    else:
        res=divide(x-(y-1),y-1)
        for i in range(y-1):
            res[i].append((x-y+2)+i)
        res.append([i for i in range(x-y+2,x+1)])
        return res


Ans=divide(n,k)
for ans in Ans:
    print(k-1,*ans)











Measured memory_bytes: 17316
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        int count = 0;

        for (int i = Math.min(A, B); i >= 1; i--) {
            if (A % i == 0 && B % i == 0) {
                count++;
            }

            if (count == K) {
                count = i;
                break;
            }
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(count);

        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 35700
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
//#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n=3;


signed main(){
    long long a;
    double b;
    cin >> a >> b;
  	b = (100 * b);
  	long c = (long)(b+0.9);
  	//printD(c);
  	print((a*c)/100);
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {

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

	    int N = Integer.parseInt(scanner.next());
	    int[] x = new int[N];
	    int[] y = new int[N];
	    long[] h = new long[N];

	    long[][] ha = new long[101][101];
	    boolean[][] b = new boolean[101][101];

	    for (int i=0; i<N; i++) {
	    	x[i]=Integer.parseInt(scanner.next());
	    	y[i]=Integer.parseInt(scanner.next());
	    	h[i] = Long.parseLong(scanner.next());
	    }

	    for (int i=0; i<101; i++) {
	    	for (int j=0; j<101; j++) {
	    	    b[i][j]=true;
	    	}
	    }

	    for (int i=0; i<N; i++) {
	    	if (h[i] == 0) {
	    		b[x[i]][y[i]] = false;
	    		continue;
	    	}
	    	for (int j=0; j<=100; j++) {
	    		for (int k=0; k<=100; k++) {
	    			if ((ha[j][k] == 0) && (h[i] != 0)) {
			    	    ha[j][k] = Math.abs(x[i] - j) + Math.abs(y[i] - k) + h[i];
	    			}
			    }
		    }
	    }

    	boolean f=false;
	    for (int i=0; i<N; i++) {
	    	for (int j=0; j<=100; j++) {
	    		for (int k=0; k<=100; k++) {
			    	if ((b[j][k] == true)) {
			    		    if(Math.max(ha[j][k] - Math.abs(x[i] - j) - Math.abs(y[i] - k), 0) != h[i]) {
			    	    		b[j][k] = false;
			    		    }
			    	}
			    }
		    }
	    }

	    for (int X=0; X<101; X++) {
	    	for (int Y=0; Y<101; Y++) {
	    		if (b[X][Y] == true) {
	    		    System.out.println(X+ " " + Y + " " + ha[X][Y]);
	    		}
	    	}
	    }
	}

}

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

using namespace std;

const int INF = 1e9 + 5;

int main()
{
  int n, a[100010][3];

  cin >> n;

  for (int i = 0; i < n; i++)
  {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }

  int dp[n+1][3];
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      dp[i][j] = 0;
    }
  }

  dp[0][0] = a[0][0];
  dp[0][1] = a[0][1];
  dp[0][2] = a[0][2];

  for (int i = 1; i < n; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      for (int k = 0; k < 3; k++)
      {
        if (j == k)
          continue;
        dp[i][k] = max(dp[i][k], dp[i-1][j] + a[i][k]);
      }
    }
  }

  cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << "\n";

  return 0;
}


Measured memory_bytes: 2560
from sys import stdin

n = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(n)]

total = 0.0

for i in range(n):
    if li[i][1] == "BTC":
        total += float(li[i][0])*380000
    else:
        total += float(li[i][0])

print(total)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
 
int main() {
  int x, n, max = -1000000, min = 1000000;
  long sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++){
    cin >> x;
    if (max < x) {max = x;}
    if (x < min) {min = x;}
    sum += x;
  }
  cout << min << " " << max << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3096