akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
 
using namespace std;
 
const ll inf=1000000007;
 
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
 
int n, m, mx[500005], my[500005], sx[500005], sy[500005], jx=0, jy=0, q;
map<ll,int> ma;
 
int main()
{
    scanf("%d%d%d",&n,&m,&q);
    while(q--)
    {
        int x, y;
        scanf("%d%d",&x,&y);
        mx[x]++;
        my[y]++;
        ma[(ll)x*(ll)1000000+(ll)y]=1;
    }
    int mmx=0;
    for(int i=1;i<=300005;i++)
    {
        mmx=max(mx[i],mmx);
    }
    for(int i=1;i<=300005;i++)
    {
        if(mx[i]==mmx)
        {
            sx[jx++]=i;
        }
    }
    int mmy=0;
    for(int i=1;i<=300005;i++)
    {
        mmy=max(my[i],mmy);
    }
    for(int i=1;i<=300005;i++)
    {
        if(my[i]==mmy)
        {
            sy[jy++]=i;
        }
    }
    for(int i=0;i<jx;i++)
    {
        for(int j=0;j<jy;j++)
        {
            if(!ma[(ll)sx[i]*(ll)1000000+(ll)sy[j]])
            {
                printf("%d\n",mmx+mmy);
                return 0;
            }
        }
    }
    printf("%d\n",mmx+mmy-1);
    return 0;
}

Measured memory_bytes: 27252
#include <iostream>
#include <string.h>
using namespace std;

int main(){
	int n,an=0,bn=0;
	cin >> n;
	string a,b;
	for(int i=0;i<n;i++){
		cin >> a >> b;
		if(a==b){
			an += 1;
			bn += 1;
		}else if(a<b){
			bn += 3;
		}else if(a>b){
			an += 3;
		}
	}
	cout << an << ' ' << bn << endl;
	return 0;
}

Measured memory_bytes: 3188
#include <stdio.h>
   
int main(void){
  int n,i,j,num;
  char egara;
  int array[4][13];
   
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      array[i][j]=0;
    }
  }
   
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c %d", &egara,&num);
    switch(egara){
      case 'S' : array[0][num-1]=1; break;
      case 'H' : array[1][num-1]=1; break;
      case 'C' : array[2][num-1]=1; break;
      case 'D' : array[3][num-1]=1; break;
    }
  }
   
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      if(array[i][j]==0){
        switch(i){
          case 0 : printf("S %d\n",j+1); break;
          case 1 : printf("H %d\n",j+1); break;
          case 2 : printf("C %d\n",j+1); break;
          case 3 : printf("D %d\n",j+1); break;
        }
      }
    }
  }
   
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,a,b,c,ans=0,cnt=0;
string s,t;
int main(){
	cin >> a >> b;
	if(a>8 or b>8){
		cout << ":(" << endl;
	}else{
		cout << "Yay!" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
using namespace std;
vector<int> dp(10001,-100000);
int match[10]={0,2,5,5,4,5,6,3,7,6};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin>>n>>m;
  vector<int>a(m);
  for(int i=0;i<m;i++)
  {
    cin>>a[i];
  }
  sort(a.begin(),a.end(),[](int a,int b){return match[a]<match[b];});
  dp[0]=0;
  for(int i=1;i<n+1;i++)
  {
    for(int ai:a)
    {
      if(i-match[ai]<0)continue;
      dp[i]=max(dp[i-match[ai]]+1,dp[i]);
    }
    //cout<<dp[i]<<" "<<i<<endl;
  }
  stable_sort(a.begin(), a.end(), greater<int>());
  int cnt=n;
  for(int i=0;i<dp[n];i++)
  {
    for(int ai:a)
    {
      if(cnt-match[ai]<0)continue;
      if(dp[cnt-match[ai]]==dp[cnt]-1)
      {
        cout<<ai;
        cnt-=match[ai];
        break;
      }
    }
    //cout<<cnt<<endl;
  }
  cout<<endl;




  return 0;

}


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

struct dice{
  int num[10];
};

dice d, t, z;

dice hoge(dice d){
  int temp = d.num[6];
  d.num[6] = d.num[2];
  d.num[2] = d.num[1];
  d.num[1] = d.num[5];
  d.num[5] = temp;
  return d;
}

dice fuga(dice d){
  int temp = d.num[6];
  d.num[6] = d.num[3];
  d.num[3] = d.num[1];
  d.num[1] = d.num[4];
  d.num[4] = temp;
  return d;
}

dice foo(dice d){
  int temp = d.num[2];
  d.num[2] = d.num[3];
  d.num[3] = d.num[5];
  d.num[5] = d.num[4];
  d.num[4] = temp;
  return d;
}

int solve(int a, int b){
   z = t;
   for(int i = 0; i < 4; i++){
     z = hoge(z);
     if(z.num[2] == a && z.num[1] == b) return d.num[z.num[3]];
     if(z.num[2] == b && z.num[1] == a) return d.num[z.num[4]];
   }
   z = t;
   for(int i = 0; i < 4; i++){
     z = fuga(z);
     if(z.num[3] == a && z.num[1] == b) return d.num[z.num[5]];
     if(z.num[3] == b && z.num[1] == a) return d.num[z.num[2]];
   }
   z = t;
   for(int i = 0; i < 4; i++){//cout<<z.num[2]<<" "<<z.num[3]<<endl;
     z = foo(z);
     if(z.num[3] == a && z.num[2] == b) return d.num[z.num[1]];
     if(z.num[3] == b && z.num[2] == a) return d.num[z.num[6]];
   }
   return -1;
}

int main(){
  int n, q, a, b, temp[110];

  string s;

  for(int i = 1; i <= 6; i++){
    cin>>d.num[i];
    t.num[i] = i;
    temp[d.num[i]] = i;
  }

  cin>>q;

  for(int i = 0; i < q; i++){
    cin>>a>>b;
    cout<<solve(temp[b],temp[a])<<endl;
  }

  return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n; 
map<string,ll> msi;

int main(){
    cin>> n;
    //map<string,int> msi;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        msi[s]++;
    }
    ll sum = 0;
    for(auto u : msi){
        sum += (u.second-1)*u.second/2;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 11136
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  string s;
  cin >> s;
  int n=s.size();
  
  for(char x='a';x<='z';x++){
    bool r=false;
    rep(i,n){
      if(x==s[i]) {
        r = true;
        break;
      }
      if(!r && i==n-1) {
        cout << x << endl; 
        return 0;
      }
    }
    if(x=='z') puts("None");
  }
  
}



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

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    vector<int> h(N);
    rep(i, N) cin >> h[i];

    ll l = 0, r = 1e10;
    while (r - l > 1) {
        ll c = (l + r) >> 1;
        ll t = 0;
        rep(i, N) {
            ll x = max(h[i] - c * B, 0LL);
            ll s = (x + (A-B) - 1) / (A-B);
            t += s;
        }
        if (t <= c) r = c; else l = c;
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 640
#define s(a,b) (t=a,a=b,b=t)
char p[9],m;q,a,b,c,d,e,f,t,r;main(n){while(scanf("%d",&n),n){r=a=1,b=6,c=2,d=5,e=3,f=4;while(n--){scanf("%s",p);m=*p-76;if(m%6==0){s(c,e);s(d,f);q=m>0?s(e,f):s(c,d);}else if(1<m&&m<8){s(a,c);s(b,d);q=m^7?s(c,d):s(a,b);}else{s(a,e);s(b,f);q=m>0?s(e,f):s(a,b);}r+=a;}printf("%d\n",r);}}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int x[2010][2010], y[2010][2010];
int main()
{
    int H, W; cin>>H>>W;
    vector<string> a(H);
    for(auto& e: a) cin>>e;

    for(int i=0; i<H; ++i) {
        for(int j=0, c=0; j<W; ++j) {
            c=a[i][j]=='#' ? 0 : c+1;
            x[i][j]=c;
        }
        for(int j=W-2; j>=0; --j) {
            if (x[i][j]==0) continue;
            x[i][j]=max(x[i][j], x[i][j+1]);
        }
    }
    for(int j=0; j<W; ++j) {
        for(int i=0, c=0; i<H; ++i) {
            c=a[i][j]=='#' ? 0 : c+1;
            y[i][j]=c;
        }
        for(int i=H-2; i>=0; --i) {
            if (y[i][j]==0) continue;
            y[i][j]=max(y[i][j], y[i+1][j]);
        }
    }

    int res=0;
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) if (a[i][j]=='.') {
            res=max(res, x[i][j]+y[i][j]-1);
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 35840
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N,M;cin >> N >> M;
    //vector<pair<pair<int,int>,int>> pq;
    vector<pair<LL,LL>> world;
    for(int a = 0;a < N;a++){
        int b,c,d;cin >> b >> c >> d;
        world.push_back(make_pair(d-b,d));
        world.push_back(make_pair(d-c,d));
    }
    for(int a = 0;a < M;a++){
        int b;cin >> b;
        world.push_back(make_pair(-b,-1));
    }
    sort(world.begin(),world.end());
    set<LL> se;
    for(int a = world.size()-1;a >= 0;a--){
        pair<LL,LL> pa = world.at(a);
        if(pa.second == -1){
            if(se.empty()){
                cout<<-1<<endl;
            }else{
                cout<<*se.upper_bound(-1e18)<<endl;;
            }
        }else{
            if(se.find(pa.second) == se.end()){
                se.insert(pa.second);
            }else{
                se.erase(pa.second);
            }
        }
    }
}


Measured memory_bytes: 21988
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cassert>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <list>
using namespace std;

int n, x, a[110];

int main() {
	scanf("%d%d", &n, &x);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (x >= a[i]) {
			x -= a[i];
			ans++;
		}
	}
	if (ans == n && x != 0)
		ans--;
	printf("%d\n", ans);
}

Measured memory_bytes: 256
n = int(input())
reds = [list(int(_) for _ in input().split()) for i in range(n)]
blues = [list(int(_) for _ in input().split()) for i in range(n)]

reds.sort()
blues.sort()

cnt_pair = 0

for i in range(n):
  blue = blues[i]
  
  max_y = -1
  red_idx = -1
  
  for j in range(len(reds)):
    red = reds[j]
    
    if red[0] >= blue[0]:
      break
    
    if red[1] < blue[1] and red[1] > max_y:
      max_y = red[1]
      red_idx = j
    
  if red_idx >= 0:
    reds.pop(red_idx)
    cnt_pair += 1

print(cnt_pair)

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

int main(){
  int n, m;  cin >> n >> m;
  int l=0, r=1e5+5;
  rep(i,m){
    int a, b; cin >> a >> b;
    if(b<l || r<a){
      cout << 0 << endl;
      return 0;
    }
    if(l<a) l=a;
    if(b<r) r=b;
  }
  int ans=r-l+1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
MOD = 998244353
N = int(input())
D = list(map(int,input().split()))
ans = [0]*N
for i in D:
    ans[i] += 1
ret = 1
for i in range(1,max(D)+1):
    ret *= (ans[i-1] ** ans[i])%MOD
    ret %= MOD
if ans[0] == 1 and D[0] == 0:
    print(ret)
else:
    print(0)

Measured memory_bytes: 14396
#include<iostream>
#include<map>

int main(){
    std::map<char, std::string> mp;
    std::cin >> mp['a'] >> mp['b'] >> mp['c'];

    int num = 0;
    for(auto kv : mp)num += kv.second.length();

    char turn = 'a';
    char top;
    while(1){
       if(mp[turn].length() == 0)break; 

       top = turn;
       turn = mp[turn][0];
       mp[top].erase(mp[top].begin());
    }

    std::cout << (char)(turn - 32) << std::endl;
}


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

int main() {
    int n;
    string str;
    while(cin >> n, n) {
        vector<int> key(n);
        for(int i=0; i<n; ++i) {
            cin >> key[i];
        }
        cin >> str;

        string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for(int i=0; i<str.size(); ++i) {
            int chars_id = 0;
            int key_val = key[i%n];
            if('a' <= str[i] && str[i] <= 'z') {
                chars_id = str[i] - 'a';
            } else {
                chars_id = str[i] - 'A' + 26;
            }
            chars_id = (chars_id+52-key_val)%52;
            cout << chars[chars_id];
        }
        cout << endl;
    }
}


Measured memory_bytes: 3108
import random as ra
import copy
import time

start_time = time.time()

D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]

### 得点計算用
#t = [int(input()) for i in range(D)]
def cal_point(t):
    score = 0
    last = [0]*26
    for d in range(D):
        score += s[d][t[d]-1]
        last[t[d]-1] = d+1
        for i in range(26):
            score -= c[i]*(d+1-last[i])
    #print(score)
    return score


t = []
last = [0]*26
for i in range(D):
    opt1 = s[i].index(max(s[i]))
    opt2 = last.index(min(last))
    if ra.random()<0.5:
        t.append(opt1+1)
        last[opt1] = i+1
    else:
        t.append(opt2+1)
        last[opt2] = i+1


#t = [ra.randint(1,26) for i in range(D)]
max_score = 0
optimal_t = copy.deepcopy(t)
#M = 10**5
while (time.time()-start_time)<1.95:
#for i in range(M):
    d = ra.randint(1,D)
    q = ra.randint(1,26)
    td = t[d-1]
    t[d-1] = q
    now = cal_point(t)
    if now > max_score:
        optimal_t = copy.deepcopy(t)
        max_score = now
    else:
        t[d-1] = td

print(*optimal_t,sep='\n')


Measured memory_bytes: 10016
#include<bits/stdc++.h>
using namespace std;
long long a,i,b,c;
int main()
{
    cin>>a>>b>>c;
    for(i=a; i<=a*1000; i+=a)
    {
        if(i%b==c) 
        {
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    string s; cin>>s;
    int n = s.size();
    vector<int> cnt(26, 0);
    for(int i=0; i<n; i++){
        cnt[s[i] - 'a']++;
    }

    int ecnt = 0, ocnt = 0;
    for(int i=0; i<26; i++){
        if(cnt[i] % 2) ocnt++;
        else ecnt++;
    }

    if((n % 2 == 1 && ocnt == 1) || (n % 2 == 0 && ecnt == 26)){
        ll sum = 0;
        for(int i=0; i<26; i++){
            cnt[i] /= 2;
            sum += cnt[i];
        }

        ll ans = 1;
        for(ll i=1; i<=sum; i++){
            ans *= i;
        }

        for(int i=0; i<26; i++){
            ll num = 1;
            for(ll j=1; j<=cnt[i]; j++){
                num *= j;
            }

            ans /= num;
        }

        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int n,h;
    cin>>n;
    vector<int>v;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>h;
        v.push_back(h);
    }
    for(int i=0;i<n;i++)
    {
        while(v[i]>0)
        {
            for(int j=i;j<n;j++)
            {
                if(v[j]>0)
                    v[j]--;
                else
                    break;
            }
            ans++;
        }
        
    }
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const long long mod = 1000000007;
struct mint {
  long long x;
  mint(ll x = 0):x(x%mod) {}
  //mint(ll x = 0):x((x%mod+mod)%mod) {} // for minus
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod-a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint ret(*this);
    return ret += a;
  }
  mint operator-(const mint a) const {
    mint ret(*this);
    return ret -= a;
  }
  mint operator*(const mint a) const {
    mint ret(*this);
    return ret *= a;
  }
  mint pow(ll t) const {
    if(t==0) return mint(1);
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }
  
  //for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint ret(*this);
    return ret /= a;
  }
};
ostream &operator<<(ostream& os, const mint& x) {
  os << x.x;
  return os;
}
bool operator==(const mint& a, const mint& b){
  return a.x == b.x;
}
class modutils {
  vector<mint> fact, invfact;
public:
  modutils(int n = 2000005):fact(n+1),invfact(n+1) {
    fact[0] = 1;
    for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
    invfact[n] = fact[n].inv();
    for(int i=n; i>=1; i--) invfact[i-1] = invfact[i] * i;
  }
  mint pow(mint x, ll n) {
    return x.pow(n);
  }
  mint comb(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[k] * invfact[n-k];
  }
  mint perm(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[n-k];
  }
  mint fac(ll n) {
    return fact[n];
  }
};
modutils mutil;


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

  if(N==1){
    cout << 0 << endl;
    return 0;
  }
  if(N==2){
    cout << 2 << endl;
    return 0;
  }
  
  mint ret(1);
  rep(i,N) ret *= 10;

  mint tmp1(1), tmp2(1);
  rep(i,N) tmp1 *= 9;
  rep(i,N) tmp2 *= 8;

  ret -= tmp1;
  ret -= tmp1;
  ret += tmp2;

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 34216
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bits/stdc++.h>
#include <array>

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

using namespace std;


int main(int argc, const char * argv[]) {
    // source code
    long n;
    cin >> n;
    long m = static_cast<long>(sqrt(n) + 1);
    for(long i = m; i>0 ; i--) {
        if (n % i == 0) {
            cout << i + n/i  - 2;
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())
l = list(map(int, input().split()))
count = 0
sum = sum(l)
for i in range(n):
    if l[i] * 4 * m >= sum :
        count += 1
    
    

if count >= m :
    print('Yes')

else :
    print('No')


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main(){
	std::ios::sync_with_stdio(false);
	int N;
	long long L, T;
	while(cin >> N >> L >> T){
		L *= 2;
		T *= 2;
		vector<pair<long long, int>> X(N);
		for(auto& p : X){
			cin >> p.first >> p.second;
			p.first *= 2;
			p.second = (p.second == 1 ? 1 : -1);
		}
		long long add = 0;
		for(int i=0;i<N;i++){
			if(X[i].second == X[0].second) continue;
			long long pos0 = X[0].first;
			long long pos1 = X[i].first;
			if(X[0].second == -1) swap(pos0, pos1);
			if(pos1 < pos0) pos1 += L;
			long long first = (pos1 - pos0)/2;
			if(T < first) continue;
			long long rest = T - first;
			add++;
			add += rest/(L/2);
		}
		long long endPos = (X[0].first + L + T%L * X[0].second) % L;
		vector<pair<long long, long long>> vp;
		for(auto p : X){
			vp.emplace_back((p.first + L + T%L * p.second) % L, p.second);
		}
		sort(vp.begin(), vp.end());
		int start = -1;
		for(int i=0;i<vp.size();i++){
			if(vp[i].first == endPos && vp[i].second == X[0].second) start = i;
		}
		start = (start + N - add%N * X[0].second) % N;
		for(int i=0;i<vp.size();i++){
			cout << vp[(i+start)%vp.size()].first/2 << endl;
		}
	}
}


Measured memory_bytes: 4464
#include <stdio.h>
int main(void)
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if(a<c && c<b) printf("Yes\n");
    else if(b<c && a>c) printf("Yes\n");
    else printf("No\n");
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   int n;
   cin >> n;
   map<string, int> st;
   for(int i = 1; i <= n; i++)
   {
       string stt;
       cin >> stt;
       st[stt]++;
   }
   int ma = 0;
   for(auto it = st.begin(); it != st.end(); it++)
   {
       ma = max(ma, it->second);
   }

   vector<string>ve;
   for(auto it = st.begin(); it != st.end(); it++)
   {
       if(it->second == ma)
       {
           //cout << "i" << " ";
           ve.push_back(it->first);
       }
   }
   sort(ve.begin(), ve.end());
   for(int i = 0; i < ve.size(); i++)
   {
       cout << ve[i] << endl;
   }
    return 0;
}


Measured memory_bytes: 27352
#include <stdio.h>
 
int main() {
    long long int a, b = 0;
    scanf("%lld", &a);
    for (int i = 1; i <= a; i++) {
        if ((i % 3) == 0 || (i % 5) == 0) {
            b = b;
        } else {
            b += i;
        }
    }
    printf("%lld", b);
}

Measured memory_bytes: 1736
S = str(input())
a = 0
if S == "SUN":
  a = 7
elif S == "MON":
  a = 6
elif S == "TUE":
  a = 5
elif S == "WED":
  a = 4
elif S == "THU":
  a = 3
elif S == "FRI":
  a = 2
elif S == "SAT":
  a = 1
print(a)

Measured memory_bytes: 2940
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a;
	a.push_back(0);
	a[0]=1;
	a.push_back(1);
	a[1]=1;
	for ( int i = 2; i < n + 1; i++ ) {
		a.push_back(i);
		a[i] = a[i-2] + a[i-1];
	}
	cout << a[n] << endl;
	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    string s;
    cin>>s;
    int x = 0;
    rep(i,0,s.length()){
        x += (s[i]-'0');
        x %= 9;
    }

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

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> price(N);
  for (int i = 0;i < N; i++) {
    cin >> price[i];
  }
  sort(price.begin(), price.end());

  int res = 0;
  for (int i = 0; i < K; i++) {
    res += price[i];
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3632
# require 'pry'
BINF = -(10**12)
N = gets.to_i
robots = []
N.times do
  s, t = gets.split.map(&:to_i)
  robots << [s + t, s - t]
end
robots.sort_by!{|x|x}
# p robots
t = BINF
count = 0
# binding.pry
robots.each do |robo|
  if t > robo[1]
    count += 1
    next
  end
  t = robo[0]
end
puts N - count


Measured memory_bytes: 12664
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007

    using namespace std;
     //int g[105][105];
    //vector < int > wt(100004);
   // vector < int > a;
    //vector < int > v(30500);
    //int cst[102][100005];
    //int ansr[100005];
 //ll int sum,x=0,c=0,n,m,flag=0,a1,a2,flag1=0,flag2=0;
    //vector < vector < int > > adj(5000, vector < int > (5000));
 //int  dp[1000006];
   // int level[500];


    void solve()
    {
         ll int i,j=0,r=200,p,q,y=0,l,k=0,ans=0,d,h,flag=0,n,m,a;
         //cin>>n>>k;
         string s;
         cin>>s;
         sort(all(s));
         if(s[0]==s[1] and s[2]==s[3] and s[0]!=s[3]) cout<<"Yes";
         else cout<<"No";



    }



    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
       // cin>>t;
        while(t--)
        solve();
    }

       /*
       int power(int x, unsigned int y, int p)
{
    int res = 1;      // Initialize result

    x = x % p;

    while (y > 0)
    {

        if (y & 1)
            res = (res*x) % p;

    =
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

  void bfs( int i , int j)
       {
           vis[i][j]= true;
         queue < int > que;
         que.push(k);
         while(!que.empty())
         {
            int x= que.front();
            que.pop();
             for ( int i=1;i<=n;i++)
             {
                 if((!g[1][n] and g[x][i] ) or (g[1][n] and ! g[x][i]))
                 {
                   if(!vis[i])
                   {
                       que.push(i);
                       level[i]=level[x]+1;
                       vis[i]= true;
                   }
                 }
             }
         }
       }

      ll int por(ll int a,ll int b)
         {
            ll int k=1;
            while(b>0)
            {
                if(b%2) k=k*a,k%=hell;
                b/=2;
                a*=a; a%=hell;
            }
            return k;
         } */


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

string f(string s,char c){
	string ret = "";
	ret += c;
	rep(i,s.size()){
		ret += s[i];
	}
	return ret;
}
string b(string s,char c){
	s += c;
	return s;
}

int main(){
	int n;
	cin >> n;
	string s[2] = { "" , "" };
	
	const char c[4][2] = { {'.','.'},{'.','#'},{'#','.'},{'#','#'} };
	
	char R;
	bool t = false;
	while(1){
		if(!t){
			rep(i,4){
				cout << b(s[0],c[i][0]) << "\n" << b(s[1],c[i][1]) << "\n";
				fflush(stdout);
				cin >> R;
				if(R == 'T'){
					s[0] = b(s[0],c[i][0]);
					s[1] = b(s[1],c[i][1]);
					break;
				}
				if(i == 3)t = true;
			}
		}
		else {
			rep(i,4){
				cout << f(s[0],c[i][0]) << "\n" << f(s[1],c[i][1]) << "\n";
				fflush(stdout);
				cin >> R;
				if(R == 'T'){
					s[0] = f(s[0],c[i][0]);
					s[1] = f(s[1],c[i][1]);
					break;
				}
			}
		}
		if(s[0].size() == n)break;
	}
}



Measured memory_bytes: 596
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
using P = pair<int, int>;

int main() {
    int n, h; cin >> n >> h;
    vector<P> ba(n);
    int Ma = 0;
    rep(i, n) {
        int a, b; cin >> a >> b;
        chmax(Ma, a);
        ba[i] = make_pair(b, a);
    }
    sort(all(ba)); reverse(all(ba));
    int cnt = 0;
    rep(i, n) {
        if(Ma <= ba[i].first) {
            cnt++;
            h -= ba[i].first;
            if(h <= 0) {
                cout << cnt << endl;
                return 0;
            }
        } else break;
    }
    cnt += (h - 1) / Ma + 1;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    vector<int> len(3);
    for(int i = 0; i < 3; ++i)  cin >> len[i];
    vector<int> l(n);
    for(int i = 0; i < n; ++i)  cin >> l[i];
    vector<vector<int>> st(3);
    auto dfs = [&](auto&& self, int N = 0) -> int{
        if(N == n){
            if(!st[0].size() || !st[1].size() || !st[2].size()) return INF;
            int res = 0;
            for(int i = 0; i < 3; ++i){
                int S = accumulate(st[i].begin(), st[i].end(), 0);
                res += 10 * (st[i].size() - 1);
                res += abs(S - len[i]);
            }
            return res;
        }
        int res = INF;
        for(int i = 0; i < 3; ++i){
            st[i].push_back(l[N]);
            chmin(res, self(self, N + 1));
            st[i].pop_back();
        }
        chmin(res, self(self, N + 1));
        return res;
    };
    cout << dfs(dfs) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#define mod 1e9+7
using namespace std;
int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a;
  vector<vector<int>> dp(1<<21,vector<int>(2,0));
  dp[0][0]=1;
  vector<vector<int>> listj(22);

  for(int k=0;k<(1<<(n));k++)
  {
    int j=0,tmp=k;
    while(tmp>0){j+=tmp%2;tmp/=2;}
    listj[j].push_back(k);
    //cout<<j<<" "<<k<<endl;
  }

  for(int i=1;i<n+1;i++)
  {
    for(int j=0;j<n;j++)
    {
      cin>>a;
      if(!a)continue;
      for(int k:listj[i-1])
      {
        if((k & (1<<j)))continue;
        int kn;
        kn=k+(1<<j);
        {
          dp[kn][i%2]+=dp[k][(i+1)%2];
          if(dp[kn][i%2]>=mod)dp[kn][i%2]-=mod;
        }
      }
    }


  }
  cout<<dp[(1<<n)-1][(n)%2]<<endl;

  return 0;

}


Measured memory_bytes: 126400
from sys import stdin

N = int(stdin.readline().rstrip())
lst = [int(x) for x in stdin.readline().rstrip().split()]
lst.sort()
lst.reverse()

Alice = 0
Bob = 0

for i in range(len(lst)):
    if i % 2 == 0:
        Alice += lst[i]
    else:
        Bob += lst[i]

print(Alice - Bob)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    rep(i,n){
      cin>>a[i];
    }
    ll ans=0;
    ll x;
    k++;
    rep(i,40){//(i+1)番目のbitまでkとxが一致する場合
      x=0;
      if((k>>i & 1)==0){//i番目のbitはkが1でxが0になる必要あり
        continue;
      }
      //cout<<i<<'\n';
      if(i!=39){
        for(ll j=39;j>=i+1;j--){
          x+=pow(2,j)*(k>>j & 1);
        }
      }
      //cout<<x<<'\n';
      ll local=0;
      //i-1bitから0bitまではaを考慮して決める
      if(i==0){
        x=k-1;
        rep(j,n){
          ans+=x^a[j];
        }
        //cout<<' '<<ans<<'\n';
        continue;
      }
      rep(j,i){
        ll cnt=0;
        rep(l,n){
          if((a[l]>>j & 1)==0){
            cnt++;
          }
        }
        //cout<<j<<' '<<cnt<<'\n';
        if(cnt>n-cnt){//j番目のビットが0の方が多かったら
          x+=pow(2,j);
        }
      }
      rep(j,n){
        local+=x^a[j];
      }
      if(local>ans){
        ans=local;
      }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <inttypes.h>

/* x*a + y*b == gcd(a, b) */
void hanazawa_kana(int64_t a, int64_t b, int64_t* x, int64_t* y) {
	if (b == 0) {
		*x = 1;
		*y = 0;
	} else {
		int64_t nx, ny;
		hanazawa_kana(b, a % b, x, y);
		/* x*b + y*(a % b) == gcd(a, b) */
		/* x*b + y*(a - a/b*b) == gcd(a, b) */
		/* y*a + (x - y*(a/b))*b == gcd(a, b) */
		nx = (*y);
		ny = (*x) - (*y) * (a/b);
		*x = nx;
		*y = ny;
	}
}

int main(void) {
	int64_t a, b;
	int64_t x = 0, y = 0;
	if (scanf("%"SCNd64"%"SCNd64, &a, &b) != 2) return 1;
	hanazawa_kana(a, b, &x, &y);
	printf("%"PRId64" %"PRId64"\n", x, y);
	return 0;
}



Measured memory_bytes: 2080
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan=new Scanner(System.in);
    		
    		char[]s=scan.next().toCharArray();
    		
    		int ans=0;
    		for (char i:s) {
    			if ("1".contentEquals(String.valueOf(i))) {
    				++ans;
    			}
    		}
    		System.out.print(ans);
    				
 
     
    }
    }
// end 

Measured memory_bytes: 21844
import numpy as np
from numpy.fft import rfft,irfft
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
class Polynomial:
    def __init__(self,coefficient=None,dim=0,const=1):
        if coefficient == None:
            self.coefficient = np.zeros(dim+1, np.int64)
            self.coefficient[dim] = const
        else:
            self.coefficient = coefficient

    def __add__(self,other): # +
        f,g = self.coefficient, other.coefficient
        if len(f) > len(g): f,g = g,f

        h = Polynomial(dim=len(g)-1,const=0)
        h.coefficient[len(f):] += g[len(f):]
        h.coefficient[:len(f)] += f + g[:len(f)]
        return h
    
    def __iadd__(self,other): # +=
        h = self.__add__(other)
        self.coefficient = h.coefficient
        return self

    def __mul__(self,other): # *
        f = self.coefficient
        g = other.coefficient
        h = Polynomial()
        h.coefficient = self.fft(f,g)[:len(f)+len(g)-1]
        return h
    
    def __len__(self):
        return len(self.coefficient)

    def __getitem__(self,key):
        return self.coefficient[key]

    def get_coefficient(self,x):
        return self.coefficient[x]


    def fft(self,A,B,fft_len=1<<18):
        x = irfft(rfft(A,fft_len) * rfft(B,fft_len))
        return np.rint(x).astype(np.int64)



def main():
    N,M=mi()
    A=list(mi())
    
    coefficient = [0] * (2*10**5+10)
    for a in A:
        coefficient[a] += 1
    
    f = Polynomial(coefficient=coefficient)
            
    g = f * f
    ans = 0
    handshake = M
    for x in range(len(g)-1,1,-1):
        count = g[x]
        if count <= 0: continue

        if count > handshake:
            ans += handshake * x
        else:
            ans += count * x
 
        handshake = max(handshake-count,0)
        if handshake == 0:
            break

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 46744
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll t1,t2;cin>>t1>>t2;
    ll a1,a2;cin>>a1>>a2;
    ll b1,b2;cin>>b1>>b2;
    if(a1<b1){
        swap(a1,b1);
        swap(a2,b2);
    }
    //a1>b1
    ll bufa=a1*t1+a2*t2,bufb=b1*t1+b2*t2;
    if(bufa==bufb){
        cout<<"infinity"<<endl;
        return 0;
    }
    if(bufb<bufa){
        cout<<0<<endl;
        return 0;
    }
    ll buf=bufb-bufa;
    ll res=(a1-b1)*t1/buf;
    res*=2;
    if(((a1-b1)*t1)%buf!=0)res++;
    cout<<res<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
using P = pair<int,int>;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

inline ll modu(ll a){
    return(a % mod + mod) % mod;
}

/* 逆元(法mod = 1e7) */
ll modinv(ll a){
    ll b = mod, u = 1, v = 0;
    while (b){
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
        }
    return modu(u);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    ll n,a,b;
    cin >> n >> a >> b;
    ll nca = 1,ncb = 1;
    REP(i,a){
        nca = modu(nca*modu((n-i)*modinv(i+1)));
    }
    REP(i,b){
        ncb = modu(ncb*modu((n-i)*modinv(i+1)));
    }
    ll answer = modu(modpow(2,n,mod) - ncb - nca - 1);
    cout << answer << "\n";
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  string t;
  cin>>t;
  int n=t.size();
  REP(i, n){
    if(t[i]=='?'){
      t[i]='D';
    }
  }
  cout<<t<<'\n';
  return 0;
}


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

int main() {
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int count=0;
		for(int i=2; i<=n; i++){
			int a = i;
			while(a%5 == 0){
				count++;
				a /= 5;
			}
		}
		cout << count << endl;
	}
	return 0;
}


Measured memory_bytes: 3088
def main(h,w,k,a):
  s=-1,-1
  for i in range(h):
    for j in range(w):
      if a[i][j]=='S':
        s=i,j
        break
    if s[0]!=-1:break
  inf=float('inf')
  da=[[inf]*w for _ in range(h)]
  da[s[0]][s[1]]=0
  todo=[s]
  dst=min(s[0],h-s[0]-1,s[1],w-s[1]-1)
  cnt=0
  while cnt<k and todo:
    ntodo=[]
    while todo:
      i,j=todo.pop()
      for di,dj in ((1,0),(-1,0),(0,1),(0,-1)):
        if 0<=i+di<h and 0<=j+dj<w and a[i+di][j+dj]=='.' and da[i+di][j+dj]>da[i][j]+1:
          da[i+di][j+dj]=da[i][j]+1
          ntodo.append((i+di,j+dj))
          dst=min(dst,i+di,h-i-di-1,j+dj,w-j-dj-1)
    cnt+=1
    todo=ntodo
  return 1+(dst+k-1)//k

h,w,k=map(int,input().split())
a=[input() for _ in range(h)]
print(main(h,w,k,a))

Measured memory_bytes: 84236
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;cin>>n;
    for(int i=0;i<n;i++)
    {
        vector<int> c(3);cin>>c[0]>>c[1]>>c[2];
        sort(c.begin(),c.end());
        //cout << c[0]<<":" << c[1] <<":"<< c[2]<<":";
        if (c[2]*c[2]==c[1]*c[1]+c[0]*c[0]) cout<<"YES\n";
        else cout<<"NO\n";
    }
}

Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
const double eps = 1e-8;

int n, hx, hy, dx, dy;
vector<int> cx, cy;
vector<double> dd;
vector<vector<double> > d;

bool check(int vis, int k, double t){
    rep(i, n)if(!(vis >> i & 1) && dd[i] <= d[k][i] + t + eps)return false;
    return true;
}

bool dfs(int vis, int k, double t){
    if(vis == (1 << n) - 1)return true;
    if(!check(vis, k, t))return false;
    rep(i, n){
        if(vis >> i & 1 || dd[i] <= d[k][i] + t + eps)continue;
        if(dfs(vis | 1 << i, i, t + d[k][i]))return true;
    }
    return false;
}

int main(){
    while(cin >> n >> hx >> hy >> dx >> dy, n|hx|hy|dx|dy){
        cx.assign(n, 0); cy.assign(n, 0); dd.assign(n, 0);
        d.assign(n + 1, vector<double>(n + 1, 0));
        rep(i, n){
            cin >> cx[i] >> cy[i];
            dd[i] = hypot(cx[i] - dx, cy[i] - dy);
            d[i][n] = d[n][i] = hypot(cx[i] - hx, cy[i] - hy);
            rep(j, i)d[i][j] = d[j][i] = hypot(cx[i] - cx[j], cy[i] - cy[j]);
        }
        cout << (dfs(0, n, 0.)? "YES\n": "NO\n");
    }
    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> A)
{
    SORT(A);
    ll sum = 0;
    ll ans = 0;
    for (int i = 0; i < N-1; i++)
    {
        sum += A[i];

        if (sum * 2 < A[i + 1])
        {
            ans = i + 1;
        }
    }

    cout << N - ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int N; string M;
int p[50]; long long power[20];
long long div(long long k, int m) {
	long long sum = 0;
	while (k >= 1) {
		k /= m; sum += k;
	}
	return sum;
}
int main() {
	while (true) {
		cin >> N >> M; power[0] = 1;
		for (int i = 0; i < 50; i++)p[i] = 0;
		for (int i = 1; i < M.size(); i++)power[i] = power[i - 1] * N;
		if (N == 0)break;
		long long C = 0;
		for (int i = 0; i < M.size(); i++) {
			int V = (char)(M[i] - '0'); if (M[i] >= 'A')V = (char)(M[i] - 'A') + 10;
			C += power[M.size() - 1 - i] * V;
		}
		int L = N;
		for (int i = 2; i <= L; i++) {
			while (L%i == 0) {
				L /= i; p[i]++;
			}
		}
		long long minx = 1LL << 62;
		for (int i = 2; i <= N; i++) {
			if (p[i] == 0)continue;
			minx = min(minx, div(C, i) / p[i]);
		}
		cout << minx << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#A問題
M,D = map(int,input().split())
count = 0
for j in range(D):
    J = j+1
    s=list(str(J))
    if len(s) >= 2:
        if int(s[0]) >= 2 and int(s[1]) >= 2:
            m = int(s[0])*int(s[1])
            if m <= M:
                count+=1
                
print(count)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
 
int main(int argc,char** argv)
{
	char a[4];
	scanf("%s",a);
	if(a[0] == a[1] &&  a[1] == a[2] && a[2] == a[3]){
		printf("Yes\n");
	}
	else if(a[0] == a[1] &&  a[1] == a[2]){
		printf("Yes\n");
	}
	else if(a[1] == a[2] && a[2] == a[3]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
 
	return(0);
}

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

void solve(int D, vector<int> c, vector<vector<int>> s)
{
    vector<int> last(26, -1);
    int score = 0;
    for (int d = 0; d < D; d++)
    {
        int max_score_d = -1e9, max_td = -1;
        for (int td = 0; td < 26; td++)
        {
            int score_d = score;
            score_d += s.at(d).at(td);
            for (int i = 0; i < 26; i++)
            {
                if (i == td)
                    continue;
                score_d -= c.at(i) * (d - last.at(i));
            }
            if (max_score_d < score_d)
            {
                max_score_d = score_d;
                max_td = td;
            }
        }
        cout << max_td + 1 << endl;
        last.at(max_td) = d;
        score = max_score_d;
    }
}

int main()
{
    int D;
    cin >> D;
    vector<int> c(26);
    for (int i = 0; i < 26; i++)
    {
        cin >> c.at(i);
    }
    vector<vector<int>> s(D, vector<int>(26));
    for (int i = 0; i < D; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            cin >> s.at(i).at(j);
        }
    }
    solve(D, move(c), move(s));
    return 0;
}


Measured memory_bytes: 3696