akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef         long double      dl;
typedef     unsigned long long  ull;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define         arrsize(a)      (sizeof(a)/sizeof(a[0]))
//#define       arrsize(a)      (sizeof(a)/sizeof(*a))
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
typedef        pair <int, int>   pii;
typedef       pair <ll, ll>      pll;
typedef      vector< pair <ll, ll> >      vpll;
typedef		vector<ll>      vll;
typedef		map<string,ll>      msl;
typedef		map<ll,ll>      mll;
#define yes cout << "YES\n"
#define no cout<<"NO\n"
//memset(ar,-1,sizeof(ar));
//#define sort(x) sort(x.begin(), x.end())
//sort(a,a+n,greater<ll>())
//for (auto it = mp.begin(); it != mp.end(); ++it){}
#define MAX 1000005
#define precision(a) fixed << setprecision(a)

#define mod 1000000007


ll ar[MAX];
int main()
{
 //O_O ;

   map<ll,ll>mp;
        ll n;
      cin>>n;ll ans=0;
      for(ll i=0;i<n;i++){
        cin>>ar[i];mp[ar[i]]++;ans+=ar[i];
        }
      ll q;cin>>q;
      for(ll i=0;i<q;i++)
      {
      ll a,b;
      cin>>a>>b;
          ll temp=mp[a];
        //  cout<<temp<<nn;
          ll temp2=mp[a]*a;
           ans-=temp2;
          ans+=(temp*b);
          mp.erase(a);
          mp[b]+=temp;

      //  cout<<mp[b]<<nn;
        cout<<ans<<nn;







   }


    return 0;
}


Measured memory_bytes: 8276
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
         new Main().solve();
    }

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        long n = Long.parseLong(tokenizer.nextToken());
        int x = Integer.parseInt(tokenizer.nextToken());
        int m = Integer.parseInt(tokenizer.nextToken());
        HashSet<Integer> alreadyIn = new HashSet<Integer>();
        ArrayList<Integer> sequence = new ArrayList<Integer>();
        ArrayList<Integer> cycle = new ArrayList<Integer>();
        int cycleStart =  x;
        while (!alreadyIn.contains(cycleStart)) {
            alreadyIn.add( cycleStart);
            sequence.add(cycleStart);
            cycleStart = (int) (((long) cycleStart * cycleStart) % m);
        }

        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
        int index = sequence.size() - 1;
        while (sequence.get(index) != cycleStart) {
            stack.addFirst(sequence.get(index));
            index--;
        }
        stack.addFirst(sequence.get(index));

        for (int i : stack) cycle.add(i);

        index = 0;
        long sum = 0;
        while (sequence.get(index) != cycleStart && n > 0) {
            sum += sequence.get(index);
            n--;
            index++;
        }


        if (n == 0) {
            out.println(sum);
        } else {
            long cycleSum = 0;
            for (int i : cycle) cycleSum += i;
            sum += cycleSum * (n / cycle.size());
            for (int i = 0; i < n % cycle.size(); i++) sum += cycle.get(i);

            out.println(sum);
        }

        out.close();
    }
}

Measured memory_bytes: 44096
import numpy as np

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

N = int(input())
monster_list = list(map(int, input().split()))
monster_list.sort(reverse=True)

for i in range(len(monster_list) - 1):
    monster_list[i + 1] = gcd(monster_list[i + 1], monster_list[i])

print(monster_list[-1])


Measured memory_bytes: 23120
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int N,K,S;
// vector<int> vec;

int dfs(int k,int sum=0,int p=0){
    if(k == K){
        // for(int i=0; i<vec.size(); i++){
        //     cout << vec[i] << (i!=vec.size()-1 ? " " : "\n");
        // }
        return (sum == S);
    }
    int res = 0;
    for(int i=p+1; i<=N; i++){
        // vec.push_back(i);
        res += dfs(k+1,sum+i,i);
        // vec.pop_back();
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K >> S;
    while(N != 0){
        cout << dfs(0) << endl;
        cin >> N >> K >> S;
    }
    return 0;
}


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

const double EPS = 1e-10;

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    // if (abs(a-b)<EPS) return 0;
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L() {}
};

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int main(){
    while(true){
        int N;
        cin >> N;
        if(N == 0) break;

        vector<L> lines;
        int ans = 1;
        for(int i=0;i<N;i++){
            int x1, y1, x2, y2;
            cin >> x1 >> y1 >> x2 >> y2;
            P p1(x1, y1), p2(x2, y2);

            L new_line(p1, p2);
            vector<P> cross_points;
            for(L& line : lines){
                if(intersectLL(new_line, line)){
                    P p = crosspoint(new_line, line);
                    if(-100 < real(p) && real(p) < 100 && -100 < imag(p) && imag(p) < 100){
                        bool exist = false;
                        for(P& ap : cross_points){
                            if(abs(ap - p) < EPS){
                                exist = true;
                                break;
                            }
                        }
                        if(!exist){
                            cross_points.push_back(p);
                        }
                    }
                }
            }
            ans += cross_points.size() + 1;
            lines.push_back(new_line);
        }
        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long LL;

const int N = 1000010;

bool f[N];

int main()
{
    f[4] = f[7] = true;
    for(int i = 8; i <= 100; i++)
    {
        if(f[i - 4]) f[i] = true;
        if(f[i - 7]) f[i] = true;
    }

    int n;
    cin >> n;

    if(f[n]) puts("Yes");
    else puts("No");

    return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if ((A + B) > (C + D)){
    cout << "Left"<< endl;
  }
  else if((A + B) == (C + D))
    cout << "Balanced" << endl;
  else 
    cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
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; }

ll N,A,B,C,D;
ll hoge[] = {2,3,5};

map<ll, ll> memo;

ll func(ll n) {
  if (n == 0) return 0;
  if (n == 1) return D;
  if (memo.count(n)) return memo[n];

  ll res = 1LL << 62;

  if (D < res / n + 1000100000LL)
  {
    chmin(res, D * n);
  }

  for (ll h : hoge) {
    ll cost = 0;
    if (h == 2) cost = A;
    else if (h == 3) cost = B;
    else cost = C;
    chmin(res, func(n / h) + D * (n - n / h * h) + cost);
    if (n % h != 0) {
      chmin(res, func(n / h + 1) + D * ((n / h + 1) * h - n) + cost);
    }
  }

  return memo[n] = res;
}

int main() {
  int T;
  cin >> T;
  while(T--) {
    cin >> N >> A >> B >> C >> D;
    memo.clear();
    cout << func(N) << endl;
  }
}


Measured memory_bytes: 4444
// 2018, Sayutin Dmitry.

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::get;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // code here
    int n = input<int>();
    std::multiset<int> mlt;

    for (int i = 0; i != n; ++i)
        mlt.insert(input<int>());

    int ans = 0;
    while (not mlt.empty()) {
        int val = *mlt.rbegin();
        mlt.erase(std::prev(mlt.end()));
        
        int pw = 2;
        while (pw <= val)
            pw *= 2;

        if (mlt.find(pw - val) != mlt.end()) {
            ++ans;
            mlt.erase(mlt.find(pw - val));
        }
    }

    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
int a[505];
int n,ans;
const int inf=1e9;
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",&a[i]);
	int now=a[1];
	rep(i,2,n){
		if (a[i]==now) a[i]=inf,ans++;
		now=a[i];	
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	V t(n);
	SCAN(t);

	int m;
	scanf("%d", &m);
	while(m--){
		int p, x, ans = 0;
		scanf("%d %d", &p, &x);
		REP(i, 0, n){
			if(i==p-1) ans += x;
			else ans += t[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}



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

typedef long long int ll;

int main(){
	ll a, b, c, d; cin>>a>>b>>c>>d;
	
	ll mc = b/c - (a-1)/c;
	ll md = b/d - (a-1)/d;
	ll ppcm = (c*d)/__gcd(c,d);
	ll mcd = b/ppcm - (a-1)/ppcm;
	ll aoub = mc + md - mcd;
	cout<<b-a+1-aoub;
}


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

int main() {
  int N,Y,count;
  vector<int> X(3);
  cin >> N >> Y;
  count=0;
 for(int i=0;i<N+1;i++){
 for(int j=0;j<N+1;j++){

   if(Y == 10000*i+5000*j+1000*(N-i-j) && N-i-j > -1){
     count =1;
     X={i,j,N-i-j};
     break;
   }
 }
 }
   
if(count==1){
  cout << X[0] << " " << X[1] << " " << X[2] <<endl;
}
else{
  X={-1,-1,-1};
  cout << X[0] << " " << X[1] << " " << X[2] <<endl;
}
}  


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

using vi = vector<int>;

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

    vi v(n);

    for(int i = 0; i < n; i++) cin >> v[i];

    sort(begin(v), end(v));

    int a = accumulate(begin(v), end(v), 0);

    for(int i = 0; i < n && a % 10 == 0; i++) if(v[i] % 10)
    {
        a -= v[i];
        break;
    }

    if(a % 10 == 0) cout << 0 << endl;
    else cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
S = input()

if 0 < int(S[:2]) <= 12:
    if 0 < int(S[2:]) <=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < int(S[2:]) <=12:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 2940
/* Manish Pant - insider_pants, hello_my_friend */
    
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define endl "\n"
#define pb push_back

typedef long long ll;
typedef long double ldob;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T> ostream& operator << (ostream &os, const multiset<T> &v) { for (T i : v) os << i << " "; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.F << ' ' << v.S; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.F << " => " << i.S << ')' << ' '; return os; } 

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve()
{

}

int main()
{
    fast();
    string s; cin >> s;
    if(s == "ABC") cout << "ARC";
    else cout << "ABC";
}

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

int n;
char s[110];
int cnt[3];

int main() {
	while (scanf("%d", &n) != EOF) {
		memset(cnt, 0, sizeof cnt);
		int res = 0;
		for (int i = 1; i <= n; ++i) {
			scanf("%s", s + 1);
			int len = strlen(s + 1); 
			for (int j = 1; j < len; ++j) {
				if (s[j] == 'A' && s[j + 1] == 'B') {
					++res;
				}
			}
			if (s[1] == 'B' && s[len] == 'A') {
				++cnt[0];
			} else if (s[1] == 'B') {
				++cnt[1];
			} else if (s[len] == 'A') {
				++cnt[2]; 
			}
		}
		if (cnt[0]) {
			res += cnt[0] - 1;
			cnt[0] = min(cnt[0], 1);
			if (cnt[1]) {
				++res;
				--cnt[1];
			}
			if (cnt[2]) {
				++res;
				--cnt[2];
			}
		}
		res += min(cnt[1], cnt[2]);
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll   long long int   
#define pb push_back
using namespace std;
const int M=1e9 + 7;
int main()
{   
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll k,x;cin>>k>>x;
    for(int i=x-k+1;i<=x;i++)
    {   
        if(i<-1000000)
        {
        	continue;
		}
		if(i>1000000)
		{
			continue;
		}
    	cout<<i<<" ";
	}
	for(int i=x+1;i<=(x+k-1);i++)
    {    
        if(i<-1000000)
        {
        	continue;
		}
		if(i>1000000)
		{
			continue;
		}
    	cout<<i<<" ";
	}
	return 0;
}
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] problems = new int[n];
            int sum = 0;
            for (int i = 0; i < n; ++i) {
                problems[i] = in.nextInt();
                sum += problems[i];
            }
            int m = in.nextInt();
            for (int i = 0; i < m; ++i) {
                int x = in.nextInt();
                int y = in.nextInt();
                out.println(sum - (problems[x - 1] - y));
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
ll power(ll a,int n){
  if(n==0)
    return 1;
  if((n%2)==0)
    return power(a*a,n/2);
  else
    return a*power(a*a,n/2);    
}
int main(){
FASTIO 
ll n;
cin>>n;
ll ans=0;
for(ll i=1;i<=n;i++){
   if(((i%3)!=0)&&((i%5)!=0)){
      ans+=i;
   }
}
cout<<ans;
return 0;
}


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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
//Write From this Line

int main()
{
	int n ;
	cin >> n ;
	//終わる時間でソート
	vector<pair<int,int>> P(n);
	rep(i,n){
		cin >> P[i].second >> P[i].first ; //end , need;
	}
	SORT(P);
	int time = 0 ;
	rep(i,n){
		//今からする仕事の時間
		int need = P[i].second ;
		time += need ;
		if(time <= P[i].first){
			//safe
		} else {
			coN();
			return 0 ;
		}
	}
	coY();
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define lson now<<1
#define rson now<<1|1
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int mod=1e9+7;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=2e5+10;
const ll inf=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n;
    cin>>n;
    map<string,int> m;
    vector<string> v;
    int mx=0;
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        m[s]++;
        if(m[s]>mx){
            v.clear();
            v.pb(s);
            mx=m[s];
        }
        else if(m[s]==mx)v.pb(s);
    }
    sort(all(v));
    for(auto i:v)cout<<i<<endl;
}



Measured memory_bytes: 25456
import java.util.Scanner;
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		int sum = 0;
		for(int i = 0;i<3;i++) {
			if(a.charAt(i)==b.charAt(i)){
				sum++;
			}
		}
		System.out.println(sum);
	}
 
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((int)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;




////////////////////////////////////////////////////////

ll N;
set<string> se;

void saiki(string s, char c){
    if(sz(s) == N){
        se.insert(s);
    }else{
        for(char d = 'a'; d <= c+1; d++){
            string t = s;
            t.push_back(d);
            if(d > c) saiki(t, c+1);
            else saiki(t, c);
        }
    }
}

int main() {
    cin >> N;
    string s = "a";
    saiki(s, 'a');
    for(auto t : se){
        co(t);
    }

    return 0;
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl

typedef long long LL;

int n;
string t;

int main() {

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

    cin >> t;
    n = t.length();

    for(char& c : t) {
        if(c == '?') {
            c = 'D';
        }
    }

    cout << t << endl;
    
    return 0;
}


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

ll b;

void solve(){
    int ans=1;
    int mi=b;
    ll sum=0;
    for(int i=2;;i++){
        sum+=i-1;
        if(sum>=b) break;
        if((b-sum)%i==0){
            ans=i;
            mi=(b-sum)/i;
        }
    }

    cout<<mi<<" "<<ans<<endl;
}

int main(){
  while(1){
      cin>>b;
      if(b==0) break;
      solve();
  }

  return 0;
}



Measured memory_bytes: 3100
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    print(N * (N - 1) // 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9060
#include<stdio.h>
int main(void)
{
	int a,b,i,n;
	char op;
	while(1){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='?') break;
		if(op=='+'){
			n=a+b;
			printf("%d\n",n);
		}
		if(op=='-'){
			n=a-b;
			printf("%d\n",n);
		}
		if(op=='*'){
			n=a*b;
			printf("%d\n",n);
		}	
		if(op=='/'){
			n=a/b;
			printf("%d\n",n);
		}
	}
	
	return 0;
}



Measured memory_bytes: 2596
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
char s[105];
int main(){
	scanf("%s",s);
	int  x=strlen(s);
	printf("%c%d%c",s[0],x-2,s[x-1]); 
	return 0;
}


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


int main() {

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

  int a,b;
  cin >> a >> b;

  int ans = (a <= b) ? a : a-1;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int n;
  cin>>n;
  string s;
  cin>>s;
  int m = s.size();
  string ans = "";
  REP(i,m){
    int offset = s[i] - 'A';
    offset += n;
    offset %= 26;
    char temp = 'A' + offset;
    ans += temp;
  }
  cout<<ans<<endl;
  return 0; 
}

Measured memory_bytes: 256
n = [int(i) for i in input().split()]
if n[1] == 100 and n[0] == 0:
    print(101)
elif n[1] == 100 and n[0] == 1:
    print(10100)
elif n[1] == 100 and n[0] == 2:
    print(1010000)
elif n[0] == 0:
    print(n[1])

elif n[0] == 1:
    print(100*n[1])
elif n[0] == 2:
    print(10000*n[1])


Measured memory_bytes: 38256
"use strict";
const fs = require('fs');
let input = fs.readFileSync(0).toString().split("\n").map((a) => a.split(" "));
const n = parseInt(input[0][0]);
const m = parseInt(input[0][1]);
const complete = Array(n).fill(false);
let correct = 0;
let penalties = 0;
const penaltiesDict = {};
input.slice(1).forEach((a) => {
	if (complete[parseInt(a[0]) - 1]) {
		return;
	}
	if (a[1] === "AC") {
		complete[parseInt(a[0]) - 1] = true;
		correct++;
		penalties += penaltiesDict[a[0]] || 0;
		delete penaltiesDict[a[0]];
		return;
	}
	if (typeof penaltiesDict[a[0]] === 'undefined') {
		penaltiesDict[a[0]] = 0;
	}
	penaltiesDict[a[0]]++;
});
console.log(correct + " " + penalties);

Measured memory_bytes: 53428
#include<iostream>
using namespace std;
int main(){
    int count[100000] = {};
    int count1,count2,ans;
    int N,A;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A;
        count[A-1]++;
        if(count[A-1] == 3) count[A-1] = 1;
    }
    count1=0;count2=0;
    for(int i=0;i<100000;i++){
        if(count[i] == 1) count1++;
        else if(count[i] == 2) count2++;
    }
    ans = count1+count2-count2%2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
template <typename T>
T gcd(T a, T b) {
    if (a == 0) return b;
    return gcd(b % a, a);
}
vector<ll> div(ll n) {
    vector<ll> res;
    for (ll t = 1; t * t <= n; t++) {
        if (n % t == 0) {
            res.push_back(t);
            if (t * t != n) res.push_back(n / t);
        }
    }
    sort(res.begin(), res.end());
    return res;
}
bool isprime(ll n) {
    if(n == 1)return false;
    for (ll t = 2; t * t <= n; t++) {
        if (n % t == 0) return false;
    }
    return true;
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    rep(i, n + 1) cin >> a[n - i];
    ll g = 0;
    rep(i, n + 1) g = gcd(g, abs(a[i]));
    auto d = div(g);
    set<ll> ans;
    for (ll x : d)if (isprime(x)) ans.insert(x);
    for (ll p = 2; p <= n; p++) {
        if (!isprime(p)) continue;
        show(p);
        auto b = a;
        show(b);
        ll temp = 0;
        for (ll i = n; i >= p; i--) {
            (b[i-p+1] += b[i]) %= p;
        }
        show(b);
        bool flag = true;
        for(int i = 0; i <= p-1; i++){
            if(b[i] % p != 0)flag = false;
        }
        if(flag)ans.insert(p);
    }
    for(ll x: ans){
        cout << x << "\n";
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 2147483647;

int  main() {
    int n,k;
    cin >> n >> k;
    vector<ll> h(n);
    for (ll i=0;i<n;++i){
        cin >> h.at(i);
    }
    vector<ll> dp(n);
    dp.at(0) = 0;
    for (int i=1;i<n;++i){
        dp.at(i) = INF;
    }
    for (int i=0;i<n-1;++i){
        // cout << "i=" << i ;
        int now_k;
        i+k<=n-1 ? now_k = k : now_k = n-i-1; 
        for (int j=1;j<=now_k;++j){
            ll cost = abs(h.at(i+j)-h.at(i))+dp.at(i);
            dp.at(i+j) = min(dp.at(i+j),cost);
        }
        for (int i=0;i<n;i++){
            // cout << " " << dp.at(i) ;
        }
        // cout << endl;
    }

    cout << dp.at(n-1) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  vi a(m);
  rep(i, m) cin >> a[i];
  sort(all(a), greater<int>());
  vi v = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  vi dp(n + 10, -1);
  dp[0] = 0;
  rep(i, n) rep(j, m) {
    if(dp[i] == -1) continue;
    dp[i + v[a[j]]] = max(dp[i + v[a[j]]], dp[i] + 1);
  }
  string ans;
  int i = n;
  while(i) {
    for(int j : a) {
      if(i - v[j] >= 0 && dp[i - v[j]] == dp[i] - 1) {
        i -= v[j];
        ans += char('0' + j);
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, ans;
vector<P> vec;
const ll mod =1000000007;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}

int main(void)
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		vec.push_back(P(a + b, a));
	}
	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			ans += vec[i].second;
		}
		else
		{
			ans -= (vec[i].first - vec[i].second);
		}
	}
	cout << ans << endl;
	int www;
	cin >> www;
}


Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define int ll
const ll inf=((ll)1)<<61;
vector<ll> v,rv;
ll judge(ll val){
  ll res=0;
  for(ll i=0;i<v.size();i++){
    ll lb=-1,rb=v.size();
    if(v[i]<0){
      while(rb-lb>1){
        ll mid=(lb+rb)/2;
        if(v[i]*rv[mid]>val) rb=mid;
        else lb=mid;
      }
    //  if(val==0) cout<<v[i]<<" "<<lb+(v[i]*v[i]<=val?0:1)<<endl;
      res+=lb+(v[i]*v[i]<=val?0:1);

    }
    else{
      while(rb-lb>1){
        ll mid=(lb+rb)/2;
        if(v[i]*v[mid]>val) rb=mid;
        else lb=mid;
      }
    //  if(val==0) cout<<v[i]<<" "<<lb+(v[i]*v[i]<=val?0:1)<<endl;
      res+=lb+(v[i]*v[i]<=val?0:1);
    }
  }
  return res/2;
}
signed main(){
  ll n,k;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    v.push_back(a);
    rv.push_back(a);
  }
  sort(v.begin(),v.end());
  sort(rv.begin(),rv.end(),greater<ll>());

  ll lb=-inf,rb=inf;

  //cout<<judge(-9)<<endl;
  while(rb-lb>1){
    ll mid=(lb+rb)/2;
    if(judge(mid)>=k) rb=mid;
    else lb=mid;
  }
  cout<<rb<<endl;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

struct murmur_hash {
    const unsigned int random = random_device{}();
    unsigned int operator()(const string& s) const {
        const unsigned int m = 0x5bd1e995;
        const int r = 24;
        unsigned int len = s.size(), h = (random ^ len);
        const unsigned int *z = (const unsigned int*)s.c_str();
        const char *c = s.c_str();
        while(len >= 4){
            unsigned int k = *z;
            k *= m, k = (k^(k>>r))*m, h = (h*m)^k;
            z += 1, len -= 4;
        }
        c += len / 4 * 4;
        switch(len)
        {
        case 3u: h ^= (c[2] << 16);
        case 2u: h ^= (c[1] << 8);
        case 1u: h ^= c[0];
                 h *= m;
        }
        h = (h^(h>>13))*m;
        return (h^(h>>15));
    }
};

unordered_map<string, unordered_map<string, int, murmur_hash>, murmur_hash> mp[2];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    n *= 2;
    string s;
    cin >> s;
    rep(i,(1 << (n-n/2))){
        string red,blue;
        rep(j,n-n/2){
            if((i >> j) & 1){
                red.pb(s[j+n/2]);
            }else{
                blue.pb(s[j+n/2]);
            }
        }
        reverse(all(blue));
        if(len(red) <= len(blue)){
            mp[0][blue][red]++;
        }else{
            mp[1][red][blue]++;
        }
    }
    ll ans = 0;
    rep(i,(1 << n/2)){
        string red, blue;
        rep(j,n/2){
            if((i >> j) & 1){
                red.pb(s[j]);
            }else{
                blue.pb(s[j]);
            }
        }
        reverse(all(blue));
        if(len(red) >= len(blue)){
            ans += mp[0][red][blue];
        }else{
            ans += mp[1][blue][red];
        }
    }
    cout << ans << "\n";
    return 0;
}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (2000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << max(0,c-(a-b)) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		float high = 0.0f;
		float low = 999999.0f;

		while(stdIn.hasNext()){
			high = Math.max(stdIn.nextFloat(), high);
			low = Math.min(stdIn.nextFloat(), low);
		}
		float differenceHeight = high - low;
		System.out.println(differenceHeight);
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll ans;
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		int a = i % 10, b = i;
		while(b > 9) {
			b /= 10;	
		}
		if(!a) {
			continue;
		}
		ans += (a == b);
		int bin = 1;
		for(int j = 1; j <= 5; ++j) {
			for(int k = 0; k < bin; ++k) {
				if(k * 10 + a * bin * 10 + b <= n) {
					++ans;
				} else {
					break;
				}
			}
			bin *= 10;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
import itertools
a = input()
b = list("357")
c = 0
for j in range(3, len(a) + 1):
    for i in itertools.product(b, repeat=j):
        if int("".join(i)) <= int(a) and "3" in i and "5" in i and "7" in i:
            c += 1
print(c)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
const int M = 105;
const int mod = 1e9 + 7;
int n, num[N], d;
string snum;

int add(int x, int y) {
	if (x + y >= mod) {
		return x + y - mod;
	}
	return x + y;
}

int mem[N][M][2];
bool vis[N][M][2];

int dp(int i, int m, bool border) {
	if (i == n) {
		return m ? 0 : 1;
	}
	if (vis[i][m][border]) {
		return mem[i][m][border];
	}
	vis[i][m][border] = true;

	int lv = border ? num[i] : 9;

	int ans = 0;
	for (int j = 0; j <= lv; j++) {
		bool nb = border && j == lv;
		ans = add(ans, dp(i + 1, (m + j) % d, nb));
	}

	return mem[i][m][border] = ans;
}

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

	cin >> snum >> d;
	n = snum.size();

	for (int i = 0; i < n; i++) {
		num[i] = snum[i] - '0';
	}

	cout << (mod + dp(0, 0, true) - 1) % mod << '\n';

	return 0;
}


Measured memory_bytes: 14912
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <tuple>
#include <climits>
#include <sstream>
using namespace std;

static const unsigned long long int MOD = 1000000007LL;

int main()
{
    int n;
    int a[200001], b[200001];

    cin >> n;

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

    sort(b, b + n, greater<int>());

    for (int i = 0; i < n; i++)
    {
        if (b[0] != a[i])
        {
            cout << b[0] << endl;
        }
        else
        {
            cout << b[1] << endl;
        }
    }
    return 0;
}

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

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;

    if(a == b) cout << "a == b" << endl;
    else if(a > b) cout << "a > b" << endl;
    else if(a < b) cout << "a < b" << endl;
}


Measured memory_bytes: 3136
#include<iostream>
using namespace std;
int main()
{
	int a[10],i,top1=0,top2=0,top3=0;
	for(i=0; i<10; i++)
	{
		cin >> a[i];
		if(top1<a[i])
		{
			top3=top2;
			top2=top1;
			top1=a[i];
		}
		else if(top2<a[i])
		{
			top3=top2;
		    top2=a[i];
		}
		else if(top3<a[i])
		{
			top3=a[i];
		}
	}
	cout << top1 << "\n" << top2 << "\n" << top3 << "\n";
return 0;}

Measured memory_bytes: 3084
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    auto S = sread();
    long cnt;
    foreach (c; S)
        cnt += c == 'o';
    bool b = 8 <= cnt + (15 - S.length);
    writeln(b ? "YES" : "NO");
}


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

long long A, B, C, D;

long long gcd(long long a, long long b){
    long long x = max(a, b);
    long long y = min(a, b);
    if(y == 0){
        return x;
    }else{
        return gcd(y, x % y);
    }
}

long long sub_prob(long long a, long long c, long long d){
    long long lcm = c * d / gcd(c, d);
    return a / c + a / d - a / lcm;
}

int main(){
    cin >> A >> B >> C >> D;
    //cout << sub_prob(B, C, D) - sub_prob(A - 1, C, D) << endl;
    cout << (B - A + 1) - (sub_prob(B, C, D) - sub_prob(A - 1, C, D)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define localin freopen("C:\\Users\\hp\\Desktop\\CPP\\inout\\inputf.in","r",stdin);
#define localout freopen("C:\\Users\\hp\\Desktop\\CPP\\inout\\outputf.in","w",stdout);
const int MAX=2e5+5;
#define ld long double
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define tot(v) v.begin(),v.end()
#define rtcheck cout<<"saurabh\n";exit(0);
#define vcheck(x) cout<<#x<<" "<<x<<endl;                                                                                                                                       
#define pint pair<int,int>
#define forn for(int i=0;i<n;i++)
const int modu=1e9+7;
const int inf=1e17;

struct knapsack
{
	int wt;
	int val;
};

int solve(vector<knapsack> v , int n , int W)
{
	int maxval = n*1000;
	int dp[n+1][maxval+1];

	for(int vl = 0 ; vl <= maxval ; vl++)
	{
		dp[1][vl] = INT_MAX;
	}
	dp[1][0] = 0;
	dp[1][v[1].val] = v[1].wt;

	for(int i=2;i<=n;i++)
	{
		for(int j=0;j<=maxval;j++)
		{
			dp[i][j] = dp[i-1][j];

			if(v[i].val > j)
			{
				continue;
			}
			dp[i][j] = min(dp[i][j] , v[i].wt + dp[i-1][j-v[i].val]);
		}
	}
	int ans = 0;
	for(int i=0;i<=maxval;i++)
	{
		if(dp[n][i] <= W)
		{
			ans = i;
		}
	}
	return ans;
}

int32_t main()
{
    fast;
    #ifndef ONLINE_JUDGE 
    localin;localout;
    #endif
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int W;
        cin >> W;
        vector<knapsack> v(n+1);

        for(int i=1;i<=n;i++)
        {
        	cin >> v[i].wt;
        	cin >> v[i].val;
        }

        int ans = solve(v,n,W);
        cout << ans << endl;
    }
    return 0;
 }


Measured memory_bytes: 81792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int t, n;
int s[30], f[30];
void solve() {
    int sum = 0;
    rep(i, n) sum += f[i] - s[i];
    if (sum >= t) {
        cout << "OK" << endl;
    } else {
        cout << t - sum << endl;
    }
}
int main() {
    while (cin >> t) {
        if(t == 0) break;
        cin >> n;
        rep(i, n) cin >> s[i] >> f[i];
        solve();
    }
    return 0;
}

Measured memory_bytes: 3060
#![allow(non_snake_case)]

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let v: Vec<T> = read_vec();
    (v[0], v[1])
}

fn main() {
    let N: usize = read();
    let a: Vec<i32> = read_vec();
    let mut ans = 0;
    for mut i in a {
        while i % 2 == 0 {
            i /= 2;
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    x, y = LI()
    for i in range(x + 1):
        j = x - i
        if i * 2 + j * 4 == y:
            print("Yes")
            return
    print("No")

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 76536
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	for(int i=0;i<s.length();i++)
	{
		if(t==s.substr(i,s.length()-i)+s.substr(0,i))
		{
			return 0*printf("Yes\n");
		}
	}
	return 0*printf("No\n");
}

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

int main(){
        int n,res=0,cnt=0;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        for(int i=0;i<n;i++){
                if(a[i]%2==0){
                        for(;;){
                                a[i]=a[i]/2;
                                cnt++;
                                if(a[i]%2==1)break;
                        }
                }
        }
        cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char *argv[]) {
  int N;

  std::cin >> N;

  int nums[N];

  for (int i = 0; i < N; i++) {
    std::cin >> nums[i];
  }

  int swapCount = 0;
  for (int i = 0; i < N - 1; i++) {
    int minIndex = i + 1;
    for (int k = i + 2; k < N; k++) {
      if (nums[minIndex] > nums[k]) {
        minIndex = k;
      }
    }
    if (nums[i] > nums[minIndex]) {
      int v = nums[minIndex];
      nums[minIndex] = nums[i];
      nums[i] = v;
      swapCount++;
    }
  }
  for (int i = 0; i < N; i++) {
    if (i) std::cout << " ";
    std::cout << nums[i];
  }
  std::cout << std::endl;
  std::cout << swapCount << std::endl;

  return 0;
}

Measured memory_bytes: 3104