akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=110;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int x[N],y[N];
vector<double>v;
double val[N],all;
int main()
{
	int n=gi(),i,k;double t;
	for (i=1;i<=n;i++)
		x[i]=gi(),y[i]=gi();
	for (k=1;k<=n;k++) {
		v.clear();
		for (i=1;i<=n;i++)
			if (i!=k) {
				t=atan2(y[i]-y[k],x[i]-x[k]);
				v.pb(t);
				v.pb(t+pi*2);
			}
		sort(v.begin(),v.end());
		for (i=1;i<v.size();i++)
			if (v[i]-v[i-1]>pi) {
				all+=val[k]=pi-(pi*2-(v[i]-v[i-1]));
				break;
			}
	}
	for (i=1;i<=n;i++)
		printf("%.8lf\n",val[i]/all);
	return 0;
}


Measured memory_bytes: 384
import sys
if sys.version_info[0]>=3: raw_input=input

def main(roman):
	m={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
	r=0
	for i in range(len(roman)):
		r+=m[roman[i]]*(1 if i==len(roman)-1 or m[roman[i]]>=m[roman[i+1]] else -1)
	print(str(r))

if __name__=='__main__':
	try:
		while True:
			main(raw_input().rstrip())
	except EOFError:
		pass

Measured memory_bytes: 6724
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <stack>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  string s; cin >> s;
  ll res = 0, b = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'B') b++;
    else if (s[i] == 'W') {
      res += b;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int main(){
	long long int n,m;
	cin>>n>>m;
	long long int ans=0;

	if(n==1 && m!=1 || n!=1 && m==1){
		ans = max(n, m) - 2;
		cout<< ans <<endl;
		return 0;
	}
	if(n==1 && m==1){
		ans = 1;
		cout<< ans <<endl;
		return 0;
	}
	ans = (n-2)*(m-2);

	cout<< ans <<endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  while(cin>>n){
    int dec[256];
    REP(i,256) dec[i]=-1;
    if(n==0) break;
    REP(i,n){
      char f,t;
      cin>>f>>t;
      dec[f]=t;
    }
    int m;
    cin>>m;
    REP(i,m){
      char set;
      cin>>set;
      if(dec[set]==-1){
        cout<<set;
      }else{
        cout<<(char)dec[set];
      }
    }
    cout<<endl;
  }
  return 0;
}

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

int main() {
	int W,H,x,y,r;

	cin>>W>>H>>x>>y>>r;
	
	if (W - r >= x && H - r >= y && x >= r && y >= r ) {
		cout<<"Yes"<<endl;
	} else {
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
long long a[200005];
int main()
{
    long long n,i,j,xo=0,sum=0,ans=0;
    scanf("%lld",&n);
    for(i = 1,j=1; i<=n; i++)
        {
            scanf("%lld",&a[i]),sum+=a[i],xo^=a[i];
            while(sum!=xo)
            {
                sum-=a[j];
                xo^=a[j];
                j++;
            }
            ans+=(i-j+1);
        }
    printf("%lld\n",ans);
}


Measured memory_bytes: 1792
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N,M;
    cin>>N>>M;
    vector<int> S(1e5+10),T(1e5+10);
    REP(i,N) cin >> S[i];
    REP(i,M) cin >> T[i];
    vector<vector<ll>> dp(2010,vector<ll>(2010,0));
    vector<vector<ll>> sum(2010,vector<ll>(2010,0));
    dp[0][0]=1;
    sum[1][1]=1;
    REP(i,N+1){
        REP(j,M+1){
            if(i==0&&j==0) continue;
            if(i-1>=0&&j-1>=0&&S[i-1]==T[j-1]){
                dp[i][j] = sum[i][j];
            }
            sum[i+1][j+1]=(sum[i][j+1]%MOD+sum[i+1][j]%MOD-sum[i][j]%MOD+dp[i][j]%MOD);
            while(sum[i+1][j+1]<0){
                sum[i+1][j+1]+=MOD;
            }
            sum[i+1][j+1]%=MOD;
        }
    }

    cout <<sum[N+1][M+1] << endl;
    
    
}

Measured memory_bytes: 64384
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vi = vector<int>; using vvi = vector<vi>;
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string o,e;
    cin >> o >> e;
    rep(i,sz(e)){
        cout << o[i] << e[i];
    }
    if(sz(o) > sz(e)) cout << o[sz(o)-1];
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  int n, ans=1;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d.at(i);
  sort(all(d));
  for(int i = 1; i < n; i++) {
    if(d.at(i) != d.at(i-1))ans++;
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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; }

using ll = long long;

ll N;
ll F[100][20];
ll P[100][20];
ll ans = -(1ll<<60);

int main()
{
  std::cin >> N;
  rep( i, N ) rep( j, 5 ) rep( k, 2 )
    std::cin >> F[i][j*2+k];

  rep( i, N ) rep( j, 11 )
    std::cin >> P[i][j];

  rep( bit, 1<<10 )
  {
    std::vector<ll> vs;

    rep( b, 10 ) if( bit>>b&1 )
      vs.emplace_back( b );

    if( vs.empty() )
      continue;

    ll sum = 0;

    rep( i, N )
    {
      ll cnt = 0;

      for( auto v : vs )
      {
        if( F[i][v] )
          ++cnt;
      }

      sum += P[i][cnt];
    }

    chmax( ans, sum );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
@lru_cache(maxsize=None)
def f(N):
    if N == 0: return 2
    if N == 1: return 1
    return f(N - 1) + f(N - 2)
print(f(ri()))

Measured memory_bytes: 63468
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static int[] vals;
	static int M, N;
	
	static int sumLeft(int pairs) {
		int ret = 0;
		for (int i = 0; i < pairs; i++) {
			ret = Math.max(ret, vals[i] + vals [2 * pairs - 1 - i]);
		}
		return ret;
	}
	
	static int sumRight(int pairs) {
		int rem = N - pairs;
		int ret = 0;
		for (int i = 0; i < rem; i++) {
			int sum = vals[2 * N - 1 - i] + vals[2 * pairs + i] - M;
			if (sum < 0) return M;
			ret = Math.max(ret, sum);
		}
		return ret;
	}
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		N = sc.nextInt();
		M = sc.nextInt();
		vals = new int[2 * N];
		for (int i = 0; i < vals.length; i++) {
			vals[i] = sc.nextInt();
		}
		Arrays.sort(vals);
		int left = -1, right = N;
		while (left + 1 < right) {
			int med = (left + right) / 2;
			if (sumRight(med) < M) {
				right = med;
			} else {
				left = med;
			}
		}
		int ans = Math.max(sumLeft(right), sumRight(right));
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 49144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		double A = scan.nextDouble();
		double B = scan.nextDouble();
		double H = scan.nextDouble();
		double M = scan.nextDouble();
		double x = 0d;
		double theta = 0d;

		theta = Math.abs(6d * M - (30d * H + 0.5d * M));
		if (theta > 180d) theta = 360d - theta;
		theta = Math.cos(theta / 360d * 2d * Math.PI);

		x += A * A;
		x += B * B;
		x -= 2d * A * B * theta;
		x = Math.sqrt(x);

		System.out.println(x);
 	}
}

Measured memory_bytes: 37500
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	int ret=mod;
	for(int i=0;i<=100;i++){
		int tmp=0;
		for(int j=0;j<a;j++){
			tmp+=(i-p[j])*(i-p[j]);
		}
		ret=min(ret,tmp);
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
int int_comp(const void*a,const void*b){return *(int*)a-*(int*)b;}
int main(void)
{
  int n;
  int d[100000];
  
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&d[i]);
  qsort(d,n,sizeof(int),int_comp);
  printf("%d\n",d[n/2]-d[n/2-1]);
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define MAXN 200000
int m, n;
vector<int>graph[MAXN];
int dfs(int node, bool visited[], int n){
	visited[node]=1;
	int count=1;
	for(auto c: graph[node]){
		if(!visited[c]){count+=dfs(c, visited, n);
		
		}
	}
	return count;
	
}
int main(){
	cin>>m>>n;
	bool visited[m]={0};
	for(int i=0; i<n; i++){
		int a, b; 
		cin>>a>>b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int count=0;
	cout<<endl;
	for(int i=0; i<m; i++){
		count=max(count, dfs(i, visited, m));
		//cout<<i<<" "<<dfs(i)<<endl;
	}
cout<<count;
}


Measured memory_bytes: 23924
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define lli long long int
#define d double
using namespace std;
 
int main() {
	FIO;
	lli n,k;
	cin>>n>>k;
	vector<lli> vec(n+1);
	for(lli i=1;i<=n;i++) cin>>vec[i];
	vector<lli> dp(n);
	dp[1]=0;
	dp[2]=abs(vec[2]-vec[1]);
	for(lli i=3;i<=n;i++){
		dp[i]=INT_MAX;
		for(lli j=i-1;j>=i-k&&j>=1;j--){
			dp[i]=min(dp[i],dp[j]+abs(vec[i]-vec[j]));
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }

void solve(){

    map<lli,vector<lli>> lef;
    map<lli,vector<lli>> rig;

    lli n;
    cin>>n;
    lli ans = 0;
    REP(i,0,n){
        lli k,l,r;
        cin>>k>>l>>r;
        if(l>r){
            ans += r;
            lef[k].push_back(l-r);
        }
        else{
            ans += l;
            rig[k].push_back(r-l);
        }
    }

    priority_queue<lli,vector<lli>,greater<lli>> q;

    REP(i,1,n+1){
        for(auto e:lef[i]){
            ans += e;
            q.push(e);
        }
        while(q.size()>i){
            ans -= q.top();
            q.pop();
        }
    }
    while(q.size())q.pop();

    for(lli i=n-1;i>=1;i--){
        for(auto e:rig[i]){
            ans+=e;
            q.push(e);
        }
        while(q.size()> n-i){
            ans -= q.top();
            q.pop();
        }
    }

    cout<<ans<<endl;
}


int main(){

    lli t;
    cin>>t;
    while(t--)solve();

    return 0;
}


Measured memory_bytes: 39832
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
       
       if(A<=8 && B<=8){
           System.out.println("Yay!");
       }
       
       else{
           System.out.println(":(");
       }
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
//#define LOCAL 1
int main(){
	#if LOCAL
//	freopen("E:\\in.txt","r", stdin);
	#endif
	string s;
	cin >> s;
	int sz = s.size();
	if(s[sz-1] == 's'){
//		s.pop_back();
		s += "es";
	}else{
		s += 's';
	}
	cout << s << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		int max = Integer.MIN_VALUE;
		int i,h;
		int ans = 0;
		for(i = 0; i < n; i++) {
			h = scan.nextInt();
			if(h >= max)
				ans++;
			max = Math.max(max, h);
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
#include<stdio.h>

void mergeSort(int numbers[], int temp[], int array_size);
void m_sort(int numbers[], int temp[], int left, int right);
void merge(int numbers[], int temp[], int left, int mid, int right);

int main(){
    int N, K;
    scanf("%d%d",&N,&K);
    int h[N];
    for(int i = 0;i < N;i++){
        scanf("%d",&h[i]);
    }
    int H[N];

    mergeSort(h,H,N);
    int d = 1000000000;
    for(int i = 0;i <= N-K;i++){
        if(d > H[i + K - 1] - H[i]){
            d = H[i + K - 1] - H[i];
        }
    }

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

void mergeSort(int numbers[], int temp[], int array_size)
{
  m_sort(numbers, temp, 0, array_size - 1);
}

void m_sort(int numbers[], int temp[], int left, int right)
{
  int mid;

  if (right > left)
  {
    mid = (right + left) / 2; /* 配列を分割する位置 */
    m_sort(numbers, temp, left, mid);
    m_sort(numbers, temp, mid+1, right);

    merge(numbers, temp, left, mid+1, right);
  }
}

void merge(int numbers[], int temp[], int left, int mid, int right)
{
  int i, left_end, num_elements, tmp_pos;

  left_end = mid - 1;
  tmp_pos = left;
  num_elements = right - left + 1; /* 配列の要素数 */

  /* 2つのリストに要素が残っている */
  while ((left <= left_end) && (mid <= right))
  {
    if (numbers[left] <= numbers[mid])
    {
      temp[tmp_pos] = numbers[left];
      tmp_pos = tmp_pos + 1;
      left = left +1;
    }
    else
    {
      temp[tmp_pos] = numbers[mid];
      tmp_pos = tmp_pos + 1;
      mid = mid + 1;
    }
  }

  /* 左側のリスト */
  while (left <= left_end)
  {
    temp[tmp_pos] = numbers[left];
    left = left + 1;
    tmp_pos = tmp_pos + 1;
  }
  /* 右側のリスト */
  while (mid <= right)
  {
    temp[tmp_pos] = numbers[mid];
    mid = mid + 1;
    tmp_pos = tmp_pos + 1;
  }

  /* 昇順に整列するようひとつのリストにまとめる */
  for (i=0; i <= num_elements; i++)
  {
    numbers[right] = temp[right];
    right = right - 1;
  }
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e3;
const int maxn=1e5+5;
const int mod=998244353;
int a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int t=0;
    int flag=1;
    for(int i=0; i<n; i++)
    {
        int x;
        scanf("%d",&x);
        if(i==0&&x!=0)flag=0;
        a[x]++;
        t=max(x,t);
    }
    if(flag==0||a[0]!=1)
    {
        printf("0\n");
        return 0;
    }
    ll sum=1;
    for(int i=1; i<n; i++)
    {
        for(int j=0; j<a[i]; j++)
        {
            sum*=a[i-1];
            sum%=mod;
        }
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 640
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-4;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int H,W,i,j;cin>>H>>W;
	int A[81][81];
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			cin>>A[i][j];
		}
	}
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			int B;cin>>B;
			A[i][j]=abs(A[i][j]-B);
		}
	}
	//6400*200
	bitset<12801>dp[81]={};
	dp[0][6400]=1;
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			int a=A[i][j];
			dp[j]=((dp[j]|dp[j-1])>>a)|((dp[j]|dp[j-1])<<a);
		}
		dp[0][6400]=0;
	}
	for(j=0;j<=6400;j++){
		if(dp[W][j+6400]){cout<<j<<endl;break;}
	}
	return 0;
}

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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

int n;

bool read() {
    if (!(cin >> n))
        return false;

    return true;
}

void solve() {
    ll A = 1, B = 1;

    while (n --> 0) {
        ll a, b;
        cin >> a >> b;

        if (A * b != B * a) {
            ll cur = max((A + a - 1) / a, (B + b - 1) / b);
            A = cur * a;
            B = cur * b;
        }
    }

    cout << A + B << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

#define int long long
#define ll long long
#define double long double
#define pii pair<int, int>
#define vec vector
#define u_map unordered_map
#define u_set unordered_set
#define str string
#define all(el) el.begin(), el.end()
#define allr(el) el.rbegin(), el.rend()
#define sz(el) (int)el.size()
#define f first
#define s second
#define pb push_back
#define in insert
#define mp make_pair
#define endl "\n"
#define forn(i, n) for (int i = 0; i < n; ++i)

inline int maxi(int &a, int b) { if (b > a) { a = b; return 1; } return 0; }

inline int mini(int &a, int b) { if (b < a) { a = b; return 1; } return 0; }

inline int maxi(double &a, double b) { if (b > a) { a = b; return 1; } return 0; }

inline int mini(double &a, double b) { if (b < a) { a = b; return 1; } return 0; }

const int maxN = 1e5 + 100;

int used[3 * maxN];
int d[3 * maxN];
vec<int> g[3 * maxN];

signed main() {

    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        u *= 3;
        v *= 3;
        g[u].pb(v + 1);
        g[u + 1].pb(v + 2);
        g[u + 2].pb(v);
    }
    int s, t;
    cin >> s >> t;
    s--, t--;
    s *= 3;
    t *= 3;
    queue<int> q;
    q.push(s);
    used[s] = 1;
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int to : g[v]) {
            if (!used[to]) {
                used[to] = 1;
                q.push(to);
                d[to] = d[v] + 1;
            }
        }
    }
    if (d[t] != 0) {
        cout << d[t] / 3;
    } else {
        cout << -1;
    }
    return 0;
}

Measured memory_bytes: 24196
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<set>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
 
using namespace std;

int main(){
  int n;
  cin >> n;
  cout << (n < 1200 ? "ABC" : "ARC") << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, x, sum;
  cin >> A >> B;
  sum = 0;
  x = A; 
  
  for (int i = 0; i <= B - A; i++) {
  int a = x % 10;
  int b = x % 100 / 10;
  int c = x % 10000 / 1000;
  int d = x / 10000;
    
    if (a == d && b == c) sum++;
    if (x == B) break;
   
  x++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n, q;
  while (cin >> n >> q, n || q)
  {
    vector<pair<pair<string, int>, int>> db(n);
    for (auto &e : db)
    {
      cin >> e.first.first >> e.first.second >> e.second;
    }
    sort(db.begin(), db.end(), [](pair<pair<string, int>, int> a, pair<pair<string, int>, int> b) { return a.second < b.second; });
    for (int i = 0; i < q; ++i)
    {
      int query;
      cin >> query;
      bool flag = true;
      for (int j = 0; j < n; ++j)
      {
        int year = db[j].first.second - (db[j].second - query);
        if (query <= db[j].second && year > 0)
        {
          cout << db[j].first.first << ' ' << year << endl;
          flag = false;
          break;
        }
      }
      if (flag)
        cout << "Unknown" << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3104
using System;

namespace AtCoder.ABC114 {
    class A {
        static void Main() => Solve();

        static void Solve() {
#if DEBUG
            global::Common.ChangeStdIn();
#endif
            var x = int.Parse(Console.ReadLine());
            if (x == 3 || x == 5 || x == 7) {
                Console.WriteLine("YES");
            } else {
                Console.WriteLine("NO");
            }
        }
    }
}

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

#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int n,ans=0;
int a[200000];
map<int,int>mp;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    sort(a,a+n);
    rep(i,n){
        if(mp[a[i]]>a[i]){
            ans+=mp[a[i]]-a[i];
            mp[a[i]]=a[i];
        }
        else if(mp[a[i]]<a[i]){
            ans+=mp[a[i]];
            mp[a[i]]=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);


void solve()
{
    int n;
    ll y;
    cin >> n >> y;
    for(ll i = 0; i <= n; i++){
        for(ll j = 0; i+j <= n; j++){
            if(10000ll*i + 5000ll*j + 1000ll*((ll)n - (i+j)) == y) {
                cout << i << " " << j << " " << n-i-j << "\n";
                return;
            }
        }
    }
    cout << "-1 -1 -1" << "\n";
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))

n, _ = rm()
li = np.array([np.array(rl()) for _ in range(n)])
cnt = 0
for i in range(n):
  for j in range(i):
    a = sum((li[i] - li[j]) ** 2)**0.5
    if a - a//1 == 0:
      cnt += 1
print(cnt)









Measured memory_bytes: 27260
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        boolean ok = Arrays.stream(as)
                .filter(a -> a % 2 == 0)
                .allMatch(a -> a % 3 == 0 || a % 5 == 0);

        System.out.println(ok ? "APPROVED" : "DENIED");
    }
}

Measured memory_bytes: 27988
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n,k;
    ll r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;cin>>t;
    ll ans=0;
    vector<bool>used(n);
    rep(i,n){
        if(i<k){
            if(t[i]=='p')ans+=s;
            if(t[i]=='r')ans+=p;
            if(t[i]=='s')ans+=r;
            used[i]=1;
            continue;
        }
        if(t[i]==t[i-k]){
            if(used[i-k]);
            else{
                if(t[i]=='p')ans+=s;
                if(t[i]=='r')ans+=p;
                if(t[i]=='s')ans+=r;
                used[i]=1;
            }
        }else{
            if(t[i]=='p')ans+=s;
            if(t[i]=='r')ans+=p;
            if(t[i]=='s')ans+=r;
            used[i]=1;
        }
    }
    cout<<ans<<endl;
}

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

const int oo=-10;
int n,m,a[52][52];
char c;

int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			cin>>c;
			if(c=='#')
			{
				a[i][j]=oo;
				a[i-1][j-1]++;
				a[i-1][j]++;
				a[i-1][j+1]++;
				a[i][j-1]++;
				a[i][j+1]++;
				a[i+1][j-1]++;
				a[i+1][j]++;
				a[i+1][j+1]++;
			}
		}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			if(a[i][j]<0)cout<<"#";
			else cout<<a[i][j];
		cout<<endl;
	}	
}

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

std::vector<int> a;

bool solve(int n, int m) {
  std::sort(a.begin(), a.end());
  int sum = 0;
  for (int i = 0; i < n; ++i) sum += a[i];
  return a[n - m] * 4 * m >= sum;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  for (int i = 0, x; i < n; ++i) {
    std::cin >> x;
    a.emplace_back(x);
  }
  if (solve(n, m)) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll A, V;
  scanf("%lld %lld", &A, &V);

  ll B, W;
  scanf("%lld %lld", &B, &W);

  ll T;
  scanf("%lld", &T);

  ll o = abs(A - B);
  ll d = (V - W) * T;

  if (o <= d) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int sum=0, effnum=0; //effectiveness number
  for(int i=1;i<=N;i++){
    sum =0;
    int i2 =i;
    while(i > 0){
      sum += i%10;
      i/=10;
      
    }
    i = i2;
    if(sum>=A && sum<=B){
      effnum += i;

    }
  }
  cout << effnum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int r2a(char a){
	switch(a){
		case 'I': return 1;		case 'V': return 5;
		case 'X': return 10;	case 'L': return 50;
		case 'C': return 100;	case 'D': return 500;
		case 'M': return 1000;	case '\n': return 0;
	}
}

int main(void){
	int s; char c, n;
	
	s=0, n=getchar();
	while(1){
		c=n, n=getchar();
		
		if(c=='\n'){
			printf("%d\n",s);
			s=0;
		}
		else if(c==EOF) return 0;
		else if(r2a(c)<r2a(n)) s-=r2a(c);
		else s+=r2a(c);
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

typedef long double ld;

const int N = 601;

int deg[N];
int con[N][N];

ld dp[N];

int n;

ld calc() {
	fill(dp, dp + n, 0);
	for (int i = n - 2; i >= 0; i--) {
		for (int j = i + 1; j < n; j++) {
			if (con[i][j]) dp[i] += dp[j];
		}
		dp[i] /= deg[i];
		dp[i] += 1;
	}
	return dp[0];
}

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

	cout << fixed << setprecision(16);

	cin >> n;
	int m;
	cin >> m;
	while (m--) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		deg[u]++;
		con[u][v] = 1;
	}
	ld ans = calc();
	vector<ld> sdp(n);
	for (int i = 0; i < n; i++) {
		sdp[i] = dp[i];
	}
	for (int i = 0; i < n; i++) {
		if (deg[i] < 2) continue;
		vector<pair<ld, int>> soski;
		for (int j = i + 1; j < n; j++) {
			if (con[i][j]) {
				soski.push_back({sdp[j], j});
			}
		}
		sort(soski.rbegin(), soski.rend());
		int j = soski.front().second;
		deg[i]--;
		con[i][j] = 0;
		ans = min(ans, calc());
		con[i][j] = 1;
		deg[i]++;
	}
	cout << ans << endl;
}


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

int main()
{
  int n;
  int flag=0;
  cin>>n;
  vector<pair<int,int>> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i).first>>a.at(i).second;
  }
  for(int i=0;i<n-2;i++)
  {
    if(a.at(i).first==a.at(i).second)
    {
      if(a.at(i+1).first==a.at(i+1).second)
      {
        if(a.at(i+2).first==a.at(i+2).second)
        {
          flag=1;
          break;
        }
      }
    }
  }
  if(flag==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>

using namespace std;

int main(){
  int a, b;

  cin >> a >> b;

  if (a <= 8 && b <= 8){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }

  return 0;
}


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


int main() {

int N, M;
int WA[105000];
bool AC[105000];

    cin >> N >> M;
    int WAnum = 0;
    int ACnum = 0;
    for(int i = 1; i <= N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--) {
        int p;
        string S;
        cin >> p >> S;
        if(AC[p]) continue;
        if(S == "AC") {
            AC[p] = true;
            ACnum++;
            WAnum += WA[p];
        } else if(S == "WA") {
            WA[p]++;
        }
    }
    cout << ACnum << " " << WAnum << endl;
    return 0;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int a,b;
    char op;
    cin >> a >> op >> b;
    cout << (op=='+'?a+b:a-b) << endl;
    return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

int N;

void dfs(string s, char x) {
  // cout << s.c_str() << endl;
  if (s.size() == N) {
    cout << s << endl;
  } else {
    for (char c = 'a'; c <= x; c++) {
      // cout << c << ' ' << x << endl;
      dfs(s + c, ((c == x) ? (char)(x + 1) : x));
    }
  }
}

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

    cin >> N;
    dfs("", 'a');
    return 0;
}

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

int a, b, c;

int main() {
    cin >> a >> b >> c;
    if (a == b && b != c) cout << "Yes\n";
    else if (a == c && a != b) cout << "Yes\n";
    else if (b == c && a != c) cout << "Yes\n";
    else cout << "No\n";
}


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

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

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

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

  int sum = 0;
  for(int i = 0; i < M; i++) {
    int a; cin >> a;
    sum += a;
  }

  if(N < sum) {
    cout << -1 << endl;
  } else {
    cout << N - sum << endl;
  }

  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if((a==b&&a==c)||(a!=b&&b!=c&&a!=c))
        printf("No");
    else
        printf("Yes");
    return 0;
}


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

int N, a[100005], sum[100005];

signed main()
{
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    sort(a, a + N);
    for(int i = 0; i < N; i++){
        sum[i] = a[i];
    }
    for(int i = 1; i < N; i++){
        sum[i] += sum[i - 1];
    }
    int ans = 0;
    for(int i = 1; i < N; i++){
        if(a[i] > sum[i - 1] * 2){
            ans = i;
        }
    }
    cout << N - ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	ll n;
	cin >> n;
	cout << n * (n - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a,b,r,c;
  scanf("%d%d",&a,&b);
  if(a<b){
    c = a;
    a = b;
    b = c;
  }

  r = a%b;
  while(r!=0)
    {
      a = b;
      b = r;
      r = a%b;
    }
    
  printf("%d\n",b);
  return 0;

}



Measured memory_bytes: 2084
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    int ncoin[3];
    int coin[3] = {500, 100, 50};
    int x;
    REP(i, 3)
    {
        cin >> ncoin[i];
    }
    cin >> x;

    int ans = 0;
    for (int i = 0; i <= ncoin[0]; i++)
    {
        for (int j = 0; j <= ncoin[1]; j++)
        {
            for (int k = 0; k <= ncoin[2]; k++)
            {
                int sum = i * coin[0] + j * coin[1] + k * coin[2];
                if (sum == x)
                    ans++;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;
using namespace atcoder;

int main(){
	int n,q;
	cin >> n >> q;
	fenwick_tree<long long> fw(n);
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		fw.add(i,x);
	}
	for(int i = 0; i < q; i++){
		int t,a,b; cin >> t >> a >> b;
		if(t==0){
			fw.add(a,b);
		}else{
			cout << fw.sum(a,b) << "\n";
		}
	}
	return 0;
}


Measured memory_bytes: 8212
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> T keta(T num){ T k=0; while(num>0){ num/=10; k++; } return k; }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    string x;
    cin >> x;

    int slen = x.length();
    ll cnt[200010];
    cnt[slen-1] = (x[slen-1]=='T') ? 1 : 0;

    repr(i, slen-2, 0){
        cnt[i] = cnt[i+1];
        if(x[i] == 'T') cnt[i]++;
    }

    //adebug(cnt, slen-1);

    ll res = slen;
    ll used = 0;
    repr(i, slen-1, 0){
        if(x[i] == 'T') continue;
        if(cnt[i]-used > 0){
            res -= 2;
            used++;
        }
    }

    cout << res << endl;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int a[n];
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool all_even = true;
  int count = 0;
  while (true) {
    for (j = 0; j < n; j++) {
      if (a[j] % 2 != 0) {
        all_even = false;
        break;
      }
      a[j] /= 2;
    }
    if (!all_even) {
      break;
    }
    count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    for(int i = 1; i < 10; i++)
    {
        int num = 10 * (i * 10 + i) + i;
        if(num >= n)
        {
            cout << num;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256