akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n,ll mod = MOD){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return ret;
}

ll mygcd(ll a,ll b){
    if(b == 0)return a;
    return mygcd(b,a%b);
}

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

bool eval(ll a,ll b,ll x,double theta){
    const double PI=3.14159265358979323846;

    if((double)a*tan(theta) >= (double)b){
        double y = (double)b/tan(theta);
        return (((double)b*y/2.0) > (double)x/(double)a);
    }

    double d = (double)a*tan(theta);
    double e = (double)a*cos(theta);
    double h = ((double)b - d)/sin(PI/2.0 - theta);

    return (h*e + ((d*(double)a)/2.0) > (double)x/(double)a);
}

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

    const double PI=3.14159265358979323846;
 
    ll a,b,x;
    cin >> a >> b >> x;

    double ok = 0.0;
    double ng = PI/2.0;

    for(int i = 0; i < 100000; i++){
        double middle = (ok+ng)/2.0;
        if(eval(a,b,x,middle)){
            ok = middle;
        }else{
            ng = middle;
        }
    }

    cout << setprecision(17) << fixed;
    cout << (2.0*ok/PI)*90.0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
map<string,int> blue;
map<string,int> red;
int ans=0;
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		string tmp;
		cin>>tmp;
		blue[tmp]++;
	}
	cin>>n;
	while(n--)
	{
		string tmp;
		cin>>tmp;
		red[tmp]++;
	}
	for(map<string,int>::iterator it=blue.begin();it!=blue.end();it++)
	{
		string a=it->first;
		ans=max(ans,blue[a]-red[a]);
	}
	cout<<ans;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct weight {
  int s, t, w;
};

bool operator<(const weight &l, const weight &r) { return l.w < r.w; }
int p[10000], r[10000];

int findSet(int x) {
  if (p[x] != x) p[x] = findSet(p[x]);
  return p[x];
}
void unite(int x, int y) {
  x = findSet(x);
  y = findSet(y);
  if (r[x] < r[y]) {
    p[x] = p[y];
  } else {
    p[y] = p[x];
    if (r[x] == r[y]) r[x]++;
  }
}
int same(int x, int y) {
  if (findSet(x) == findSet(y)) return true;
  return false;
}

int main() {
  int v, e, totalw = 0;
  weight tw;
  vector<weight> w;
  cin >> v >> e;
  for (int i = 0; i < v; i++) {
    p[i] = i;
    r[i] = 0;
  }
  for (int i = 0; i < e; i++) {
    cin >> tw.s >> tw.t >> tw.w;
    w.push_back(tw);
  }
  sort(w.begin(), w.end());

  for (int i = 0; i < e; i++) {
    tw = w[i];
    if (!same(tw.s, tw.t)) {
      unite(tw.s, tw.t);
      totalw += tw.w;
    }
  }
  cout << totalw << endl;
  return 0;
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    struct P {
        int x, y, index;
    };
    vector<P> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i].x >> p[i].y;
        p[i].index = i;
    }
    sort(p.begin(), p.end(), [](const P a, const P b) {
        return a.x < b.x;
    });
    vector<int> ans(n);
    int pre = -1;
    int min_y = n + 1;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (min_y == n - i + 1) {
            for (int j = i - 1; j > pre; --j) {
                ans[p[j].index] = cnt;
            }
            pre = i - 1;
            cnt = 1;
        } else {
            ++cnt;
        }
        min_y = min(min_y, p[i].y);
    }
    for (int i = n - 1; i > pre; --i) {
        ans[p[i].index] = cnt;
    }
    for (int i = 0; i < n; ++i) {
        cout << ans[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 6348
h,w=map(int,input().split())
S=[]
for i in range(h):
    S.append(input())

ans='Yes'
for i in range(1,h-1):
    for j in range(1,w-1):
        if S[i][j]=='#' and S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
            ans='No'

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


signed main(void){
    int A;
    string b;
    cin >> A >> b;
    int B=0;
    REP(i,b.size()){
        if(b[i]!='.'){
            B*=10;
            B+=(b[i]-'0');
        }
    }
    int R = A*B;
    R /=100;
    cout << R << endl;
    return 0;
}




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

int main(){
	int n, d; cin >> n >> d;
	vector<int> candy;
	for( int i = 0; i <= 126; ++i ) candy.push_back(i*i);
	int point[n][d];
	int ans = 0;
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < d; ++j ){
			cin >> point[i][j];
		}
	}
	for( int i = 0; i < n; ++i ){
		for( int j = i+1; j < n; ++j ){
			int dist = 0;
			for( int k = 0; k < d; ++k ){
				int a = point[i][k]-point[j][k];
				dist += a*a;
			}
			if( binary_search( candy.begin(), candy.end(), dist ) ){
				++ans;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,m;
	cin>>n>>m;
	int a[n];
	for(int i=0;i<n;i++)
	{
		a[i]=-1;
	}
	int x,y;
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		if(a[x-1]!=-1&&a[x-1]!=y)
		{
			cout<<"-1"<<endl;
			return 0;
		}
		a[x-1]=y;
	}
	if(a[0]==0&&n!=1)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	if(a[0]==-1&&n!=1)
	{
		a[0]=1;
	}
	else if(a[0]==-1&&n==1)
	{
		a[0]=0;
	}
	cout<<a[0];
	for(int i=1;i<n;i++)
	{
		if(a[i]==-1)
		{
			a[i]=0;
		}
		cout<<a[i];
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int A = one.get(0);
		int B = one.get(1);
		for(int i = 1; i <= 100000; i++){
			int L = (int)(i * 1.08);
			int R = (int)(i * 1.1);
			if(L - i == A && R - i == B){
				myout(i);
				return;
			}
		}
		myout(-1);
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 33004
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << ((a%2 && b%2) ? "Yes" : "No" )<< endl; 
    
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        int[][] letters = new int[n][26];
        for (int i = 0; i < n; i++) {

            String S = input.readLine();

            for (int j = 0; j < S.length(); j++) {
                letters[i][S.charAt(j) - 'a'] += 1;
            }
        }

        int[] commonLetters = letters[0];

        for (int i = 0; i < 26; i++) {
            for (int j = 1; j < n; j++) {
                if (commonLetters[i] <= letters[j][i]) {

                } else {
                    commonLetters[i] = letters[j][i];
                }

            }
        }

        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < commonLetters[i]; j++) {
                builder.append((char) ('a' + i));
            }
        }

        System.out.println(builder.toString());


    }

}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const ll mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

ll N, M, K, H, W, L, R, X;
string S, T;



int main(){
  cin >> N;
  unordered_map<string, int> mp;
  ll ans = 0;
  rep(i,N){
    string s; cin >> s;
    sort(all(s));
    ans += mp[s];
    mp[s]++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 10328
c = [ list(map(int,input().split())) for _ in range(3)]
a = [0]
b = []
for i in range(3):
        b.append(c[i][0])
a.append(c[1][1]-b[1])
a.append(c[2][2]-b[2])
for i in range(3):
        for j in range(3):
                if c[i][j] != a[j] + b[i]:
                        print("No")
                        exit()
print("Yes")

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;


public class Main {
	public static void main(String[] args){
		PrintWriter out = new PrintWriter(System.out);
		InputReader sc=new InputReader(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		long sum=0;
		long MOD=1000000007;
		for (long i = K; i <= N+1; i++) {
			sum+=N*i-(i*i-i)+1;
			sum%=MOD;
		}
		System.out.println(sum);
	}
	
	static class InputReader { 
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;
		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}
 
		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}
 
		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}
 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
 
		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}
 
		public boolean hasNext() {
			skip();
			return hasNextByte();
		}
 
		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
 
		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 32608
#include<bits/stdc++.h>
using namespace std;
int main()
{

   int a,b,sum=0;
   cin>>a>>b;
   int c[b];
   for(int i=0;i<b;i++)
   {
      cin>>c[i];

   }
   for(int i=0;i<b;i++)
   {
      sum+=c[i];
   }
   if(sum>=a)
      cout<<"Yes";
      else cout<<"No";


}



Measured memory_bytes: 640
n = int(input())
a_list = list(map(str, input().split()))
nums = {}
for num in a_list:
    if num in nums:
        nums[num][0] += 1
    else:
        nums[num] = [1]
total = 0
for key, value in nums.items():
    subtotal = (value[0] * (value[0] - 1)) // 2
    value.append(subtotal)
    total += subtotal
for i in range(n):
    val = a_list[i]
    subtotal = ((nums[val][0]-1)*(nums[val][0]-2))//2
    res = total - nums[val][1] + subtotal
    print(res)


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N), S(N + 1, 0);
    map<ll, ll> mp;
    mp[0] = 1;
    rep(i, N) {
        cin >> A[i];
        S[i + 1] = S[i] + A[i];
        mp[S[i + 1]]++;
    }
    ll ans = 0;
    for (auto i : mp) {
        ans += i.second * (i.second - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
import numpy as np

n, m, x = map(int, input().split())
books = []
for i in range(n):
    book = list(map(int, input().split()))
    books.append(book)

min_cost = float('inf')
for i in range(2 ** n):
    cost = 0
    _sum = np.array([0] * m)
    for j in range(n):  
        if ((i >> j) & 1):  
            _sum += np.array(books[j][1:]) 
            cost += books[j][0]
    flag = 0
    for k in _sum:
        if k < x:
            flag = 1
    if flag == 0:
        min_cost = min(min_cost, cost)
if min_cost == float('inf'):
    print(-1)
else:
    print(min_cost)

Measured memory_bytes: 27144
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#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 RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()
#define MOD 1000000007

ll n, score, dp[51][51][2600] = {1};

int main() {
    cin >> n >> score;

    REP(i, n) REP(j, i + 1) REP(k, score + 1) {
        dp[i + 1][j][k + j * 2]           = (dp[i + 1][j][k + j * 2]           + dp[i][j][k]) % MOD;
        dp[i + 1][j + 1][k + (j + 1) * 2] = (dp[i + 1][j + 1][k + (j + 1) * 2] + dp[i][j][k]) % MOD;
        dp[i + 1][j][k + j * 2]           = (dp[i + 1][j][k + j * 2]           + dp[i][j][k] * j * 2) % MOD;
        dp[i + 1][j - 1][k + (j - 1) * 2] = (dp[i + 1][j - 1][k + (j - 1) * 2] + dp[i][j][k] * j * j) % MOD;
    }
    cout << dp[n][0][score] << endl;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    string S;
    cin >> N >> S;
    S.erase(unique(S.begin(), S.end()), S.end());
    cout << S.size() << endl;
    return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007

using namespace std;
using ll = long long;
using ldb = long double;

int main() {
    string s, t;
    cin >> s >> t;
    bool flag = true;
    if (s.size() + 1 != t.size()) flag = false;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            flag = false;
            break;
        }
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];

  map<string, int> cnt;
  rep(i, n) { cnt[s[i]]++; }

  int max_cnt = 0;
  for (auto i = cnt.begin(); i != cnt.end(); ++i) {
    max_cnt = max(max_cnt, i->second);
  }

  vector<string> ans;
  for (auto i = cnt.begin(); i != cnt.end(); ++i) {
    if (i->second == max_cnt) {
      ans.push_back(i->first);
    }
  }

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

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

  return 0;
}

Measured memory_bytes: 28404
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 3e3 + 10;
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string str;
	int n;
	cin >> n;
	cin >> str;
	LL ans = 1;
	int o = 0;
	for (auto& c : str)
	{
		if (c == 'B')
		{
			if (o % 2 == 0) o++;
			else ans = ans * o-- % INF;
		}
		else
		{
			if (o % 2 == 1) o++;
			else ans = ans * o-- % INF;
		}
		if (o < 0) ans = 0;
	}
	if (o != 0) ans = 0;
	for (int i = 1; i <= n; i++) ans = ans * i % INF;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 644
MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
lst = [-1] * n

# O(N)
for i in range(n + 1):
    if lst[a[i] - 1] != -1:
        first = lst[a[i] - 1]
        second = i
        break
    lst[a[i] - 1] = i

# print (first, second)    
left = first
right = n - second

U = 10 ** 5 + 1
def power_mod(a, n):
    if n == 0:
        return 1
    x = power_mod(a//2)

def make_fact(fact, fact_inv):
    for i in range(1, U + 1):
        fact[i] = (fact[i - 1] * i) % MOD
    fact_inv[U] = pow(fact[U], MOD - 2, MOD)
    for i in range(U, 0, -1):
        fact_inv[i - 1] = (fact_inv[i] * i) % MOD

def comb(n, k):
    if k < 0 or n < k:
        return 0
    x = fact[n]
    x *= fact_inv[k]
    x %= MOD
    x *= fact_inv[n - k]
    x %= MOD
    return x

fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
make_fact(fact, fact_inv)

for i in range(1, n + 2):
    ans = comb(n + 1, i) - comb(left + right, i - 1)
    print (ans % MOD)

Measured memory_bytes: 20384
#include<bits/stdc++.h>
using namespace std;
int H,W;
char a[110][110];
int main(){
  for(int i=0;i<110;i++){
    for(int j=0;j<110;j++){
      a[i][j]='0';
    }
  }
  cin >> H >> W;
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<=H+1;i++){
    for(int j=0;j<=W+1;j++){
      if(a[i][j]=='0') cout << "#";
      else cout << a[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		sc.close();

		//整数CがAより大きく、Bより小さいときにYESを出力
		if((A <= C) && (C <= B)) {
			System.out.println("Yes\r\n" +
					"");
		}else {
			System.out.println("No\r\n" +
					"");
		}
	}
}

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

int main(){
	int A, B, ans = 0;

	cin >> A >> B;

	ans += max(A, B);
	if(A == max(A, B)){
		A -= 1;
	}else{
		B -= 1;
	}

	ans += max(A, B);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair


void solve()
{
    int m;
    cin >> m;
    cout << 48 - m;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);

const n = +input[0];

let count = 0;
let min = +input[1];

input.slice(1, n + 1).map(i => {
  if (+i <= min) {
    min = +i;
    count++;
  }
});

console.log(count);


Measured memory_bytes: 34784
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define N 1005
string s;
int main(){
	cin >> s;
	int step = 0;
	for (auto x : s){
		if (step == 0 && x == 'C')step++;
		if (step == 1 && x == 'F')step++;
	}
	if (step >= 2)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
int read()
{
    char ch = getchar();
	int x = 0, f = 1;
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}
vector<ll>v[10],v1,v2;

int main()
{
CloseIo;
ll a[10],k;
rep(i,0,3)
scanf("%lld",&a[i]);
scanf("%lld",&k);
rep(i,0,3)
{
	 rep(j,0,a[i])
	 {
	 ll t;
	 scanf("%lld",&t);
	 v[i].push_back(t);
	 	
	 }
//	 sort(v[i].begin(),v[i].end(),cmp);
}
//printf("\n\n\n");
rep(i,0,v[0].size())
rep(j,0,v[1].size())
{
	v1.push_back(v[0][i]+v[1][j]);
}
sort(v1.begin(),v1.end(),greater<ll>());
v1.resize(k);
rep(i,0,v1.size())
rep(j,0,v[2].size())
{
	v2.push_back(v1[i]+v[2][j]);
}
sort(v2.begin(),v2.end(),greater<ll>());
rep(i,0,k)
printf("%lld\n",v2[i]);
}



Measured memory_bytes: 42744
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
ll vis[mx], cl[mx];
vector<pair<ll,ll>> gr[mx];

void dfs(ll node){
    ll sz= gr[node].size();
    ll i,j;
    for(i=0; i<sz; i++){
        if(!vis[gr[node][i].first]){
            vis[gr[node][i].first]= 1;
            if(gr[node][i].second & 1)
            cl[gr[node][i].first]= !cl[node];
            else
            cl[gr[node][i].first]=  cl[node];
            dfs(gr[node][i].first);
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	ll n,i,j,u,v,w ;
	
	cin>>n;
	ll par[mx];
	for(i=0; i< n-1; i++){
	    cin>>u>>v>>w;
	    gr[u].pb({v,w});
	    gr[v].pb({u,w});
	    
	}
	cl[1]= 0;
	for(i=1; i<=n; i++)
	vis[i]= 0;
	
	vis[1]= 1;
	dfs(1);
	
	for(i=1; i<=n; i++)
	cout<<cl[i]<<endl;
    return 0;
}























Measured memory_bytes: 13952
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"-----------"<<endl;
#define ll long long
#define P pair<int,int>
#define mk make_pair
#define en endl
#define RE return 0
#define int ll

// A

signed main(){
  int n,i;
  cin>>n>>i;
  if(n==1){
    cout<<1<<en; RE;
  }else{
    cout<<n-i+1<<en; RE;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int w,h,x,y,r;
	scanf("%d",&w);
	scanf("%d",&h);
	scanf("%d",&x);
	scanf("%d",&y);
	scanf("%d",&r);
	if(x>=r && y>=r && (x+r)<=w && (y+r)<=h)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 580
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map(String::toInt)
    val a = Array<Int>(n){i -> i + 1}
    var count = 0
    for (i in 0..n-1) {
        if (a[i] - p[i] != 0) {
            count++
        }
    }
    if (count == 0 || count == 2) println("YES") else println("NO")
}

Measured memory_bytes: 37596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, r, d;
	stack<int> ans;

	cin >> N;
	d = N;

	if (d == 0) ans.push(0);

	while (d != 0) {
		if (d < 0) {
			r = (-d) % 2;
			d = (-d + 1) / 2;
		}
		else {
			r = d % 2;
			d = (d / 2) * (-1);
		}

		ans.push(r);
	}

	while (!ans.empty()) {
		cout << ans.top();
		ans.pop();
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <sstream>
using namespace std;

#define x first
#define y second
#define pb push_back
#define mp make_pair
#define FOR(i, l, r) for (int (i) = (l); (i) < (r); ++(i))
#define REP(i, n) FOR((i), 0, (n))


int n;
int h, w, d;
int A[333][333];
int go[333*333];
int L, R;
pair<int, int> pos[333*333];

int main() {
	ios::sync_with_stdio(false);
	cin >> h >> w >> d;
	REP(i, h) REP(j, w){
		cin >> A[i][j];
		A[i][j]--;
		pos[A[i][j]] = mp(i, j);
	}

	go[0] = 0;
	REP(i, h * w) {
		int j = i + d;
		if (j >= h * w) break;
		int xj = pos[j].x;
		int yj = pos[j].y;

		int xi = pos[i].x;
		int yi = pos[i].y;

		go[j] = go[i] + abs(xi-xj)+abs(yi-yj);
	}

	int q;
	cin >> q;
	REP(t, q) {
		cin >> L >> R;
		L--; R--;
		int res = go[R] - go[L];
		cout << res << endl;
	}
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

  ll n, m; cin >> n >> m;
  ll x = 1900*m + 100*(n-m);
  ll p = pow(2, m);

  cout << x * p << endl;

  return 0;
}


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

int main()
{
    int n;
    cin>>n;
    int b[n-1];
    rep(i,n-1)cin>>b[i];
    int ans=b[0]+b[n-2];
    rep(i,n-2)ans+=min(b[i],b[i+1]);
    cout<<ans<<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;

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

const int mod = 1000000007;

class mint {
  ll x;

 public:
  constexpr mint(ll x = 0) : x((x % mod + mod) % mod) {}
  constexpr mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr mint& operator-=(const mint& a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr mint& operator*=(const mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  constexpr mint& operator/=(const mint& a) { return *this = *this * a.inv(); }
  constexpr mint operator+(const mint& a) const {
    mint r(*this);
    return r += a;
  }
  constexpr mint operator-(const mint& a) const {
    mint r(*this);
    return r -= a;
  }
  constexpr mint operator*(const mint& a) const {
    mint r(*this);
    return r *= a;
  }
  constexpr mint operator/(const mint& a) const {
    mint r(*this);
    return r /= a;
  }
  constexpr mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  constexpr mint inv() const { return pow(mod - 2); }

  friend ostream& operator<<(ostream& os, const mint& m) {
    os << m.x;
    return os;
  }
};

int main() {
  ll n;
  cin >> n;
  mint eight = 1;
  mint nine = 1;
  mint ten = 1;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (n == 2) {
    cout << 2 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    eight *= 8;
    nine *= 9;
    ten *= 10;
  }
  mint ans = ten + eight - nine * 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
const ll M = 1000000007;

int main () {
  int N;
  ll A, B;
  ll h[100010];
  cin >> N >> A >> B;
  for (auto i = 0; i < N; ++i) {
    cin >> h[i];
  }
  ll ub = M;
  ll lb = 0;
  ll base = B;
  ll add = A - B;
  while (ub - lb > 1) {
    ll t = (ub + lb) / 2;
    ll death = base * t;
    ll need = 0;
    for (auto i = 0; i < N; ++i) {
      if (h[i] <= death) {
        continue;
      } else {
        ll nokori = h[i] - death;
        need += (nokori + (add - 1)) / add;
      }
    }
    if (need <= t) {
      ub = t;
    } else {
      lb = t;
    }
  }
  cout << ub << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main()
{
    int n;
    cin >> n;

    int t = n % 10;

    string ans;
    if(t == 2 || t == 4 || t == 5 || t == 7 || t == 9) {
        ans = "hon";
    } else if(t == 0 || t == 1 || t == 6 || t == 8) {
        ans = "pon";
    } else {
        ans = "bon";
    }

    cout << ans << endl;

    return 0;
}

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


int main()
{
	int N;
	cin>>N;
	vector<vector<int>> A(2,vector<int>(N));
	rep(i,N)cin>>A[0][i];
	rep(i,N)cin>>A[1][i];
	vector<vector<int>> dp(2,vector<int>(N,0));
	dp[0][0]=A[0][0];
	rep(i,2)
	{
		rep(j,N)
		{
			if(i-1>=0)dp[i][j]=max(dp[i][j],dp[i-1][j]+A[i][j]);
			if(j-1>=0)dp[i][j]=max(dp[i][j],dp[i][j-1]+A[i][j]);
		}
	}
	cout<<dp[1][N-1]<<endl;
	return 0;
}

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

using namespace std;

int main(){
    int n,score[101],sum;
    while(cin >>n && n>0){
        for(int i=0; i<n; i++){
            cin >>score[i];
        }
        sort(score,score+n);
        sum = 0;
        for(int i=1; i<n-1; i++){
            sum += score[i];
        }
        cout << sum/(n-2) << endl;
    }
    return 0;
}


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

signed main() {
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for(int i=0; i<N; i++) cin >> L[i];

  int ans = 0, d = 0;
  for(int i=0; i<=N; i++) {
    if(d <= X) ans++;
    d += L[i];
  }
  cout << ans << endl;
}


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

#define ll long long

using namespace std;

int n;
int c1, c2, c3;
double dp[301][301][301];
bool used[301][301][301];

double go(int a, int b, int c) {
	if (a == b && b == c && c == 0) return 0;
	if (used[a][b][c]) return dp[a][b][c];
	used[a][b][c] = 1;
	double &res = dp[a][b][c];
	res = 1;
	if (a > 0)
		res += 1.0 * a / n * go(a - 1, b, c);
	if (b > 0)
		res += 1.0 * b / n * go(a + 1, b - 1, c);
	if (c > 0)
		res += 1.0 * c / n * go(a, b + 1, c - 1);
	res *= (1.0 * n / (a + b + c));
	return res;
}

main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int x;
		scanf("%d", &x);
		if (x == 1) c1++;
		else if (x == 2) c2++;
		else c3++;
	}
	cout << fixed << setprecision(15) << go(c1, c2, c3);
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
const long long INF = 1LL<<60;
const long long mod=1e9+7;

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> A(M);
    REP(i, M) cin >> A[i].second >> A[i].first;
    sort(A.begin(), A.end());

    int res = -1;
    int ans = 0;
    REP(i,M){
        if(A[i].second >= res){
            res = A[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <set>
#include <map>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)

using namespace std;
typedef long long ll;

int main(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    cout<<(H-h)*(W-w)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=998244353;
const int N=8010, M=205, LOG=14, NN=(1<<LOG);

ll n, m, k, u, v, x, y, t, a, b, ans;
ll F[N], I[N], A[NN], B[NN];
int rev[NN];
ll dp[M][N];

ll powmod(ll a, ll b){
	ll res=1;
	for (; b; b>>=1, a=a*a%mod) if (b&1) res=res*a%mod;
	return res;
}
ll nCr(ll n, ll r){
	if (r<0 || r>n) return 0;
	return F[n]*I[r]%mod*I[n-r]%mod;
}
inline void NTT(ll *A, bool inv){
	for (int i=1; i<NN; i++) if (rev[i]<i) swap(A[rev[i]], A[i]);
	for (int ln=1; ln<NN; ln<<=1){
		ll wn=powmod(3, mod/ln/2);
		if (inv) wn=powmod(wn, mod-2);
		for (int i=0; i<NN; i+=2*ln){
			ll w=1;
			for (int j=i; j<i+ln; j++){
				ll a=A[j], b=A[j+ln]*w;
				A[j]=(a+b)%mod;
				A[j+ln]=(a-b)%mod;
				w=w*wn%mod;
			}
		}
	}
	if (inv){
		ll invn=powmod(NN, mod-2);
		for (int i=0; i<NN; i++) A[i]=A[i]*invn%mod;
	}
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	F[0]=1;
	for (int i=1; i<N; i++) F[i]=F[i-1]*i%mod;
	I[N-1]=powmod(F[N-1], mod-2);
	for (int i=N-1; i; i--) I[i-1]=I[i]*i%mod;
	for (int i=1; i<NN; i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<(LOG-1));
	
	cin>>n>>m;
	for (int j=0; j<=n; j++) B[j]=I[j+2];
	NTT(B, 0);
	dp[0][0]=1;
	for (int i=1; i<=m; i++){
		memset(A, 0, sizeof(A));
		for (int j=0; j<=n; j++) A[j]=dp[i-1][j]*I[j]%mod;
		NTT(A, 0);
		for (int j=0; j<NN; j++) A[j]=A[j]*B[j]%mod;
		NTT(A, 1);
		for (int j=1; j<=n; j++) dp[i][j]=A[j]*F[j+2]%mod;
		for (int j=1; j<=n; j++) dp[i][j]=(dp[i][j] - dp[i-1][j]*(j+1))%mod;
	}
	for (int i=0; i<=m; i++) for (int j=0; j<=n; j++)
		ans=(ans + nCr(m, i)*nCr(n, j)%mod*dp[i][j])%mod;
	if (ans<0) ans+=mod;
	cout<<ans<<"\n";
	
	return 0;
}


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

int main(){
  long int ans,N,i,k;
  
  cin>>N;
  ans=N;
  k=int(sqrt(N));

  
  for(i=1;i<=(k+1);i++){
    if(N%i==0){
      		if(ans>(i-1)+(N/i)-1){
              	ans=(i-1)+(N/i)-1;
            }
	    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
//alds1_2_a.cpp

int bubbleSort(int A[], int N) {
	int sw = 0;
	bool flag = 1;
	for ( int i = 0; flag; i++) {
		flag = 0;
		for (int j = N -1; j >= i+1; j--) {
			if(A[j] < A[j - 1]) {
				swap(A[j], A[j-1]);
				flag = 1;
				sw++;
			}
		}
	}
	return sw;
}

int main() {
	int A[100], N, sw;
	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i];
	
	sw = bubbleSort(A, N);
	
	for ( int i = 0; i < N; i++) {
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
	
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 5000000000000000;
constexpr auto MOD = 1000000007;



int main() {

	int r;
	cin >> r;

	cout << r*r<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define     inf                 LONG_LONG_MIN
#define     INF                 LONG_LONG_MAX

#define     forn(i,ii,n)        for(int i=ii; i<=n; ++i)
#define     ford(i,n,ii)        for(int i=n; i>=ii; --i)
#define     pb                  push_back
#define     eb                  emplace_back
#define     sz(xx)              (int) xx.size()
#define     mk                  make_pair
#define     mem(x,v)            memset(x,v,sizeof x)
#define		clr(xx)				xx.clear()
#define		ff 					first
#define		ss 					second
#define		all(x)				x.begin(),x.end()
#define		nl 					cout << endl
#define     kase(x)             cout << "Case " << x <<": "
#define     fastt               ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     dbg(args...)        do {   cerr << #args << ' ' ;  print(args); } while(0); cerr<< endl ;
 
template< typename T > void print(const T& v) {    cerr << v << ' ' ;}
template< typename T1, typename... T2 > void print( const T1& first, const T2&... rest ){ print(first); print(rest...) ;}

/*typedef*/
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<ull> vul;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef priority_queue <pii, vector<pii>, greater<pii> > pq;	///for djkstra
/*typedef ends*/

const int maxn=2005;
int n;
pii a[maxn];
ll dp[maxn][maxn];
ll DP(int id, int left, int right)
{
    if(id>=n) return 0;
    ll &ret = dp[id][left];
    if(ret != -1) return ret;
    ll x = a[id].ff;
    int pos = a[id].ss;
    ret = max(x*(abs(pos-left))+DP(id+1,left+1,right),x*abs(pos-right)+DP(id+1,left,right-1));
    // dbg(ret);
    return ret;
}

int main()
{
    //  freopen("in.txt", "r", stdin);
    //  freopen("out.txt", "w", stdout);

    fastt;
    cin>>n;
    forn(i,0,n-1) cin>>a[i].ff, a[i].ss=i;
    sort(a,a+n,[&](const pii& x, const pii& y){return (x.ff==y.ff) ? x.ss<y.ss : x.ff>y.ff;});
    mem(dp,-1);
    cout << DP(0,0,n-1);

	return 0;
}

Measured memory_bytes: 35236
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

// warshall_floyd
// dは隣接行列(long long intを使うこと)
void warshall_floyd(vector<vector<long long int>> &d) {
    long long int n = d.size();
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (d[i][k] == LLONG_MAX || d[k][j] == LLONG_MAX) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

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

int main() {
    int n, m, s;
    cin >> n >> m >> s;
    vector<int> r(s);
    for (int i = 0; i < s; i++) {
        cin >> r[i];
        r[i]--;
    }
    vector<vector<lint>> d(n, vector<lint>(n, LLONG_MAX));
    for (int i = 0; i < m; i++) {
        lint a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        chmin(d[a][b], c);
        chmin(d[b][a], c);
    }
    for (int i = 0; i < n; i++) d[i][i] = 0;
    warshall_floyd(d);
    vector<int> perm(s);
    for (int i = 0; i < s; i++) perm[i] = i;
    lint ans = LLONG_MAX;
    while (1) {
        lint cand = 0;
        for (int i = 0; i < s - 1; i++) cand += d[r[perm[i]]][r[perm[i + 1]]];
        chmin(ans, cand);
        if (!next_permutation(perm.begin(), perm.end())) break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512