akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
 
using namespace std;
                        
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
                        
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define ghost signed
#define left left228
#define right right228
#define complex complex228
#define count count228
#define sin sin228
#define list list228

const int N = 2002;

int a[N][N], f[N], gol[N], gor[N];

ghost main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			char cc;
			cin >> cc;
			if (cc == '.') a[i][j] = 0;
			else a[i][j] = 1;
		}
	}
	int res = max(n, m);
	for (int row = 1; row <= n; ++row) {
		for (int i = 1; i < m; ++i) {
			if ((a[row][i] ^ a[row - 1][i]) == (a[row][i + 1] ^ a[row - 1][i + 1])) ++f[i];
			else f[i] = 1;
		}
		for (int i = 1; i < m; ++i) {
			gor[i] = m;
			gol[i] = 0;
		}
		vector<int> st;
		for (int i = 1; i < m; ++i) {
			while (!st.empty() && f[i] < f[st.back()]) {
				gor[st.back()] = i;
				st.pop_back();
			}
			st.push_back(i);
		}
		st.clear();
		for (int i = m; i; --i) {
			while (!st.empty() && f[i] < f[st.back()]) {
				gol[st.back()] = i;
				st.pop_back();
			}
			st.push_back(i);
		}
		for (int i = 1; i < m; ++i) {
			uax(res, f[i] * (gor[i] - gol[i]));
		}
	}
	cout << res << '\n';
    return 0;
}
// kek ;
// Ого! Кажетсья это $#@!
 
 
 


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

int main() {
    int x, a;
    cin >> x >> a;

    int ans = 0;

    if(x >= a)
        ans = 10;

    cout << ans << endl;
}

Measured memory_bytes: 3616
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<climits>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<string.h>
#include<algorithm>
#include<unordered_map>
#pragma GCC optimize "trapv"
using namespace std;

#define ld long double
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(int i=a;i<b;i++)
#define pp pair<int,pair<int,int>>
#define ppp pair<pair<int,int>,pair<int,int>>

const ll M=1e9,N=2e3+2;

struct hash_pair{
	template <class T1, class T2>
	size_t operator()(const pair<T1, T2>& p) const{
		auto hash1 = hash<T1>{}(p.first);
		auto hash2 = hash<T2>{}(p.second);
		return hash1 ^ hash2;
	}
};

void sieve(){
	bool prime[N+1];
	memset(prime,true,sizeof(prime));
	for(ll p=2;p*p<=N;p++){
		if(prime[p] == true){
			for(ll i=p*p;i<=N;i+=p)
				prime[i] = false;
		}
	}
}

ll power(ll x,ll y,ll p){
	ll res = 1;
	x = x%p;
	while(y > 0){
		if(y&1)
			res = (res*x)%p;
		y = y>>1;
		x = (x*x)%p;
	}
	return res;
}

int root(int i,int A[]){
	while(A[i] != i){
		A[i] = A[A[i]];
		i = A[i];
	}
	return i;
}

void unite(int a,int b,int A[],int B[]){
	int c = root(a,A);
	int d = root(b,A);
	if(c == d)
		return;
	if(B[c] < B[d]){
		A[c] = d;
		B[d] += B[c];
	}
	else{
		A[d] = c;
		B[c] += B[d];
	}
}

inline ll in()
{
	ll n=0;
	bool check=0;
	register char c=getchar();
	while(c<'0' || c>'9')
	{
		if(c=='-')
			check=1;
		c=getchar();
	}
	while(c>='0' && c<='9')
	{
		n = (n<<1)+(n<<3)+c-'0';
		c=getchar();
	}
	return n-2*n*check;
}

string ip()
{
    string i="";
    int temp=getchar();
    while(temp<'a'||temp>'z')
        temp=getchar();
    while(temp>='a'&&temp<='z')
    {
        i+=(char)temp;
        temp=getchar();
    }
    return i;
}

vector<int> V[N];
bool B[N];
int A[N],D[N];

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


	int n,x,y,a;
	cin>>n>>x>>y;
	for(int i=1;i<n;i++){
		V[i].push_back(i-1);
		V[i-1].push_back(i);
	}
	x--,y--;
	V[x].push_back(y);
	V[y].push_back(x);
	memset(A,0,sizeof(A));
	for(int i=0;i<n;i++){
		memset(B,0,sizeof(B));
		memset(D,0,sizeof(D));
		queue<int> Q;
		D[i] = 0;
		B[i] = true;
		Q.push(i);
		while(Q.size()){
			a = Q.front();
			Q.pop();
			for(auto x: V[a]){
				if(B[x] == false){
					B[x] = true;
					D[x] = D[a]+1;
					A[D[x]]++;
					Q.push(x);
				}
			}
		}
	}
	for(int i=1;i<n;i++)
		cout<<A[i]/2<<"\n";

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d ",n)
#define out(n) printf("%d\n",n)
#define llin(a) cin >> a
#define llpr(a) cout << a << " "
#define llout(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define DEBUG(x) cout << #x << " : " << x << endl;
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define M 1000000007
#define N 50005
typedef long long int ll;
int main()
{
    int a,b,c;
    in3(a,b,c);
    a-=b;
    c-=a;
    out(max(c,0));
}
// read the constraint properly (ll vs int)


Measured memory_bytes: 764
package main

import (
	"fmt"
)

// 10000i + 5000j + 1000k = Y, i + j + k = N
func main() {
	var N, Y int
	fmt.Scan(&N, &Y)
	ansi := -1
	ansj := -1
	ansk := -1
	for i := 0; i <= N; i++ {
		for j := 0; j <= N-i; j++ {
			k := N - i - j
			if 10000*i+5000*j+1000*k == Y {
				ansi = i
				ansj = j
				ansk = k
				break
			}
		}
	}
	fmt.Println(ansi, ansj, ansk)
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
 int n;
 cin>>n;
 string s[n];
 cin>>s[0];
 for(int i=1;i<n;i++){
  cin>>s[i];
  if(s[i][0]!=s[i-1][s[i-1].size()-1]){
   cout<<"No"<<endl;
   return 0;
  }
  for(int j=i-1;j>=0;j--){
   if(s[i]==s[j]){
    cout<<"No"<<endl;
    return 0;
   }
  }
 }
 cout<<"Yes"<<endl;
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    string s; cin >> s; unsigned long long k; cin >> k;
    int idx = 0; for (; idx < s.length() && s[idx] == '1'; ++idx); ++idx;
    cout << (k < idx ? '1' : s[idx-1]);
    return 0;
}

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

int main() {
	int N;
	int P[10];

	cin >> N;
	for (int i = 0; i < N; ++i) cin >>P[i];
	int res = 0;

	sort(P, P + N, greater<int>());

	P[0] /= 2;

	for (int i = 0; i < N; ++i) res += P[i];
	cout << res << endl;
}
	



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  vector<vector<int>>G(N);
  for(int i=0;i<M;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  
  vector<int>dist(N,0);
  queue<int> que;
  dist[0]=0;
  que.push(0);
  vector<int> happy(N,0);
  while(!que.empty()){
    auto v=que.front();
    que.pop();
    for(auto next_v:G[v]){
      if(dist[next_v]!=0)continue;
      dist[next_v]=dist[v]+1;
      happy[next_v]=v;
      que.push(next_v);
    }
  }
  for(int i=1;i<N;i++){
    if(dist[i]==0){
    cout<<"No"<<endl;
    return 0;
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<N;i++){
    cout<<happy[i]+1<<endl;
  }
  
}

Measured memory_bytes: 10548
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var inputStr = retreiveStringArray();

			var S = inputStr[0];
			var M = inputStr[1];

			var ans = string.Empty;
			for (int i = 0; i < N; i++) {
				ans += S[i];
				ans += M[i];
			}

			//答えの出力
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll n,m;
string a[100],b[100];

int main(){
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    bool flag = false;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(a[i][j] == b[0][0]){
                flag = true;
                for(int k = 0; k < m; k++){
                    for(int l = 0; l < m; l++){
                        ll a_i = i+k;
                        ll a_j = j+l;
                        if(a_i > n || a_j > n){
                            flag = false;
                            break;
                        }
                        if(a[a_i][a_j] != b[k][l]){
                            flag = false;
                            break;
                        }  
                    }
                }
                if(flag){
                    cout << "Yes\n";
                    return 0;
                }
            }
        }
    }
    cout << "No\n";
}

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

using namespace std;

int N,sum=0;

struct Q{
	int a,b;
};
Q A[200010];

bool cmp(Q x,Q y)
{
	return x.b<y.b;
}

int main()
{
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>A[i].a>>A[i].b;
	}
	sort(A+1,A+N+1,cmp);
	for(int i=1;i<=N;i++)
	{
		sum+=A[i].a;
		if(sum>A[i].b)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30);
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
struct UnionFind {
    vector<int> par, siz;
    UnionFind(int n) {
        par.resize(n);
        siz.resize(n, 1);
        for(int i = 0; i < n; i++)
            par[i] = i;
    }
    int find(int x) {
        if(par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }
    bool unite(int u, int v) {
        u = find(u), v = find(v);
        if(u == v)
            return false;
        if(siz[u] < siz[v])
            swap(u, v);
        par[v] = u;
        siz[u] += siz[v];
        return true;
    }
    bool same(int u, int v) { return find(u) == find(v); }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for(int i = 0; i < m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        --x;
        --y;
        uf.unite(x, y);
    }
    set<int> st;
    for(int i = 0; i < n; i++) {
        st.insert(uf.find(i));
    }
    cout << st.size() << endl;
}


Measured memory_bytes: 5760
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
unsigned long long int a = 0, b = 0, c = 0,d=0,e=0, ans = 0, x = 0, y = 0, z = 0, n = 0, m = 0, maxy = 0, mini = 9999, counter = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100001], sec[100001];
long long int iremono2[100001], check[100001];
std::vector<std::string>kinds{}, kaku{};
char maze[1000][1000];
int sx, sy;
int gx, gy;

int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
std::string output, output2, input, input2;
char rev[100001];
int starta, startb, enda, endb,ab;


unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

int H, W;//はんい

int main()
{
	cin >> a>>b>>c;
	x = c;
	rep(i, 10) {
		x *= a;
		x -= b;
		cout << x << endl;
	}
}


Measured memory_bytes: 256
A, B = map(int, input().split())

coin = 0

def get_coin(coin, A, B):
    if A >= B:
        coin += A
        A -= 1
    else:
        coin += B
        B -= 1
    return coin, A, B

for _ in range(2):
    coin, A, B = get_coin(coin, A, B)

print(coin)

Measured memory_bytes: 38384
N, M, S, T = gets.split.map(&:to_i)
uvab_list = M.times.map { gets.split.map(&:to_i) }
MONEY = 10 ** 15
yen_graph = Array.new(N) { Array.new }
snuke_graph = Array.new(N) { Array.new }
uvab_list.each do |(u, v, a, b)|
  u -= 1
  v -= 1
  yen_graph[u].push([v, a])
  yen_graph[v].push([u, a])
  snuke_graph[u].push([v, b])
  snuke_graph[v].push([u, b])
end

def dijkstra(s, graph)
  d_list = Array.new(graph.size, 1 << 60)
  d_list[s] = 0
  queue = [[s, 0]]
  while !queue.empty?
    v, d = queue.shift
    next if d > d_list[v]
    graph[v].each do |(u, c)|
      if d_list[u] > d_list[v] + c
        d_list[u] = d_list[v] + c
        queue.push([u, d_list[u]])
      end
    end
  end
  d_list
end

yen_cost_list = dijkstra(S - 1, yen_graph)
snuke_cost_list = dijkstra(T - 1, snuke_graph)
cost_list = yen_cost_list.zip(snuke_cost_list).map { |y, s| y + s }
ans_list = Array.new(N)
ans_list[N - 1] = MONEY - cost_list[N - 1]
(N - 2).downto(0).each do |i|
  n = MONEY - cost_list[i]
  ans_list[i] = if n > ans_list[i + 1]
    n
  else
    ans_list[i + 1]
  end
end
ans_list.each { |ans| puts ans }


Measured memory_bytes: 63728
#include <bits/stdc++.h>
using namespace std;
//atcoder 146 c
int main()
{
  int n;
  cin >> n;
  vector<int> A(n),ans(n,0);
  for(int& e:A)cin >> e;
  sort(begin(A),end(A));
  for(int i=1,l=1;l<n;i++){
    for(int k=l,m=0;A[k]==i;k++){
      m++;
      ans[i-1]=m;
      l++;
    }
  }

  for(int i=0;i<n;i++)cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
int  pow(int x,int n) {int res=1; while(n){if(n&1) res=(res*x);x=(x*x);n>>=1;}return res;}
 struct activity {
 	int A, B, C;
 };

 int solve(struct activity *arr, int n){
 	int dp[n+1][3]={0};

 	dp[1][1]=arr[1].A;
 	dp[1][2]=arr[1].B;
 	dp[1][3]=arr[1].C;
 	for(int i=2;i<=n;i++){
 		dp[i][1]= arr[i].A + max(dp[i-1][2], dp[i-1][3]);
 		dp[i][2]= arr[i].B + max(dp[i-1][1], dp[i-1][3]);
 		dp[i][3]= arr[i].C + max(dp[i-1][1], dp[i-1][2]);
 	}

 	return max(dp[n][1], max(dp[n][2], dp[n][3]));
 }
int32_t main()
{
	//paawan9s
	FIO;
	int n; cin>>n;
	mk(arr, n+1, struct activity );
	for(int i=1;i<=n;i++){
		cin>>arr[i].A;
		cin>>arr[i].B;
		cin>>arr[i].C;
	}

	cout<< solve(arr, n);


	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int A,B;
    int C,D;
    cin>>A>>B>>C>>D;
    int ans = 0;
    for (int i=A;i<=B;i++) {
        if (i>=C && i<=D) ans++;
    }
    if (ans != 0) ans--;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  ll a, b, n, s = 0, t;
  cin >> a >> b >> n;
  if(b - 1 <= n) {
    s = floor((double)(a * (b - 1)) / b);
  }
  t = floor((double)(a * n) / b) - a * floor((double)n / b);
  cout << max(s, t) << endl;
  return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 998244353;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> D(N);
	ll ans = 1;
	for(int i=0;i<N;i++)cin >> D[i];
	ll last =1;
	ll ld = 0;
	if(D[0]!=0){
		cout << 0 << endl;
		return 0;
	}else{
		sort(ALL(D));
		for(int i=1;i<N;i++){
			ll cnt = 1;
			if(D[i]==0|| (ld+1)!=D[i]){
				cout << 0 << endl;
				return 0;
			}else{
				ld = D[i];
				while(i<N&&D[i]==D[i+1]){
					cnt++;
					i++;
				}
				for(int i=0;i<cnt;i++){
					ans *= last;
					ans %= mod;
				}
			}
			last = cnt;
		}
	}
	cout << ans%mod << endl;
}

Measured memory_bytes: 640
import bisect
from collections import deque
N=int(input())
a=[int(input()) for _ in range(N)]
d=deque()

for i in range(N):
    p=bisect.bisect_left(d, a[i])
    #print(a[i], p, d)
    if p==0:
        d.appendleft(a[i])
    else:
        d[p-1]=a[i]
print(len(d))

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

#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const int max_n = 1000011, inf = 1000111222, mod = 1000000007;

char c[max_n];
int cnt[30];

int main() {
    //freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    scanf("%s", c);
    for (int i = 0; i < n; ++i) {
        ++cnt[c[i] - 'a'];
    }
    int ans = 1;
    for (int i = 0; i < 30; ++i) {
        if (cnt[i] == 0) continue;
        ans = (1LL * ans * (cnt[i] + 1)) % mod;
    }
    cout << (1LL * ans + mod - 1) % mod << endl;
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  ll x;
  cin >> x;
  int t = (int)((-1 + sqrt(1 + 8 * x)) / 2.0);
  while (t * (t + 1) < 2 * x) t++;
  cout << t << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N;
long long C[200005];

#define DIV 1000000007

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

int main(){
	cin >> N;
	rep(i, N) cin >> C[i];
	sort(C, C + N);

	long long ans = 0;
	rep(i, N) {
		long long upper = i;
		long long lower = N - i - 1;
		//lowerのそれぞれのbitについて何回立つか + 自分自身の分
		long long tmp = (lower * modpow(2, lower - 1))%DIV + modpow(2, lower) %DIV;
		tmp %= DIV;
		tmp *= C[i];
		tmp %= DIV;
		tmp *= modpow(2, upper);
		//コスト
		ans += tmp;
		ans %= DIV;
	}
	ans *= modpow(2, N);
	ans %= DIV;
	cout << ans << endl;
}


Measured memory_bytes: 5160
function Main(input) {
  var inp = input.split('\n');

  var tate = Math.floor(inp[0]);
  var yoko = Math.floor(inp[1]);
  var kuro = Math.floor(inp[2]);
  
  var ans = 0;
  
  if (tate > yoko) {
    ans = Math.ceil(kuro / tate);
  } else {
    ans = Math.ceil(kuro / yoko);
  }
  
  console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2



//Segtree
ll def = 0;
const int MAX_N = 1 << 18;
ll n, dat[2 * MAX_N - 1];

ll comp(ll a, ll b) {
	return max(a, b);
}

void init(ll n_) {
	n = 1;
	while (n < n_) {
		n *= 2;
	}
	rep(i, 0, 2 * n - 1)dat[i] = 0;
}
void update(ll k,ll a) {
	k += n - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = comp(dat[2*k+1],dat[2*k+2]);
	}
}
ll query(ll a,ll b,ll k,ll l,ll r){
	if (r <= a || b <= l)return def;
	if (a <= l && r <= b)return dat[k];
	else {
		ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
		ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
		return comp(vl, vr);
	}
}
ll get(ll a,ll b) {
	return query(a,b+1,0,0,n);
}
//endSegtree


int main(){
	ll N;
	cin >> N;
	init(N);
	vector<ll>H(N);
	vector<ll>A(N);
	rep(i, 0, N) {
		cin >> H[i];
		H[i]--;
	}
	rep(i, 0, N)cin >> A[i];

	rep(i, 0, N) {
		ll opt = get(0,H[i])+A[i];
		update(H[i],max(get(H[i],H[i]),opt));
	}
	cout << get(0,1<<18) << endl;

	return 0;
}


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

class Cube{
public:
  int f[6];
  Cube(){}
  void roll_z(){ roll(1, 2, 4, 3);}
  void roll_y(){ roll(0, 2, 5, 3);}
  void roll_x(){ roll(0, 1, 5, 4);}
  void roll(int i, int j, int k, int l){
  	int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
  }
};

bool eq( Cube c1, Cube c2 ){
  for ( int i = 0; i < 6; i++ )
    if ( c1.f[i] != c2.f[i] ) return false;
  return true;
}

bool equal( Cube c1, Cube c2 ){
  for ( int i = 0; i < 6; i++ ){
  	for ( int j = 0; j < 4; j++ ){
  	  if ( eq(c1, c2) ) return true;
  	  c1.roll_z();
  	}
    if ( i % 2 == 0 ) c1.roll_y();
    else c1.roll_x();
  }
  return false;
}

int main(){
  int n;
  cin >> n;
  Cube c[n];
  
  for ( int i = 0; i < n; i++ ){
  	for ( int j = 0; j < 6; j++ ) cin >> c[i].f[j];
  }
  
  int cnt = 0;
  while(1){
  	if ( n - cnt == 1 ) break;
  	for ( int i = cnt + 1; i < n; i++ ){
  	  if ( equal(c[cnt], c[i]) ){
  	  	cout << "No" << endl;
  	  	return 0;
  	  }
  	}
  	cnt++;
  }
  
  cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, x;
  cin >> n >> x;
  vi m(n);
  rep(i,n) cin >> m[i];
  int ans = n + (x-suma(m))/(*min_element(rng(m)));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

// Most important thing in CP - Have Fun :)

void solve(){
	//write here
   ll n,d;
   cin>>n>>d;
   int count = 0;
   ll x,y;
   rep(i,0,n){
       cin>>x>>y;
       if (x*x + y*y<= d*d)count++;
   }
   cout<<count<<endl;
}

int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(false);
	//insert code
	
		solve();
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


long long func( long long a, long long b, long long p ) {
    if ( b == 0 ) {
        return 1;
    }
    else if ( b%2 == 0 ) {
        long long temp = func( a, b/2, p );
        return (temp * temp)%p;
    }
    else {
        return ( func( a, b-1, p ) * a ) % p;
    }   
}
 
long long M[200001];
long long D[200001];


long long Comb( int n, int r ) {
    return (((M[n]*D[r])%MOD)*D[n-r])%MOD;
}
 

int main() {
    

    M[0] = 1;
    for ( long long i = 1; i <= 200000; i++ ) {
        M[i] = (M[i-1]*i)%MOD;
    }
    D[0] = 1;
    for ( long long i = 1; i <= 200000; i++ ) {
        D[i] = (D[i-1]*func( i, MOD-2, MOD ))%MOD;
    }

    int N;
    long long M;
    cin >> N >> M;

    int A[100000] = {0};

    vector<int> P;

    for ( int i = 2; i < 100000; i++ ) {
        if ( A[i] ) { continue; }

        P.push_back(i);
        for ( int j = i*2; j < 100000; j+= i ) {
            A[j] = 1;
        }
    }

    vector<int> X;

    for ( int i = 0; i < P.size(); i++ ) {

        int cnt = 0;
        while ( (M%P[i]) == 0 ) {

            M /= P[i];
            cnt++;
        }
        if ( cnt ) { X.push_back(cnt); }

    }

    if ( M != 1 ) { X.push_back(1); }

    long long ans = 1;

    for ( int i = 0; i < X.size(); i++ ) {
        ans *= Comb( X[i]+N-1, N-1 );
        ans %= MOD;
    }


    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <queue>
#include <cctype>
#include <climits>
#include <stack>
using namespace std;
   
  
   
int main(){
   

	vector<double> xs,ys;
	double x,y;	
	while(scanf("%lf,%lf",&x,&y)!=EOF){
		 xs.push_back(x);
		 ys.push_back(y);
	}

	xs.push_back(xs[0]);
	ys.push_back(ys[0]);

	double res=0;
	for(int i=0;i<xs.size()-1;i++){
		res+=(xs[i]-xs[i+1])*(ys[i]+ys[i+1]);
	} 

	printf("%.10f\n",abs(res/2.0));

}

Measured memory_bytes: 3188
#include<stdio.h>
int main(){
    int n;
    double a[101];
    scanf("%d",&n);
    int i;
    for(i=1;i<=n;i++){
        scanf("%lf",&a[i]);
    }
    double mot=0;
    for(i=1;i<=n;i++){
        mot = mot +1/a[i];
    }
    printf("%lf\n",1/mot);
    return 0;
}

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

using ll=long long; 

void solve(){
	int n;
	cin>>n;
	for(int i=1; i<10; i++){
		for(int j=1; j<10; j++){
			if(i*j==n){
				cout<<"Yes"<<endl;
				return;
			}
		}
	}	
	cout<<"No"<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
N = 26
d = int(input())
c = list(map(int,input().split()))
s = [[] for i in range(d)]
for i in range(d):
    line = list(map(int,input().split()))
    s[i] = line
cost_list = [0 for i in range(N)]
#print(c)
#print(s)

last_di = [0 for i in range(N)]

def todays_cost(day,contest):
    cost = 0
    for i in range(N):
        cost += c[i] * (day - last_di[i])
    cost -= c[contest - 1] * (day - last_di[contest - 1])
    cost -= s[day - 1][contest - 1]
    return  - cost 

def greedy():
    m = 0
    for i in range(d):
        for j in range(N):
            cost_list[j] = todays_cost(i,j)
        max_value = max(cost_list)
        max_index = cost_list.index(max_value)
        last_di[max_index] = i 
        m += max_value
        print(max_index + 1)

greedy()
#print(m)


Measured memory_bytes: 9408
c = input()
moji = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ans = 0
for i in range(25):
  if c == moji[i]:
    ans = i + 1
print(moji[ans])

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

#define watch(x) cout << (#x) << " is " << (x) << endl
#define fr(i,n) for(int i=0; i<n; i++)
#define rep(i, st, en) for(int i=st; i<=en; i++)
#define repn(i, st, en) for(int i=st; i>=en; i--)
#define sq(a) (a*a)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int mod = 1e9+7;

vector<vector<int>> g;
vector<pii> dp;
int n;

void add_self(int &a, int b){
    a += b;
    if(a >= mod) a -= mod;
}

void mul_self(int &a, int b){
    ll z = 1ll*a*1ll*b;
    if(z >= mod) z %= mod;
    a = z;
}

void dfs(int v, int p){
    pii &z = dp[v];

    int cnt = 0;
    int prod[2] = {1, 1};
    for(auto u: g[v]){
        if(u == p) continue;
        dfs(u, v);
        cnt++;  /// child count
        mul_self(prod[0], dp[u].second);
        mul_self(prod[1], dp[u].first + dp[u].second);
    }

    z = make_pair(prod[0], prod[1]);
}

void solve(){
    int u, v;
    cin>>n;
    g.resize(n);
    dp.resize(n, {0, 0});
    /// dp[i].first = no. of valid subtrees with vertex i set to black
    /// dp[i].second = no. of valid subtrees with vertex i set to white

    fr(i, n-1){
        cin>>u>>v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    auto sum = [&](pii z){
        add_self(z.first, z.second);
        return z.first;
    };

    dfs(0, 0);
    cout<<sum(dp[0]);
}

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

    ll t = 1;
    //  cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 13440
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> v(n), S(n+1);
    for (auto &&i : v) scanf("%lld", &i);
    sort(v.begin(),v.end());
    for (int i = 0; i < n; ++i) {
        S[i+1] = S[i] + v[i];
    }
    ll ng = 0, ok = INF<ll>;
    while(ok - ng > 1){ // X以下である握手値がM個以下であるうちのX
        ll mid = (ok + ng)/2;
        ll val = 0;
        for (int i = 0; i < n; ++i) {
            val += v.end() - lower_bound(v.begin(),v.end(), mid-v[i]);
        }
        if(val <= m) ok = mid;
        else ng = mid;
    }
    ll ans = 0, cnt = 0;
    for (int i = 0; i < n; ++i) {
        int a = lower_bound(v.begin(),v.end(), ok-v[i]) - v.begin();
        cnt += n-a;
        ans += (S[n] - S[a])+v[i]*(n-a);
    }
    cout << ans + (m-cnt)*(ok-1) << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

int main ()
{
  string s;
  cin >> s;

  vector<int> res(s.size(), 0);

  bool rFlag = true;
  int renzokuNum = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'R') {
      renzokuNum++; 
    } else {
      if (renzokuNum > 0) {
        res[i - 1]++;
        renzokuNum--;
        res[i - 1] += renzokuNum / 2;
        res[i] += (renzokuNum / 2) + (renzokuNum % 2);
      }
      renzokuNum = 0;
    }
  }

  renzokuNum = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'L') {
      renzokuNum++; 
    } else {
      if (renzokuNum > 0) {
        res[i + 1]++;
        renzokuNum--;
        res[i + 1] += renzokuNum / 2;
        res[i] += (renzokuNum / 2) + (renzokuNum % 2);
      }
      renzokuNum = 0;
    }
  }

  for (int i = 0; i < s.size(); i++) {
      cout << res[i] << " ";
  }
}


Measured memory_bytes: 1024
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, s:chars, t:chars};
    for i in 0..n {
        print!("{}", s[i]);
        print!("{}", t[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
from collections import defaultdict as dict

n, p = map(int, input().split())
s = input()
a = []
for x in s:
    a.append(int(x))

def solve():
    l = [0]*p
    ans = 0
    for x in a:
        l_ = [0] * p
        for i in range(p):
            l_[(i * 10 + x) % p] += l[i]
        l, l_ = l_, l
        l[x % p] += 1
        ans += l[0]

    print(ans)
if p <= 5:
    solve()
    exit()
x = 0
mem = dict(int)
mem[0] = 1
ans = 0
a.reverse()
d = 1
for y in a:
    x += d*y
    x %= p
    d = (d * 10) % p
    ans += mem[x]
    mem[x] += 1
    # print(mem)

print(ans)

Measured memory_bytes: 48588
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          Copyright                    */
#include<bits/stdc++.h>
using namespace std;
/// Pragmas:
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz(a) int((a).size())
#define rep(i,x,y) for(int i=x;i<y;i++)
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 400010;
const int mod = 1000000007;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 2000000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b % mod;
    int pwur = qpow(b,e>>1);
    return (pwur * pwur) % mod;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// My Code -------------------------------------------------

vi g[8];
bool vis[8];
int n,m,res;
void dfs(int x,int cnt){
    if(cnt==n){
        res++;
        return;
    }
    vis[x]=1;
    for(auto v:g[x]){
        if(!vis[v]){
            dfs(v,cnt+1);
            vis[v]=0;
        }
    }
}

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));
    //freopen("a.in","r",stdin);
    //freopen("a.in","w",stdout);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(1,1);
    cout<<res<<endl;

    return 0;
}


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

const int MOD = 1e9 + 7;







int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int Q; cin >> Q;
  priority_queue<LL> L; // large on top
  priority_queue<LL, vector<LL>, greater<LL>> R; // small on top
  LL Ls = 0, Rs = 0;
  LL B = 0;
  while (Q--) {
    LL t, a, b;
    cin >> t;
    if (t == 1) {
      cin >> a >> b;
      if (L.empty()) L.push(a), Ls += a;
      else if (a < L.top()) L.push(a), Ls += a;
      else if (R.empty()) R.push(a), Rs += a;
      else if (a > R.top()) R.push(a), Rs += a;
      else {
        assert(L.top() <= a and a <= R.top());
        L.push(a);
        Ls += a;
      }
      while (L.size() > R.size() + 1) 
        R.push(L.top()), Rs += L.top(), Ls -= L.top(), L.pop();
      while (R.size() > L.size()) 
        L.push(R.top()), Ls += R.top(), Rs -= R.top(), R.pop();
      B += b;
    }
    else {
      LL x = L.top();
      LL ans = x * L.size() - Ls + Rs - x * R.size() + B;
      cout << x << ' ' << ans << '\n';
    }
  }
}


Measured memory_bytes: 3828
import java.util.*;

class Main{
	public static void main(String args[]){
      Scanner in=new Scanner(System.in);
      int N=in.nextInt();
      int H[]=new int[N];
      
      for(int i=0;i<N;i++){
      	H[i]=in.nextInt();
      }
      
      int res=0;
      int curr=0;
      for(int i=1;i<N;i++){
      	if(H[i]<=H[i-1]){
          curr++;
        }
        else{
        	res=Math.max(res, curr);
            curr=0;
        }
      }  
      res=Math.max(res, curr);
      System.out.println(res);
      in.close();
    }
}

Measured memory_bytes: 50988
a = list(map(int, input().split()))
b = []
d = 0
    
for i in range(a[0] + 1):
    c = 0
    e = i
    sum = []
    while e != 0:
        sum.append(e % 10)
        e //= 10
    for j in sum:
            c += j
    if a[1] <= c <= a[2]:
            b.append(i)

for i in b:
    d += i
       
print(d)

Measured memory_bytes: 3292
#include <iostream>
using namespace std;
main(){
	int a,b,c;
	cin >> a>> b;
	if(a>=b)c=a;
	if(a<b)c=b;
	if(c<=8){
	cout << "Yay!"<<endl;
	}else{
	cout << ":("<<endl;
	}
	}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,f=0,n=10,o=1;
	while(scanf("%d %d",&a,&b)  != EOF)
	{
		o=1;f=0;
		a=a+b;
		while(o==1)
		{
			if(a / n)
			{
				f++;
				n=n*10;
				o=1;
			}
			else
			{
				printf("%d\n",f+1);
				o=0;n=10;
			}		
		}
	}
	return 0;
}

Measured memory_bytes: 600
n,m=map(int,input().split())
temp=[0]*m
tempn=[]
for i in range(0,m):
  p,y=map(int,input().split())
  temp[i]=[i,p,y]
  tempn.append(p)
temp.sort(key=lambda x: x[2])  
temp.sort(key=lambda x: x[1])  
j=1
tempn=list(set(tempn))
tempn.sort()
k=0
n=tempn[k]
for i in range(0,m):
  if temp[i][1]==n:
    tempa=str(n)
    tempj=str(j)
    temp[i][1]=tempa.zfill(6)
    temp[i][2]=tempj.zfill(6)
    j=j+1
  else:
    k=k+1
    if k>=len(tempn):
      break
    n=tempn[k]
    j=1
    tempa=str(n)
    tempj=str(j)
    temp[i][1]=tempa.zfill(6)
    temp[i][2]=tempj.zfill(6)
    j=j+1
temp.sort(key=lambda x: x[0])
for i in range(0,m):
  print(temp[i][1]+temp[i][2])

Measured memory_bytes: 37448
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define PER(a,b,c) for(int a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
using namespace std;
const int MAXN=1e6+5;
int n,m,t;
int a[MAXN],b[MAXN];
int main(){
    cin>>n>>m>>t;
    REP(i,1,n)sci(a[i]);
    REP(i,1,m)sci(b[i]);
    int ans=1e9;
    REP(i,1,t){
        int x,y,z;
        sci(x),sci(y),sci(z);
        ans=min(ans,a[x]+b[y]-z);
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    ans=min(ans,a[1]+b[1]);
    cout<<ans;
}

Measured memory_bytes: 4736