akhauriyash/Code-Regression huggingface dataset:
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  var count = 0;
  for(var i = 0; i < N - 2; i++){
  	for(var j = i + 1; j < N - 1; j++){
  		for(var k = j + 1; k < N; k++){
  			if(list[i] != list[j] && list[j] != list[k] && list[i] != list[k]){
  				if(list[i] + list[j] > list[k] && 
  					list[i] + list[k] > list[j] && 
  					list[j] + list[k] > list[i]){
  					count++;
  				}
  				
  			}
  		}
  	}
  }
  myout(count);
}

Measured memory_bytes: 33280
#pragma GCC optimize "03"
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

#define ordered_set tree<pi, null_type,less<pi>, rb_tree_tag,tree_order_statistics_node_update>

int n, a[N], b[N];

int f(int x){
	ordered_set pbds;
	int ans = 0;
	pbds.insert({0, 0});
	for(int i = 1; i <= n; i++){
		if(a[i] >= x)
			b[i] = 1;
		else
			b[i] = -1;
		b[i] += b[i-1];
		ans += pbds.order_of_key({b[i]+1, 0});
		pbds.insert({b[i], i});
	}
	return ans;
}
 
signed main() {
	IOS;
	#ifdef LOCAL
		freopen("input.txt","r", stdin);
		freopen("output.txt","w",stdout);
	#endif
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int l = 1, h = inf, x = n*(n+1)/2;
	x = (x-1)/2 + 1;
	while(l + 1 < h){
		int md = (l + h) >> 1;
		if(f(md) >= x)
			l = md;
		else
			h = md;
	}	
	cout << l;
	return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<int>v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    int sum = 0;
    for(int i=0; i<3 && d; i++)
    {
        int val = 0;
        if(i==0)val=1;
        if(i==1)val=0;
        if(i==2)val=-1;
        if(v[i]<d)
        {
            d-=v[i];
            sum+=v[i]*val;
        }
        else
        {
            sum+=d*val;
            d = 0;
        }
    }
    cout<<sum<<endl;

}


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

int main() {
  int N,n;
  cin >> N;
  if((N%100000)<N){
    n=90909;
  }else if((N%10000)<N){
    n=N-9999+909;
  }else if((N%100)<N){
    if(N>999){
      n=909;
    }else{
      n=N-99+9;
    }
  }else{
    if(N>9){
      n=9;
    }else{
      n=N;
    }
  }
  cout << n << endl;
}



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

struct queues {
	char name[11];
	int time;
	int next;
};

int main( void ) 
{
	struct queues ps[100001];
	int i;
	int n,q;
	int cnt,cur,pre;
	int time,res;
	int head;
	
	scanf( "%d%d", &n, &q );
	head=0;
	for( i=0; i<n; i++ ) {
		scanf( "%s%d", ps[i].name, &ps[i].time );
		ps[i].next=i+1;
	}
	
	res=time=cnt=0;
	pre=-1;
	cur=head;
	while( cnt<n ) {
		res=ps[cur].time-q;
		if( res <= 0 ) {
			time+=ps[cur].time;
			ps[cur].time=time;
			printf( "%s %d\n", ps[cur].name, ps[cur].time );
			
			if( head == cur ) {
				head=ps[cur].next;
			} else {
				ps[ pre ].next=ps[cur].next;
			}
			cnt++;
		} else {
			time+=q;
			ps[cur].time=res;
			pre=cur;
		}
		cur=ps[cur].next;
		
		if( n<=cur ) { 
			cur=head;
		}	
	}
	
	return 0;
}

Measured memory_bytes: 1580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int ans=0;
    vector<int> nums(t);
    for(int i=0;i<t-1;i++)
    {
        cin>>nums[i];
    }
    ans+=nums[0]+nums[t-2];
    for(int i=0;i<t-2;i++)
    {
        ans+=(min(nums[i],nums[i+1]));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#define REP(i,n) for(int i = 0;i<(n);i++)
using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		vector<vector<int> > p(N);
		REP(i,N){
			int m;
			cin >> m;
			p[i].resize(m);
			REP(j,m)cin >> p[i][j];
		}
		int k;
		cin >> k;
		vector<int> l(k);
		REP(i,k)cin >> l[i];
		int ct;
		bool is_find = false;
		int num_find = 0;
		REP(i,N){
			ct = 0;
			REP(j,p[i].size()){
				REP(a,k){
					if(ct == k)break;
					if(l[a] == p[i][j]){
						ct++;
						break;
					}
				}
			}
			if(ct == k ){
				if(!is_find){
					is_find = true;
					num_find = i+1;
				}else{
					is_find = false;
					break;
				}
			}
		}
		if(is_find)cout << num_find << endl;
		else cout << -1 << endl;
	}
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) cout << s[i] << t[i];
  cout << endl;
  return 0;
}


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define ALL(x) (x).begin(), (x).end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const db eps = 0.000001;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 10450555;
const int M = 1155;

void solve() {
    ll A, B;
    cin >> A >> B;

    ll y = B-2*A;
    ll x = A-y/2;

    if (x >= 0 && y >= 0 && y % 2 == 0) cout << "Yes"; else
        cout << "No";

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3612
//实现社会主义现代化和中华民族伟大复兴
//在全面建成小康社会的基础上
//分两步走在本世纪中叶建成富强民主文明和谐美丽的社会主义现代化强国

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#include<cmath>
#define y1 DEEP_DARK_FANTASY
#define y2 VAN_YOU_SEE
#define ll long long
const double pi=acos(-1.0);
using namespace std;
inline ll read(){
	ll re=0,flag=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(isdigit(ch)) re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int x1,x2,y1,y2,n,x[200010],y[200010],rk[200010],dp[200010];
inline bool cmp(ll l,ll r){
	if(x[l]!=x[r]) return x[l]<x[r];
	else return y[l]<y[r];
}
int main(){
//	freopen("in.in","r",stdin);
	x1=read();y1=read();x2=read();y2=read();n=read();
	int i,j,t1,t2;
	for(i=1;i<=n;i++) x[i]=read(),y[i]=read(),rk[i]=i,dp[i]=1e9;
	if(x1>x2){
		swap(x1,x2);swap(y1,y2);
	}
	if(y1>y2){
		y1=1e8-y1;
		y2=1e8-y2;
		for(i=1;i<=n;i++) y[i]=1e8-y[i];
	}
	x[++n]=x1;
	y[n]=y1;rk[n]=n;dp[n]=1e9;
	x[++n]=x2;
	y[n]=y2;rk[n]=n;dp[n]=1e9;
	sort(rk+1,rk+n+1,cmp);
	t1=1;t2=1;
	while(x[rk[t1]]!=x1||y[rk[t1]]!=y1) t1++;
	while(x[rk[t2]]!=x2||y[rk[t2]]!=y2) t2++;
	dp[1]=y[rk[t1]];dp[0]=-1;
//	for(i=1;i<=n;i++) cout<<i<<' '<<rk[i]<<' '<<x[rk[i]]<<' '<<y[rk[i]]<<'\n';
	ll pos;
	for(i=t1+1;i<t2;i++){
//		cout<<i<<' '<<y[rk[i]]<<' '<<y[rk[t1]]<<' '<<y[rk[t2]]<<'\n';
		if(y[rk[i]]<y[rk[t1]]||y[rk[i]]>y[rk[t2]]) continue; 
		pos=upper_bound(dp,dp+n+1,y[rk[i]])-dp;
//		cout<<i<<' '<<pos<<'\n';
		dp[pos]=y[rk[i]];
	}
	ll len=upper_bound(dp,dp+n+1,y[rk[i]])-dp-2;
	double ans=100.0*(double)(y2-y1+x2-x1);
	ans+=(pi-4.0)*5.0*len;
//	cout<<"check "<<len<<' '<<dp[len]<<' '<<t1<<' '<<t2<<'\n';
	if(len==(min(y2-y1,x2-x1)+1ll)) ans+=pi*5.0;
	printf("%.12lf\n",ans);
}
/*
0 1 1 0
1
0 0

*/

Measured memory_bytes: 3328
def main():
	k, a, b = list(map(int, input().split()))

	n = 1

	if a > k - 1:
		print(n + k)
		return

	n += a - 1
	k -= a - 1

	#print(n, k, a, b)
	if b - a >= 2 and k >= 2:
		n += (b - a) * (k // 2) + k % 2
	else:
		n += k

	print(n)


if __name__ == '__main__':
	main()




Measured memory_bytes: 3060
S = input()

# 一日ごとに晴れ（Sunny)、曇り(Cloudy)、雨(Rainy)の周期

if S == 'Sunny':
    print('Cloudy')

if S == 'Cloudy':
    print('Rainy')

if S == 'Rainy':
    print('Sunny')

Measured memory_bytes: 8992
n = int(input())
c=[]; s=[]; f=[]
for i in range(n-1):
    ci,si,fi = map(int,input().split())
    c.append(ci); s.append(si); f.append(fi)
for k in range(n-1):
    ans = [0]*(n)
    ans[k+1] = s[k] + c[k]
    for i in range(k+2,n):
        if ans[i-1] <= s[i-1]:
            ans[i] = s[i-1] + c[i-1]
        else:
            dpt = s[i-1]
            if (ans[i-1]-dpt)%f[i-1]==0:
                dpt = ans[i-1]
            else:
                dpt += ((ans[i-1]-dpt)//f[i-1]+1)*f[i-1]
            ans[i] = dpt + c[i-1]
    print(ans[n-1])
print(0)


Measured memory_bytes: 3188
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		Integer[] A = new Integer[N];
		for (int i=0;i<N;i++) {
			A[i] = Integer.parseInt(sc.next());
		}
		List<Integer> A_list = Arrays.asList(A);
		Collections.reverse(A_list);
		Integer[] A_2 = (Integer[])A_list.toArray(new Integer[N]);
		// System.out.println(Arrays.toString(A_2));
		System.out.println(LIS(A_2));
		// System.out.println(LDS(A));
	}

	static int LIS (Integer[] A) {
		int N = A.length;
		Integer[] dp = new Integer[N];
		for (int i=0;i<N;i++) {
			dp[i] = Integer.MAX_VALUE;
		}
		for (int i=0;i<N;i++) {
			int index = Arrays.binarySearch(dp, A[i], (x,y)->x.compareTo(y)>0?1:-1);
			if (index<0) {index = -index-2;}
			dp[index+1] = A[i];
		}
		int ans = 0;
		for (int i=0;i<N;i++) {
			if (dp[i] != Integer.MAX_VALUE) {
				ans++;
			}
		}
		return ans;
	}
	// static int LDS (Integer[] A) {
	// 	int N = A.length;
	// 	int[] dp = new int[N];
	// 	for (int i=0;i<N;i++) {
	// 		dp[i] = Integer.MAX_VALUE;
	// 	}
	// 	for (int i=0;i<N;i++) {
	// 		int index = Arrays.binarySearch(dp, A[i]);
	// 		if (index<0) {index = -index-2;}
	// 		dp[index+1] = A[i];
	// 	}
	// 	int ans = 0;
	// 	for (int i=0;i<N;i++) {
	// 		if (dp[i] != Integer.MAX_VALUE) {
	// 			ans++;
	// 		}
	// 	}
	// 	System.out.println(Arrays.toString(dp));
	// 	return ans;
	// }
}

Measured memory_bytes: 51540
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%10==3)printf("bon\n");
	else if(n%10==0||n%10==1||n%10==6||n%10==8)printf("pon\n");
	else printf("hon\n");
	return 0;
}

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

 int main() {
   string Sp, T, ans = "UNRESTORABLE";
   cin >> Sp >> T;

   if (Sp.length() < T.length()) cout << ans << endl;

   else {
     for(int i = Sp.length() - T.length(); i >= 0; i--) {
       bool done = true;
       rep(j, 0, T.length()) {
         if (Sp.at(i + j) == T.at(j) || Sp.at(i + j) == '?') continue;
         else {
           done = false;
           break;
         }
       }
       if (done) {
         rep(k, i, i + T.length()) {
           if (Sp.at(k) == '?') Sp.at(k) = T.at(k - i);
         }
         rep(l, 0, Sp.length()) {
           if (Sp.at(l) == '?') Sp.at(l) = 'a';
         }
         ans = Sp;
         break;
       }
     }
     cout << ans << endl;
   }
 }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define lint long long
#define MAX 100000

int main() {
	int N; cin >> N;
	lint sum = 0;
	for (int i = 0; i < N; i++)
	{
		int x; cin >> x;
		sum += x - 1;
	}
	cout << sum;
}

Measured memory_bytes: 256
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

s= arr_data[0][0]

mysum = sum([1 if x=="+" else -1 for x in list(s)] )

print(mysum)


Measured memory_bytes: 3060
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

int idx = 0;

int factor(const string &s)
{
    int ret = 0;
    if ('0' <= s[idx] && s[idx] <= '2')
    {
        ret = s[idx] - '0';
    }
    else
    {
    }
    idx++;
    return ret;
}

int formula(const string &s)
{
    if (s[idx] == '-')
    {
        idx++;
        return 2 - formula(s);
    }
    else if (s[idx] == '(')
    {
        idx++;
        int ret = formula(s);
        if (s[idx] == '*')
        {
            idx++;
            ret = min(ret, formula(s));
        }
        else if (s[idx] == '+')
        {
            idx++;
            ret = max(ret, formula(s));
        }
        idx++; // ')'
        return ret;
    }
    else
    {
        return factor(s);
    }
}

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

    string s;
    vector<char> c = {'0', '1', '2'};
    while (cin >> s, s != ".")
    {
        int res = 0, n = s.length();
        for (int p = 0; p < 3; p++)
        {
            for (int q = 0; q < 3; q++)
            {
                for (int r = 0; r < 3; r++)
                {
                    string t = s;
                    for (int i = 0; i < n; i++)
                    {
                        if (t[i] == 'P')
                            t[i] = c[p];
                        if (t[i] == 'Q')
                            t[i] = c[q];
                        if (t[i] == 'R')
                            t[i] = c[r];
                    }
                    idx = 0;
                    if (formula(t) == 2)
                        res++;
                }
            }
        }
        cout << res << endl;
    }
}



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

int main(){
  string s;
  cin >> s;
  ll k;
  cin >> k;
  ll l = s.length();
  if(l == 1) {
    cout << k/2 << endl;
    return 0;
  }
  ll p = 1; ll ans = 0;
  for(int i = 1; i < l; i++) {
    if(s[i] == s[i-1]) p++;
    else {
      ans += p/2;
      p = 1;
    }
  }
  ans += p/2;
  if(k == 1) {
    cout << ans << endl;
    return 0;
  }
  ans *= k;
  if(s[0] != s[l-1]) {
    cout << ans << endl;
    return 0;
  }
  int ini = 0, ls = 0;
  while(ini < l && s[ini] == s[0]) {ini++;}
  while(ls < l &&  s[l-1-ls] == s[l-1]) {ls++;}
  if(ini == l) {
    ans = (l*k)/2;
    cout << ans << endl;
    return 0;
  }
  if((ini % 2) && (ls % 2)) {
    ans += k-1;
    cout << ans << endl;
    return 0;
  } else {
    cout << ans << endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 256
A,B,K=map(int,input().split())
C=[]
D=[]
for i in range(K):
    if A+i<=B:
        C.append(A+i)
for i in range(K):
    if B-i>=A:
        D.append(B-i)
E=C+D
E.sort()
F=list(set(E))
F.sort()
for i in range(len(F)):
    print(F[i])

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

int main(){ 
  Int N;
  cin >> N;
  vector<Int> A(N);
  rep(i,N) cin >> A[i];
  
  vector<double> AI(N);
  rep(i,N) {
    AI[i] = 1.0 / (double)A[i];
  }
  
  double x = 0;
  rep(i,N) x += AI[i];
  
  x = 1.0 / x;
  
  cout << setprecision(10);
  cout << x << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int, int>
typedef unsigned long long uLL;
typedef long long LL;
using namespace std;
constexpr int MAXM = 2e4 + 4;
int n;
vector<LL>vec;
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	bool can = true;
	for (int i = 1, tmp; i <= n; i++) {
		cin >> tmp;
		if (!(tmp & 1) && tmp % 3 != 0 && tmp % 5 != 0) can = false;
	}
	can ? puts("APPROVED") : puts("DENIED");
	return 0; 
}

Measured memory_bytes: 256
import collections
import statistics as st
N = int(input())
L = list(map(int,input().split()))
L.sort()
M = list(set(L))
M.sort()
C = collections.Counter(L)

ans = 0

for i in range(len(M)):
    for j in range(len(M)):
        for k in range(len(M)):
            if M[i] == M[j] or M[i] == M[k] or M[j] == M[k]:
                continue
            else:
                if M[i]<M[j]<M[k] and M[i]+M[j] > M[k] and M[i]+M[k] > M[j] and M[j]+M[k] > M[i]:
                    ans += list(C.values())[i]*list(C.values())[j]*list(C.values())[k]


print(ans)


Measured memory_bytes: 10852
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define reo(i,n) for(int (i) = 1 ; (i) <= (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'a')
#define itoc(c) (char)(c+'a')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
const vec<int>dx{ 0,0,-1,1 }, dy{ 1,-1,0,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 (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------------------
signed main() {
	int h, w, n;
	cin >> h >> w >> n;
	cout << min(ceil(n * 1. / h), ceil(n * 1. / w)) << endl;
}

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

int main(void){
    int n,s = 0;
    cin >> n;

    for(int i = n ; i > 0; i--){
        if(i / 100000 < 1 and i / 10000 >= 1) s += 1;
        else if(i / 1000 < 1 and i / 100 >= 1) s += 1;
        else if(i / 10 < 1 and i / 1 >= 1) s += 1;
    }
    cout << s << endl;

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<P> A;
    rep(i,n){
        int a;
        cin >> a;
        A.emplace_back(a,i+1);
    }
    sort(A.begin(),A.end());
    rep(i,n){
        cout << A.at(i).second << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4316
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int INF = 2000000000;

int main() {
  vector<int> list;
  int n;
  int min = INF;
  scanf("%d\n", &n);
  int temp;
  for (int i = 0; i < n; i++) {
    scanf("%d", &temp);
    list.push_back(temp);
  }

  while (true) {
    sort(list.begin(), list.end());
    int min_index = -1;
    min = INF;
    for (int i = 1; i < n; i++) {
      if (abs(list[i] - list[i-1]) < min) {
        min = abs(list[i] - list[i-1]);
        min_index = i;
      }
    }
    if (min == 0) break;
    if (list[min_index - 1] < list[min_index]) {
      list[min_index] -= list[min_index - 1];
    } else {
      list[min_index - 1] -= list[min_index];
    }
  }

  sort(list.begin(), list.end());
  min = list[0];

  for (int i = 1; i < n; i++) {
    if (list[i] % list[0] > 0 && min > list[i] % list[0]) {
      min = list[i] % list[0];
    }
  }

  printf("%d\n", min);

  return 0;
}

Measured memory_bytes: 892
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    Vi c(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        c[a]++;
        c[b]++;
    }
    ll ans=0;
    rep(i,n){
        if(c[i]%2!=0){
            ans++;
        }
    }
    if(ans==0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        int minCount = 0;
        int i = 0;
        while(i < n - 1) {
            if(i + k - 1 >= n) {
                minCount++;
                System.out.println(minCount);
                return;
            }
            minCount++;
            i += (k - 1);
        }
        System.out.println(minCount);
    }
}


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

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/

int main(){
    double pai=3.141592653589;
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d %d\n",a*b,a*2+b*2);
    return 0;
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

int main()
{
    ll N,M;
    cin >> N >> M;

    vector<ll> A(N);
    for(auto& x : A)
    {
        cin >> x;
    }

    ll total = accumulate(ALL(A),0LL);

    sort(ALL(A),greater<int>());

    // total / 4M <= A[M-1]
    if(total <= A[M-1] * 4 * M) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    int loc = a[n - 1], fg = 0;
    long long ans = 1;
    for (int i = n - 2; i >= 0; i--) {
        if (a[i] == a[i + 1]) {
            ans *= a[i];
            i--;
            fg++;
            if (fg == 2) break;
        }
    }
    if (fg != 2) ans = 0;
    printf("%lld\n", ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
cout << fixed << setprecision(30);
  ll a,b;
  cin>>a>>b;
  putout(lcm(a,b));
  
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N;
    cin >> N;
    bool ok = false;
    REP(i, 0, 3) {
        if (N[i] == '7') {
            ok = true;
        }
    }
    yesno(ok);
}


Measured memory_bytes: 3616
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_RET_END		0										// 戻り値 - 終了
#define D_RET_MALE		1										// 戻り値 - 男性
#define D_RET_FEMALE	-1										// 戻り値 - 女性

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
	fflush(stdout);
#endif

	return 0;
}

// 応答
int
fRes(
	int piNo					// <I> 位置
)
{
	// 質問
	char lc1Buf[1024];
	sprintf(lc1Buf, "%d\n", piNo);
	fOutLine(lc1Buf);

	// 回答
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	if (!strncmp(lc1Buf, "Vacant", 6)) {
		return D_RET_END;
	}
	if (!strncmp(lc1Buf, "Male", 4)) {
		return D_RET_MALE;
	}

	return D_RET_FEMALE;
}

// 実行メイン
int
fMain(
)
{
	char lc1Buf[1024];

	// 椅子数 - 取得
	int liCCnt;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liCCnt);

	// 両側
	int liMinSts = fRes(0);
	if (liMinSts == 0) {
		return 0;
	}
	int liMinNo = 0;
	int liMaxSts = liMinSts;
	int liMaxNo = liCCnt;

	// 範囲を絞る
	while (1) {

		// 中間位置
		int liAvgNo = (liMaxNo + liMinNo) / 2;
		int liAvgSts = fRes(liAvgNo);
		if (liAvgSts == 0) {
			break;
		}
		int liVal;
		if ((liAvgNo - liMinNo) % 2 == 0) {
			liVal = 1;
		}
		else {
			liVal = -1;
		}

		// 結果
		if (liMinSts * liAvgSts * liVal > 0) {
			liMinNo = liAvgNo;
			liMinSts = liAvgSts;
		}
		else {
			liMaxNo = liAvgNo;
			liMaxSts = liAvgSts;
		}
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 760
#include <iostream>
using namespace std;
using ll = long long;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (a >= k) {
    cout << a - k << " " << b << endl;
  } else {
    cout << 0 << " " << max(0ll, b - (k - a)) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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 = 1e6 + 5;
int n;
int a[maxn];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  multiset<int> s;
  cin>>n;
  for (int i=0; i<n; i++) {
    int x; cin>>x;
    if (s.empty() || *s.begin() >= x) {
      s.insert(x);
    } else {
      auto iter = s.lower_bound(x);
      --iter;
      s.insert(x);
      s.erase(iter);
    }
  }

  cout<<s.size()<<endl;
  

  return 0;
}


Measured memory_bytes: 4992
import random
import math
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("Yes")
no = lambda: print("No")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
t = II()
if t%10 == 3:
	print("bon")
elif t%10 in [0,1,6,8]:
	print("pon")
else:
	print("hon")

Measured memory_bytes: 9564
#include <iostream>
#include <queue>
#include <stdio.h>
using namespace std;
int n,k,ans,cnt[30],tmp[30],jum;
string x;
priority_queue < int > pq;
int main()
{
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++)
    {
        cin>>x;
        cnt[x[0]-'A']++;
    }
    for(int i=0;i<26;i++)
    {
        if(cnt[i]) pq.push(cnt[i]);
    }
    while(pq.size()>=k)
    {
        jum = 0;
        for(int i=0;i<k;i++)
        {
            
            tmp[jum++] = pq.top()-1;
            pq.pop();
        }
        ans++;
        for(int i=0;i<jum;i++)
        {
            if(tmp[i]) pq.push(tmp[i]);
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <assert.h>
#include <set>
using namespace std;

int f(int x) {
  if (x & 1) {
    return 3 * x + 1;
  }
  return x / 2;
}

int main() {
  int x;
  scanf("%d", &x);
  set<int> s;
  s.insert(x);
  for (int i = 2; ; i++) {
    x = f(x);
    if (s.find(x) != s.end()) {
      printf("%d\n", i);
      return 0;
    }
    s.insert(x);
  }
  assert(false);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

template<class T>
struct WeightedUnionFind {
private:
    vector<int> par, rank;
    vector<T> diff_weight;
    
public:
    WeightedUnionFind() {}
    WeightedUnionFind(int n, T def = 0) {
        par.resize(n, -1);
        rank.resize(n, 0);
        diff_weight.resize(n, def);
    }
    
    int root(int x) {
        if (par[x] < 0) return x;
        int r = root(par[x]);
        diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;
    }
    
    T weight(int x) {
        root(x);
        return diff_weight[x];
    }
    
    bool is_same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y, T w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }
    
    T diff(int x, int y) {
        return weight(y) - weight(x);
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, m;
    cin >> n >> m;
    WeightedUnionFind<ll> wuf(n);
    rep(i, m) {
        ll l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        if (wuf.is_same(l, r)) {
            if (wuf.diff(l, r) != d) {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            wuf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a != c) puts("1");
	else puts("0");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
num_list = map(int,input().split(' '))
even_num_list = filter(lambda x : x % 2 == 0,num_list)

denied = False
for num in even_num_list:
    if num % 3 == 0 or num % 5 == 0:
        continue
    else:
        denied = True
        print('DENIED')
        break

if not denied:
    print('APPROVED')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main(){
  int N, M, a, b, max = 0;
  cin >> N >> M;
  Graph G(N);

  for (int i = 0; i < M; ++i) {
    cin >> a >> b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1);
  }
  vector<int> dist(N, -1);
  queue<int> que;

  for(int q = 0; q<N; q++){
    if(dist[q]!= -1) continue;
    int count = 1;
    dist[q] = 0;
    que.push(q);
    while (!que.empty()) {
      int v = que.front(); // キューから先頭頂点を取り出す
      que.pop();
      for (int nv : G[v]) {
        if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない
        dist[nv] = dist[v] + 1;
        que.push(nv);
        count++;
      }
    }
    if(count > max) max = count;
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 15444
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[105];
int main()
{
    for(int i=0;i<3;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+3);
    printf("%d\n",a[0]+a[1]);
    return 0;
}


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

int main(){
  int A,B,C,X,a,b,c,count=0;
  cin >> A >> B >> C >> X;
  for(a=0;a<=A;a++){
    for(b=0;b<=B;b++){
      for(c=0;c<=C;c++){
        if(500*a+100*b+50*c == X){
          count++;
        }
      }
    }
  }
  cout << count;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 100005
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define FastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

/* ----------------------------------------------------------------------------------- */

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

/* ----------------------------------------------------------------------------------- */

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
	typedef string::iterator si;
	static void call(si it, si ed) {}
	template<typename T, typename ... aT>
	static void call(si it, si ed, T a, aT... rest) {
		string b;
		for(; *it!=','; ++it)
			if(*it!=' ')
				b+=*it;
		cout << b << "=" << a << " ";
		call(++it, ed, rest...);
	}
};

/* ----------------------------------------------------------------------------------- */
int arr[105];

void solve() {
	int x, n;
	cin >> x >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		arr[a] = 1;
	}

	int left = 0, right = 0;
	for (int i = x; i <= 102; i++) {
		if(arr[i] == 0) {
			left = i;
			break;
		}
	}

	for (int i = x; i >= 0; i--) {
		if(arr[i] == 0) {
			right = i;
			break;
		}
	}

	if(abs((left - x)) < abs((x - right))) {
		cout << left << endl;
	} else {
		cout << right << endl;
	}
}

int main() {
	solve();

	// __test {
	// 	solve();
	// }
}

Measured memory_bytes: 3556
#import <stdio.h>
void P(long k){
    printf("%ld",k);
    exit(0);
}
int main() {
    long n,m;
    scanf("%ld %ld",&n,&m);
    if (n==1&&m==1) P(1);
    if (n==1) P(m-2);
    if (m==1) P(n-2);
    P((m-2)*(n-2));
}


Measured memory_bytes: 6988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define se second
#define fi first
#define pb push_back
#define mp make_pair
using namespace std;

const int oo = 2e9;
const int N = 100010;
const int MX = 1000000;

int n, m, a[N], sz[N], dsu[N], took[N], ed = 0;

int find(int u) {
	return dsu[u] == u ? u : dsu[u] = find(dsu[u]);
}
void merge(int u , int v) {
	u = find(u);
	v = find(v);
	sz[u] += sz[v];
	dsu[v] = u;
}
bool block[N];

ll total = 0;
vector<pii> all;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		dsu[i] = i;
		sz[i] = 1;
	}
	for (int i = 0; i < m; ++i) {
		int u , v;
		scanf("%d%d", &u, &v);
		merge(u, v);
	}
	if (m == n - 1) {
		puts("0");
		return 0;
	}
	for (int i = 0; i < n; ++i) {
		all.pb(mp(a[i], find(i)));
	}
	int rem = 2*((n - 1) - m);
	sort(all.begin(), all.end());
	for (int it = 0 ; it < 2 ; ++it) {
		for (int i = 0; i < all.size(); ++i) {
			if (ed == rem)continue;
			if (it == 0) {
				if (took[all[i].se])continue;
			}
			if(block[i])continue;
			block[i] = 1;
			ed++;
			took[all[i].se]++;
			total += all[i].fi;
		}
	}
	if (ed != rem) {
		puts("Impossible");
	} else {
		printf("%lld\n", total);
	}
	return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int min = INT_MAX;
    FOR(i, n + 1){
        int display = 1;
        display = pow(2, i) + k * ( n - i );
        if(min > display) {
            min = display;
        }
    }
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
s=0
for i in range(1,N+1):
    if i%15==0:
        s=s#print("FizzBuzz")
    elif i%3==0:
        s=s#print("Fizz")
    elif i%5==0:
        s=s#print("Buzz")
    else:
        #print(i)
        s=s+i
print(s)

Measured memory_bytes: 9048
#include <bits/stdc++.h>
#include <iomanip>      // std::setprecision
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1] 
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FENWICK(k) (k&-k)
#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end()) 
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end()) 
#define LL long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const int rogi[4][2] = { {1,1}, {1,-1}, {-1,1}, {-1,-1} };

int n,m;

void dane() {
	cin>>n>>m;

	int maxi_a = 0;
	int mini_b = INF;

	F(i,0,m) {
		int a,b;
		cin>>a>>b;
		maxi_a = max(maxi_a, a);
		mini_b = min(mini_b, b);
	}
	cout<<max(0,(mini_b - maxi_a +1))<<endl;

}   


int main() {
	IOS
	// int t;
	// cin>>t;
	// F(i,0,t)
	    dane();
    return 0;
}

Measured memory_bytes: 256