akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)



int main() {
	ll n,ans=0;
	in(n);
	vll c(n), v(n);
	rep(i, 0, n) {
		in(v[i]);
	}

	rep(i, 0, n) {
		in(c[i]);
		if (v[i] - c[i] > 0) {
			ans += v[i] - c[i];
		}
	}

	outn(ans);
	return 0;

}


Measured memory_bytes: 256
L = int(input())
cur = 0

N = len(bin(L)) - 2
res = []

for i in range(N - 1):
    res.append([i, i + 1, 0])
    res.append([i, i + 1, 2 ** i])
cur = 2 ** (N - 1)

while cur < L:
    sz = L - cur
    b = len(bin(sz)) - 2
    res.append([b - 1, N - 1, cur])
    cur += 2 ** (b - 1)

print(N, len(res))
for i in res:
    a, b, c = i
    print(a + 1, b + 1, c)

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

int main(){
  int n; cin >> n;
  long long ans = 0;
  for(int i = 0; i <= n; i++){
    if(i % 3 == 0 || i % 5 == 0){
      continue;
    }
    else{
      ans += i;
    }
  }
  cout << ans << endl;
}
    


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  int ans = 0;
  REP(i, N) {
    if ((i + 1) % 2 == 0) continue;
    if (A[i] % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



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

  int cont=0;
  for(int a=0;a<=A;a++){
    for(int b=0;b<=B;b++){
      for(int c=0;c<=C;c++){
        int temp=500*a+100*b+50*c;
        if(temp==X)cont++;
      }
    }
  }

  cout<<cont<<endl;
  return 0;
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b && a==c && b==c) cout<< 1 << endl;
  else if(a!=b && a!=c && b!=c) cout << 3 << endl;
  else cout << 2 << endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

signed main(void)
{
  string s;
  cin >> s;
  if(s[0] == '9' || s[1] == '9') cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int ac=0,tle=0,re=0,wa=0;
    while(t--)
    {
      string s;
      cin>>s;
      if(s=="AC")
        ac++;
      else if(s=="TLE")
        tle++;
      else if (s=="WA")
        wa++;
      else
        re++;
    }
    cout<<"AC"<<" x "<<ac<<endl<<"WA"<<" x "<<wa<<endl<<"TLE"<<" x "<<tle<<endl<<"RE"<<" x "<<re<<endl;
}


Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

int n;

struct node{
	int l,r,par;
	int key;
	void init(int a,int p){
		l=r=-1;
		par=p;
		key=a;
	}
};
struct bst{
	int size;
	node t[600001];
	void init(){
		size=0;
	}
	void insert(int v){
		int i=0,p=-1;
		while(i<size){
			int& child=(v<t[i].key?t[i].l:t[i].r);
			if(child==-1)child=size;
			p=i;
			i=child;
		}
		t[size++].init(v,p);
	}
	bool find(int v){
		int i=0;
		while(i<size){
			if(t[i].key==v)return true;
			int child=(v<t[i].key?t[i].l:t[i].r);
			if(child==-1)child=size;
			i=child;
		}
		return false;
	}

	void kesu(int v){
		int i=0;
		while(i<size){
			if(t[i].key==v){
				if(t[i].l==-1 && t[i].r==-1){
					if(t[i].par!=-1){
						int p=t[i].par;
						if(t[p].key>=t[i].key)t[p].l=-1;
						else t[p].r=-1;
					}
					t[i].init(-1,-1);
				}else if(t[i].l==-1){
					int nex=t[i].r;
					t[i].key=t[nex].key;
					t[i].l=t[nex].l;
					t[i].r=t[nex].r;
					t[nex].init(-1,-1);
				}else if(t[i].r==-1){
					int nex=t[i].l;
					t[i].key=t[nex].key;
					t[i].l=t[nex].l;
					t[i].r=t[nex].r;
					t[nex].init(-1,-1);
				}else{
					int nex=t[i].r;
					int p=-1;
					while(t[nex].l!=-1){
						p=nex;
						nex=t[nex].l;
					}
					t[i].key=t[nex].key;
					if(p!=-1){
						t[p].l=-1;
					}else t[i].r=-1;
					t[nex].init(-1,-1);
				}
				return;
			}
			int child=(v<t[i].key?t[i].l:t[i].r);
			if(child==-1)return;
			i=child;
		}
	}

	void preorder(int pos){
		if(pos==-1|| pos==size)return;
		printf(" %d",t[pos].key);
		preorder(t[pos].l);
		preorder(t[pos].r);
	}

	void inorder(int pos){
		if(pos==-1|| pos==size)return;
		inorder(t[pos].l);
		printf(" %d",t[pos].key);
		inorder(t[pos].r);
	}

	void postorder(int pos){
		if(pos==-1|| pos==size)return;
		postorder(t[pos].l);
		postorder(t[pos].r);
		printf(" %d",t[pos].key);
	}
};

bst T;

int main(void){
	scanf("%d",&n);
	char str[100];
	for(int i=0;i<n;i++){
		scanf("%s",str);
		if(str[0]=='i'){
			int a;
			scanf("%d",&a);
			T.insert(a);
		}else if(str[0]=='f'){
			int a;
			scanf("%d",&a);
			printf("%s\n",T.find(a)?"yes":"no");
		}else if(str[0]=='d'){
			int a;
			scanf("%d",&a);
			T.kesu(a);
		}else{
			T.inorder(0);
			printf("\n");
			T.preorder(0);
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 8948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n,k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n) {
        int x;
        cin >> x;
        if(!(x<k)) ans++;
    }
    cout << ans<<endl;
    return 0;
}

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

#define pb push_back

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
	
	int numA, numL;
	cin >> numA >> numL;

	int curL = numA * 2;
	for (int i = 0; i < numA && curL < numL; i++) {
		curL += 2;
	}
	
	if (curL == numL) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;
}

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

using namespace std;

int main(){
   string s;
   int n;
   cin>>n;
   cin>>s;
   
   int ans=0;;
   for(int i=0;i<s.length()-1;i++){
        int k=0;
        bool al[27];
        bool al2[27];
        for(int j=0;j<27;j++){
            al[j]=false;
            al2[j]=false; 
        }
       for(int j=0;j<i+1;j++){
           al[s[j]-'a']=true;
       }
         for(int j=i+1;j<s.length();j++){
           if(al[s[j]-'a'])if(!al2[s[j]-'a']){
            k++;
           al2[s[j]-'a']=true;
           }

       }
       ans=max(ans,k);
   }
   cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char s[10][10];
int book[10],t,n,m,a[20],d[20],c[10];
void dfs(int x)
{
	if(c[x]==1)
	dfs(x+1);
	if(x==8)
	{
		for(int i=0;i<8;i++)
		printf("%s\n",s[i]);
		return;
	}
	for(int i=0;i<8;i++)
	{
		if(book[i]==0&&a[x+i]==0&&d[x-i+8]==0)
		{
			book[i]=1;
			a[x+i]=1;
			d[x-i+8]=1;
			s[x][i]='Q';
			dfs(x+1);
			book[i]=0;
			a[x+i]=0;
			d[x-i+8]=0;
			s[x][i]='.';
		}
	}
}
int main()
{
	scanf("%d",&t);
	for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	s[i][j]='.';
	for(int i=0;i<t;i++)
	{
		scanf("%d%d",&n,&m);
		s[n][m]='Q';
		book[m]=1;
		a[n+m]=1;
		d[n-m+8]=1;
		c[n]=1;
	}
	dfs(0);
	return 0;
}


Measured memory_bytes: 2148
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 1500

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int h, w;
int mp[ARRAY_MAX][ARRAY_MAX];
int dp[ARRAY_MAX][ARRAY_MAX];

int main() {

	cin >> h >> w;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j  < w; j ++)
		{
			cin >> mp[i][j];
		}
	}

	for (int i = 0; i < h; i++)
	{
		if (mp[i][0] == 0)
		{
			dp[i][0] = 1;
		}
	}

	for (int i = 0; i < w; i++)
	{
		if (mp[0][i] == 0)
		{
			dp[0][i] = 1;
		}
	}

	for (int i = 1; i < h; i++)
	{
		for (int j = 1; j < w; j++)
		{
			if (mp[i][j] == 1)
			{
				continue;
			}
			dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
		}
	}

	int maxi = 0;

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			maxi = max(maxi, dp[i][j]);
		}
	}
	cout << maxi * maxi << endl;
}


Measured memory_bytes: 17148
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<queue>
#define L l,m,rt<<1
#define R m+1,r,rt<<1|1
#define LL long long 
using namespace std;
LL n;
LL l,r,ans,maxx,mid;
LL f[5000100];
LL s[5000100];
LL sum[10000010];
LL read()
{
	LL _=0,__=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')__=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){_=_*10+ch-'0';ch=getchar();}
	return _*__;
}
void pushup(LL rt){sum[rt]=sum[rt<<1]+sum[rt<<1|1];}
void build(LL l,LL r,LL rt)
{
	sum[rt]=0;
	if(l==r)
	{
	return ;
    }
	LL m=(l+r)>>1;
	build(L);
	build(R);
	pushup(rt);
}
void update(LL x,LL l,LL r,LL rt)
{
	if(l==r)
	{
		sum[rt]+=1;
		return ;
	}
 	LL m=(l+r)>>1;
	if(x<=m) update(x,L);
	else update(x,R);
	pushup(rt); 
}
LL query(LL x,LL y,LL l,LL r,LL rt)
{
	if(x>y) return 0;
	if(x<=l&&y>=r)
	{
		return sum[rt];
	}
	LL set=0;
	LL m=(l+r)>>1;
	if(x<=m)set+=query(x,y,L);
	if(y>m) set+=query(x,y,R);
	return set; 
}
LL check(LL x)
{
	memset(sum,0,sizeof(sum));
	ans=0;maxx=-1;
	 for(int i=1;i<=n;i++)
	 {
	 	if(f[i]>x)
	 	s[i]=-1;
	 	else 
	 	s[i]=1;
	 	s[i]+=s[i-1];
	 }
	 for(int i=0;i<=n;i++)
	 s[i]+=n+1,maxx=max(maxx,s[i]);
	 build(1,maxx+5000,1);
	 for(int i=0;i<=n;i++)
	 {
	 	ans+=query(1,s[i]-1,1,maxx+5000,1);
	 	update(s[i],1,maxx+5000,1);
	 }
	 if(ans>=(1ll*n*(n+1)/4+1)) return 1;
	 else return 0;
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		f[i]=read();
		r=max(r,f[i]); 
	}
//	if(n==1)
//	{
//		printf("%lld",f[1]);
//		return 0;
//	}
	r=r+1;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid;
        }
        else
        {
            l=mid+1;
        }
        if(r-l<=1) 
        {
            mid=check(l)?l:r;
            break;
        }
    }
    printf("%lld\n",mid);
//	printf("%lld",r);
//	cout<<endl;
//	printf("%d",r);
	return 0;
}

Measured memory_bytes: 82176
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d, e, min = 10, ans, Flag;
  cin >> a >> b >> c >> d >> e;
  int a1, a2, a3, a4, a5;  
  
  a1 = a % 10; a2 = b % 10;
  a3 = c % 10; a4 = d % 10;
  a5 = e % 10;

  if(min > a1 && a1 != 0){
    Flag = 1;
    min = a1;
  }
  
  if(min > a2 && a2 != 0){
    Flag = 2;
    min = a2;
  }
  
  if(min > a3 && a3 != 0){
    min = a3;
    Flag = 3;
  }
  if(min > a4 && a4 != 0){
    min = a4;
    Flag = 4;
  }
  if(min > a5 && a5 != 0){
    min = a5;
    Flag = 5;
  }
  
  if (Flag != 1 && a1 != 0 ){
    a = a + (10 - a1);
   
  }
  if (Flag != 2 && a2 != 0){
    b = b + (10 - a2);
   
  }
  if (Flag != 3 && a3 != 0){
    c = c + (10 - a3);
    
  }
  if (Flag != 4 && a4 != 0){
    d = d + (10 - a4);
    
  }
  
  if (Flag != 5  && a5 != 0){
    e = e + (10 - a5);
    
  }  

  ans = a + b + c + d + e;
  cout << ans << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MAX = 3000000;
const ll MOD = 1000000007;
//string s;
ll n;

int main() {
    cin >> n;
    ll a[n];
    ll bef[n+1];
    ll aft[n+1];
    ll count[n+1];
    ll sum = 0;
    for(ll i=0;i<n+1;i++){
        bef[i] = 0;
        aft[i] = 0;
        count[i] = 0;
    }
    for(ll i=0;i<n;i++){
        ll tmpa;
        cin >> tmpa;
        a[i] = tmpa;
        count[tmpa]++;
        if(count[tmpa]>1){
            bef[tmpa] = aft[tmpa];
            aft[tmpa] += (count[tmpa]-1);
        }
    }
    for(ll i=0;i<n+1;i++){
        sum += aft[i];
    }
    for(ll i=0;i<n;i++){
        cout << sum - aft[a[i]] + bef[a[i]] << endl;
    }
    return 0;
}


Measured memory_bytes: 9728
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;

template<typename T>
constexpr std::vector<std::pair<T, T>> primeFactorization(T number) noexcept {
	std::vector<std::pair<T, T>> primeFactors;
	T quotient = number;
	for (T i = 2; i * i <= quotient; ++i) {
		if (quotient % i == 0) {
			T prime = i, power = 1;

			quotient /= i;
			while (quotient % i == 0) {
				++power;
				quotient /= i;
			}

			primeFactors.push_back(std::pair<T, T>(prime, power));
		}
	}
	if (quotient != 1) primeFactors.push_back(std::pair<T, T>(quotient, 1));

	return primeFactors;
}

template<typename T>
constexpr int countDivisor(std::vector<std::pair<T, T>> primeFactors) noexcept {
	int counter = 1;
	for (int i = 0; i < primeFactors.size(); ++i) {
		counter *= (primeFactors[i].second + 1);
	}

	return counter;
}

template<typename T>
constexpr std::vector<T> findDivisor(T number) noexcept {
	std::vector<std::pair<T, T>> primeFactors = primeFactorization(number);

	std::vector<T> divisor(countDivisor(primeFactors));
	divisor[0] = 1;

	int counter = 1;
	for (int i = 0; i < primeFactors.size(); ++i) {
		int currentSize = counter;
		for (int j = 1; j <= primeFactors[i].second; ++j) {
			T x = 1;
			for (int k = 0; k < j; ++k) {
				x *= primeFactors[i].first;
			}

			for (int k = 0; k < currentSize; ++k) {
				divisor[counter + k] = divisor[k] * x;
			}
			counter += currentSize;
		}
	}
	sort(divisor.begin(), divisor.end());

	return divisor;
}

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

	ll n;
	cin >> n;
	ll ans = countDivisor(primeFactorization(n - 1)) - 1;
	auto divisor = findDivisor(n);
	REP(i, 1, divisor.size()) {
		ll t = n;
		while (t%divisor[i] == 0) t /= divisor[i];

		if (t%divisor[i] == 1) ++ans;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int d,n;
  std::cin >> d >> n;

  int a = 1;
  rep(i,d)
    a *= 100;

  if(n == 100)
    std::cout << a*(n+1) << '\n';
  else
    std::cout << a*n  << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;
int main(){
   ll n,m,j,s=0;
   cin>>n>>m;
   for(ll i=1;i<=m;i++)cin>>j,s+=j;
   if(n<s)cout<<-1;
   else cout<<(n-s);
   
  
}


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

int main(void)
{
    ll n,m;
    cin >> n >> m;

    vector<int> a(m);

    rep(i,m){
        cin >> a.at(i);
        n -= a.at(i);
    }

    if(n<0)n=-1;

    cout << n << endl;

    return 0;
}


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

int main() {

    int n, t, c, T;
    scanf("%d %d", &n, &T);

    int mindata = 1001;
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &c, &t);

        if (t <= T) {
            if (c < mindata) {
                mindata = c;
            }
        }
    }
    if(mindata==1001){
        puts("TLE");
    }else{
        printf("%d",mindata);
    }
    
    return 0;
}


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

int findp(int*, int);
int main(){
  int n; scanf("%d",&n);
  int st; st=(int)sqrt(n);
  int p[n];
  int id= findp(p,n);
  int k=n,f=0; 
  while(1){
    if(n==2){ printf("2\n"); break;}
    for(int i=0; i<id; i++){
      //printf("%d %d\n",p[i],i);
      if (k%p[i]==0) break;
      else if(i==id-1){f=1; printf("%d\n",k);}
    }
    if(f==1) break;
    k++;
  }
  return 0;
}

int findp(int p[], int n){
  int id=1; p[0]=2;
  for (int i=2; i<n; i++)
    for(int j=2; j<i; j++){
      if(i%j==0) break;
      else if(j==i-1){
        p[id]=i; //printf("%d %d\n",p[id],id);
        id++; 
      }
    }
  return id;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char c[300009];
main(){
    int n;
    cin >> n>>c[1];
    int l=0,r=0;
    for(int i = 2; i <= n; i++){
        cin>>c[i];
        if(c[i] == 'W') l++;
        else  r++;
    }
    int Rr=0, Rl=0, Lr, Ll;
    Lr = r; Ll = l;
    int ans = n;
    for(int i = 1; i <= n; i++){
        ans = min(ans, Lr+Rl);
        if(c[i] == 'W') Rl++;
        else Rr++;
        if(c[i+1] == 'W') Ll--;
        else Lr--;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		try {
		
			int [][][] a = new int[4][3][10];
					
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 3; j++) {
					for (int k = 0; k < 10; k++) {
						a[i][j][k] = 0;
					}
				}
			}

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String s = reader.readLine();	
			int n = Integer.parseInt(s);

			String t;
			String[] u;
			int b, f, r, v;
			for (int l = 0; l < n; l++) {
				t = reader.readLine();
				u = t.split(" ");
				b = Integer.parseInt(u[0]);
				f = Integer.parseInt(u[1]);
				r = Integer.parseInt(u[2]);
				v = Integer.parseInt(u[3]);
				a[b - 1][f - 1][r - 1] += v;
			}
			
			for (int m = 0; m < 4; m++) {
				for (int o = 0; o < 3; o++) {
					for (int p = 0; p < 10; p++) {
						System.out.print(" ");
						System.out.print(a[m][o][p]);
					}
					System.out.println();
				}
				if (m != 3) {
					System.out.println("####################");
				}
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Measured memory_bytes: 24624
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>

using namespace std;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        lli n,u,v,ans=0,temp;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            ans+=(i*(n-i+1));
        }
        for(i=0;i<n-1;i++)
        {
            cin>>u>>v;
            if(u>v)
            {
                temp=u;
                u=v;
                v=temp;
            }
            ans-=(u*(n-v+1));
        }
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll ans = 0;
  ll n, k;
  cin >> n >> k;
  if (k == 0) {
    cout << n * n << endl;
    return 0;
  }
  for (ll i = 2; i <= n; i++) {
    if (i - 1 < k) continue;
    ans += (n / i) * (i - k);
    if (n % i != 0) {
      ans += max(0LL, n % i - (k - 1));
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
    int i,j,a,b,c=0,l=0,t,x,y,n;
    cin>>n>>x>>t;
    if(n%x==0) i=n/x;
    else i=(n/x)+1;
    cout<<i*t<<endl;


 return 0;
}


Measured memory_bytes: 3588
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package here;

/**
 *
 * @author sokumar
 */
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = sc.nextInt();
        int [][]dp = new int[n+1][3];
        for(int i=1;i<=n;i++)
        {
            for(int j=0;j<3;j++)
            {
                dp[i][j] = sc.nextInt();
            }
        }
        for(int i=2;i<=n;i++)
        {
            for(int j=0;j<3;j++)
            {
                int max = Math.max(dp[i-1][(j+1)%3],dp[i-1][(j-1+3)%3]);
                dp[i][j]+=max;
            }
        }
        int res = Math.max(dp[n][0],dp[n][1]);
        res = Math.max(res, dp[n][2]);
        w.println(res);
        
        
        
        w.close();
    }
    
}


Measured memory_bytes: 96800
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int x, y, z, k; cin >> x >> y >> z >> k;
  vector<ll> a(x), b(y), c(z), d, ans;
  rep(i, x) cin >> a[i];
  rep(i, y) cin >> b[i];
  rep(i, z) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  reverse(c.begin(), c.end());

  rep(i, x){
    rep(j, y){
      d.push_back(a[i] + b[j]);
    }
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  rep(i, min(k, (int)d.size())){
    rep(j, z){
      ans.push_back(d[i] + c[j]);
    }
  }

  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ans.end());
  rep(i, k){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 44112
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }



int main(){
    ll n; cin >> n;
    vector<char> res;
    ll m = 1;
    while(n - m >= 0){
        n -= m;
        res.push_back('a');
        m *= 26;
    }
    int index = 0;
    while(n > 0){
        int tmp = n % 26;
        res[index] += tmp;
        n /= 26;//右ビットシフト的な
        index++;
    }
    reverse(all(res));

    for(auto tmp: res) cout << tmp;
    cout << ln;
}


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

using namespace std;

int main() {
	int b;
	cin >> b;
	string a;
	getline(cin, a);
	for (int i = 0; i < b; i++) {
		getline(cin, a);
		string::size_type index = a.find("Hoshino");
		while (index != string::npos) {
			a.replace(index, 7, "Hoshina");
			index += 7;
			index = a.find("Hoshino", index);
		}
		cout << a << endl;
	}
	return 0;
}

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

using namespace std;

#define foru(i, l, r) for (int i = l; i <= r; i++)
#define ford(i, r, l) for (int i = r; i >= l; i--)

typedef long long ll;
const int maxn = 1e6 + 5;
int A[maxn], N, Add;
ll Ans;

int main() {
  //  freopen("b.in", "r", stdin);
  //  freopen("b.out", "w", stdout);
  scanf("%d", &N);
  foru(i, 1, N) scanf("%d", &A[i]);
  foru(i, 1, N) {
    Ans += A[i] >> 1, A[i] &= 1;
    if (A[i] && A[i + 1]) Ans++, A[i]--, A[i + 1]--;
  }
  printf("%lld\n", Ans);
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N; cin>>N;
    string s=to_string(N+1);

    int ans=0,cur=0;
    REP(i,SZ(s)){
        if(s[i]!='0')
            ans=max(ans,cur+(s[i]-'1')+9*(SZ(s)-i-1));
        cur+=s[i]-'0';
    }
    cout<<ans<<endl;
}     

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
map<long long,int>f;long long n;
inline int get_ans(long long t){
    if(f[t]) return f[t];
    return f[t]=((get_ans(t/2)+get_ans((t-1ll)/2))%mod+get_ans(t/2-1ll))%mod;
}
int main(){
    f[0]=1,f[1]=2;scanf("%lld",&n);
    printf("%d\n",get_ans(n));
    return 0;
}

Measured memory_bytes: 256
//2018年  3月 27日 火曜日 00:08:28 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M;
string str[2010];
bool used[2010][2010];
int B[2010][2010];
int L[2010], R[2010];

int find_rect(int D[2010]) {
	stack<int> S;
	rep(i, 0, M) {
		while(!S.empty() && D[S.top()] >= D[i]) S.pop();
		L[i] = S.empty() ? 0 : S.top() + 1;
		S.push(i);
	}
	while(!S.empty()) S.pop();
	rer(i, M, 0) {
		while(!S.empty() && D[S.top()] >= D[i]) S.pop();
		R[i] = S.empty() ? M : S.top();
		S.push(i);
	}
	int res = 0;
	rep(i, 0, M) {
		MAX(res, (D[i] + 1) * (R[i] - L[i] + 1));
	}
	return res;
}

void solve() {
	cin >> N >> M;
	rep(i, 0, N) {
		cin >> str[i];
	}
	rep(i, 0, N - 1) {
		rep(j, 0, M - 1) {
			int tmp = 0;
			rep(k, 0, 2) {
				rep(l, 0, 2) {
					if(str[i + k][j + l] == '#') {
						tmp++;
					}
				}
			}
			if(tmp % 2) used[i][j] = 1;
		}
	}
	int ans = max(N, M);
	N--; M--;
	rep(j, 0, M) {
		if(used[0][j]) B[0][j] = 0;
		else B[0][j] = 1;
	}
	rep(i, 1, N) {
		rep(j, 0, M) {
			if(used[i][j]) B[i][j] = 0;
			else B[i][j] = B[i - 1][j] + 1;
		}
	}
	// rep(i, 0, N) {
	// 	debug(vi(B[i], B[i] + M));
	// }
	rep(i, 0, N) {
		MAX(ans, find_rect(B[i]));
	}
	cout << ans << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 24192
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        String[] t = T.split("");
        int ans = t.length;
        for(int i=0; i<=s.length-t.length; i++) {
            int count = t.length;
            for(int j=0; j<t.length; j++) {
                if(s[i+j].equals(t[j])) {
                    count--;
                }
            }
            if(ans > count) ans = count;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35716
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <stdlib.h>

using namespace std;

int main() {
	int i, j, k;
	int n;
	vector<long>a(100000, 0), b(100000,0);
	int cnt = 0;

	cin >> n;

	map<long, int>mp;

	for (i = 0; i < n; i++) {
		cin >> a[i];
	
		if (mp.count(a[i]) == 0) {
			mp.insert(pair<long, int>(a[i], 1));
		}
		else {
			mp[a[i]]++;
		//	if (mp[a[i]] == 2) {
		//		b[cnt] = a[i];
		//		cnt++;
		//	}
		}
	}

	map<long, int>::reverse_iterator it;
	bool flag = false;
	long maxn = 0;

	for (it = mp.rbegin(); it != mp.rend(); it++) {
		
		if ((*it).second >= 4) {
			if (flag == false) {
				cout << (*it).first * (*it).first << endl;
				getchar();
				getchar();
				return 0;
			}
			else {
				cout << maxn * (*it).first << endl;
				getchar();
				getchar();
				return 0;
			}
		}
		else if ((*it).second >= 2) {
			if (flag == false) {
				maxn = (*it).first;
				flag = true;
			}
			else {
				cout << maxn * (*it).first << endl;
				getchar();
				getchar();
				return 0;
			}
		}
	}

	cout << 0 << endl;

	/*
	sort(b.begin(), b.end(), greater<long>());

	if (cnt >= 2) {
		cout << b[0] * b[1] << endl;
	}
	else {
		cout << 0 << endl;
	}
	*/







	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  int k; cin >> k;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  k --;
  cout << a[k] << endl;
}


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

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    double H[n];
    rep(i,n) cin >> H[i];
    
    int ban = 0;
    double hika = 100000;
    rep(i,n){
        double sa = abs( a - (t - H[i] * 0.006));
        if(hika > sa){
            hika = sa;
            ban = i;
        }
    }

    cout << ++ban << endl;     
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main()
{
    while(1){
    int n;
    cin >>  n;
    if(n== 0)break;
    vector<ll> p(n),j(n-1);
    ll pipe = 0;
    rep(i,n){
        cin >> p[i];
        pipe +=p[i];
    }
    rep(i,n-1)cin >> j[i];
    sort(j.begin(),j.end());
    reverse(j.begin(),j.end());
    
    
    
    ll ans = pipe*n;
    rep(i,n-1){
        pipe += j[i];
        ll res = pipe * (n-i-1);
        
        ans = max(ans,res);

    }
    cout << ans << endl;
    }

    

    return 0;
}


Measured memory_bytes: 3848
Sum = input().split()
cou = 1
while len(Sum) != 1 :
    cou += 1
    if Sum[cou] == '+' :
        del Sum[cou]
        Sum.insert((cou - 2) ,int(Sum.pop(cou - 2)) + int(Sum.pop(cou - 2)))
        cou -= 2
    elif Sum[cou] == '-' :
        del Sum[cou]
        Sum.insert((cou - 2) ,int(Sum.pop(cou - 2)) - int(Sum.pop(cou - 2)))
        cou -= 2
    elif Sum[cou] == '*' :
        del Sum[cou]
        Sum.insert((cou - 2) ,int(Sum.pop(cou - 2)) * int(Sum.pop(cou - 2)))
        cou -= 2

print(Sum[0])

Measured memory_bytes: 7612
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(x.first<y.first)
        return true;
    else if(x.first==y.first)
        return x.second>y.second;
    else
        return false;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}

void solve()
{   
    int x,n;
    cin>>x>>n;
    set<int> p;
    for(int i=0;i<n;i++){
        int t;
        cin>>t;
        p.insert(t);
    }
    auto it=p.lower_bound(x);
    if(it==p.end()){
        cout<<x;
    }
    else
    {
        if(*it==x)
        {
            int i=1;
            while(1){
                if(p.count(x-i)==0)
                {
                    cout<<x-i;
                    break;
                }
                else if(p.count(x+i)==0){
                    cout<<x+i;
                    break;
                }
                i++;
            }
        }
        else
            cout<<x;
    }

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


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

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

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> int_array;
	int current;
	for (int i = 0; i < N; i++) {
		cin >> current;
		int_array.push_back(current);
	}

	int answer = 0;
	while (1) {
		bool div_by_2(true);
		for (int j = 0; j < N; j++) {
			if (int_array[j] % 2 != 0) {
				div_by_2 = false;
				break;
			}
		}

		if (!div_by_2) {
			break;
		}

		for (int k = 0; k < N; k++) {
			int_array[k] = int_array[k] / 2;
		}
		answer++;
	}

	cout << answer << endl;
	return 0;
}


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

using namespace std;



int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> mp(n, vector<int>());
    vector<vector<int>> rmp(n, vector<int>());
    vector<double> rev(n, 0);// pathcnt, edgetotalcnt
    vector<int> toChoose(n);
    vector<int> S(m), T(m);
    for(int i=0;i<m;i++){
        int s,t;
        cin >> s >> t;
        S[i] = s-1;
        T[i] = t-1;
        mp[S[i]].push_back(i);
        rmp[T[i]].push_back(i);
    }
    rev[n-1] = 0;
    for(int i=n-1;i>=0;i--){
        for(int ne:mp[i]){
            int nei = T[ne];
            rev[i] += rev[nei];
        }
        if(mp[i].size() > 0){
            rev[i] = rev[i] / (double)mp[i].size() + 1;
        }else{
            rev[i] = 0;
        }
        double mx=-1.0;
        for(auto ne:mp[i]){
            int nei = T[ne];
            if(rev[nei] >= mx){
                mx = rev[nei];
                toChoose[i] = ne;
            }
        }
    }
    double scMin = 1e18;
    toChoose.push_back(-1);
    for(int i=0;i<=n;i++){
        vector<double> dp(n);
        dp[n-1] = 0.0;
        for(int j=n-2;j>=0;j--){
            int cnt=0;
            double sum=0.0;
            for(int ne:mp[j]){
                int nei = T[ne];
                sum += dp[nei];
                cnt++;
            }
            if(i == j && cnt >= 2 && toChoose[i] != -1){
                sum -= dp[T[toChoose[i]]];
                cnt --;
            }
            dp[j] = sum / (double)cnt + 1;
        }
        if(dp[0] != 0 && scMin > dp[0]){
            scMin = dp[0];
        }
    }
    printf("%.8lf\n", scMin);

    return 0;
}


Measured memory_bytes: 4096
import std.stdio, std.string, std.conv, std.algorithm, std.math;

void main()
{
    int num, sum, selsum;
    while(true)
    {
        string line = readln;
        if(line is null)break;
        auto f = line.chomp.split(",").map!(to!int);
        sum += f[0] * f[1];
        selsum += f[1];
        ++num;
    }
    sum.writeln;
    (cast(int)(cast(real)selsum / num + 0.5)).writeln;
}

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

int main() {
  int W,H,x,y,r;
  cin >> W >> H >> x >> y >> r;
  
  if(W < x+r || H < y+r || r > x || r > y)
    cout << "No" << endl;
  
  else 
    cout << "Yes" << endl;
  
}



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

int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int n,m;
   
   cin>>n>>m;
   
   
   long long int x1 = n*(n-1)/2 , x2 = m*(m-1)/2;
   
   cout<<(x1+x2)<<endl;
   
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  int n;cin>>n;int h[n];
  for (int i=0;i<n;i++)cin>>h[i];int ans[n];ans[0]=0;ans[1]=abs(h[1]-h[0]);
  for (int i=2;i<n;i++)
  {
    ans[i]=min(ans[i-2]+abs(h[i]-h[i-2]),ans[i-1]+abs(h[i]-h[i-1]));}
  cout<<ans[n-1];return 0;}
  
  

Measured memory_bytes: 1024
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define min3(a,b,c) min(min(a,b),c)

#define STR_MAX 100000
#define BUF_SIZE (STR_MAX+50)

int main(void) {
    static char str[BUF_SIZE];
    if(!fgets(str, BUF_SIZE, stdin)) return 0;
    int len = strlen(str) - 1;
    int i;
    for(i = 0; i < len; i++) str[i] = (str[i] == '1');

    int prev = str[i];
    int ans = STR_MAX+1;
    for(i = 0; i < len; i++) {
        if(prev == str[i]) continue;
        ans = min(ans, max(i, len-i));
        prev = str[i];
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.begin()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

  int n; cin >> n;
  int p[30];
  rep(i, n) {
    cin >> p[i];
  }

  int cnt = 0;
  reps(i, 1, n - 2) {
    if( p[i] > p[i-1] && p[i] < p[i+1] ) cnt++;
    else if( p[i] < p[i-1] && p[i] > p[i+1] ) cnt++;
  }

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 256
nq = gets.split.map(&:to_i)
ary = Array.new(nq[0]){[]}

nq[1].times do
  odr = gets.split.map(&:to_i)
  case odr[0]
  when 0
    ary[odr[1]] << odr[2]
  when 1
    unless (ary[odr[1]][0]).nil?
      puts(ary[odr[1]][0])
    end
  when 2
    ary[odr[1]].shift
  end
end


Measured memory_bytes: 9228
x = int(input())
if x >= 400 and x < 600:
    print(8)
elif x >= 600 and x < 800:
    print(7)
elif x >= 800 and x < 1000:
    print(6)
elif x >= 1000 and x < 1200:
    print(5)
elif x >= 1200 and x < 1400:
    print(4)
elif x >= 1400 and x < 1600:
    print(3)
elif x >= 1600 and x < 1800:
    print(2)
else:
    print(1)


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

int main(){
    int N;
    cin >> N;
    // x, y, 色(赤が0で青が1)
    vector<tuple<int, int, int>> pts;
    for(int c=0; c<2; c++) for(int i=0; i<N; i++){
        int x, y;
        cin >> x >> y;
        pts.emplace_back(x, y, c);
    }
    // x座標でソート
    sort(pts.begin(), pts.end());

    // ペア待ち点のy座標の集合
    set<int> st;
    int ans = 0;
    for(auto& [x, y, c] : pts){
        if(c == 0){
            st.insert(y);
        }else{
            auto it = st.lower_bound(y);
            if(it != st.begin()){
                st.erase(prev(it));
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


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


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>

using namespace std;

int main(){
  int X,a=0,b=0;
  cin >> X;
  for(int i=0; i<X; i++){
    a += 1;
    b += a;
    if(b>=X){
      cout << a << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
dbflag=""

def debug(*args):
	if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
	if ""!=dbflag:return _INDATA.readline()
	else: return input()


result = -1


H, W = map(int, readline().split())

import numpy as np
data=np.ndarray(shape=(H,W),dtype=object)
for i in range(0,H):
	data[i,:]=list(readline().rstrip())
	
for i in range(0,2*H):
	for j in range(0,W):
		#debug(i,j,(i)//2)
		print(data[(i)//2, j],end="")
	
	print("")


Measured memory_bytes: 13968
import collections

N,M = map(int,input().split())
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i] = map(int,input().split())

c_A = collections.Counter(A)
c_B = collections.Counter(B)

for i in range(N):
  print(c_A[i+1]+c_B[i+1])

Measured memory_bytes: 38256