akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
ll power(ll a,ll n)
{
    ll res=1;
    while(n)
    {
        if(isodd(n))
            res=((res%mod)*(a%mod))%mod;
        a=((a%mod)*(a%mod))%mod;n/=2;
    }
    return res;
}
int vfun()
{
    ll n,x;
    cin>>n;
    vector <ll> v((n+1)/2,0);
    fo(i,n)
    {
        cin>>x;
        v[x/2]++;
    }
    ll i=0;
    if(isodd(n))
    {
        if(v[i]==0)
            return 0;
        i=1;
    }
    for(ll j=i;j<(n+1)/2;j++)
    {
        if(v[j]!=2)
            return 0;
    }
    cout<<power(2,n/2)<<endl;


    return 1;

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {


         if(!vfun())
            cout<<"0\n";

    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not





Measured memory_bytes: 3716
N = int(input())
H = list(map(int,input().split()))
m = 0
n = 0
for i in range(len(H)):
  try:
    if (H[i] >= H[i+1]):
      n += 1
    else:
      m = max(m,n)
      n = 0
  except:
    m = max(m,n)
    print(m)
      
    
    

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

int main(void){

    int n;
    while(1){
        cin >> n;
        if(n == 0) break;

        int w, h; cin >> w >> h;

        vector<vector<bool> > lord(h + 1, vector<bool> (w + 1, false));

        /*for(int i = 1; i < lord.size(); i++){
            for(int j = 1; j < lord[i].size(); j++){
                cout << lord[i][j] << " ";
            }
            cout << endl;
        }*/

        for(int i = 0; i < n; i++){
            int x, y; cin >> x >> y;
            lord[y][x] = true;

            /*for(int i = 1; i < lord.size(); i++){
                for(int j = 1; j < lord[i].size(); j++){
                    cout << lord[i][j] << " ";
                }
                cout << endl;
            }*/
        }
        //cout << "end" << endl;

        int s, t; cin >> s >> t;

        int ans = 0;

        for(int i = 1; i <= w - s + 1; i++){
            for(int j = 1; j <= h - t + 1; j++){

                int sum = 0;
                for(int k = i; k < i + s; k++){
                    for(int l = j; l < j + t; l++){
                        sum += lord[l][k];
                    }
                }

                ans = max(sum, ans);

            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14 100兆
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  string S, T;
  cin >> S >> T;
  rep(i, 26){
    char x = 'a'+i;
    if(T == S+x){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
#define sz(x) (int)x.size()
typedef long long ll;
typedef pair<int, int> P;

vector<int> to[200005]; //グラフ
vector<int> ans;

void dfs(int v, int p=-1) {
    for (int u : to[v]) {
        if (u == p) continue;
        ans[u] += ans[v];
        dfs(u, v);
    }
    
}

int main() {
    int N, Q; cin >> N >> Q;
    int a, b;
    rep(i, N-1) {
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    vector<int> p(Q), x(Q);
    rep(i, Q) {
        int tmp;
        cin >> tmp >> x[i];
        p[i] = --tmp;
    }

    ans.resize(N);

    rep(i, Q) {
        ans[p[i]] += x[i]; //まず部分木の根だけカウント増やしとく　あとで累積和とる
    }

    dfs(0);

    rep(i, N) {
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 25088
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n, x;
    cin >> n;
    vi v;
    FOR(i, 0, n){
        cin >> x;
        v.pb(x);
    }
    if(v.size()==1){
        cout << "Yes";
        return 0;
    }
    
    int ans = 0;
    FOR(i, 0, (v.size()-1)){
        if(v[i+1]-v[i]==-1){
            v[i]--;
        }
        else if(v[i+1]==v[i]){
            v[i]=-1;
            ans++;
        }
        else if(v[i+1]-v[i]<-1){
            cout << "No";
            return 0;
        }
    }
    if((v.size()-ans)==1){
        cout << "Yes";
        return 0;
    }
    /*FOR(i, 0, v.size()){
        cout << v[i] << " ";
    }*/
    
    vi secv;
    for(int i = 0; i < v.size(); i++){
        if(v[i]!=-1){
            secv.pb(v[i]);
        }
    }
    /*FOR(i, 0, secv.size()){
        cout << secv[i] << " ";
    }*/
    bool enter = false;
    FOR(i, 0, (secv.size()-1)){
        if(secv[i+1]>=secv[i]){
            enter = true;
        }
        else{
            enter = false;
            cout << "No";
            return 0;
        }
    }
    if(enter == true){
        cout << "Yes";
        return 0;
    }


}


Measured memory_bytes: 1400
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
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*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n=read(),now=0,i;
    for(i=1;i<=n;i++)
    {
    	now=(now*10+7)%n;
    	if(!now)break;
    }
    if(now)puts("-1");
    else pr2(i);
    return 0;
}

Measured memory_bytes: 1532
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby
#from itertools import product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
#from operator import itemgetter

#inf = 10**17
mod = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(60):
    cnt = 0
    for j in a:
        if (j>>i) & 1:
            cnt += 1
    res += ((cnt*(n-cnt))*2**i) % mod
print(res%mod)


Measured memory_bytes: 123132
import heapq
N, M = map(int, input().split())

A = list(map(int, input().split()))
h = []

for i in range(N):
    A[i] *= -1

for i in range(N):
    heapq.heappush(h, A[i])

for i in range(M):
    num = heapq.heappop(h)
    num = num * -1
    num = num // 2
    heapq.heappush(h, -num)

print(-sum(h))


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

int main(){
	list<int>ls;
	auto it=ls.end();
	int q;cin>>q;
	rep(i,q){
		int a;cin>>a;
		if(a==0){
			int b;cin>>b;
			it=ls.insert(it,b);
		}
		else if(a==1){
			int b;cin>>b;
			if(b>0)rep(i,b)it++;
			else rep(i,-b)it--;
		}
		else{
			it=ls.erase(it);
		}
	}
	for(auto i:ls)cout<<i<<endl;
}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

template <typename T1, typename T2>
bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    string S, T;
    cin >> S >> T;
    ll ans = L_INF;
    for (ll i = 0; i < (ll)S.size(); i++) {
        if (i + (ll)T.size() > (ll)S.size()) break;
        ll cnt = 0;
        for (ll j = 0; j < (ll)T.size(); j++) {
            if (S[i + j] != T[j]) {
                ++cnt;
            }
        }
        chmin(ans, cnt);
    }
    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(nullptr), cout.tie(nullptr);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    string s;
      cin>>s;
      vector<int> f(26,0);
      for(int i=0;i<4;i++)
     	f[s[i]-'A']++;

       // for(int i=0;i<26;i++)
    //cout<<f[i]<<" ";
      int cnt=0;
      for(int i=0;i<26;i++)
        if(f[i]!=0 && f[i]!=2)
        {
            //cout<<i<<endl;
            cout<<"No";
            return 0;
        }
        else if(f[i]==2)
            cnt++;
    //cout<<cnt<<endl;
  if(cnt==2)
    cout<<"Yes";
  else
    cout<<"No";
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
long long n, t, ans = 1, c[1007];
bool v[1007];
int main()
{
    int i, j, k;
    cin >> n;
    for (i = 2; i <= n; i++) {
        if (v[i]) continue;
        for (j = i * 2; j <= n; j *= i) v[j] = 1;
    }
    for (i = 2; i <= n; i++) {
        t = i;
        for (j = 2; j <= n; j++) {
            if (!v[j]) {
                while (t % j == 0) {
                    t /= j;
                    c[j]++;
                }
            }
        }
    }
    for (i = 2; i <= n; i++) {
        if (!v[i]) ans = ans * (c[i] + 1) % 1000000007;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N =int(input())
l =[int(i)for i in input().split()]

min = []
max = []
ans =0
while l !=[0]*N:
    ans += 1
    s =False
    for i,j in enumerate(l):
        if s:
            if j == 0:
                break
        if j !=0:
            s =True
            l[i]-=1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::string a, b;
  std::cin >> a >> b;

  std::string c = a + b;
  ll d = atoi(c.c_str());
  bool judge = false;
  for (ll i = 1; i * i <= d; i++) {
    if (std::pow(i, 2) == d) {
      judge = true;
      break;
    }
  }

  if (judge) print("Yes");
  else print("No");

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdint.h>
using namespace std;
#define LL unsigned long long int
#define LD long double

LL f(LL n){
    if(n==1){
        return 1;
    }
    else{
        return 1+2*f(n/2);
    }
}

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

    LL n;
    cin>>n;
    LL ans=f(n);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                int M = scan.nextInt();
                int[] H = new int[N+1];
                int[] MaxA = new int[N+1];

                for(int i=1; i<=N;i++){
                    H[i] = scan.nextInt();
                    MaxA[i] = 0;
                }

                for(int i=1; i<=M;i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    MaxA[a] = Math.max(MaxA[a], H[b]);
                    MaxA[b] = Math.max(MaxA[b], H[a]);
                }
                
                int ans = 0;
                for(int i=1; i<=N;i++){
                    if(H[i]>MaxA[i]){
                        ans++;
                    }
                }
                System.out.println(ans);
        }
}


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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 1;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n;

vector < pair < double , double > > v;
double sum = 0.0;

double calc(pair < double , double > a , pair < double , double > b){
    return hypot( a.first - b.first , a.second - b.second );
}

void solve(int testCase){

    scanf("%d" , &n);

    for(int i = 0 ; i < n ; i ++){
            double x , y;
            scanf("%lf %lf" , &x , &y);
            v.push_back({x , y});
    }

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

    do {
            for(int i = 1 ; i < n ;  i ++){
                    sum += calc(v[i-1] , v[i]);
            }
    }while(next_permutation(v.begin() , v.end()));

    double all = 1;
    for(int i = 1 ; i <= n ; i ++){
            all *= (double)i;
    }

    printf("%.9f\n" , sum / all);

}

main(){

    int t = 1;
    ///scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_141
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nkq = ReadInts();
            int n = nkq[0];
            int k = nkq[1];
            int q = nkq[2];
            int[] res = new int[n];
            for(int i = 0; i < q; i++)
            {
                int a = ReadInt() - 1;
                res[a]++;
            }
            for(int i = 0; i < n; i++)
            {
                if (k - (q - res[i]) <= 0)
                {
                    WriteLine("No");
                }
                else
                {
                    WriteLine("Yes");
                }
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 17600
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

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

	int R; cin >> R;

	cout << 2 * R * 3.14 << endl;

	return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define all(x)              (x).begin(), (x).end()
#define inf                 1e18

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//	ifstream cin("input.txt");
//	ofstream cout("output.txt");
	ll a, b, c;
	cin >> a >> b >> c;
	set <ll> st; st.insert(a); st.insert(b); st.insert(c);
	cout << ((st.size() == 2) ? "Yes" : "No");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int[] a = new int[N];
        float check = 0;
        for(int i = 0 ; i < N ; i++)
        {
            a[i] = sc.nextInt();
            check += a[i];
        }
        check = check/(4*M);
        int count = 0;
        for(int i = 0 ; i < N ; i++)
        {
            count += (a[i] >= check) ? 1 : 0;
        }
        System.out.println(count >= M ? "Yes" : "No");
    }
}


Measured memory_bytes: 35872
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);

int main() {
    vec x(2), v(2);
    rep(i,2) cin>>x[i]>>v[i];
    cin>>K;
    cout<<(abs(x[0] - x[1]) <= K * (v[0] - v[1]) ? "YES" : "NO")<<endl;
}

Measured memory_bytes: 3596
#!/usr/bin/env python3
import sys
import bisect

def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
    import numpy as np

    A = np.array(A)
    F = np.array(F)

    A = np.sort(A)
    F = np.sort(F)[::-1]

    sum_A = A.sum()
    if sum_A <= K:
        ans = 0
    else:
        high = (A * F).max()
        low = 0
        mid = (high + low) // 2
        while low < mid < high:
            if sum_A - np.minimum(A, mid // F).sum() <= K: ##K回の修行いないで成し遂げれるなら
                high = mid
            else:
                low = mid
            mid = (high + low) // 2
        ans = high

    print(ans)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A, F)

if __name__ == '__main__':
    main()


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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

vector<vector<P> > nx
{
  {P(0,5),P(1,6),P(2,7),P(3,8),P(4,9)},
  {P(0,1),P(4,3),P(9,14),P(10,15),P(5,11)},
  {P(0,4),P(5,10),P(11,16),P(6,12),P(1,2)},
  {P(1,0),P(6,11),P(12,17),P(7,13),P(2,3)},
  {P(2,1),P(7,12),P(13,18),P(8,14),P(3,4)},
  {P(3,2),P(8,13),P(14,19),P(9,10),P(4,0)},
  {P(5,0),P(10,9),P(15,19),P(16,17),P(11,6)},
  {P(6,1),P(11,5),P(16,15),P(17,18),P(12,7)},
  {P(7,2),P(12,6),P(17,16),P(18,19),P(13,8)},
  {P(8,3),P(13,7),P(18,17),P(19,15),P(14,9)},
  {P(9,4),P(14,8),P(19,18),P(15,16),P(10,5)},
  {P(15,10),P(19,14),P(18,13),P(17,12),P(16,11)}
};

signed char dp[203][203][21][21][6];
struct st{
  Int y,x,n,m,d;
  st(Int y,Int x,Int n,Int m,Int d):y(y),x(x),n(n),m(m),d(d){}
};
const Int CC = 101;
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  {
    memset(dp,-1,sizeof(dp));
    queue<st> q;
    dp[CC][CC][0][5][0]=0;
    q.emplace(CC,CC,0,5,0);
    Int dyl[6]={0,0,1,0,0,-1};
    Int dxl[6]={-1,-1,0,1,1,0};
    Int dyr[6]={0,-1,0,0,1,0};
    Int dxr[6]={1,0,-1,-1,0,1};
    Int dyo[6]={1,0,0,-1,0,0};    
    Int dxo[6]={0,1,1,0,-1,-1};

    auto push=[&](st a,st b){
      if(~dp[a.y][a.x][a.n][a.m][a.d]) return;
      dp[a.y][a.x][a.n][a.m][a.d]=dp[b.y][b.x][b.n][b.m][b.d]+1;
      q.emplace(a);
    };
    
    while(!q.empty()){
      st s=q.front();q.pop();
      if(dp[s.y][s.x][s.n][s.m][s.d]>100) break;
      
      Int k=0,l=0;
      for(Int i=0;i<12;i++)
	for(Int j=0;j<5;j++)
	  if(nx[i][j]==P(s.n,s.m)) k=i,l=j;
      
      //cout<<k<<" "<<l<<endl;
      
      {// L
	st t=s;
	t.y+=dyl[s.d];
	t.x+=dxl[s.d];
	tie(t.n,t.m)=nx[k][(l+4)%5];
	t.d=(s.d+5)%6;	
	push(t,s);
      }
      {// R
	st t=s;
	t.y+=dyr[s.d];
	t.x+=dxr[s.d];
	tie(t.n,t.m)=nx[k][(l+1)%5];
	t.d=(s.d+1)%6;	
	push(t,s);
      }
      {// O
	st t=s;
	t.y+=dyo[s.d];
	t.x+=dxo[s.d];
	swap(t.n,t.m);
	t.d=(s.d+3)%6;	
	push(t,s);
      }
    }
    
    
  }
  
  
  {
    Int x,y,n;
    while(cin>>x>>y>>n,x||y||n){
      short ans=101;
      x+=CC;y+=CC;
      for(Int i=0;i<20;i++){
	for(Int j=0;j<6;j++){
	  if(dp[y][x][n][i][j]<0) continue;
	  chmin(ans,dp[y][x][n][i][j]);
	}
      }
      cout<<ans<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 109956
x,y = map(int,input().split())
L1 = [1,3,5,7,8,10,12]
L2 = [4,6,9,11]

if x==2 or y==2:
    print("No")
    quit()
else:
    if x in L1 and y in L1:
        print("Yes")
    elif x in L2 and y in L2:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3060
#include <stdio.h>

int main(){
  int x[5],i;
  for(i=0;i<5;i++){
    scanf("%d",&x[i]);
  }

  for(i=0;i<5;i++){
    if(x[i]==0){
      break;
    }
  }

  printf("%d\n",i+1);
  return 0;
}


Measured memory_bytes: 2144
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

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

}
double max(double a, double b) {

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

}
//aとbの大きい方

ll min(ll a, ll b) {

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

}
//aとbの小さい方

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//aとbの差の絶対値

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	int X, Y, Z, ans;
	cin >> X >> Y >> Z;

	ans = (X - Z) / (Y + Z);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
string s;
main()
{
    cin>>n;
    for(;n--;)
    {
        cin>>s;
        string t="NA";
        if(s.substr(0,2)==">'")
        {
            int cnt=0;
            int i=2;
            while(i<s.size()&&s[i]=='=')i++,cnt++;
            if(cnt>0&&s[i]=='#')
            {
                int j=i+1;
                while(j<s.size()&&s[j]=='=')j++,cnt--;
                if(cnt==0&&j+1==s.size()&&s.substr(j,1)=="~")t="A";
            }
        }
        else if(s.substr(0,2)==">^")
        {
            int i=2;
            while(i+2<s.size()&&s.substr(i,2)=="Q=")i+=2;
            if(i>2&&i+2==s.size()&&s.substr(i,2)=="~~")
            {
                t="B";
            }
        }
        cout<<t<<endl;
    }
}


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

int main()
{
    string O, E;
    cin >> O >> E;
    //    int tsize = O.size() + E.size();
    for (int i = 0; i < E.size(); i++)
    {
        cout << O[i] << E[i];
    }
    if (O.size() == E.size())
        cout << endl;
    else
    {
        cout << O[O.size() - 1] << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int N,A,x[50];
LL dp[50][50*50][50];
LL solve(int now, int sum, int num){
	if(now == N){
		if(num != 0 && sum%num == 0 && sum/num == A) return 1;
		else return 0;
	}
	if(dp[now][sum][num] != -1) return dp[now][sum][num];
	return dp[now][sum][num] = solve(now+1,sum,num) + solve(now+1,sum+x[now],num+1);
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	cin >> N >> A;
	for(int i=0; i<N; i++){
		cin >> x[i];
		for(int j=0; j<N*50; j++){
			for(int k=0; k<N; k++){
				dp[i][j][k] = -1;
			}
		}
	}
	cout << solve(0,0,0) << endl;

	return 0;
}


Measured memory_bytes: 49152
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    public static void Solve()
    {
        int a = NextInt();
        int b = NextInt();
        string ans = "";
        if (a > b) for (int i = 0; i < a; i++) ans += b.ToString(); 
        else for (int i = 0; i < b; i++) ans += a.ToString();
        Console.WriteLine(ans);
    }
    public static long GCD(long a, long b)
    {
        if (a < b) GCD(b, a);
        long d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(long a, long b)
    {
        return a / GCD(a, b) * b;
    }

    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
int main() {
  while(1){
    int n,x,c=0; cin>>n>>x;
    if(!n&&!x) return 0;
    for(int i=1;i<n-1;i++){
      for(int j=i+1;j<n;j++){
        for(int k=j+1;k<=n;k++) if(i+j+k==x) c++;
      }
    }
    cout<<c<<endl;
  }
}


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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    // 後ろから解くかわりにすべての文字列を「左右反転」する
    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    // 端から切っていく
    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; // 4 個の文字列たちどれかで divide できるか
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { // d で divide できるか
                can2 = true;
                i += d.size(); // divide できたら i を進める
            }
        }
        if (!can2) { // divide できなかったら
            can = false;
            break;
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <deque>
#include <stack>

using namespace std;
const long long P = 1000000007;
const long long INF = 1LL << 60;

double dist(double x1,double y1, double x2, double y2) {
  double res = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
  return res;
}

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int count = 0;
  int flag = 0;
  for(int i = 0; i < n-1; i++) {
    if(flag == 0) {
      if(a[i] < a[i+1]) {flag = 1;}
      else if(a[i] > a[i+1]) {flag = -1;}
    }
    else if(flag == 1) {
      if(a[i] > a[i+1]) {
        flag = 0;
        count++;
      }
    }
    else if(flag == -1) {
      if(a[i] < a[i+1]) {
        flag = 0;
        count++;
      }
    }
  }
  cout << count+1 << endl;
  return 0;
}


Measured memory_bytes: 640
// Author - Saikat_7
#include <bits/stdc++.h> 
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define trav(i,cont) for(const auto& i:cont)
#define cs(x) cout<<x<<" "
#define cn(x) cout<<x<<" "<<endl
#define ll long long int
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007 //998244353 
#define inf 1e17
const int mx = 2000005; // 2* (10 to power 5);
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    int tc=1;
    // cin>>tc;
    while(tc-- > 0)
    {	
    	int n;
 		cin>>n;
 		int a[n+1],b[n+1],c[n+1],dp[n+1][3]={0};
 		for(int i=1;i<=n;i++)
 		{
 			cin>>a[i]>>b[i]>>c[i];
 		}
 		dp[1][0]=a[1];
 		dp[1][1]=b[1];
		dp[1][2]=c[1];
		for(int i=2;i<=n;i++)
		{
			dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
			dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
			dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
		}
		cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
    }
    return 0;
}

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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
ll dp[105][100005], sum[100005];
ll add(ll u, ll v){
        if ((u + v) >= mod) return u + v - mod;
        else return u + v;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("VietCT.INP", "r")){
                freopen("VietCT.INP", "r", stdin);
                freopen("VietCT.OUT", "w", stdout);
        }
        ll n, k;
        cin >> n >> k;
        dp[0][0] = 1;
        sum[0] = 1;
        for (int i = 1; i <= k; i++) sum[i] = sum[i - 1] + dp[0][i];
        for (int i = 1; i <= n; i++){
                ll a;
                cin >> a;
                for (int j = 0; j <= k; j++){
                        if (j >= (a + 1)) dp[i][j] = add(sum[j] - sum[j - a - 1], mod);
                        else dp[i][j] = sum[j];
                }
                memset(sum, 0, sizeof(sum));
                sum[0] = dp[i][0];
                for (int j = 1; j <= k; j++) sum[j] = add(sum[j - 1], dp[i][j]);
        }
        cout << dp[n][k];
}
/*
*/

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

using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int) (v).size()
#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define pb push_back
#define mp make_pair

using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int inf = 0x3f3f3f3f;
constexpr ll MOD = 1000000007LL;
constexpr double tol = 1e-8;

void buff() { ios::sync_with_stdio( false ); cin.tie(nullptr); }

constexpr int ms = 405;
long long dp[ms][ms];

int main() 
{
    buff();
    int n;
    cin >> n;
    vector< long long > A(n);
    vector< long long > ACC(n + 1, 0 );
    for(int i = 0; i < n; ++i) cin >> A[i];
    
    partial_sum( all(A), ACC.begin() + 1 );
    
    auto range_sum = [&] (int l, int r ) { return ACC[r] - ACC[l - 1]; };

    for(int len = 2; len <= n; ++len)
    {
        for(int st = 1; st + len - 1 <= n; ++st)
        {
            int nd = st + len - 1;
            dp[st][nd] = LLONG_MAX;
            for(int mid_point = st; mid_point < nd; ++mid_point )
            {
                long long left_sum = range_sum(st, mid_point);
                long long right_sum = range_sum( mid_point + 1, nd );
                dp[st][nd] = min( dp[st][nd],
                                  dp[st][mid_point] + dp[mid_point + 1][nd] +
                                  left_sum + right_sum );
            }
        }
    }

    cout << dp[1][n] << '\n';

    return 0;
}



Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        int k = sc.NextInt();

        int answer = 0;
        int count = 0;

        for (int i = 100; i >= 1; i--)
        {
            if (a % i == 0 && b % i == 0)
            {
                count++;
            }
            if (count == k)
            {
                answer = i;
                break;
            }
        }

        Console.WriteLine(answer);
    }

    private static int GetDivisorCount(int n)
    {
        int count = 0;
        for (int i = 1; i <= n; i++)
        {
            if (n % i == 0)
            {
                count++;
            }
        }
        return count;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
N,M = map(int,input().split())
L = list(map(int,input().split()))
L.insert(0,0)
for i in range(1,N+1):
  L[i] = (L[i-1]+L[i])%M
L.sort()
p = L[0]
cnt = 1
ans = 0
L.append(10**18)
for i in range(N+1):
  if L[i+1] == p:
    cnt += 1
  else:
    if cnt == 1:
      cnt = 1
      p = L[i+1]
    else:
      ans += (cnt)*(cnt-1)//2
      cnt = 1
      p = L[i+1]
print(ans)

Measured memory_bytes: 14572
using System;

namespace Sorts
{
    class Program
    {
        public struct Card
        {
            public readonly char m;
            public readonly int n;
            public Card(char m, int n)
            {
                this.m = m;
                this.n = n;
            }
        }

        private static Card[] B_Sort(Card[] ca)
        {
            var c = new Card[ca.Length];
            Array.Copy(ca, 0, c, 0, c.Length);
            for (var i = 0; i < c.Length; i++)
                for (var j = c.Length - 1; j > i; j--)
                    if (c[j].n < c[j - 1].n)
                    {
                        var t = c[j];
                        c[j] = c[j - 1];
                        c[j - 1] = t;
                    }
            return c;
        }

        private static Card[] S_Sort(Card[] ca)
        {
            var c = new Card[ca.Length];
            Array.Copy(ca, 0, c, 0, c.Length);
            for (var i = 0; i < c.Length; i++)
            {
                var m = i;
                for (var j = i; j < c.Length; j++)
                {
                    if (c[m].n > c[j].n)
                        m = j;
                }
                var t = c[m];
                c[m] = c[i]; c[i] = t;
            }
            return c;
        }

        public static void Main()
        {
            Console.ReadLine();
            var i = Console.ReadLine().Split();
            var cards = new Card[i.Length];
            for(int j = 0; j < i.Length; j++)
            {
                var m = i[j][0];
                var n = int.Parse(i[j].Remove(0, 1));
                cards[j] = new Card(m, n);
            }
            var b_cards = string.Join(" ", Array.ConvertAll(B_Sort(cards), e => string.Format("{0}{1}", e.m, e.n)));
            var s_cards = string.Join(" ", Array.ConvertAll(S_Sort(cards), e => string.Format("{0}{1}", e.m, e.n)));
            Console.WriteLine("{0}", b_cards);
            Console.WriteLine("Stable");
            Console.WriteLine("{0}", s_cards);
            Console.WriteLine("{0}", b_cards == s_cards ? "Stable" : "Not stable");
        }
    }
}

Measured memory_bytes: 9288
#include <stdio.h>
using namespace std;
int main(void){
    int a,n,i,b;
    scanf("%d",&n);
i=0;
int day[n];
while(i<n){
scanf("%d",&day[i]);
 i=i+1;
//printf("%d ",day[i]);
    
} //  for(i=n-i;i>=0;i=i-1)
while(i>1){
    printf("%d ",day[i-1]);
    i=i-1;
    
}
   printf("%d\n",day[0]);
    
    

    
}



Measured memory_bytes: 2704
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;

ll n;
ll massiv[200010];

int main(){
FLASH;
cin>>n;
for(ll i=1;i<=n;i++)
{ 
  cin>>massiv[i];	
}

ll sum=0;

for(ll i=2;i<=n;i++)
{
  if(massiv[i-1]>massiv[i])
  {
	sum+=massiv[i-1]-massiv[i];
	massiv[i]=massiv[i-1];  
  }	
}

cout<<sum<<endl;





return 0;
} 


Measured memory_bytes: 5144
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	ll x; cin >> x;
	cout << (x/500)*1000 + ((x%500)/5)*5 << endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let before: Vec<char> = s[0..(s.len() - 1) / 2].to_vec();
    let after: Vec<char> = s[(s.len() + 2) / 2..s.len()].to_vec();
    let mut ans: bool = true;

    for i in 0..before.len() {
        if before[i] != after[before.len() - i - 1] {
            ans = false;
        }
        if before[i] != after[i] {
            ans = false;
        }
    }
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll count_divs(ll n){
  ll res = 1;
  for(ll i = 2;i * i <= n;i++){
    ll cnt = 0;
    if(n % i == 0){
      while(n % i == 0){
        n /= i;
        cnt++;
      }
      res *= (cnt + 1);
    }
  }
  if(n != 1)
    res *= 2;
  return res;
}

vector<ll> get_divs(ll n){
  vector<ll> res;
  for(ll i = 1;i * i <= n;i++){
    if(n % i == 0){
      res.push_back(i);
      if(i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}
bool check(ll n, ll k){
  ll r = n % k;
  if(r == 1)
    return true;
  else if(r == 0)
    return check(n / k, k);
  else
    return false;
}
int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  ll n;
  cin >> n;
//  ll brute = 0;
//  for(int i = 2;i <= n;i++){
//    if(check(n, i)){
//      cout << i << ' ' << ((n + 1) % i == 0) << endl;
//      brute++;
//    }
//  }
//  cout << brute << endl;
  ll res = count_divs(n - 1) - 1;
  vector<ll> divs = get_divs(n);
//  cout << res << endl;
  for(auto el : divs){
    if(el != 1 && check(n, el))
      res++;
  }
  cout << res;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;
long long actionFunction(vector<int> &weights, vector<long long> &values, int maxWeightCapacity) {
    if(weights.size()==0 || maxWeightCapacity<0)return 0;
    vector<vector<long long>> dp(weights.size()+1,vector<long long>(maxWeightCapacity+1,0));
    for(int i=1;i<=weights.size();i++) {
        for(int k=0;k<=maxWeightCapacity;k++) {
            dp[i][k]=max(dp[i-1][k],weights[i-1]<=k?values[i-1]+dp[i-1][k-weights[i-1]]:0);
        }
    }
    return dp[weights.size()][maxWeightCapacity];
}
int main(void){
    vector<int> weights;
    vector<long long> values;
    int n,k,tmp;
    long long tmpl;
    cin>>n>>k;
    for(int i=0;i<n;i++) {
        cin>>tmp>>tmpl;
        weights.push_back(tmp);
        values.push_back(tmpl);
    }
    cout<<actionFunction(weights,values,k)<<endl;
}


Measured memory_bytes: 80256