akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

template<ll mod>
struct RollingHash{
  vector<ll> hash,p;
  ll base;
  RollingHash(string s, ll b){
    ll n = (ll)s.size();
    base = b;
    hash.assign(n+1,0);
    p.assign(n+1,1);
    for(ll i=0;i<n;i++){
      hash[i+1]=(hash[i]*base+s[i])%mod;
      p[i+1]=(p[i]*base)%mod;
    }
  }
  ll get(ll l, ll r){
    ll ret=hash[r+1]-(hash[l]*p[r-l+1])%mod;
    if(ret<0)ret+=mod;
    return ret;
  }
};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  //const ll tmp_mod=608396398;
  const ll tmp_mod=979418779;
  //const ll tmp_mod=775791517;
  using RH = RollingHash<tmp_mod>;
  ll base = 100000;
  ll n;cin>>n;
  string s;cin>>s;
  RH rh(s,base);
  /*auto v=vec(n,n,0LL);
  rep(i,0,n)rep(j,0,n){
    if(i+j<n)v[i][j]=rh.get(i,i+j);
  }*/
  rep(i,0,n-1)rep(j,i+1,n){
    if(s[i]!=s[j])continue;
    ll l=i,r=j;
    while(r-l>=2){
      ll mid=(l+r)/2;
      if(j+mid-i>=n||rh.get(i,mid)!=rh.get(j,j+mid-i)){
        r=mid;
      }
      else l=mid;
    }
    chmax(res,l-i+1);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
int n;
ll a[100000];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<n;i++) cin>>a[i];
    ll dp[n][2];
    dp[0][0]=a[0];
    dp[0][1]=-a[0];
    for(int i=1;i<n;i++){
        dp[i][0]=max(dp[i-1][0]+a[i],dp[i-1][1]-a[i]);
        dp[i][1]=max(dp[i-1][0]-a[i],dp[i-1][1]+a[i]);
    }

    cout << dp[n-1][0] << "\n";
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
 
using namespace std;
 
#define pb push_back
#define mp make_pair
constexpr int INF = 1 << 29;
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
 
constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};
 
int main() {
	int N;
	cin >> N;
	if (N >= 1000) {
		printf("ABD\n");
	} else {
 
		printf("ABC\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b,i,cnt=0,n,m,c;
	cin>>a>>b;
	for(i=a;i<=b;i++)
	{
		m=i;
		n=i;
		c=0;
		while(n>0)
		{
			c=(c*10)+(n%10);
			n=n/10;
		}
		if(m-c==0)
		cnt++;
	}
	cout<<cnt<<endl;

	return 0;
}

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

#define SIZE_OF_ARRAY(d) (sizeof(d)/sizeof(d[0]))


int main(){
    int a, b;
    cin >> a >> b;
    int d[b];
    int i, sum;
    for (i = 0; i<b; i++){cin >> d[i];}
    sum = accumulate(d, d + SIZE_OF_ARRAY(d), 0);
    if (a < sum){std::cout << -1 << std::endl;}
    else {std::cout << a-sum << std::endl;}
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int k = in.nextInt();
        int sum = a + b + c;
        int max = Math.max(Math.max(a, b), c);
        sum = sum - max;
        for (int i = 0; i < k; i++) {
            max = max * 2;
        }
        sum = sum + max;
        System.out.println(sum);
    }
    
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#define mod(x) ((x % MOD) + MOD) % MOD
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define RREP(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define NL cerr << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int from, to; int cost; };
ostream& operator << (ostream& s, const edge& e) {
   s << "(" << e.from << "->" << e.to << ": " << e.cost << ")";
   return s;
}
bool operator< (const edge &edge1, const edge &edge2){
   return edge1.cost < edge2.cost;
};

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   int A, B, C; cin >> A >> B >> C;

   cout << min(C, A+B+1) + B << endl;

   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
    int n, k, ans = 1;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        if(ans <= k) ans *= 2;
        else ans+=k ;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main()
{
	fast;
	string s;
	cin>>s;
	if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])
		cout<<"Bad";
	else
		cout<<"Good";
	return 0;
}


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

using namespace std;

#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define ll long long
const int maxn=1e6+10;
const int mod=1e9+7;
const double pi=acos(-1);

int main()
{
    int n,k;
    sint2(n,k);
    if(n<=10)
        printf("%d",k+100*(10-n));
    else
        printf("%d",k);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    while(1){
        string n;
        cin >> n;
        if(n=="0") break;
        
        int ans=0;
        for(int i=0;i<(int)n.length();i++){
            ans += n[i]-'0';
        
        }
        cout << ans <<endl;
    }// Your code here!
    
}


Measured memory_bytes: 3160
using System;

class Program
{
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int n = int.Parse(input[0]);
            int h = int.Parse(input[1]);
            int w = int.Parse(input[2]);

            int[] a = new int[n];
            int[] b = new int[n];

            int cnt = 0;

            for(int i = 0; i < n; i++)
            {
                string[] sInput = Console.ReadLine().Split(' ');
                a[i] = int.Parse(sInput[0]);
                b[i] = int.Parse(sInput[1]);
            }

            for(int i = 0; i < n; i++)
            {
                if(a[i] >= h && b[i] >= w)
                {
                    cnt++;
                }
            }

            Console.WriteLine(cnt);
        }
}

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

typedef long long ll;

int main(){
    string s, t[] = {"eraser", "erase", "dreamer", "dream"};
    cin >> s;
    bool ans = true;
    for(int i = 0; i < (int)s.size(); i++)
    {
        for(int j = 0; j < 4; j++)
        {
            if(j==0){
                if(s.substr(i, 6) == t[j]){
                    i+=5;
                    break;
                }
            }
            else if(j==1 || j==3){
                if(s.substr(i, 5) == t[j]){
                    i+=4;
                    break;
                }
            }
            else if(j==2 && s[i+7]!='a'){
                if(s.substr(i, 7) == t[j]){
                    i+=6;
                    break;
                }
            }
            if(j==3) ans = false;
        }

        if(!ans) break;
    }

    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;  
        
    return 0;
}

Measured memory_bytes: 512
s=input()
q=int(input())
t=0
zengo=["",""]
for i in range(q):
    l=input().split()
    if len(l)==1:
        t^=1
    else:
        f,c=int(l[1])-1,l[2]
        zengo[f^t]+=c
if t:
    print(zengo[1][::-1]+s[::-1]+zengo[0])
else:
    print(zengo[0][::-1]+s+zengo[1])

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

int main() {
	// your code goes here

    int n,k; cin>>n>>k;
    int a[n];
    
    for(int i=0;i<n;i++) cin>>a[i];
    if(n==2)
    {
        cout<<abs(a[1]-a[0])<<endl;
    }
    else {
    int dp[n+1];
    dp[0]=0;
   // dp[n]=min(abs(a[n-1]-a[n-2]),abs(a[n-1],a[n-3]));
    for(int i=1;i<n;i++)
    {
       if(i==1) dp[i]=abs(a[i]-a[i-1]);
       else {  dp[i]=INT_MAX;
           for(int j=0;j<k;j++)
           { 
               if(i-(j+1)<0) break;
             dp[i]=min(dp[i],min(abs(a[i]-a[i-j])+dp[i-j],abs(a[i]-a[i-(j+1)])+dp[i-(j+1)]) );
           }
           if(dp[i]==INT_MAX) dp[i]=abs(a[i]-a[i-1]);
           
       };
       
    //   cout<<dp[i]<<" ";
       
    }
    cout<<dp[n-1]<<endl; 
    }
	return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    cout << a.back() - a.front() << endl;
    return 0;
}


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

int main() {
	int n,l;
	cin>>n>>l;
	string a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		cout<<a[i];
	}
	cout<<endl;
	return 0;
}

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


typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
int main(){
	string k;
	int count=0;
	cin >>k;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(k[i]==k[j]){
				count++;
			}
		}
		if(count!=2){
			cout<<"No"<<endl;
			return 0;
		}else{
			count=0;
		}
	}
	cout <<"Yes"<<endl;
	return 0;
}

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

const int Nmax = 301;

int n;
long long dist[301][301];
int answer[301][301];
typedef pair<long long, pair<long long, long long>> succ;
vector<succ> vec;

int main() {
    
    cin>>n;
    
    for(int i=1; i<=n; i++) {
        for(int j=1; j<=n; j++) {
            cin >> dist[i][j];
        }
    }
    
    for(int i=1; i<=n; i++) {
        for(int j=1; j<=n; j++) {
            if(dist[i][j] != dist[j][i]) {
                cout<<"-1\n";
                return 0;
            }
            if(i==j && dist[i][j] != 0) {
                cout<<"-1\n";
                return 0;
            }
        }
    }
    
    for(int i=1; i<=n; i++) {
        for(int j=i+1; j<=n; j++) {
            vec.push_back( make_pair(dist[i][j], make_pair(i,j)) );
        }
    }
    
    long long ans = 0;
    sort(vec.begin(), vec.end());
    
    for(auto pr : vec) {
        long long value = pr.first;
        int x = pr.second.first;
        int y = pr.second.second;
        
        long long must = 1e14;
        
        int allr = 0;
        for(int k=1; k<=n; k++) {
            if(k!=x && k!=y) {
                if(dist[x][k] + dist[k][y] == value) {
                    allr=1;
                }
                must = min( must, dist[x][k] + dist[k][y] );
            }
        }
        
        if(must < value) {
            cout<<"-1\n";
            return 0;
        }
        
        if(!allr) {
            ans += value;
        }
        
    }
    
    cout<< ans <<'\n';
}

Measured memory_bytes: 2680
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim_i = (b); i < lim_i; i++)
#define REP(i, ...) REP_((i), __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Mar 14 21:00:01 JST 2020
 **/

signed main() {
    Int h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << (h * w + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main() {
    int n,m;
    cin >> n >> m;
    
    printf("%d\n", n*(n-1)/2 + m*(m-1)/2);
    
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    N=ii()
    x=int(N**0.5)
    while x>0:
        y=N//x
        if x*y==N:
            print(x+y-2)
            exit()
        else:x-=1


if __name__ == "__main__":
    main()

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

using namespace std;

int a,b,du[10];

int main()
{
    while (scanf("%d",&a) != EOF)
    {
        scanf("%d",&b);
        du[a]++;
        du[b]++;
    }
    int cnt = 0;
    for (int i = 1; i <= 4; i++)
        if (du[i] % 2 == 1)
            cnt++;
    if (cnt != 2 && cnt != 0)
        puts("NO");
    else
        puts("YES");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59
 

ll n,h;

int main(){
  ll i,j;
  cin>>n>>h;

  ll a[n],b[n];
  for(i=0;i<n;i++) cin>>a[i]>>b[i];

  ll m=0;
  for(i=0;i<n;i++){
    m=max(m,a[i]);
  }

  sort(b,b+n);
  reverse(b,b+n);
  ll po=0;
  while(po<n&&b[po]>=m&&h>0){
    h-=b[po];
    po++;
  }
  if(h<=0) cout<<po<<endl;
  else cout<<po+(h+m-1)/m<<endl;

}

Measured memory_bytes: 1792
let () = Scanf.scanf "%d %d\n" @@ fun k n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let ds = Array.init n @@ fun i -> (k + as_.((i + 1) mod n) - as_.(i)) mod k in
  Printf.printf "%d\n" @@ Array.fold_left ( + ) 0 ds - Array.fold_left max min_int ds

Measured memory_bytes: 6016
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		int a = Integer.parseInt(scan.next());
		int b = Integer.parseInt(scan.next());
		int c = Integer.parseInt(scan.next());
		
		int count = 0;
		
		for (int i = a; i <= b; i++) {
			if (c % i == 0) count++;
		}
		
		System.out.println(count);
	}
}

Measured memory_bytes: 26076
# 小さい二本を固定して残りの一本を二分木で探索 O(N ^ 2logN)

def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools
    import bisect

    n = int(input())
    ls = sorted(list(map(int, input().split())))

    ans = 0
    for l1 in range(n - 2):
        for l2 in range(l1 + 1, n - 1):
            check_l = ls[l1] + ls[l2]
            ans += max(bisect.bisect_left(ls, check_l) - (l2 + 1), 0)
            # print(ls[l1], ls[l2], bisect.bisect_left(ls, check_l) - (l2 + 1))
            
    print(ans)


if __name__ == '__main__':
    main()

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

A.sort()
maxA = A[-1]
dp = [-1 for i in range(maxA+1)]
for a in A:
  if dp[a] != 0:
    if dp[a] == 1:
      dp[a] = 0
      continue
    dp[a] = 1
    for i in range(2*a, maxA+1, a):
      dp[i] = 0
ans = 0
for a in A:
  if dp[a] == 1:
    ans += 1
print(ans)  

Measured memory_bytes: 32176
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


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

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


void solve(long long n, std::vector<long long> a){
    i64 ans = 0;
    sort(a.begin(), a.end(), greater<>());
    for(int i = 1; i < n; ++i){
        ans += a[i >> 1];
    }
    cout << ans << endl;
}


signed 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: 4844
#include<iostream>
#include<string>

using namespace std;

int main () {

    std::string s;

    getline(cin, s);

    for (int i = 0; i < 1200; i++) {
        if (65 <= s[i] && s[i] <= 90) {
            s[i] += 32;
        } else if (97 <= s[i] && s[i] <= 122) {
            s[i] -= 32;
        }
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3164
# coding: utf-8

n_s, n_c = map(int, input().split())
ans = 0

if n_c >= n_s * 2:
    ans += n_s
    rest_c = n_c - n_s * 2
    ans += rest_c // 4
else:
    ans += n_c // 2

print(ans)

Measured memory_bytes: 2940
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <functional>
#include <string.h>

using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#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=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a,0,sizeof(a))
#define minus(a) memset(a,0xff,sizeof(a))
#define chmax(a,b) a=min((a),(b))
#define chmin(a,b) a=max((a),(b))

template <typename T>
class Bit {
public:
	vector<T> a;
	Bit(int n) {
		a.resize(n+1);
	}
	void add(int x, T y) {
		for (int i = x; i < a.size(); i += (i&-i)) {
			a[i] += y;
		}
	}

	T sum(int x) {
		T ret = 0;
		for (int i = x; i > 0; i -= (i&-i)) {
			ret += a[i];
		}
		return ret;
	}
};

typedef tuple<int, int, int>P;
vector<P> lr;
int n, m;


int main(){
	int l, r;
	scanf("%d %d ", &n, &m);
	
	rep(i, n) {
		scanf("%d %d ", &l, &r);
		lr.push_back(P(r - l + 1, l, r));
	}
	sort(all(lr));
	vector<int> width;
	int x, y, w;
	
	rep(i, lr.size()) {
		tie(w,x,y) = lr[i];
		width.push_back(w);
	}
	int up;
	int pos = 0, cur = 0;
	Bit<int> bit(m);
	FOR(d,1,m){//
		int res = 0;
		pos = lower_bound(all(width), d) - width.begin();
		res += n - pos;
		if (pos > cur) {
			while (cur < pos) {
				tie(w,x,y) = lr[cur++];
				bit.add(x, 1);
				bit.add(y + 1, -1);
			}
		}
		
		for (int j = d; j <= m; j += d) {//
			res += bit.sum(j);
		}
		printf("%d\n", res);
	}

	return 0;
}


Measured memory_bytes: 9580
#include <stdio.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <math.h>
#include <vector>
#include <list>
#define inf 200
using namespace std;

int n;
list<int> adj[101];
int d[101];
bool f[101];
void BFS(int v)
{
    int m = 0;
    f[v] = false;
    while (!adj[v].empty())
    {
        d[adj[v].front()] = min(d[v] + 1, d[adj[v].front()]);
        adj[v].pop_front();
    }
    for (int i = 1; i <= n; i++)
    {
        if (f[i] && d[i] < d[m])
            m = i;
    }
    if (m > 0)
        BFS(m);
}

void print()
{
    for (int i = 1; i <= n; i++)
    {
        if (d[i] == inf)
            d[i] = -1;
        printf("%d %d\n", i, d[i]);
    }
}

int main()
{
    int u, k, v;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> u >> k;
        while (k > 0)
        {
            cin >> v;
            adj[u].push_back(v);
            k--;
        }
    }
    for (int i = 0; i <= n; i++)
    {
        d[i] = inf;
        f[i] = true;
    }
    d[1] = 0;
    BFS(1);

    print();

    return 0;
}


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

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

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n = read::<i32>();
    let tn = read_vec::<i32>();
    let m = read::<i32>();
    let mut pxn = Vec::new();

    for _ in 0..m {
        pxn.push(read_vec::<i32>());
    }

    let sum:i32 = tn.iter().sum();
    let ans:Vec<i32> = pxn.iter().map(|x| sum-tn[(x[0]-1) as usize] +x[1]).collect();
    for x in ans{
        println!("{}",x);
    }
}

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

int main() {
    int X;
    cin >> X;
    int m = 0;

    for(int i=1; i<1000; i++) {
        for(int j=2; j<10; j++) {
            int a = pow(i, j);
            if(X >= a){
                m = max(m, a);
            }
        }
    }
    cout << m << endl;
}


Measured memory_bytes: 4148
n,m = map(int, input().split())
p = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)

for i in range(m):
    uf.union(a[i][0]-1, a[i][1]-1)


count=0
for i in range(n):
    if p[i]-1==i:
        count+=1
    else:
        if uf.same(p[i]-1,i):
            count+=1
print(count)

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

int main(){
    //入力
    int X,A,B;
    cin >> X >> A >> B;
    //出力
    if(B-A>X){
        cout << "dangerous" << endl;
    }else if(B>A){
        cout << "safe" << endl;
    }else{
        cout << "delicious" << endl;
    }
    
}

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

int main() {
  int num;
  cin >> num;
  string c = "YES";

  vector<int> vec(num);

  for(int i=0; i<num; ++i){
    cin >> vec[i];
  }
  sort(vec.begin(),vec.end());

  for(int m=0; m+1<num; m++){
    if(vec[m] == vec[m+1]){
      c="NO"; break;
    }
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(b&1 || b>4*a || b<2*a){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pie 3.142857143
#define ll long long int
#define fr(i,a,n) for(ll i=a;i<n;i++)
#define vi vector<int>
#define vlli vector<ll>
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fv(i,a) for(auto i:a)
#define sz(a) int((a).size())
#define all(c) (c).begin(),(c).end()
#define frv(i,c) for(auto i = c.begin(); i != c.end(); i++)

void solve()
{
	const ll inf = 1e18l + 5;
	ll n, k, s = 0;
	cin >> n >> k;
	vlli w(n), v(n);
	fr(i, 0, n)
	{
		cin >> w[i] >> v[i];
		s += v[i];
	}
	vlli dp(s + 1, inf);
	dp[0] = 0;
	fr(i, 0, n)
	{
		for (ll j = s - v[i]; j >= 0; --j)
			dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
	}
	ll ans = 0;
	fr(i, 0, s + 1)
	{
		if (dp[i] <= k)
			ans = max(ans, i);
	}
	cout << ans << endl;
}


int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen ("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	//cin>>t;
	t = 1;
	while (t--)
	{
		solve();
	}


	return 0;
}

Measured memory_bytes: 3964
using System;
class Program
 {
        static void Main(string[] args)
        {
        
    　　int n,b;
            n = int.Parse(Console.ReadLine());
            string[] S = Console.ReadLine().Split(' '); //標準入力
            int[] nums;
            nums = new int[n];
            for(int i = 0;i < n; i++){
              nums[i] = int.Parse(S[i]);
            }
            int max = 0;
            int tmp = 0;
            for(int i = 0;i < n-1; i++){
              
              if(nums[i] >= nums[i+1]){
                tmp++;
                if((i == n-2) && (tmp > max)){
                  max = tmp;
                }
              }else if(tmp > max){
                max = tmp;
                tmp = 0;
              }
              else{
                tmp = 0;
              }
                                 
            }
          
          Console.WriteLine(max);
        }
 }

Measured memory_bytes: 23004
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, 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 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 = INT()
S = input()

nR = S.count("R")
nG = S.count("G")
nB = S.count("B")
ans = nR*nG*nB
for i in range(N):  # 開始 index
	for j in range(1, N//2+1):  # 幅
		if i+2*j >= N:
			break
		a, b, c = S[i], S[i+j], S[i+2*j]
		if a != b and b != c and c != a:
			ans -= 1
print(ans)


Measured memory_bytes: 10060
import fractions
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    div2cnt = 0
    a = A[0]
    while a % 2 == 0:
        a //= 2
        div2cnt += 1

    lcmval = A[0]//2
    for i in range(1, N):
        if A[i] % (2 ** (div2cnt+1)) == 0 or A[i] % (2 ** div2cnt) != 0:
            print(0)
            exit(0)
        
        lcmval = lcm(lcmval, A[i]//2)
        if lcmval > M:
            print(0)
            exit(0)
    
    print(int((M-lcmval)//(lcmval* 2)+ 1))

def lcm(x, y):
    return x * y // fractions.gcd(x, y)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 89580
using System;
using static System.Console;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] n =ReadLine().ToCharArray();
            for(int i = 0; i < n.Length; i ++)
            {
                if (n[i] == '1')
                {
                    Write('9');
                }
                else if(n[i] == '9')
                {
                    Write('1');
                }
                else
                {
                    Write(n[i]);
                }
            }
            
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

long long int mod=1e9+9;
const int N=100000;
int t,i,j,cs=0,n,a,b;
char s;

int main()
{
    cin>>s;
    if(s=='A')
        cout<<'T';
    else if(s=='T')
        cout<<'A';
    else if(s=='C')
        cout<<'G';
    else
        cout<<'C';
    cout<<endl;
}





Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
count = b[a[0]-1]
for i in range(1,n):
    if a[i] - a[i-1] == 1:
        count += b[a[i]-1] + c[a[i-1]-1]
    else:
        count += b[a[i]-1]
print(count)

Measured memory_bytes: 9148
s = input()

c = [0 for i in range(2019)]
c[0] = 1
mod = 2019
x = 0
for i,j in enumerate(s[::-1]):
	x = (x + int(j)*pow(10,i,mod))%mod
	c[x] += 1
ans = 0
for i in range(mod):
	ans += (c[i]*(c[i]-1))//2
print (ans)


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
void hakidashi(vector<ll>& v) {
    int pos = 0;
    for (int d = 60; d >= 0; d--) {
        int add = 0;
        for (int i = pos; i < sz(v); i++) {
            if (!(v[i] >> d & 1)) continue;
            add = 1;
            swap(v[pos], v[i]);
            break;
        }

        for (int i = pos + 1; i < sz(v); i++) {
            if (v[i] >> d & 1) v[i] ^= v[pos];
        }
        pos += add;
    }
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<int> cnt(62);
    rep(i, n) rep(d, 62) cnt[d] ^= (a[i] >> d & 1);
    ll ans = 0;
    rep(d, 62) {
        if (cnt[d]) {
            ans += 1ll << d;
            rep(i, n) {
                a[i] &= ~(1ll << d);
            }
        }
    }
    hakidashi(a);
    ll add = 0;
    for (ll x : a) {
        for (int d = 62; d >= 0; d--) {
            if (x >> d & 1) {
                if (!(add >> d & 1)) add ^= x;
                break;
            }
        }
    }
    ans += 2 * add;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 15000; ++i) {
        if (i * 8 / 100 == a && i * 10 / 100 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

//ここから

using P=pair<ll,ll>;
void solve(){
  ll d,g;
  cin>>d>>g;
  vector<P>score(d);
  int ans=1005;
  rep(i,d)cin>>score[i].first>>score[i].second;
  for(int bit=0;bit<(1<<d);++bit){//使い切るものにbitを立てる
    ll sum=0;
    int solved=0;
    rep(i,d){
      if(bit&(1<<i)){
        sum+=score[i].first*(ll)(i+1)*100LL;
        sum+=score[i].second;
        solved+=score[i].first;
      }
    }
    if(g<=sum){
      chmin(ans,solved);
    }
    else {
      for(int i=d-1;i>=0;--i){//残りは使い切らないもので補う
        if(!(bit&(1<<i))){//コンプリートボーナスがないので得点が高いものから使った方がお得
          ll add=min((g-sum)/(100*(i+1)),score[i].first-1);
          sum+=add*(i+1)*100;
          solved+=add;
          if(sum>=g){
            chmin(ans,solved);
            break;
          }
        }
      }
    }
  }
  cout<<ans<<"\n";
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

string add0(int X) {
    string S = to_string(X);
    while (S.size() < 6) {
        S = '0' + S;
    }
    return S;
}

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

    int N, M;
    cin >> N >> M;
    vector<int> P(M), Y(M);
    vector<vector<int> > V(N);
    for (int i = 0; i < M; ++i) {
        cin >> P.at(i) >> Y.at(i);
        V.at(P.at(i) - 1).push_back(Y.at(i));
    }
    for (auto &A : V) {
        sort(A.begin(), A.end());
    }
    for (int i = 0; i < M; ++i) {
        auto &A = V.at(P.at(i) - 1);
        int res = lower_bound(A.begin(), A.end(), Y.at(i)) - A.begin() + 1;
        cout << setfill('0') << right << setw(6) << P.at(i);
        cout << setfill('0') << right << setw(6) << res << endl;
    }

    return 0;
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n; cin >> n;
	map<int,int> hash;
	for(int i = 1 ; i <= sqrt(n) ; i++){
		for(int j = 1 ; j <= sqrt(n) ; j++){
			for(int k = 1 ; k <= sqrt(n) ; k++){
				int p = i*i+j*j+k*k+i*j+j*k+k*i;
				hash[p]++;
			}
		}
	}
	for(int i = 1 ; i <= n ; i++){
		cout<<hash[i]<<"\n";
	}
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 5392
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
typedef struct p point;
ll MOD = (1e9)+7;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
ll DP[101010];
int input[101010];
int main(){
	fastIO();
	memset(DP,0,sizeof(DP));
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>input[i];
	}
	DP[1]=abs(input[0]-input[1]);
	for(int i=2;i<n;i++){
		DP[i]=min(DP[i-1]+abs(input[i]-input[i-1]),DP[i-2]+abs(input[i]-input[i-2]));
	}
	cout<<DP[n-1]<<endl;
}
// - VERIFICAR LONG VS INT -


Measured memory_bytes: 1408
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

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

    Scanner sc = new Scanner(System.in);

    String S = sc.next();
    String T = sc.next();

    int cnt = 0;
    for(int i = 0; i < S.length(); i++) {

      char s = S.charAt(i);
      char t = T.charAt(i);
      cnt += s == t ? 1 : 0;
    }

    System.out.println(cnt);
  }
}


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

int main() {
    const int INF = 1e9;
    int N, T;
    cin >> N >> T;

    int ansC = INF;
    int ansT = INF;
    for (int i = 0; i < N; ++i){
        int c, t;
        cin >> c >> t;
        if (t <= T && c < ansC){
            ansC = c;
        }
    }

    if (ansC == INF){
        cout << "TLE" << endl;
    }else{
        cout << ansC << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let w: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let mut c = std::collections::HashMap::new();
    for &i in &w { *(c.entry(i).or_insert(0)) += 1; }
    let ans = if c.iter().all(|(_, &num)| num % 2 == 0) { "Yes" } else { "No" };

    println!("{}", ans);
}

Measured memory_bytes: 4352
require 'set'

class PriorityQueue < SortedSet
  @@id = 0

  def << obj
    add obj
  end

  def add obj
    super([obj,@@id])
    @@id+=1
  end

  def at idx
    super idx
  end

  def top
    self.min[0]
  end

  def pop
    self.delete(self.min)
  end
end

s = PriorityQueue.new

input = gets.split(' ').map(&:to_i)

for i in input
  s << i
end

arr = []
5.times do
  arr << s.top
  s.pop
end

puts arr.reverse.join(' ')

Measured memory_bytes: 6264
n=int(input())
s='*'+input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
cnt=0
for i in range(1,n+1):
    for j in range(i,n+1):
        k=2*j-i
        if k>n:
            continue
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            cnt+=1
print(r*g*b-cnt)

Measured memory_bytes: 9228
#include <iostream>
using namespace std;
int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  for (int i = 1; i <= B; i++)
  {
    if ((A * i) % B == C)
    {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

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

using namespace std;

int main (void) {
    int n, a;
    int div4 = 0, div2 = 0, other = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        if (a % 4 == 0) {
            ++div4;
            continue;
        } else if (a % 2 == 0) {
            ++div2;
            continue;
        } else {
            ++other;
        }
    }
    bool res;
    if (div2 == 0) res = (other <= div4 + 1);
    else res = (other <= div4);
    if (res) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()
A = li()

A = sorted(A)

print(sum(A[:M]))

Measured memory_bytes: 9264
#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()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

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

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

const int INF=1e9;
const int MAX_V=252;

// d[i][j]: 辺e=(i, j)のコスト(存在しない場合はINF, d[i][i]=0)
// d[i][i]が負になる場合は負の閉路が存在
int d[MAX_V][MAX_V];
int V;

void warshall_floyd(){
	REP(k, V){
		REP(i, V){
			REP(j, V){
				d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, R, r, rr[10], a, b, c;
	cin>>n>>m>>R;
	V=n;
	fill(d[0], d[n], INF);
	REP(i, n){
		d[i][i]=0;
	}
	REP(i, R){
		cin>>r;
		rr[i]=r-1;
	}
	REP(i, m){
		cin>>a>>b>>c;
		d[a-1][b-1]=d[b-1][a-1]=c;
	}
	warshall_floyd();
	sort(rr, rr+R);
	ll ans=1e18;
	do{
		ll tmp=0;
		REP(i, R-1){
			tmp+=d[rr[i]][rr[i+1]];
		}
		ans=min(ans, tmp);
	}while(next_permutation(rr, rr+R));
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};

// ll f(int n){
//   return n * (n + 1) / 2;
// }

int main(void){
  int N;
  cin >> N;
  ll ans = 0;
  for (int i = 1; i <= N; i++){
    ll k = N / i;
    ans += k * (k + 1) / 2 * i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, w, ans = 0;
  scanf("%lld%lld", &n, &w);
  pair<ll, ll> vw[n];
  for(i = 0; i < n; ++i) scanf("%lld%lld", &vw[i].second, &vw[i].first);
  vector< pair<ll ,ll> > v1, v2;
  vector<ll> v2sum;
  for(i = 0; i < 1 << n / 2; ++i) {
    ll nw = 0, nv = 0;
    for(j = 0; j < n / 2; ++j) {
      if(i & 1 << j) nw += vw[j].first, nv += vw[j].second;
    }
    pair<ll, ll> p = make_pair(nw, nv);
    v1.push_back(p);
  }
  for(i = 0; i < 1 << (n + 1) / 2; ++i) {
    ll nw = 0, nv = 0;
    for(j = 0; j < (n + 1) / 2; ++j) {
      if(i & 1 << j) nw += vw[j + n / 2].first, nv += vw[j + n / 2].second;
    }
    pair<ll, ll> p = make_pair(nw, nv);
    v2.push_back(p);
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  vector< pair<ll ,ll> >::iterator it1, it2;
  vector<ll>::iterator its;
  ll now = 0;
  for(it2 = v2.begin(); it2 != v2.end(); ++it2) {
    if(now < (*it2).second) now = (*it2).second;
    v2sum.push_back(now);
  }
  it2 = v2.end();
  its = v2sum.end();
  it2--, its--;
  /*for(it1 = v1.begin(); it1 != v1.end(); ++it1) printf("%lld %lld\n", (*it1).first, (*it1).second);
  for(it1 = v2.begin(); it1 != v2.end(); ++it1) printf("%lld %lld\n", (*it1).first, (*it1).second);*/
  for(it1 = v1.begin(); it1 != v1.end(); ++it1) {
    int s = 0;
    while((*it1).first + (*it2).first > w) {
      it2--;
      its--;
      if(it2 < v2.begin()) {
        s = 1;
        break;
      }
    }
    if(s) break;
    if(ans < (*it1).second + *its) ans = (*it1).second + *its;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 51448
#include <stdio.h>

int main(void) {
  int n;
  int count=0;
  int height=0;
  scanf("%d",&n);
  int h[n];
  for(int i=0;i<n;i++) {
    scanf("%d",&h[i]);
    if(h[i]>=height) {
      count++;
      height=h[i];
    }
  }
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<string.h>
#include<math.h>

using namespace std;

int main(void) {
 long long int n, a, b, tmp1, tmp2, sum=0;
  cin >> n >> a >> b;
  tmp1=a+b;
  tmp2 = n/tmp1;
  sum += tmp2 * a;
  tmp2 = n % tmp1;
  sum += min(tmp2,a);
  cout << sum << endl;
}

Measured memory_bytes: 256
def gcd(a, b):

	while b:

		a, b = b, a % b

	return a

N, X = map(int, input().split())
x = list(map(int, input().split()))

x2 = [abs(i-X) for i in x]

D = x2[0]
for i in range(N-1):
    D = gcd(D, x2[i+1])

print(D)

Measured memory_bytes: 14224
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
/*

class A
{
	int x;
	int y;
public:
	A();
	A show();
};

A::A(void)
{
	y = 10;
	x = 100;
}

A A::show(void)
{
	cout << "x = " << this->y << endl;
	return *this;
}

int main(void)
{
	A test1, test2;	
	test2 = test1.show();
	//test2 = test1.show();
	test2.show();
	cout << test1();
	return 0;
}


*/
int main() {
	int N, M;
	cin >> N >> M;
	if (N == M) {

		cout << "Yes";
	}
	else {

		cout << "No";
	}

}


Measured memory_bytes: 256