akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
  int x,y;
  cin>>x>>y;
  cout<<x+y/2<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var aStr = br.readLine().split(" ")[0];
      final var s = br.readLine().split(" ");
      final var a = Integer.parseInt(s[0]);
      final var b = Integer.parseInt(s[1]);
      final var u = br.readLine();

      if (aStr.equals(u)) {
        System.out.println((a - 1) + " " + b);
      } else {
        System.out.println(a + " " + (b - 1));
      }
    }
  }
}


Measured memory_bytes: 36712
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <utility>
#include <iomanip>
#define input(a) cin >> a
#define print(x) cout << x << endl
#define rep(a,n) for(int i = a; i < n; i++)
#define ll long long int
using namespace std;


int main(){
    float a,b;
    cin >> a >> b;
    int c = ceil((a+b)/2);
    print(c);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;

const int P=1000000007;
int n,f[23000005],Ans;

ll Pow(ll a,ll b,ll s=1){for(;b;b>>=1,a=a*a%P)if(b&1)s=s*a%P;return s%P;}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=23000000;++i)f[i]=f[i/10]+1;
    for(int i=1,j=1,s=0;i<10000000;++i)
    {
        while(s<n)s+=f[j++];
        Ans+=s==n,s-=f[i];
    }
    for(int i=1;i<=n/8;++i)
        if(n%i)++Ans;
        else Ans=(Ans+9*Pow(10,n/i-1)-i+1+P)%P;
    printf("%d\n",(Ans+P)%P);
    return 0;
}

Measured memory_bytes: 89984
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




int main() {
  ll a,b,N;
  cin >> a >> b >> N;
  if(N < b-1) {
    a*=N;
    cout << a/b << endl;
  }
  else {
    ll x = b-1;
    a*=x;
    cout <<  a/b << endl;
  }
  


  
  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int n; cin>>n;
  rep(i,3,n+1){
    int a=i;
    bool f=false;
    while(a>0){
      if(a%10==3) f=true;
      a/=10;
    }
    if(i%3==0 || f) cout<<" "<<i;
  }
  co("");
  return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    string s, t, u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u){
        cout << a-1 << " " << b;
    }
    else{
        cout << a << " " << b-1;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e,x;
scanf("%d %d %d",&x,&a,&b);
d=abs(x-a);
e=abs(x-b);
if(d>e) printf("B");
else printf("A");
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

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

int main(){
    int x,a,b;
    cin>>x>>a>>b;
    if(abs(x-a)<abs(x-b))cout<<"A"<<endl;
    else cout<<"B"<<endl;

    return 0;
}

Measured memory_bytes: 3592
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    int n, x;
    cin >> n >> x;
    vector <int> v(n);
    for (auto &it : v)
        cin >> it;
    sort(all(v));
    int ans = 0;
    for (auto it : v)
    {
        if (it <= x)
        {
            ans++;
            x -= it;
        }
    }
    cout << (ans == n && x ? ans - 1 : ans);
}


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

int main(void) {
    double A, B , H , M;
    double ans;
    cin >> A >> B >> H >> M;

    double ang_A,ang_B;

    ang_A = 30.0*H + 0.5*M;
    ang_B = 6.0*M;

    if(ang_A==ang_B) {
      cout << abs(A-B) << endl;
      return 0;
    }

    double rad;
    rad = (ang_A-ang_B)*M_PI/180.0;
    ans = A*A + B*B - 2.0*A*B*cos(rad);
    printf("%.10lf\n",sqrt(ans) );

    return 0;
}


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

int func(int n){
  if(n%2==0) return n/2;
  else return 3*n+1;
}

int main() {
  int s; cin>>s;
  int a=s;//初項
  set<int> st;//かぶりを検知
  st.insert(a);
  for(int i=2;i<=1000000;i++){
    a=func(a);//aiを求める
    if(st.count(a)){
      cout<<i<<endl;
      return 0;
    }
    else st.insert(a);
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const static ull MOD = 1000000007;

int main(){
    int N, K;
    scanf("%d %d", &N, &K);
    vector<ll> plus, minus;
    ll tmp;
    for(int i = 0; i < N; ++i){
        scanf("%lld", &tmp);
        if(tmp > 0) plus.push_back(tmp);
        else if(tmp < 0) minus.push_back(tmp);
    }
    int z = plus.size(), x = minus.size(), y = N - x - z;
    ull answer = 1;
    if(((min(x, K)>>1)<<1) + z >= K){
        sort(plus.begin(), plus.end(), greater<ll>());
        sort(minus.begin(), minus.end());
        int i = 0, j = 0;
        while(K >= 2){
            if(j + 2 <= x && (i + 1 >= z || minus[j]*minus[j+1] >= plus[i]*plus[i+1])){
                answer = minus[j]*minus[j+1]%MOD*answer%MOD;
                j += 2;
            }else{
                answer = plus[i]*plus[i+1]%MOD*answer%MOD;
                i += 2;
            }
            K -= 2;
        }
        if(K > 0) answer = answer*plus[i]%MOD;
    }else if(y) answer = 0;
    else{
        for(auto i : minus) plus.push_back(-1*i);        
        sort(plus.begin(), plus.end());
        for (int i = 0; i < K; i++){
            answer = answer*plus[i]%MOD;
        }
        answer = (MOD - answer) %MOD;
    }
    printf("%llu\n", answer);
	return 0;
}

Measured memory_bytes: 5572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
int main(){
    int n,d;cin>>n>>d;
    int x[1000];
    REP(i,d*n){
        cin>>x[i];
    }
    double dis=0;
    int cnt=0;
    REP(i,n)
    {
    
            for (int j = i+1; j < n; j++)
            {
                /* code */
                dis=0;
                REP(k,d){
                dis+=pow((x[k+i*d]-x[k+d*j]),2.0);

            }
            if (fmod(sqrt(dis),1.0)==0.0)
            {
                /* code */
                cnt++;
            }
            
                
        }
    }
    cout<<cnt<<endl;
   }

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(){
    int A, B, C, D, a, b;
    cin >> A >> B >> C >> D;
    a = A / D + (A % D != 0 ? 1 : 0);
    b = C / B + (C % B != 0 ? 1 : 0);
    cout << (a >= b ? "Yes" : "No") << endl;
    return 0; 
}

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

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	string s; cin >> s;
	int n = s.size();
	int cnt = 0;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'A' ||s[i] == 'C' ||s[i] == 'G'||s[i] == 'T') {
			cnt++;
			ans = max(ans, cnt);
		}
		else {
			
			cnt = 0;
		}
	}

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long in;
typedef pair<in,in> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (in)x.size()
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(in i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

int main()
{
    IOS;
    in n,m,tot=0;
    cin >> n >> m;
    vector<in> p(n);
    rep(i,0,n){
        cin >> p[i];
        tot+=p[i];
    }
    in k = tot/(4*m),count=0;
    if(tot % (4*m) != 0) k++;
    rep(i,0,n){
        if(p[i]>=k) count++;
    }
    (count>=m) ? cout << "Yes\n" : cout << "No\n";
}

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

#define ll long long

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define X first
#define Y second
using namespace std;

typedef pair<int, int> pos;

void solve();

int main(){

	solve();
	return 0;

}

void solve(){

	ll w, h;
	
	while (1) {

		cin >> w >> h;
		if (w == 0) return;

		vector<vector<ll>> f(h);
		vector<vector<int>> vw(h);
		vector<vector<int>> hw(h);
		REP(i, h) {
			f[i].resize(w);
			vw[i].resize(w - 1);
			hw[i].resize(w);
			REP(j, w) {
				f[i][j] = 1e9;
			}
		}

		REP(i,h) {
			REP(j, w - 1) {
				cin >> vw[i][j];
			}
			if (i < h - 1) {
				REP(j, w) {
					cin >> hw[i][j];
				}
			}
			else {
				REP(j, w) {
					hw[h - 1][j] = (j < w - 1 ? 1 : 0);
				}
			}
		}
		f[0][0] = 1;

		queue<pos> q;
		pos pbuf;
		pbuf.X = 0;	pbuf.Y = 0;
		q.push(pbuf);

		while (q.size() > 0) {

			pos now;
			now=q.front();
			q.pop();

			if (now.X > 1 && !(vw[now.Y][now.X - 1])) {	//テ・ツキツヲテ」ツ?ォティツ。ツ古」ツ?妥」ツつ?

				if (f[now.Y][now.X - 1] > f[now.Y][now.X] + 1) {	//テ」ツ?禿」ツ?」テ」ツ?。ティツサツステヲツイツケテ」ツ?古ヲツ慊?ァツ淞ュテァツつ?

					f[now.Y][now.X - 1] = f[now.Y][now.X] + 1;
					pbuf.X = now.X - 1;	pbuf.Y = now.Y;
					q.push(pbuf);
				}
			}
			if (now.X<w-1 && !(vw[now.Y][now.X])) {	//テ・ツ渉ウテ」ツ?ォティツ。ツ古」ツ?妥」ツつ?

				if (f[now.Y][now.X +1] > f[now.Y][now.X] + 1) {	//テ」ツ?禿」ツ?」テ」ツ?。ティツサツステヲツイツケテ」ツ?古ヲツ慊?ァツ淞ュテァツつ?

					f[now.Y][now.X +1] = f[now.Y][now.X] + 1;
					pbuf.X = now.X +1;	pbuf.Y = now.Y;
					q.push(pbuf);
				}
			}
			if (now.Y>0 && !(hw[now.Y-1][now.X])) {	//テ、ツクツ甘」ツ?ォティツ。ツ古」ツ?妥」ツつ?

				if (f[now.Y-1][now.X] > f[now.Y][now.X] + 1) {	//テ」ツ?禿」ツ?」テ」ツ?。ティツサツステヲツイツケテ」ツ?古ヲツ慊?ァツ淞ュテァツつ?

					f[now.Y-1][now.X ] = f[now.Y][now.X] + 1;
					pbuf.X = now.X ;	pbuf.Y = now.Y-1;
					q.push(pbuf);
				}
			}
			if (now.Y < h - 1 && !(hw[now.Y][now.X])) {	//テ、ツクツ凝」ツ?ォティツ。ツ古」ツ?妥」ツつ?

				if (f[now.Y + 1][now.X] > f[now.Y][now.X] + 1) {	//テ」ツ?禿」ツ?」テ」ツ?。ティツサツステヲツイツケテ」ツ?古ヲツ慊?ァツ淞ュテァツつ?

					f[now.Y + 1][now.X] = f[now.Y][now.X] + 1;
					pbuf.X = now.X;	pbuf.Y = now.Y + 1;
					q.push(pbuf);
				}
			}
		}

		cout << (f[h-1][w-1]<1e9?f[h-1][w-1]:0) << endl;

	}
}

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

using namespace std;

int a,b,c,d,i,j,n,m,t[200005];
string s;

int main()
{
    cin>>a>>s;
    while (s.find("ABC")!=string::npos){
        s.erase(s.find("ABC"),3);
        n++;
    }
    cout<<n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
ll power(ll a,ll b)
{ll result=1;
while(b>0)
{if(b%2==1)
 result*=a;
 a*=a;
 b/=2;
}
return result;
}
int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
string s;
cin>>s;
ll n=s.length();
if(s[n-1]!='s')
cout<<s<<"s";
else
cout<<s<<"es";
}


Measured memory_bytes: 3648
N = int(input())

con = True
for h in range(1,3500):
    for n in range(h,3500):
        memo1 = N*h*n
        memo2 = 4*h*n-N*n-N*h
        if memo2 != 0:
            memo3 = memo1/memo2
            memo4 = memo1%memo2
            if (memo4==0) and (memo3>=1):
                print(h,n,int(memo3))
                con = False
                break
    if not(con):
        break


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}



int main()
{
	ll d,g,ans=INF;
	cin >> d >> g;
	vll p(d),c(d);
	rep(i,d) cin >> p[i] >> c[i];
	rep(i,1<<d){
		ll sum=0,cnt=0;
		vll a,b;
        rep(j,d){
            if(i&(1<<j)) a.pb(j);
            else b.pb(j);
        }
        rep(j,(int)a.size()){
        	sum+=(a[j]+1)*100*p[a[j]]+c[a[j]];
        	cnt+=p[a[j]];
        }
        if(sum>=g) chmin(ans,cnt);
        else{
        	sort(rall(b));
        	ll tmp=g-sum;
        	ll tmp2=(tmp+((b[0]+1)*100-1))/((b[0]+1)*100);
        	sum+=min(p[b[0]],tmp2)*(b[0]+1)*100;
        	cnt+=min(p[b[0]],tmp2);
        	if(sum>=g) chmin(ans,cnt);
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){
    long long int n;
    cin >> n;
    vector<long long int> v(n);
    REP(i, n) {
        cin >> v[i];
    }

    sort(v.begin(), v.end());
    long long int cannot_div_num,cannot_div_where;
    DEFOR(i,v[1],2){
        cannot_div_num = 0;
        cannot_div_where = -1;
        REP(j,n){
            if(v[j]%i){
                if(cannot_div_num==0){
                    cannot_div_num++;
                    cannot_div_where = i;
                }else{
                    cannot_div_num++;
                    break;
                }
            }
        }
        if(cannot_div_num<=1){
            cout << i << endl;
            return 0;
        }
    }

    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    X = int(input())

    y = 100
    ans = 0
    while y < X:
        ans += 1
        y += y // 100
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62360
#include<bits/stdtr1c++.h>
#include<list>
#include<algorithm>
#include<cstdlib>
using namespace std;

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if (A+B>=C){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int, input().split()))
al = [0]*(n+1)
pl = [0]*(n+1)
ans = 0
for i in range(n):
  al[i+1] = al[i] + a[i]
  pl[i+1] = pl[i]
  if a[i] > 0: pl[i+1] += a[i]
for r in range(k-1,n):
  l = r-k+1
  cur = pl[l] + max(0, al[r+1] - al[l]) + pl[n] - pl[r+1]
  if ans < cur: ans = cur
print(ans)

Measured memory_bytes: 16832
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)g
#define INF 999999999
using namespace std;


int main(){
	stack<int> S1;
	stack<pair<int,int> > S2;
	char ch;
	int sum =0;
	for(int i= 0;cin >> ch;i++){
		if(ch == '\\')S1.push(i);
		else if(ch == '/'&& S1.size() > 0){
			int j = S1.top(); S1.pop();
			sum += i-j;
			int a= i - j;
			while( S2.size() > 0 && S2.top().first > j){
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}

	vector<int> ans;
	while (S2.size() > 0 ){ans.push_back(S2.top().second); S2.pop();}
	reverse(ans.begin(),ans.end());
	cout << sum << endl;
	cout << ans.size();
	REP(i,ans.size()){
		cout <<" ";
		cout <<ans[i];
	}
	cout <<endl;

	return 0;
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";

int main(){
    ll x,y;
    std::cin >> x >> y;
    ll ans = 0;
    while(true){
        if(x>y) break;
        ans++;
        x *= 2;
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3596
N = int(input())
L = list(map(int, input().split()))
L.sort()
def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h

ans = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    x = L[i] + L[j]
    temp = find(L[j+1:], x)
    ans += temp
print(ans)

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

int main(){
	int a,b;
	cin >> a;
	cin >> b;
	if(a==b){
		int i=b;
		while(i--){
			cout<<a;
		}
		cout<<endl;
	}
	else{
		if(a>b){
			int i=a;
			while(i--){
				cout<<b;
			}
			cout<<endl;
		}
		else{
			int i=b;
			while(i--){
				cout<<a;
			}
			cout<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  string str;
  cin >> str;
  if(str == "SUN")
  {
    cout << "7\n";
  }
  else if(str == "MON")
  {
    cout << "6\n";
  }
  else if(str == "TUE")
  {
    cout << "5\n";
  }
  else if(str == "WED")
  {
    cout << "4\n";
  }
  else if(str == "THU")
  {
    cout << "3\n";
  }
  else if(str == "FRI")
  {
    cout << "2\n";
  }
  else
  {
    cout << "1\n";
  }
  return (0);
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = LIST()

A = [-x for x in A]
A.sort()

for _ in range(M):
	heappush(A, -(-heappop(A)//2))
	

print(-sum(A))



Measured memory_bytes: 16324
import sys
sys.setrecursionlimit(10000000)

N, M = list(map(int, input().split()))

d = {i: [] for i in range(1, N + 1)}
for _ in range(M):
    a, b = list(map(int, input().split()))
    d[a].append(b)
    d[b].append(a)

visited = [False for _ in range(N + 1)]


def visit(x):
    if visited[x]:
        return 0
    visited[x] = True

    z = 1
    for y in d[x]:
        z += visit(y)
    return z


m = 1
for i in range(1, N + 1):
    r = visit(i)
    if m < r:
        m = r

print(m)


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

res = 0
for i in range(N):
  if A[i] < B[i]:
    res += min(A[i+1]+A[i],B[i])
    A[i+1] = max(A[i+1]+A[i]-B[i],0)
  else:
    res += B[i]
    
print(res)

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



Measured memory_bytes: 2052
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
  long long int x,k,d;
  scanf("%lld %lld %lld",&x,&k,&d);

  long long int ans;

  if(x<0) x*=(-1);

  ans=x;
  if(x/d>=k) ans-=d*k;
  else
  {
    ans-=(x/d+1)*d;
    if((k-x/d-1)%2==0) ans*=(-1);
    else ans+=d;
  }

  printf("%lld\n",ans);

  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <queue>
#include <sstream>
#include <set>
using namespace std;



int main(){
    string s ;
    int k ;
    cin >> s >> k;
    vector<string> sub(0) ;
    for (size_t i = 0; i < k; i++)
    {
        for (size_t j = 0; j < s.size()-i; j++)
        {
            sub.push_back(s.substr(j,i+1)) ;
        }
        
    }
    set<string> st ;
    for (size_t i = 0; i < sub.size(); i++)
    {
        st.insert(sub.at(i)) ;
    }
    sort(sub.begin(),sub.end()) ;
    int n = 1 ;
    for (size_t i = 0; i < sub.size(); i++)
    {
        if (n == k)
        {
            cout << sub.at(i) << endl ;
            break ;
        }
        if (sub.at(i) != sub.at(i+1))
        {
            n ++ ;
        }
        
        
    }
    
}


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

vector<string> v[11];
int main() {
	ll n;
	cin>>n;

	v[1].push_back("1");
	v[1].push_back("2");
	v[1].push_back("3");
	v[1].push_back("4");
	v[1].push_back("5");
	v[1].push_back("6");
	v[1].push_back("7");
	v[1].push_back("8");
	v[1].push_back("9");
	for(int i=2;i<=10;i++){
		for(int j=0;j<v[i-1].size();j++){
			if(v[i-1][j][v[i-1][j].size()-1]=='0'){
				v[i].push_back(v[i-1][j]+'0');
				v[i].push_back(v[i-1][j]+'1');
			}else if(v[i-1][j][v[i-1][j].size()-1]=='9'){
				v[i].push_back(v[i-1][j]+'8');
				v[i].push_back(v[i-1][j]+'9');
			}else{
				char a=v[i-1][j][v[i-1][j].size()-1]-1,b=v[i-1][j][v[i-1][j].size()-1],c=v[i-1][j][v[i-1][j].size()-1]+1;
				v[i].push_back(v[i-1][j]+a);
				v[i].push_back(v[i-1][j]+b);
				v[i].push_back(v[i-1][j]+c);
			}
		}
	}
	ll yan=0;
	for(int i=1;i<=10;i++){
		yan+=v[i].size();
		if(n<=yan){
			yan-=v[i].size();
			cout<<v[i][n-yan-1];
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 13940
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

vector<int> prime_factor_table(int n){
    vector<int> res(n+1,0);
    for (int i=2;i<=n;++i) if (!res[i]){
        for (int j=i;j<=n;j+=i){
            if (!res[j]) res[j]=i;
        }
    }
    return res;
}

const int MAX_A=1e6+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<string> ans={"pairwise coprime","setwise coprime","not coprime"};
    vector<int> table=prime_factor_table(MAX_A);
    int N; cin >> N;
    vector<int> A(N); cin >> A;

    auto fac=[&](int a){
        map<int,int> res;
        while(a>1){++res[table[a]]; a/=table[a];}
        return res;
    };

    int G=0;
    map<int,int> cnt;
    for (int i=0;i<N;++i){
        G=gcd(G,A[i]);
        for (auto p:fac(A[i])) ++cnt[p.first];
    }

    int ok=1;
    for (auto p:cnt){
        if (p.second>1){
            ok=0;
        }
    }

    if (ok) cout << ans[0] << '\n';
    else if (G==1) cout << ans[1] << '\n';
    else cout << ans[2] << '\n';
}

Measured memory_bytes: 14668
h, w = map(int, input().split())
l = [list(input()) for _ in range(h)]


dxdy = [(-1,-1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
ans = [['#' for _ in range(w)] for _ in range(h)] 

for y in range(h):
    for x in range(w):
        if l[y][x] == '#': 
          continue
        ct = 0
        for dx,dy in dxdy:
            if x+dx < 0 or x+dx > w-1 or y+dy < 0 or y+dy > h-1: 
              continue
            if l[y+dy][x+dx] == "#": 
              ct += 1
            
        ans[y][x] = str(ct)
        

for i in ans:
    print(''.join(i))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int N;
	cin>>N;
	vector<int> a(N);
	vector<ll> b(N+1,0);
	ll mod = 1e9+7;
	for(int i=0;i<N;i++){
		cin>>a[i];
		b[i+1]=b[i]+a[i];
	}
	ll x=0;
	for(int i=0;i<N;i++){
	ll sum =(b[N]-b[i+1])%mod;
	x+=a[i]*sum;
	x%=mod;
	}
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 5636
#include <iostream>
using namespace std;
int main(void){
    int x, y, count;
    while(1){
        count=0;
        cin >> x;
        if(x==0) break;
        
        y=1000-x;
        count += y/500;
        y=y%500;
        count += y/100;
        y=y%100;
        count += y/50;
        y=y%50;
        count += y/10;
        y=y%10;
        count += y/5;
        y=y%5;
        count +=y;
        
        cout << count << endl;
    }
    
}



Measured memory_bytes: 3068
#include <iostream>
#include<cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
	ll n, l1 = 0, l2 = 0;
	cin >> n;
	ll a[n] = {};
	for (ll i = 0 ; i < n ; i++) cin >> a[i]; 
	sort(a, a + n);
	for (ll i = n - 1 ; i >= 0 ; i--) {
		if (a[i] == a[i - 1]) {
			if (l1 == 0) {
				l1 = a[i];
				i -= 1;
			}
			else {
				l2 = a[i];
				cout << l1 * l2;
				return 0;
			} 
		}
	}
	cout << 0;
}


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

using namespace std;

int main()
{
	int a, b, c, cnt = 0;
 	cin >> a >> b >> c;
  	while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
    	int a1 = b / 2 + c / 2;
      	int b1 = a / 2 + c / 2;
      	int c1 = a / 2 + b / 2;
      	a = a1, b = b1, c = c1;
	 	cnt ++;
      	if(cnt > 1e6) break;
    }
  	if(cnt > 1e6) cout << "-1\n";
  	else cout << cnt << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <set>

#include <regex>
#include <locale>
#include <iomanip>

using namespace std;
using ll = long long;

#define OVERLOAD3(_1,_2,_3,name,...) name
#define REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a),i##_Len=int(b);i<i##_Len;++i)
#define rep(...) OVERLOAD3(__VA_ARGS__,REPI,REP,)(__VA_ARGS__)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())

int main () {
  string s = "";
  char c;
  rep(i,9) {
    cin >> c;
    if (i%4 == 0) {
      s.push_back(c);
    }
  }
  cout << s << endl;
}

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

void push(int);
int pop(void);

int top, S[1000];

int main(){
  int x=0, save1, save2;
  char s[100];



  while( scanf("%s",s) != EOF ){
    if ( s[0] == '+' ){
      save1 = pop();
      save2 = pop();
      x = save2 + save1;
      push(x);

    } else if ( s[0] == '-' ){
      save1 = pop();
      save2 = pop();
      x = save2 - save1;
      push(x);

    } else if ( s[0] == '*' ){
      save1 = pop();
      save2 = pop();
      x = save2 * save1;
      push(x);

    } else{
      x = atoi(s);
      push(x);

    }
  }

  printf("%d\n", pop());

  return 0;
}


void push(int x){
  S[++top] = x;
}

int  pop(){
  int n;
  top--;
  n = S[top+1];
  return n;
}

int isFull(void){
  if(top == 99){
    return 1;
  }else{
    return 0;
  }
}



Measured memory_bytes: 2096
a, b = [0]*3, [0]*3
for i in range(3):
    a[i], b[i] = map(int, input().split())

c = a + b
from collections import Counter
cnt = Counter(c).most_common()
if cnt[0][1] == 2 and cnt[1][1] == 2 and cnt[2][1] == 1 and cnt[3][1] == 1:
    print('YES')
else:
    print('NO')


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

using namespace std;

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

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

string sum(string a,string b)
{
	if(a.size()<b.size())
		swap(a,b);
	reverse(allof(a));
	reverse(allof(b));
	a+='0';
	while(b.size()<a.size())
		b+='0';
	
	string res(a.size(),'0');
	rep(i,a.size()){
		int m=a[i]-'0';
		int n=b[i]-'0';
		res[i]+=m+n;
		if(res[i]>'9'){
			res[i]-=10;
			res[i+1]++;
		}
	}
	reverse(allof(res));
	if(res[0]=='0')
		res=res.substr(1);
	return res;
}

int main()
{
	for(string s;getline(cin,s);){
		int plus=s.find('+');
		int equal=s.find('=');
		int res=-1;
		rep(i,10){
			string t=s;
			replace(allof(t),'X',char('0'+i));
			string a=t.substr(0,plus);
			string b=t.substr(plus+1,equal-(plus+1));
			string c=t.substr(equal+1);
			if(sum(a,b)==c){
				res=i;
				break;
			}
		}
		if(res==-1)
			cout<<"NA"<<endl;
		else
			cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> mochi(N);
  vector<int> zero(N);
  for(int i = 0; i < N; i++){
    cin >> mochi.at(i);
  }
  int y = 0;
  while(!(mochi == zero)){
    int x = 0;
    for(int i = 0; i < N; i++){
      if(mochi.at(i) > x){
        x = mochi.at(i);
      }
    }
    for(int i = 0; i < N; i++){
      if(mochi.at(i) == x){
        mochi.at(i) = 0;
      }
    }
    y++;
  }
  cout << y << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(){
int n; cin >> n;
set<int>s;
while(s.count(n) == 0){
	s.insert(n);
	// 8 4 2 1 4
	if(n % 2 == 0)
		n /= 2;
	else
		n  = 3 * n + 1;

}
cout << s.size()+1;
  return 0;
}



Measured memory_bytes: 384
from collections import Counter
from operator import itemgetter

n, k = map(int, input().split())
a = list(map(int, input().split()))

c = dict(Counter(a))
if len(c) <= k:
	print(0)
else:
	hindo = sorted(c.items(), key=itemgetter(1))
	ans = 0
	for i in range(len(hindo) - k):
		ans += hindo[i][1]
	print(ans)

Measured memory_bytes: 39348
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
const ll MOD = 1000000007; 
using plong = pair<long,long>;



int main(){   
    ll N;
    cin>>N;
    ll T[N],A[N];
    for(ll i=0;i<N;i++){
        cin>>T[i]>>A[i];
    }
    for(ll i=1;i<N;i++){
        // for(ll j=1;;j++){
        //     if(T[i]*j>=T[i-1]&&A[i]*j>=A[i-1]){
        //         T[i] *= j;
        //         A[i] *= j;
        //         break;
        //     }
        // }
        ll mul = max((T[i-1]+T[i]-1)/T[i],(A[i-1]+A[i]-1)/A[i]);
        T[i] *= mul;
        A[i] *= mul;
    }
    // for(ll i=0;i<N;i++){
    //     cout<<T[i]<<":"<<A[i]<<endl;
    // }
    cout<<T[N-1]+A[N-1]<<endl;

}

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

#define pb push_back
#define all(a) (a).begin(), (a).end()

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

const int N = 25, inf = 1e3;
bool grid[N][N];
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};

int solve(int H, int W, int x, int y) {
	vector<vector<int>> dist(H + 2, vector<int>(W + 2, inf));
	dist[x][y] = 0;
	int best = 0;
	queue<pii> q;
	q.push({x, y});
	while (!q.empty()) {
		int xx = q.front().first, yy = q.front().second;
		q.pop();
		for (int i = 0; i < 4; ++i) {
			if (xx + dx[i] > H || yy + dy[i] > W)
				continue;
			if (!grid[xx + dx[i]][yy + dy[i]])
				continue;
			if (dist[xx][yy] + 1 < dist[xx + dx[i]][yy + dy[i]]) {
				dist[xx + dx[i]][yy + dy[i]] = dist[xx][yy] + 1;
				q.push({xx + dx[i], yy + dy[i]});
				best = max(best, dist[xx][yy] + 1);
			}
		}
	}
	return best;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int H, W; cin >> H >> W;
    for (int i = 1; i <= H; ++i) {
    	for (int j = 1; j <= W; ++j) {
    		char c; cin >> c;
    		grid[i][j] = (c == '.');
    	}
    }
    int ans = 0;
    for (int i = 1; i <= H; ++i) {
    	for (int j = 1; j <= W; ++j) {
    		if (grid[i][j]) {
    			ans = max(ans, solve(H, W, i, j));
    		}
    	}
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
diamond=[]
path=[]
while True:
    try:
        s=[int(i) for i in input().split(",")]
        if(len(diamond)==0):
            diamond.append(s)
            path.append(s)
        elif(len(diamond[-1])<len(s)):
            diamond.append(s)
            _path=[path[-1][0]+s[0]]
            for i in range(len(s)-2):
                _path.append(max(path[-1][i],path[-1][i+1])+s[i+1])
            _path.append(path[-1][-1]+s[-1])
            path.append(_path)

        else:
            diamond.append(s)
            _path=[]
            for i in range(len(s)):
                _path.append(max(path[-1][i],path[-1][i+1])+s[i])
            path.append(_path)

            if len(s)==1:
                print(path[-1][0])
                diamond=[]
                path=[]
    except EOFError:
        break



Measured memory_bytes: 5728
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll A,B,ans;
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
int main()
{
	scanf("%lld%lld",&A,&B);
	ll g=gcd(A,B);
	for(int i=2;i<=g/i;i++)
	{
		if(g%i==0)
		{
			ans++;
			while(g%i==0)
				g/=i;
		}
	}
	if(g>1)
		ans++;
	printf("%lld",ans+1);
	return 0;
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 n, u, v;
    cin >> n >> u >> v, u--, v--;
    vector<vector<i32>> t(n);
    for (i32 i = 0; i < n-1; i++) {
        i32 a, b;
        cin >> a >> b, a--, b--;
        t[a].push_back(b);
        t[b].push_back(a);
    }

    vector<i32> takahashi(n, -1);
    queue<i32> q;
    takahashi[u] = 0;
    q.push(u);
    while (!q.empty()) {
        i32 i = q.front(); q.pop();
        for (auto& e : t[i]) {
            if (takahashi[e] != -1) continue;
            takahashi[e] = takahashi[i] + 1;
            q.push(e);
        }
    }

    vector<i32> aoki(n, -1);
    aoki[v] = 0;
    q.push(v);
    while (!q.empty()) {
        i32 i = q.front(); q.pop();
        for (auto& e : t[i]) {
            if (aoki[e] != -1) continue;
            aoki[e] = aoki[i] + 1;
            q.push(e);
        }
    }

    i32 p = v;
    for (i32 i = 0; i < n; i++) {
        if (t[i].size() != 1) continue;
        if (takahashi[i] >= aoki[i]) continue;
        if (aoki[p] < aoki[i]) p = i;
    }

    cout << aoki[p] - 1 << endl;
}


Measured memory_bytes: 8064
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;

bool solve() {
  int h, w;
  cin >> h >> w;
  if (h == 0 && w == 0) {
    return false;
  }
  vector<string> r(h);
  for (auto &i : r) {
    cin >> i;
  }
  string s;
  cin >> s;
  int p = 0, q = 0, result = 0;
  for (char c : s) {
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (c == r[i][j]) {
          result += abs(p - i) + abs(q - j) + 1;
          p = i;
          q = j;
        }
      }
    }
  }
  cout << result << endl;
  return true;
}

int main() {
  while (solve()) {
  }
}



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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
  double a, b, n;
  cin >> a >> b >> n;
  if (n >= b)
    cout << floor(a * (b - 1) / b) - int(a) * floor((b - 1) / b) << endl;
  else
    cout << floor(a * n / b) - int(a) * floor(n / b) << endl;
}

Measured memory_bytes: 3876
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int len = S.length();
    int cnt[26] = {};
    REP(i,len){
        cnt[S[i]-'a']++;
    }
    bool ok = 1;
    REP(i,26){
        if(cnt[i]%2 == 1) ok = 0;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();

		int min = 1000;
		for(int i = 1;i < N;i++) {
			int sum = 0;
			char[] A = String.valueOf(i).toCharArray();
			char[] B = String.valueOf(N - i).toCharArray();
			for(int j = 0;j < A.length;j++) {
				sum += Character.getNumericValue(A[j]);
			}
			for(int j = 0;j < B.length;j++) {
				sum += Character.getNumericValue(B[j]);
			}
			if(sum < min) {
				min = sum;
			}
		}
		System.out.println(min);
	}
}

Measured memory_bytes: 38272
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(10);
          char a,b;
           cin>>a>>b;
           if(a<b)cout<<'<'<<endl;
           else if(a==b)cout<<'='<<endl;
           else cout<<'>'<<endl;
}

Measured memory_bytes: 3636