akhauriyash/Code-Regression huggingface dataset:
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define RG register int
#define rep(i,a,b)	for(RG i=a;i<=b;++i)
#define per(i,a,b)	for(RG i=a;i>=b;--i)
#define ll long long
#define inf (1<<29)
using namespace std;
int T,n=10,flg;
int num[15],rec[15],a[15],b[15];
inline int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

void judge()
{
	int la=0,lb=0;
	rep(i,1,n)	if(rec[i]==1)	a[++la]=num[i];
				else			b[++lb]=num[i];
	rep(i,2,la)	if(a[i-1]>a[i])	return;
	rep(i,2,lb)	if(b[i-1]>b[i])	return;
	flg=1;return;
}

void dfs(int step)
{
	if(flg)	return;
	if(step>n){judge();return;}
	rec[step]=1;dfs(step+1);
	rec[step]=0;dfs(step+1);
}

int main()
{
	T=read();
	while(T--)
	{
		rep(i,1,n)	num[i]=read();
		flg=0;
		dfs(1);
		puts(!flg?"NO":"YES");
	}
	return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<int>graph[MAX];
int parent[MAX],v[MAX],v2[MAX],c[MAX];
void dfs(int src)
{
    v[src]=1;
    for(int i=0; i<graph[src].size(); i++)
    {
        int child=graph[src][i];
        if(v[child]==0)
        {
            parent[child]=src;
            dfs(child);
        }
    }
}
void dfs2(int src,int color)
{
    v2[src]=1;
    c[src]=color;
    for(int i=0; i<graph[src].size(); i++)
    {
        int child=graph[src][i];
        if(c[child]==0)
            dfs2(child,color);
    }
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=0; i<n-1; i++)
    {
        int u,v;
        cin>>u>>v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    dfs(1);
    vector<int>node;
    int cur=n;
    while(cur!=0)
    {
        node.push_back(cur);
        cur=parent[cur];
    }
    reverse(all(node));
    int l=1,r=node.size()-2,f=1;
    v2[1]=1;
    v2[n]=1;
    while(l<=r)
    {
        if(f)
        {
            v2[node[l]]=1;
            c[node[l++]]=1,f^=1;
        }
        else
        {
            v2[node[r]]=1;
            c[node[r--]]=2,f^=1;
        }
    }
    c[1]=1;
    c[n]=2;
    for(int i=1; i<=n; i++)
    {
        if(c[i])
            dfs2(i,c[i]);
    }
    int x=0,y=0;
    for(int i=1; i<=n; i++){
        if(c[i]==1)
            x++;
        else
            y++;
    }
    if(x>y)
        cout<<"Fennec"<<endl;
    else
        cout<<"Snuke"<<endl;
    return 0;
}


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

using namespace std;


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

    string s, t;
    int cnt = 0;
    cin >> s >> t;
    for (int i = 0; i < s.size(); ++i)
        if (s[i] != t[i])
            cnt++;
        
    cout << cnt << endl;

}

Measured memory_bytes: 3792
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

vector<vector<char>> ban(8,vector<char>(8));

int main() {
    int N;cin >> N;
    vector<int> retu(N);
    set<int> S;
    int maxi = 0;
    for(int i = 0;i<N;i++){
        cin >> retu.at(i);
        if(retu.at(i) >= 3200){
            maxi++;
            continue;
        }
        S.insert(retu.at(i)/400);
    }

    if(S.size() == 0){
        cout << 1 << " " << maxi << endl;
        return 0;
    }

    cout << S.size() << " " << maxi + S.size() << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

long INVERSION_NUMBER(long N, long *Array);
int main(void) {

   long N,K;
   
   scanf("%ld%ld",&N,&K);
   
   long A[N];
   long B[2*N];
   long i;
   for (i = 0; i < N; i++) {
      scanf("%ld", &A[i]);
   }
   
   for (i = 0; i < N; i++) {
      B[i] = A[i];
   }
   
   long a1 = INVERSION_NUMBER(N, B);

   for (i = 0; i < N; i++) {
      B[i] = A[i];
   }
   for (i = 0; i < N; i++) {
      B[i+N] = A[i];
   }

   long w = (long)pow(10,9) + 7;
   long a2 = INVERSION_NUMBER(2*N, B);
   long mix = (a2%w - a1%w - a1%w)%w;
   

   printf("%ld\n", ((K%w)*(a1%w) + ((K - 1)*K/2)%w*mix%w)%w);
  
   return 0;
}

long INVERSION_NUMBER(long N, long *Array) {
   
   long w = (long)pow(10,9) + 7;
   long i,j;
   long temp;
   long ans = 0;
   long count;
   
   for (i = 0;i < N; i++) {
      count = 0;
      for (j = 0; j < N - 1 - i; j++) {
         if (Array[j] > Array[j+1]) {
            temp       = Array[j];
            Array[j]   = Array[j+1];
            Array[j+1] = temp;
            ans = (ans + 1)%w;
            count = 1;
         }
      }
      if (count == 0) {
         break;
      }
   }
   
   return ans;
   
}


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

int main(){
	int n, cnt, x;
	while(cin>>n&&n){
		x=n;
		cnt=0;
		while(x>1){
			if(x%2){
				x+=x*2+1;
			}else{//gusu
				x/=2;
			}
			cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,n;
    string str;
    cin>>m>>n;
    cin>>str;
    for(int i=0;i<m;i++)
    {
        if(str[i]>'9'||str[i]<'0')
        {
            cout<<"No\n"<<endl;
            return 0;
        }

    }
    for(int i=m+1;i<m+n+1;i++)
    {
        if(str[i]>'9'||str[i]<'0')
        {
            cout<<"No\n"<<endl;
            return 0;
        }

    }
    if(str[m]!='-')
    {
        cout<<"No\n"<<endl;
        return 0;
    }
     cout<<"Yes\n"<<endl;
     return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
 
int main(){
  int N;
  cin >> N ;

  int a,b;
  a = N % 10;
  if(a == 3){
    cout << "bon" << endl;
  }else if(a == 0 || a == 1|| a == 6 || a == 8){
    cout << "pon" << endl;

  }else{
    cout << "hon" << endl;
  }

  }


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

class Point{
public:
	Point() : x(0), y(0){}
	Point(int ax, int ay) : x(ax), y(ay){}
	int x, y;
};

int field[100][100] = {0};
bool checked[100][100] = {0};
int w, h, n;
Point s, g;

const Point dire4[4] = {Point(-1, 0), Point(1, 0), Point(0, -1), Point(0, 1)};

bool isEnabled(int x, int y){
	return (0 <= x && x < w && 0 <= y && y < h);
}

int main(){
	while(1){
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		
		for(int y = 0;y < h;y++){
			for(int x = 0;x < w;x++){
				field[x][y] = 0;
				checked[x][y] = false;
			}
		}
		
		cin >> s.x >> s.y >> g.x >> g.y >> n;
		s.x--; s.y--; g.x--; g.y--;
		for(int i = 0;i < n;i++){
			int c, d, x, y;
			cin >> c >> d >> x >> y;
			x--; y--;
			int tw = ((d == 0)? 4 : 2), th = ((d == 0)? 2 : 4);
			for(int iy = 0;iy < th;iy++){
				for(int ix = 0;ix < tw;ix++){
					field[x + ix][y + iy] = c;
				}
			}
		}
		
		bool res = false;
		
		queue<Point> que;
		que.push(s);
		while(!que.empty()){
			Point p = que.front();
			que.pop();
			if(p.x == g.x && p.y == g.y){
				res = true;
				break;
			}
			for(int i = 0;i < 4;i++){
				int x = p.x + dire4[i].x, y = p.y + dire4[i].y;
				if(isEnabled(x, y) && field[p.x][p.y] == field[x][y] && !checked[x][y]){
					que.push(Point(x, y));
					checked[x][y] = true;
				}
			}
		}
		
		if(res) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
def read_input():
    n, l = map(int, input().split())

    return n, l


def submit():
    n, l = read_input()
    tastes = [l + i for i in range(n)]

    total = sum(tastes)
    left = 0
    right = total

    mindiff = abs(total) + 1
    ans = None

    for curr in tastes:
        right -= curr

        absdiff = abs(total - (left + right))
        if absdiff < mindiff:
            mindiff = absdiff
            ans = left + right

        left += curr

    print(ans)




if __name__ == '__main__':
    submit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;
const double PI=3.14159265358979323846;

int main (){
    ll N, M;
    cin >> N >> M;;
    vector<vector<ll>> A(M,vector<ll>(2));
    rep(i,0,M) {
        cin >> A[i][1] >> A[i][0];
    }

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

    ll tmp = 0;

    ll ans = 0;

    rep(i,0,M) {
        if (A[i][1]>=tmp) {
            ans++;
            tmp = A[i][0];
        }

    }

    cout << ans << endl;

}





Measured memory_bytes: 5760
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val (p, q, r) = readListOfInt()
    
    val ans = Math.min(p+q, Math.min(q + r, p + r))
    println(ans)
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

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

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

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

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

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

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

int main()
{
	char c;
	ll h,w,ans=0;
	ll dx[]={0,-1,1,0};
	ll dy[]={-1,0,0,1};
	queue<pair<ll,ll>> q;
	cin >> h >> w;
	vvll v(h,vll(w,-1));
	rep(i,h){
		rep(j,w){
			cin >> c;
			if(c=='#'){
				v[i][j]=0;
				q.push(m_p(i,j));
			}
		}
	}
	while(!q.empty()){
		pair<ll,ll> tmp=q.front();
		q.pop();
		rep(i,4){
			ll yy=tmp.first+dy[i];
			ll xx=tmp.second+dx[i];
			if(yy<0 || yy>=h || xx<0 || xx>=w) continue;
			if(v[yy][xx]==-1){
				v[yy][xx]=v[tmp.first][tmp.second]+1;
				q.push(m_p(yy,xx));
			}
		}
	}
	rep(i,h)rep(j,w) chmax(ans,v[i][j]);
	cout << ans << endl;
	return 0;
}

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

int main(){
    ll N;
    cin>>N;
    vector<pair<ll,ll>>A(N);
    rep(i,N){
        cin>>A[i].first;
        A[i].second=i;
    }
    vector<ll>B(N);
    sort(A.begin(),A.end());
    rep(i,N){
        if(i<=N/2-1){
            B[A[i].second]=A[N/2].first;
        }
        else{
            B[A[i].second]=A[N/2-1].first;            
        }
    }
    rep(i,N){
        cout<<B[i]<<endl;    
    }
}

Measured memory_bytes: 6912
// Grand Garden

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

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

    int res = 0;

    int tmp_min = 100000000;
    for (int i = 0; i < n; i++) {
        if (h[i] == 0) {
            continue;
        }
        while (h[i] != 0) {
            int j;
            for (j = i; h[j] != 0 && j < n; j++) {
                if (h[j] < tmp_min) {
                    tmp_min = h[j];
                }
            }
            for (int k = i; k < j; k++) {
                h[k] -= tmp_min;
            }
            res += tmp_min;
        }

    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
  ll n,ans=0;
  cin>>n;
  vector<pair<ll, ll>> Xi(n);
  for (ll i=0;i<n;i++) {
    cin>>Xi[i].first;
    Xi[i].second=i;
  }
  sort(Xi.begin(),Xi.end());
  
  vll b(n);
  for (ll i=0;i<n;i++) {
    if (i<=n/2-1) {
      b[Xi[i].second]=Xi[n/2].first;
    }
    if (i>=n/2) {
      b[Xi[i].second]=Xi[n/2-1].first;
    }
  }
  
  for (ll i=0;i<n;i++) {
    cout<<b[i]<<endl;
  }
}

Measured memory_bytes: 6912
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
    set<int> se;
    rep(i, n) {
        int a; cin >> a;
        if(se.find(a) == se.end()) {
            se.insert(a);
        } else {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>

using namespace std;

static const int MAX = 101;


void trace(int a[],int n)
{
    for(int i = 0 ;i<n;i++)
    {   if(i > 0)
    {
        cout << " ";
    }
        cout << a[i];
    }

    cout << "\n";
}

int main()
{
    int n,a[MAX];

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    trace(a,n);
    for(int i = 1;i < n; i++)
    {
        int temp = a[i];
        int j = i-1;
        while(j>=0 && a[j]>temp)
        {
            a[j+1] = a[j];  //更新
            j--;
        }
        a[j+1] = temp;

        trace(a,n);

    }
    return 0;
    


}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000000000
int main(){
  int n,w;
  cin>>n>>w;
  vector<int> v1(n+1),w1(n+1);
  for(int i=1;i<=n;i++)
     cin>>w1[i]>>v1[i];
     
  long long dp[100005][n+1];
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=100000;i++)
   dp[i][0]=inf;
      
  for(int i=1;i<=100000;i++){
    for(int j=1;j<=n;j++){
      if(i-v1[j]>=0)
        dp[i][j]=min(dp[i][j-1],dp[i-v1[j]][j-1]+w1[j]);
      else
         dp[i][j]=dp[i][j-1];
    }
  }
  int i=100000;
  for(;i>=1;i--){
    if(dp[i][n]<=w)
       break;
  }
      cout<<i;
}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int K;
  cin >> K;
  int x = 7 % K;
  set<int> S;
  for(int i = 1; i <= K; ++i){
  	if(x == 0){
    cout << i << endl;
      return 0;
    }
    x = (x * 10 + 7) % K;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3608
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i64 = input();

    let mut f = 0;
    let mut m = n;
    while m > 0 {
        f += m % 10;
        m /= 10;
    }

    println!("{}", if n % f == 0 { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
s = input()
t = input()
f = False

for i in range(len(s)):
    tmp = s[-1]
    for j in range(len(s)-1):
        tmp += s[j]
    if tmp == t:
        f = True
        break
    s = tmp

if f:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
package main

import (
	"fmt"
	"sort"
)

// 以下の問題
// https://atcoder.jp/contests/abc042/tasks/abc042_b

func main() {
	var N, L int
	fmt.Scan(&N, &L)

	arr := make([]string, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}

	sort.Strings(arr)
	for _, v := range arr {
		fmt.Print(v)
	}
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e5 + 5;

int n,m,parent[maxn],sz[maxn];

ll nc2(int x) {
  return (1ll*x*(x-1))/2;
}

int par(int x) {
  if (parent[x]==x) {
    return x;
  } else {
    return parent[x] = par(parent[x]);
  }
}

int size1(int x) {
  int p = par(x);
  return sz[p];
}

void join(int x, int y) {
  int px = par(x);
  int py = par(y);
  if (px==py) return;
  sz[px] += sz[py];
  parent[py]=px;
}


int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  
  cin>>n>>m;
  for (int i=1; i<=n; i++) {
    parent[i]=i;
    sz[i]=1;
  }
  vector<pair<int,int>> edges;
  vector<ll> ans;
  for (int i=0; i<m; i++) {
    int u,v; cin>>u>>v;
    edges.push_back({u,v});
  }
  reverse(edges.begin(), edges.end());

  ll cur = nc2(n);
  ans.push_back(cur);

  for (auto ed: edges) {
    int u=ed.first;
    int v=ed.second;
    if (par(u) != par(v)) {
      cur += nc2(size1(u));
      cur += nc2(size1(v));
      if (size1(v)>size1(u)) {
        swap(u,v);
      }      
      join(u,v);
      cur -= nc2(size1(u));
    }
    
    ans.push_back(cur);
  }
  
  ans.pop_back();
  reverse(ans.begin(), ans.end());
  
  for (auto x: ans) {
    cout<<x<<endl;
  }
  return 0;
}


Measured memory_bytes: 3828
n = int(input())

tank = []
res = ["a"]

for le in range(1,n):
    tank = res
    res = []
    for i in range(len(tank)):
        tmp = "a"
        for j in range(le):
            res.append(tank[i] + tank[i][j])
            if tank[i][j] > tmp:
                tmp = tank[i][j]
        res.append(tank[i] + chr(ord(tmp)+1))
    res = list(set(res))
res.sort()

for e in res:
    print(e)

Measured memory_bytes: 73816
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

ll mod = 1000000007;

bool secinc(const pair<ll, ll> a, const pair<ll, ll> b) {
  return a.second < b.second;
}

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

  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

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

  vector<ll> b(n);
  rep(i, n) {
    if (i == 0) b[i] = a[i];
    else b[i] = b[i-1] + a[i];
  }

  int ans = 1;
  for (int i = n-1; i > 0; i--) {
    if (a[i] <= b[i-1] * 2) ans++;
    else break;
  }

  cout << ans << endl;  

  return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, T; cin >> N >> T;
    int A[N]; rep(i, N) cin >> A[i];
    int mx_right[N];
    int mn_left[N];
    mn_left[0] = mod;
    mx_right[N-1] = -1;
    for(int i = N-2; i >= 0; i--) mx_right[i] = max(mx_right[i+1], A[i+1]);
    for(int i = 1; i < N; i++) mn_left[i] = min(mn_left[i-1], A[i-1]);

    int mx_dist = -mod;
    int ans_mx = 0;
    for(int i = 0; i <= N-2; i++){
        if(mx_right[i] - A[i] == mx_dist) ans_mx++;
        else if(mx_right[i] - A[i] > mx_dist){
            mx_dist = mx_right[i] - A[i];
            ans_mx = 1;
        }
    }

    int mn_dist = -mod;
    int ans_mn = 0;
    for(int i = N-1; i >= 1; i--){
        if(A[i] - mn_left[i] == mn_dist) ans_mn++;
        else if(A[i] - mn_left[i] > mn_dist){
            mn_dist = A[i] - mn_left[i];
            ans_mn = 1;
        }
    }
    cout << min(ans_mn, ans_mx) << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.*;
public class Main{
  static boolean sort(int[] n){
    int temp;
    Arrays.sort(n);
    int[] s = {5,5,7};
    Arrays.sort(s);
    if(Arrays.equals(n,s)){
      return true;
    }
    return false;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] n = new int[3];
    for(int i = 0;i<3;i++){
      n[i] = sc.nextInt();
    }
    if(sort(n)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 20564
//============================================================================
// Author       : Sun YaoFeng
//============================================================================

//#pragma 	comment(linker, "/STACK:100240000,100240000")
//#include	<cstdio>
//#include	<cstdlib>
//#include	<cstring>
//#include	<algorithm>

#include	<bits/stdc++.h>

using	namespace	std;

#define DB		double
#define	lf		else if
#define I64		long long
#define	Rd()	(rand()<<15|rand())
#define For(i,a,b)	for(int i=a,lim=b;i<=lim;i++)
#define Rep(i,a,b)	for(int i=a,lim=b;i>=lim;i--)

#define	fi	first
#define se	second
#define MK	make_pair
#define PA	pair<int, int>

//#define	min(a,b)	((a)<(b)?(a):(b))
//#define	max(a,b)	((a)<(b)?(b):(a))

#define	CH	(ch=getchar())
int		IN()	{
		int x= 0, f= 0, ch;
		for	(; CH < '0' || ch > '9';)	f= (ch == '-');
		for	(; ch >= '0' && ch <= '9'; CH)	x= x*10 + ch -'0';
		return	f? -x : x;
}

#define n	500005

int		N, L[n], R[n], Next[n];

char	s[n];

void	Get(int *L){
		for (int i= 2, j= 0; i <= N; i++){
			for (; j && s[j+1] != s[i]; j= Next[j]);
			if	(s[j+1] == s[i])	j++;
			Next[i]= j;
		}
		
		For(i, 1, N)	L[i]= (! Next[i] || i % (i - Next[i]) != 0);
}

int		main(int argc, char* argv[]){
		scanf("%s", s+1);
		N= strlen(s+1);
		
		Get(L);
		reverse(s+1, s+N+1);
		Get(R);
		
		if	(L[N])	printf("%d\n%d\n", 1, 1);
		lf	(Next[N] == N-1)	printf("%d\n%d\n", N, 1);
		else	{
			int	Ans= 0;
			For(i, 2, N-1)	Ans+= L[i] && R[N-i];
			printf("%d\n%d\n", 2, Ans+1);
		}
		
		return	0;
}

Measured memory_bytes: 6528
# C - Welcome to AtCoder
from collections import defaultdict


def main():
    N, M, *PS = open(0).read().split()
    is_correct = [0] * (int(N) + 1)
    wa_count = defaultdict(int)
    penalties = 0
    for p, s in zip(*[iter(PS)] * 2):
        p = int(p)
        if not is_correct[p]:
            if s == "AC":  # first AC -> count penalties on problem_p
                is_correct[p] = 1
                penalties += wa_count[p]
            else:  # not yet AC and get WA -> +1 penalty
                wa_count[p] += 1
    print(sum(is_correct), penalties)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31752
from itertools import combinations as pt
import math

N, D = map(int, input().split())

data = [[int(_) for _ in input().split()] for i in range(N)]

# print('input')
# print('N:', N)
# print('D:', D)
# print('data:\n', data)

def dist(p1, p2):
    a = 0
    for i in range(D):
        a += (p1[i] - p2[i]) ** 2
    b = math.sqrt(a)
    return b

def is_integer(n):
    if isinstance(n, int):
        return True
    elif isinstance(n, float):
        return n.is_integer()
    return False

# exec
num = 0
for comb in pt(range(N), 2):
    # global num
    p1 = data[comb[0]]
    p2 = data[comb[1]]
    a = dist(p1, p2)
    # print(comb[0], comb[1], a)
    if is_integer(a):
        num += 1

print(num)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
      Scanner scanner = new Scanner(System.in);
      String input_text = scanner.nextLine();
      scanner.close();
      
      String[] str = input_text.split(" ", 0);
      
      for(int i=0; i<str.length; i++){
		if (Integer.parseInt(str[i])==0){
        	
          System.out.print(i+1);
          break;
        
        }
      }
    }

}

Measured memory_bytes: 35516
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<ll>A(n),B(n),C(n);
    rep(i,n) cin >> A[i];
    rep(i,n) cin >> B[i];
    rep(i,n) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.begin());
    sort(C.begin(),C.end());
    ll ans = 0;
    for(int i = 0;i < n;i++) {
        ll a = lower_bound(A.begin(),A.end(),B[i]) - A.begin();
        ll c = C.end()-upper_bound(C.begin(),C.end(),B[i]);
        ans += a*c;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2688
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M;
  cin>>N;
  map<string, int> amap;
  map<string, int> bmap;
  vector<string> arr;
  string tmp;
  for(int i=0;i<N;++i) {
    cin>>tmp;
    if(bmap[tmp]==0) arr.push_back(tmp);
    amap[tmp]++;
    bmap[tmp]++;
  }
  cin>>M;
  for(int i=0;i<M;++i) {
    cin>>tmp;
    if(bmap[tmp]==0) arr.push_back(tmp);
    amap[tmp]--;
    bmap[tmp]++;
  }
  int ans = 0;
  for(int i=0;i<arr.size();++i) ans = max(ans, amap[arr[i]]);
  cout<<ans<<endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pr(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 150005
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N;
ll ans=0;

void dfs(ll s, ll nd) {
    if(s>N) return;
    
    ll i;
    ll cnt[10]={};
    for(i=0; i<nd; i++) {
        cnt[s/(ll)pow(10, nd-1-i)%10]++;
    }
    
    if(cnt[3]>0 && cnt[5]>0 && cnt[7]>0) ans++;
    
    for(i=3; i<=7; i+=2) {
        dfs(s*10+i, nd+1);
    }
    
}

int main(void) {
    cin >> N;
    
    dfs(0, 0);
    pr(ans);
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int sq(int n){
    return n*n;
}

inline void solve(){
    int n;cin>>n;
    int a[n];
    for (int &i: a) cin>>i;
    int ans=100000000000000LL;
    for (int i=-100;i<=100;i++){
        int cur=0;
        for (int j=0;j<n;j++){
            cur += sq(i-a[j]);
        }
        ans = min(ans,cur);
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
bool comp(const P &a,const P &b){
    if(a.fi+a.se==b.fi+b.se){
        return a<b;
    }
    return a.fi+a.se>=b.fi+b.se;
}
int main(){
    int n;
    cin>>n;
    vp vec(n);
    REP(i,n){
        cin>>vec[i].fi>>vec[i].se;
    }
    sort(all(vec),comp);
    ll ans=0;
    REP(i,n){
        if(i%2){
            ans-=vec[i].se;
        }else{
            ans+=vec[i].fi;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
import sys
input = sys.stdin.readline

MOD = 10 ** 9 + 7
MIN = 100


def main():
    N, M = map(int, input().split())
    memo = [0] * max((N + 1), MIN)
    a = [0] * M

    memo[0] = 1
    memo[1] = 1
    memo[2] = 2
    for i in range(3, max(N+1, MIN)):
        memo[i] = memo[i-1] + memo[i-2]

    ans = 1

    for i in range(M):
        a[i] = int(input())

        if i != 0 and abs(a[i] - a[i-1]) == 1:
            print(0)
            return

        if a[i] == 1:
            ans *= 1
        elif i == 0:
            ans *= memo[a[i] - 1]
            ans %= MOD
            # print(a[i], ans, a[i] - 1)
        else:
            ans *= memo[a[i] - a[i-1] - 2]
            ans %= MOD
            # print(a[i], ans, a[i] - a[i-1] - 2)

    if M == 0:
        ans *= memo[N]
        ans %= MOD
        # print(ans, N - a[M-1] - 1)
        print(ans)
    else:
        ans *= memo[N - a[M-1] - 1]
        ans %= MOD
        # print(ans, N - a[M-1] - 1)
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 474616
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
   ll n;
   cin>>n;
   ll ans=1e12+1;
   for(ll i=1; i<=1e6; i++){
       if(n%i==0){
           ans=min(ans,n/i+i-2);
       }
   }
   printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;
long long int N,X,m[200200],res=0;


int main(){
    cout << fixed << setprecision(18);
    cin>>N>>X;
    for(long long int i = 0; i < N; i++){
        cin>>m[i];
        X-=m[i];
    }
    sort(m,m+N);
    cout<<N+X/m[0];
}



Measured memory_bytes: 3596
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    int a[m],b[m],c[m];
    for (int i=0; i<m; i++){
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
        a[i]--;
        b[i]--;
    }
    
    int cost[n],q[n],prev[n],count=1;
    bool visited[n],ans[m];
    for (int i=0; i<m; i++){
        ans[i]=false;
    }
    
    for (int i=0; i<n; i++){
        for (int j=i+1; j<n; j++){
            
            for (int k=0; k<n; k++){
                cost[k]=1e9;
                q[k]=1e9;
                visited[k]=false;
                prev[n]=-1;
            }    
            cost[i]=0;
            q[i]=0;
            
            for (int k=0; k<count; k++){
                int tmp=1e9,next;
                for (int l=0; l<n; l++){
                    if (tmp>q[l] && visited[l]==false){
                        tmp=q[l];
                        next=l;
                    }
                }
                visited[next]=true;
                if (next==j){
                    break;
                }
                count++;
                for (int l=0; l<m; l++){
                    if (a[l]==next){
                        if (cost[b[l]]>cost[next]+c[l]){
                            cost[b[l]]=cost[next]+c[l];    
                            prev[b[l]]=next;
                            q[b[l]]=cost[next]+c[l];
                        }
                    }
                    if (b[l]==next){
                        if (cost[a[l]]>cost[next]+c[l]){
                            cost[a[l]]=cost[next]+c[l];    
                            prev[a[l]]=next;
                            q[a[l]]=cost[next]+c[l];
                        }
                    }
                }
            }
            int k=j;
            while (k!=i){
                for (int l=0; l<m; l++){
                    if (a[l]==k && b[l]==prev[k]){
                        ans[l]=true;
                    } else if (b[l]==k && a[l]==prev[k]){
                        ans[l]=true;
                    }
                }  
                k=prev[k];
            }
        }
    }
    
    int anscount=0;
    for (int i=0; i<m; i++){
        if (ans[i]==false){
            anscount++;
        }
    }
    printf("%d\n",anscount);
	return 0 ;
}

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

int main()
{    
    int n;
    cin >> n;
    vector<vector<pair<int, bool>>> xy(n);
    rep(i,n)
    {
        int a;
        cin >> a;
        rep(j,a)
        {
            int x, y;
            cin >> x >> y;
            xy[i].push_back({x-1, y});
        }
    }

    stack<pair<int,bool>> st;
    st.push({0, true});
    st.push({0, false});
    bool is_honest[n] = {false};
    int max_cnt = 0;

    while(!st.empty())
    {
        int cur = st.top().first;
        is_honest[cur] = st.top().second;
        st.pop();

        if(cur == n-1)
        {
            int cnt = 0;
            rep(i,n)
            {
                if(is_honest[i])
                {
                    bool consistent = true;
                    rep(j,xy[i].size())
                    {
                        int xij = xy[i][j].first;
                        bool hij = xy[i][j].second;
                        if(is_honest[xij] != hij)
                        {
                            consistent = false;
                            break;
                        }
                    }

                    if(consistent) cnt++;
                    else
                    {
                        cnt = 0;
                        break;
                    }
                }
            }

            max_cnt = max(max_cnt, cnt);
            continue;
        }

        st.push({cur+1, true});
        st.push({cur+1, false});
    }

    cout << max_cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MONEY 500

int main(void)
{
    int K; // 持ってる500円玉の数
    int X; // 総額

    scanf("%d %d", &K, &X);
    if (MONEY * K >= X)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    ll a[N];
    ll b[N];
    
    for (int i=0; i<=N;i++){
        cin >> a[i];
        
    }
    for (int i=0; i<N;i++){
        cin >> b[i];
    }
    ll sum = 0;
    for (int i=0; i<N;i++){
        for (int j=0;j<2;j++){
            if (a[i+j]-b[i] < 0){
                b[i] = b[i] - a[i+j];
                sum += a[i+j];
                a[i+j] = 0; 
                
            }
            else {
                a[i+j] = a[i+j] - b[i];
                sum += b[i];
                b[i] = 0;
            }
           
        }
    }
    cout << sum;
    
    
}

Measured memory_bytes: 1792
attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp.split
end

tmp = attrs.shift
H = tmp[0].to_i
W = tmp[1].to_i
attrs.flatten!
attrs.delete("." * W)

attrs2 = Array.new
attrs.each do |row|
  attrs2 << row.split("")
end

attrs3 = attrs2.transpose.map{|row| row.join}

attrs3.delete("." * attrs3[0].length)

attrs4 = Array.new
attrs3.each do |row|
  attrs4 << row.split("")
end

puts attrs4.transpose.map{|row| row.join}

Measured memory_bytes: 2812
from heapq import heapify, heappush, heappop
from math import floor
n, m = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
a = [x*(-1) for x in a]
heapify(a)
for _ in range(m):
    x = floor(-heappop(a)/2)*(-1)
    heappush(a, x)

print(-sum(a))

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

int main() {
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> a(q);
  for (int i = 0;i < q;i++){
    cin >> a[i];
    a[i]--;
  }
  vector<int> c(n);
  
  for (int i = 0;i < q;i++){
    c[a[i]]++;
  }
  
  for (int i = 0;i < n;i++){
    if (k > (q - c[i])){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4028