akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	string s;
	cin>>s;
	s.erase(unique(s.begin(),s.end()),s.end());
	cout<<s.size();
	return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n;
    cin >> n;
    vector<P> es(n - 1);
    map<P, int> EdgeId;
    vector<vector<int>> graph(n);
    for(int i = 0; i < n - 1; ++i){
        int u, v;
        cin >> u >> v;
        --u, --v;
        P p = minmax(u, v);
        es[i] = p;
        EdgeId[p] = i;
        graph[u].emplace_back(v);
        graph[v].emplace_back(u);
    }
    int k = 0;
    for(int i = 0; i < n; ++i)  chmax(k, (int)graph[i].size());
    vector<int> ans(n - 1);
    queue<P> que;
    que.push(P(0, -1));
    vector<bool> used(n, false);
    while(!que.empty()){
        P p = que.front();
        que.pop();
        int from = p.first, color = p.second;
        used[from] = true;
        int cur = 0;
        for(int to : graph[from]){
            if(used[to])    continue;
            if(cur == color)    ++cur;
            P edge = minmax(from, to);
            ans[EdgeId[edge]] = cur;
            que.push(P(to, cur));
            ++cur;
        }
    }
    cout << k << '\n';
    for(int i = 0; i < n - 1; ++i)  cout << ans[i] + 1 << '\n';
}

Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <ios>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main(void){
  int a,b;
  cin >> a >> b;
  
  if(a <= 5)
    cout << 0 << endl;
  else if(a <= 12)
    cout << b / 2 << endl;
  else
    cout << b << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;

ll n,s;

ll check(ll n, ll b) {
	ll r=0;
	for (;n;n/=b) r+=n%b;
	return r;
}

ll f(ll n, ll s) {
	
	if(n==s) return n+1;
	if(n<s) return -1;
	
	for (ll i=2;i<=sqrt(n);i++) {
		if (check(n,i)==s) return i;
	}
	
	n-=s;
	
	for (ll i=sqrt(n+s)+1;i;i--) {
		if (n%i==0&&n/i>0&&check(n+s,n/i+1)==s) return n/i+1;
	}
	
	return -1; 
}

int main() {
	
	scanf("%lld%lld",&n,&s);
	printf("%lld\n",f(n,s));
	
	return 0;
	
}

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

int main(){
    int N, K;  cin >> N >> K;
    vector<double> p(N+1, 0);
    for(int i=1; i<=N; i++){
        int v;  cin >> v;
        if(v%2 == 0){
            p[i] = v/2 + 0.5;
        }else {
            p[i] = v/2 + 1;
        }
    }

    vector<double> sum(N+1, 0);
    for(int i=1; i<=N; i++){
        sum[i] += sum[i-1] + p[i];
    }

    double ans = 0;
    for(int i=K; i<=N; i++){
        ans = max(ans, sum[i] - sum[i-K]);
    }
    cout << fixed << setprecision(10) << ans << endl;
}

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

int main(){
  int64_t n,m;
  cin>>n>>m;
  vector<int64_t> a(m);
  int64_t sum=0;
  for(int i=0;i<m;++i){
    cin>>a[i];
    sum += a[i];
  }

  cout<<max(n-sum,(int64_t)-1)<<endl;
}


Measured memory_bytes: 3660
#include<iostream>

using namespace std;

int main()
{
  int A[3][3];
  int N,i,j,k,t;
  
  for(int i=0;i<3;i++)
  {
    for(int j=0;j<3;j++)
    {
      cin>>A[i][j];
      
    }
  
  }
  
  cin>>N;
  int b[N];
  
  for(i=0;i<N;i++)
  {
    cin>>b[i];
  }
  
  for(i=0;i<3;i++)
  {
    for(j=0;j<3;j++)
    {
      for(k=0;k<N;k++)
      {
        if(A[i][j]==b[k])
        {
          A[i][j]=0;         
        }
      }
    }
  }
  
  for(i=0;i<3;i++)
  {
    if(A[i][0]==0&&A[i][1]==0&&A[i][2]==0)
    {
      cout<<"Yes";
      goto end;
    }
    else if(A[0][i]==0&&A[1][i]==0&&A[2][i]==0)
    {
      cout<<"Yes";
      goto end;
    }
  }
  
  if(A[1][1]==0&&A[2][2]==0&&A[0][0]==0)
  {
    cout<<"Yes";
    goto end;
  }
  else if(A[2][0]==0&&A[1][1]==0&&A[0][2]==0)
  {
    cout<<"Yes";
    goto end;
  }  
  
  cout<<"No";
  end:;
  
  /*for(int i=0;i<3;i++)
  {
    for(int j=0;j<3;j++)
    {
      cout<<A[i][j]<<" ";
    }
    cout<<"\n";
  }*/
}
  
  


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

string weather[] = {"Sunny", "Cloudy", "Rainy"};
int main(){
    string input_weather;
    cin >> input_weather;
    int i = 0;
    while(1){
        if(input_weather == weather[i]){
            i++;
            if(i>2){
                i = 0;
            }
            break;
        }
        i++;
    }
    cout << weather[i] << "\n";
    return 0;
}

Measured memory_bytes: 256
def count_books(books, limit):
    num_books = len(books)
    total_time = 0
    for i, time in enumerate(books):
        if total_time + time > limit:
            num_books = i
            break
        total_time += time
    return [num_books, total_time]

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    max_num_A, total_time_A = count_books(A, K)

    read_book_nums = [0] * (max_num_A + 1)

    remain = K - total_time_A
    num_B, total_time_B = count_books(B, remain)
    read_book_nums[-1] = max_num_A + num_B

    num_A = max_num_A
    m = 0
    total_time_B = 0
    for n in range(max_num_A-1, -1, -1):
        num_A -= 1
        remain += A[n]

        while m < M and total_time_B + B[m] <= remain:
            total_time_B += B[m]
            m += 1
        num_B = m

        read_book_nums[n] = num_A + num_B

    print(max(read_book_nums))
    
main()

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

int main() {
    long long i, j, n, m, ans = 0;
    cin >> n >> m;
    long long lst[3] = {0}, count[3] = {0};
    for(i = 0; i < m; i++){
        int keta, num;
        cin >> keta >> num;
        if(count[keta - 1] != 0){
            if(lst[keta - 1] != num){
                cout << -1 << endl;
                return 0;
            }
        }
        lst[keta - 1] = num;
        count[keta - 1]++;
    }
    if(n == 1) cout << lst[0] << endl;
    else{
        if(count[0] != 0 && lst[0] == 0) cout << -1 << endl;
        else{
            if(lst[0] == 0)lst[0] = 1;
            for(i = 0; i < n; i++){
                ans += lst[i] * pow(10, n-i-1);
            }
            cout << ans << endl;
        }
    }
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << (a*b>=c*d?a*b:c*d) << endl;
}


Measured memory_bytes: 256
n,m=[int(_) for _ in input().split()]

n=2*m+1
if m%2==0:
  for i in range(m//2):
    print(i+1,m-i)
  for i in range(m//2):
    print(m+1+i,n-i)
else:
  for i in range(m//2):
    print(i+1,m-i)
  for i in range(m//2+1):
    print(m+1+i,n-i)

Measured memory_bytes: 9192
def hanbun(a):
    return a//2
n=int(input())
a=list(map(int,input().split()))
judge=1
ans=0
while judge:
    for i in a:
        if i%2!=0:
            judge=0
            break
    if judge:ans+=1
    a=list(map(hanbun,a))
print(ans)

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

int main() {
    int n;
    cin >> n;
    rep(i,n) {
        int a;
        cin >> a;
        if (a%2 == 0) {
            if (a%3 != 0 && a%5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

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

using namespace std;

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

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

vector<vector<ll>> dp(101, vector<ll>(100001, 1e15));

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

    int N, W;
    cin >> N >> W;
    dp[0][0] = 0;
    for (int i = 1; i <= N; i++)
    {
        ll w, v;
        cin >> w >> v;
        for (int j = 100000; j >= 0; j--)
        {
            dp[i][j] = dp[i - 1][j];
            if (j >= v)
            {
                dp[i][j] = min(dp[i][j], dp[i - 1][j - v] + w);
            }
        }
    }
    for (int i = 100000; i >= 0; i--)
    {
        if (dp[N][i] <= W)
        {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
#define maxn 200005 
using namespace std;
long long sum[maxn] , arr[maxn]; 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n; 
    cin >> n;
	for(int i=1;i<=n;i++)
	    cin >> arr[i] , sum[i] = sum[i-1] + arr[i];
	long long ans = 12345678912345;
	for(int i=1;i<=n-1;i++)
	    ans = min(ans,abs(sum[n]-sum[i]-sum[i]));
	cout << ans << endl; 
    return 0;
}


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

int resolve(int input)
{
	int result = 0;
	int max_a = std::min(9, input);
	for (int a = 0; a <= max_a; ++a) {
		int max_b = std::min(9, input - a);
		for (int b = 0; b <= max_b; ++b) {
			int max_c = std::min(9, input - a - b);
			for (int c = 0; c <= max_c; ++c) {
				int d = input - a - b - c;
				if (0 <= d && d <= 9) {
					++result;
				}
			}
		}
	}
	return result;
}

int main()
{
	int input;
	while (std::cin >> input) {
		std::cout << resolve(input) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1160
S = input()
if S==S[::-1]:
    print(0)
else:
    S1 = ""
    x = []
    a = 0
    for i in range(len(S)):
        if S[i]=="x":
            a += 1
            if i==len(S)-1:
                x.append(a)
        else:
            S1+=S[i]
            x.append(a)
            a = 0
            if i==len(S)-1:
                x.append(a)
    if S1!=S1[::-1]:
        print(-1)
    else:
        ans = 0
        y = x[::-1]
        for i in range(len(x)//2):
            ans += abs(x[i]-y[i])
        print(ans)

Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
long long g[15][15],ans,s;
int i,j,vis[15],n,f[15]={0,1,2,4,7,12,20,29,38,52,73};
void dfs(int l,int i,int n,long long s)
{
	int j;
	if(i>n)
	{
		ans=max(ans,s);
		return;
	}
	for(j=1;j<=n;++j)
		if(vis[j]==0)
		{
			vis[j]=1;
			dfs(j,i+1,n,s+g[l][j]);
			vis[j]=0;
		}
}
int main()
{
	scanf("%d",&n);
	for(i=2;i<=n;++i)
	{
		dfs(0,1,i,0);
		s=1;
		for(j=1;j<i;++j)
			g[j][i]=g[i][j]=(ans+1)*f[j];
	}
	for(i=1;i<=n;++i)
	{
		for(j=1;j<=n;++j)
			cout<<g[i][j]<<' ';
		cout<<endl;
	}
}


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

int a, b, c, x, y, ans;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> a >> b >> c >> x >> y;
	a = min(a, 2 * c);
	b = min(b, 2 * c);
	while(x + y) {
		if(x && y) {
			ans += min(a + b, 2 * c);
			x--;
			y--;
		}
		else if(x) {
			ans += a;
			x--;
		}
		else {
			ans += b;
			y--;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

def gcd(m, n):
  if n == 0:
    return m
  return gcd(n, m % n)

def gcd_2(a):
  ans = a[0]
  for i in range(1, len(a)):
    ans = gcd(ans, a[i])
  return ans

print(gcd_2(a))



Measured memory_bytes: 14252
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
lint LCM(lint a,lint b){
  lint tmp,r,x;
  x=a*b;
  if(a<b) tmp=a,a=b,b=tmp;
  r=a%b;
  while(r!=0) a=b,b=r,r=a%b;
  x=x/b;
  return x;
}

lint GCD(lint a,lint b){
  return (a*b)/LCM(a,b);
}
 
int main(void){
    lint N,X;
    cin >> N >> X;
    lint x[N];
    rep(i,N) cin >> x[i];
    lint dis[N];
    rep(i,N) dis[i]=abs(x[i]-X);
    lint ans=dis[0];
    for(int i=1;i<N;i++){
        ans=GCD(ans,dis[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
// A - Apple Pie

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int main(){
	int A, P;
	cin >> A >> P;

	int ans = ((A * 3) + P) / 2 ;

	cout << ans << endl;

	return 0;
}

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

int main() {
  ll N;
  ll i, j, k;
  cin >> N;
  for (k = 1; k * k <= N; k++) {
    if (N % k  == 0) {
      i = k;
      j = N /k;
    }
  }
  cout << i+j-2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;


signed main(){
	ll x,y,a,b,c;
	cin >> x >>y>>a>>b>>c;
	vl pa(a),pb(b),pc(c);
	rep(i,0,a)cin>>pa[i];
	rep(i,0,b)cin>>pb[i];
	rep(i,0,c)cin>>pc[i];
	sort(all(pa)); reverse(all(pa));
	sort(all(pb)); reverse(all(pb));
	sort(all(pc)); reverse(all(pc));
	ll s=0,t=0,u=0;
	ll ans=0;
	rep(i,0,x+y){
		if(s<a && max({pa[s],pb[t],pc[u]})==pa[s]){
			ans+=pa[s];
			s++;
		}
		else if(t<b && max({pa[s],pb[t],pc[u]})==pb[t]){
			ans+=pb[t];
			t++;
		}
		else{
			ans+=pc[u];
			u++;
		}
	}
	if(s<=x && t<=y){
		cout<<ans<<endl;
		return 0;
	}
	if(x<s){
		for(ll i=s-1;i>=x;--i)ans-=pa[i];
		ll k=s-x;
		rep(i,0,k){
			if(t<b && max({pb[t],pc[u]})==pb[t]){
				ans+=pb[t];
				t++;
			}
			else{
				ans+=pc[u];
				u++;
			}
		}
		cout << ans << endl;
	}
	else{
		for(ll i=t-1;i>=y;--i)ans-=pb[i];
		ll k=t-y;
		rep(i,0,k){
			if(s<a && max({pa[s],pc[u]})==pa[s]){
				ans+=pa[s];
				s++;
			}
			else{
				ans+=pc[u];
				u++;
			}
		}
		cout << ans << endl;
	}

	

		return 0;
}


Measured memory_bytes: 5556
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int>v;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        v.push_back(x);
    }
    set<int>s;
    int cnt=0;
    s.insert(v[0]);
    for(int i=1;i<n;i++){
        if(*s.begin()>=v[i])cnt++;
        s.insert(v[i]);
    }
    cout<<cnt+1<<endl;
}


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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    string n;
    cin>>n;
    for(auto c : n)
        cout<<(c=='9'?'1':'9');
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
eval"N,*H="+`dd`.split*?,
B=[0]*N
p B.each{k= ~r=-j=H.shift
1while(r=[r,B[j-1]+H[N-1]].max;j&=j-1)>0
(B[k]=r;k|=k+1)while B[k]&.<r}.max

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int r;
  std::cin >> r;
  std::cout << r * r << '\n';
}


Measured memory_bytes: 256
#include <cstdio>

const int MN = 100005;

int N, A[MN];
long long Ans;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
	int lst = 0;
	for (int i = 1; i <= N; ++i)
		Ans += (A[i] + lst) / 2,
		lst = A[i] ? (A[i] + lst) % 2 : 0;
	printf("%lld\n", Ans);
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll MOD = 1000000007;


int main()
{
    string N;
    cin >> N;
    rep(i, 3) {
        if (N[i] == '7') {
            print("Yes");
            return 0;
        }
    }
    print("No");
    return 0;
}


Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;map<int,int>M;
  for(int i=0;i<=1000000;i++)
    M[i]=0;
  set<int>S;
  for(int i=0;i<N;i++){
  int a;cin>>a;
    M.at(a)++;
    S.insert(a);
  }for(int i=1;i<=1000000;i++){
  if(S.count(i))
    for(int j=2;j*i<=1000000;j++)
      if(S.count(i*j))S.erase(i*j);
  }int ans=0;
  for(auto x:S){
  if(M.at(x)==1)ans++;
  }cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 59752
n=int(input())
c=0
c2=0;c3=0;c5=0;c7=0;c11=0;c13=0;c17=0;c19=0;c23=0;c29=0;c31=0;c37=0;c41=0;c43=0;c47=0
for i in range(2,n+1):
  if i%64==0:c2+=6
  elif i%32==0:c2+=5
  elif i%16==0:c2+=4
  elif i%8==0:c2+=3
  elif i%4==0:c2+=2
  elif i%2==0:c2+=1
  if i%81==0:c3+=4
  elif i%27==0:c3+=3
  elif i%9==0:c3+=2
  elif i%3==0:c3+=1
  if i%25==0:c5+=2
  elif i%5==0:c5+=1
  if i%49==0:c7+=2
  elif i%7==0:c7+=1
  if i%11==0:c11+=1
  if i%13==0:c13+=1
  if i%17==0:c17+=1
  if i%19==0:c19+=1
  if i%23==0:c23+=1
  if i%29==0:c29+=1
  if i%31==0:c31+=1
  if i%37==0:c37+=1
  if i%41==0:c41+=1
  if i%43==0:c43+=1
  if i%47==0:c47+=1
l=[c2,c3,c5,c7,c11,c13,c17,c19,c23,c29,c31,c37,c41,c43,c47]
if max(l)>=74:
  c+=1
if max(l)>=24:
  a=0;b=0
  for j in range(len(l)):
    if l[j]>=24:a+=1
    elif l[j]>=2:b+=1
  c+=a*(a+b-1)
if max(l)>=14:
  e=0;f=0
  for k in range(len(l)):
    if l[k]>=14:e+=1
    elif l[k]>=4:f+=1
  c+=e*(e+f-1)
if max(l)>=2:
  g=0;h=0
  for m in range(len(l)):
    if l[m]>=4:g+=1
    elif l[m]>=2:h+=1
  if g>=2:
    x=int((g*(g-1))/2)
    c+=x*(g+h-2)
print(c)

Measured memory_bytes: 3192
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

int N;
string S;
int K;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> S >> K;

  char c = S[K - 1];

  for (int i = 0; i < N; i++) {
    if (c == S[i]) {
      cout << c;
    } else {
      cout << '*';
    }
  }
  cout << endl;
  return 0;
}

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

int main() {
	int p, q, r;
	cin >> p >> q >> r;
	cout << min(p + q, min(p + r, q + r)) << endl;

}

Measured memory_bytes: 256
// Problem : 
// 			C - Low Elements
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)             (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#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 gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#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 all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)         cout << #x << " = " << x << endl
#define trace(x)         cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	int n, m = inf;
	cin>>n;
	vi v(n);
	int cnt = 0;
	fo(i,n){
		cin>>v[i];
		if(v[i]<m){
			cnt++;
			m = min(m,v[i]);
		}
	}
	cout<<cnt;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 4700
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;


int a[200010];
int b[200010];
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n; cin >> n;
    set<int> st;
    REP(i, n){
        int a, b; cin >> a >> b;
        if(a){
            if(st.find(b)!=st.end()) cout << 1 << endl;
            else cout << 0 << endl;
        }else{
            st.insert(b);
            cout << st.size() << endl;
        }
    }
	return 0;
}


Measured memory_bytes: 12492
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] arrayv=new int[n],arrayc=new int[n];
		int sum=0;

		for(int i=0;i<n;i++) {
			arrayv[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) {
			arrayc[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) {
			sum+=Math.max(0, arrayv[i]-arrayc[i]);
		}

		System.out.println(sum);
	}
}

//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));




Measured memory_bytes: 21972
#include<stdio.h>

int main(void){
	int n,i;
	double ax,ay,bx,by,cx,cy,dx,dy;	//入力
	double ab,cd;	//傾き;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy,&dx,&dy);
		//傾きを求める
		ab=(by-ay)/(bx-ax);
		cd=(dy-cy)/(dx-cx);
		if(ab==cd)
			printf("YES\n");
		else
			printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
kill = 0
m = sum(A)
for i in range(1,N+1):
    if B[-i] <= A[-i]:
        A[-i] -= B[-i]
    else:
        B[-i] -= A[-i]
        A[-i] = 0
        if B[-i] <= A[-i-1]:
            A[-i-1] -= B[-i]
        else:
            A[-i-1] = 0
print(m-sum(A))

Measured memory_bytes: 82020
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int score = 1e9 + 7, num = 0;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        if(score > b){
            num = a;
            score = b;
        }
    }
    cout << num + score << "\n";
}

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

const int N=300005;

int n,a[N];

int main() {
	
	scanf("%d",&n);
	for (int i=0;i<n;++i) scanf("%d",&a[i]);
	
	//tow-pointers;
	
	int l=0,r=-1;
	
	long long tot1=0,tot2=0,ans=0;
	
	while(l<n) {
		while(r<n && tot1==tot2) {
			++r;
			tot1+=a[r];
			tot2^=a[r];
		}
		ans+=(long long)(r-l);
		tot1-=a[l];
		tot2^=a[l];
		++l;
	}
	printf("%lld\n",ans);
	
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#define _CRT_DISABLE_PERFCRIT_LOCKS
#include <bits/stdc++.h>

using namespace std;
#define BOOST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define fileIn freopen("1.txt", "r", stdin)
#define fileOut freopen("output.txt", "w", stdout)
#define dbg(n) cout << n <<"\n"
#define dbg2(n) cout << n <<" "
#define all(a) a.begin(), a.end()
#define cinArr(arr) for(auto &v : arr) cin>>v
#define coutArr(arr) for(auto &v : arr) cout<<v<<" "
#define FOR(i, a, b) for(int i = a; i < b; i++)
typedef int64_t ll;
typedef uint64_t ull;
typedef vector<int> vi;
typedef vector<vi > vii;


int main()
{
    BOOST;
    int a, b;
    cin>>a>>b;
    cout<<((a == b) ? (a * 2) : (max(a, b) * 2 - 1));
    return 0;
}





















Measured memory_bytes: 256
n,m=map(int,input().split())
box_l=[1]*n
red_l=[0]*n
red_l[0]=1

for i in range(m):
	x,y=map(int,input().split())
	x-=1
	y-=1
	if red_l[x]==1:
		red_l[y]=1
		if box_l[x]==1:
			red_l[x]=0
	box_l[x] -= 1
	box_l[y] += 1
print(sum(red_l))

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, cnt; 
ll A[int(1e5+5)], sum = 0;

int main(){
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    if (A[i] < 0) cnt++, A[i] *= -1;
    sum += A[i];
  }
  sort(A, A + N);

  if (cnt % 2 == 0) cout << sum << endl;
  else cout << sum - A[0] * 2 << endl;

  return 0;
}


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

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

  set<int> ans;
  for(int i=1; i<n/2+10; ++i){
    ans.insert(i);
    if(n==i*(i+1)/2)break;
    if(n<i*(i+1)/2){ans.erase(i*(i+1)/2-n); break;}
  }

  for(int x:ans)cout<<x<<" "<<endl;
}


Measured memory_bytes: 512
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.trim().split('\n');
const n = Number(list[0]);
const A = list[1].trim().split(' ');
const q = Number(list[2]);
const mi = list[3].trim().split(' ');

const genKey = (...args) => {
  return args.join(':');
}

const dp = new Map();
const memo = (i, m) => {
  const key = genKey(i, m);
  if (dp.has(key)) {
    return dp.get(key);
  }
  if (i === n || m === 0) {
    const result = m === 0;
    dp.set(key, result);
    return result;
  }

  const result = memo(i + 1, m) || memo(i + 1, m - A[i]);
  dp.set(key, result);
  return result;
}
for (let i = 0; i < q; i++) {
  console.log(memo(0, Number(mi[i])) ? 'yes' : 'no');
}



Measured memory_bytes: 24364
use std::cmp;
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let k: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read::<i64>()).collect();

    let mut rui = vec![0; n + 1];
    let mut sei = vec![0; n + 1];
    for i in 0..n {
        rui[i + 1] = rui[i] + a[i];
        sei[i + 1] = sei[i] + cmp::max(0, a[i]);
    }

    let mut ans = 0;
    for i in 0..n - k + 1 {
        ans = cmp::max(
            ans,
            sei[i] + cmp::max(0, rui[i + k] - rui[i]) + sei[n] - sei[i + k],
        );
    }
    println!("{}", ans);
}

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")
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,M; cin>>N>>M;
  vi A(N);
  rep(i,0,M){
    int X,Y; cin>>X>>Y;
    A[X-1]++;
    A[Y-1]++;
  }
  string ans="YES";
  rep(i,0,N){
    if(A[i]%2==1) ans="NO";
  }
  cout<<ans<<endl;
  }


Measured memory_bytes: 1024
import itertools
n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(q)]
ans=0
for v in itertools.combinations_with_replacement(list(range(1,m+1)),n):
    sub=0
    for a in l:
        if v[a[1]-1]-v[a[0]-1]==a[2]:
            sub+=a[3]
    ans=max(ans,sub)
print(ans)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0;
    int l = 0;

    rep(i, (int)s.size()){
        if(s[i] == ')'){
            if(l == 0) r++;
            else l--;
        }else{
            l++;
        }
    }
    rep(i, l) s += ')';
    rep(i, r) s = '(' + s;
    cout << s << endl;
}

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

int main(){
	int K;
  	cin >> K;
  	int s[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  	cout << s[K-1] << endl;
}


Measured memory_bytes: 256
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

#include <bits/stdc++.h>
using namespace std;

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef pair<ll, ll>        pll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vii;
typedef vector<pll>         vll;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll dp[1005][1005];
string m[1005];

void solve(int TEST_CASE){
    int h,w;
    cin >> h >> w;
    fr(i,h) cin >> m[i];
    fill(dp);
    dp[1][1]=1;
    frA(i,1,h){
        frA(j,1,w){
            if(m[i-1][j-1]=='#') continue;
            dp[i][j]+=(dp[i-1][j]+dp[i][j-1])%MOD;
        }
    }
    cout << dp[h][w];
}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

Measured memory_bytes: 12564
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n; ll a[1 << 17];
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	ll out = 0;
	if (n % 2 == 0) {
		rep(i, n/2) {
			out -= 2 * a[i];
		}
		out += a[n / 2 - 1];
		Rep(i, n / 2, n) {
			out += 2 * a[i];
		}
		out -= a[n / 2];
	}
	else {
		rep(i, n / 2) {
			out -= 2 * a[i];
		}
		Rep(i, n / 2, n) {
			out += 2 * a[i];
		}
		out -= a[n / 2];
		out -= a[n / 2 + 1];
		ll out2 = 0;
		rep(i, n / 2 + 1) {
			out2 -= 2 * a[i];
		}
		out2 += a[n / 2];
		out2 += a[n / 2 - 1];
		Rep(i, n / 2 + 1, n) {
			out2 += 2 * a[i];
		}
		out = max(out, out2);
	}
	cout << out << endl;
	return 0;
}


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

using namespace std;

typedef long long int ll;



ll x, y;


int main(){

	while(scanf("%lld %lld", &x, &y)!=EOF){
		if(x>y) swap(x, y);
		printf("%s\n", (y>x+1)?"Alice":"Brown");
	}		

	return 0;

}



Measured memory_bytes: 256
n = int(input())
heights = [int(h) for h in input().split()]

record = 0
current = heights[0]
cnt = 0
for h in heights[1:]:
    if current >= h:
        cnt += 1
        current = h
    else:
        record = cnt if cnt > record else record
        current = h
        cnt = 0
record = cnt if cnt > record else record
print(record)

Measured memory_bytes: 14252
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int R = sc.nextInt();
    int G = sc.nextInt();
    int B = sc.nextInt();
    int N = sc.nextInt();
    
    int count = 0;
    for (int r = 0; r * R <= N; r++) {
      for (int g = 0; r * R + g * G <= N; g++) {
        int b = (N - r * R - g * G) / B;
        if (r * R + g * G + b * B == N) {
          count++;
        }
      }
    }

    os.println(count);
  }
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>

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

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i++)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

//library----------------------------------------------

int main() {
    LCIN(a,b,k);
    if(a<=k){
        k-=a;a=0;
    }else{
        a-=k;k=0;
    }
    if(k>0){
        if(b<=k){
            b=0;k=0;
        }else{
            b-=k;k=0;
        }
        
    }
    printf("%lld %lld\n",a,b);

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

P seg[1<<21]; // < 10^6
ll sz;
vector<ll> sav;

inline ll calc(const P& f,ll x){ return f.first * x + f.second; }

void init(ll n){
  sz=1;
  while(sz<n)sz*=2;
  for(ll i=0;i<sz*2;i++)seg[i]=P(0,INF);
}

void rollback(){
  for(ll i : sav)seg[i]=P(0,INF);
  sav.clear();
}

void apply(const P& func,ll k=0,ll l=0,ll r=sz){
  P crt=seg[k];
  if(calc(crt,l)<=calc(func,l)&&calc(crt,r-1)<=calc(func,r-1)) return;
  if(calc(crt,l)>=calc(func,l)&&calc(crt,r-1)>=calc(func,r-1)){ seg[k]=func; sav.push_back(k); return; }

  P lo,hi;
  ll mid=(l+r)/2;
  if(calc(crt,l)<calc(func,l)){ lo=crt; hi=func; }
  else{ lo=func; hi=crt; }

  if(calc(lo,mid)>calc(hi,mid)){
    seg[k]=hi;
    sav.push_back(k);
    apply(lo,k*2+1,l,mid);
  }else{
    seg[k]=lo;
    sav.push_back(k);
    apply(hi,k*2+2,mid,r);
  }
}

ll query(ll x,ll k=0,ll l=0,ll r=sz){
  if(l+1==r)return calc(seg[k],x);

  ll res=calc(seg[k],x);
  ll mid=(l+r)/2;
  if(x<mid) res=min(res,query(x,k*2+1,l,mid));
  else res=min(res,query(x,k*2+2,mid,r));
  return res;
}

ll n,C;
ll h[200010],dp[200010];

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

  cin>>n>>C;
  rep(i,n)cin>>h[i];
  init(1000001);
  dp[0]=0;
  apply(P(-2*h[0],h[0]*h[0]+dp[0]));
  repl(i,1,n){
    dp[i]=query(h[i])+C+h[i]*h[i];
    apply(P(-2*h[i],h[i]*h[i]+dp[i]));
  }
  cout<<dp[n-1]<<endl;

  return 0;
}


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

int main() {
  ll x;
  cin >> x;
  for (int a = -1e3; a <= 1e3; a++) {
    for (int b = -1e3; b <= 1e3; b++) {
      if (pow(a, 5)-pow(b, 5) == x) {
        cout << a << ' ' << b << endl;
        return 0;
      }
    }
  }
  return 0;
}


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

int main(){
  string s;
  cin>>s;
  if(s=="SUN")cout<<7<<endl;
  if(s=="MON")cout<<6<<endl;
  if(s=="TUE")cout<<5<<endl;
  if(s=="WED")cout<<4<<endl;
  if(s=="THU")cout<<3<<endl;
  if(s=="FRI")cout<<2<<endl;
  if(s=="SAT")cout<<1<<endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==5 && a[1]==5 && a[2]==7)
        cout<<"YES";
    else
    {
        cout<<"NO";
    }
    return 0;
    
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using ld = long double;
const ll MOD = (ll)1e9 + 7;

int n, k;
vector<int> v;

int findXor(int n) {
    if(n == -1) return 0;
    if(n % 4 == 3) return 0;
    if(n % 4 == 0) return n;
    if(n % 4 == 1) return 1;
    if(n % 4 == 2) return n + 1;
}

signed main() {
    int a, b;
    cin >> a >> b;
    cout << (findXor(b) xor findXor(a - 1)) << "\n";
    return 0;
}

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

int main() {
    long int n,v;
    cin>>n>>v;
    long int b[n],c[n];
   for(int i=0;i<n;i++){
       cin>>b[i];
   }
   c[0]=0;
   c[1]=abs(b[0]-b[1]);
   for(int i=2;i<n;i++){
       c[i]=9999999999;
       for(int k=1;k<=v&&k<=i;k++){
       
         c[i]=min(abs(b[i]-b[i-k])+c[i-k],c[i]);
       }  
   }
   cout<<c[n-1];
	return 0;
}


Measured memory_bytes: 5148
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repb(i, n) for(int i = n;i >= 0;i--)
#define reps(i, m, n) for(int i = m;i < n;i++)
#define repsb(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

int main(){
	int n,p,c,r;
	while(true)
	{
		cin>>n>>r;
		if(n==0)	return 0;
		int b[50];
		rep(i,n){
			b[i]=n-i;
		}

		rep(s,r){
			int a[50],j;
			cin>>p>>c;
			for(j=0;j<c;j++){
				a[j]=b[p+j-1];
			}
			for(;j<p+c-1;j++){
				a[j]=b[j-c];
			}
			for(;j<n;j++){
				a[j]=b[j];
			}
			rep(t,n){
				b[t]=a[t];
			}
		}
		cout<<b[0]<<endl;
	}

	return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define rep(i,l,r) for(int i = l;i < r;i++)
#define per(i,l,r) for(int i = r - 1;i >= l;i--)
#define de(x) cout<<#x<<" = "<<x<<endl
#define dd(x) cout<<#x<<" = "<<x<<','
typedef long long ll;
int main()
{
	int n;
	scanf("%d",&n);
	printf("%d",48 - n);
	return 0;
}

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

int main(){

	int i=1;
	while(1){
		int n;
		cin >> n;
		if(n==0)break;
		cout << "Case " << i << ": " << n << endl;
		i++;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
using namespace std;
 
int main(){
    int a,b; cin >> a >> b;
    int ans=0;
    int now=1;
    while(now<b){
        now+=a-1;
        ans++;
    }
    cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>

using namespace std;

#define ZZZ -1000000007

int main(void) {

	int a, b; cin >> a >> b;

	cout << setprecision(20) << (double)a / b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int INF = 1e9 + 7;

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

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

	if (n <= 999) cout << "ABC" << endl;
	else cout << "ABD" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin >> a >> b;
	if (a>b){
	cout << "a > b" << endl;
	} else if (a<b){
	cout << "a < b" << endl;
	} else {
	cout << "a == b" << endl;
	}
}


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

const int INF = 1001001001;

int a[12][12];

int main() {
 int N,M;
 cin>>N>>M;
 vector<int>count(M);
 for(int i=0;i<N;i++){
   int K;
   cin>>K;
   for(int j=0;j<K;j++){
     int A;
     cin>>A;
     A--;
     count[A]++;
   }
 }
 int count2=0;
 for(int i=0;i<M;i++){
   if(count[i]==N){count2++;}
 }
 cout<<count2<<endl;
  return 0;
}

Measured memory_bytes: 256
N = list(input())
l = []

for i in range(2**len(N)):
    eq = ''
    for j in range(len(N)):
        if j == len(N)-1:
            eq += N[j]
            break
        if (i >> j) % 2 == 1:
            eq += N[j] + '+'
        else:
            eq += N[j]
    l.append(eq)

ans = 0
for l_ in l:
    ans += eval(l_)
print(ans//2)


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

int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==b)cout<<"a == b"<<endl;
    if(a>b)cout<<"a > b"<<endl;
    if(a<b)cout<<"a < b"<<endl;
}



Measured memory_bytes: 3152
#include<stdio.h>

long gcd(long a, long b){
    if(b==0){
        return a; 
    }
    return gcd(b, a%b);
}

long main(){
    long ans, a, b, tmp;
    scanf("%ld %ld",&a, &b);
    
    if(a>b){
        tmp=a;
        a=b;
        b=tmp;
    }
    long ab=a*b;
    ans = ab/gcd(a,b);

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

Measured memory_bytes: 128
N,X,M=map(int,input().split())
modlist=[0]*M
modset=set()
ans=0
for i in range(M):
    if X in modset:
        startloop=modlist.index(X)
        sum_outofloop=sum(modlist[:startloop])
        inloop=ans-sum_outofloop
        numofloop=(N-startloop)//(i-startloop)
        ans=sum_outofloop+numofloop*inloop+sum(modlist[startloop:startloop+((N-startloop)%(i-startloop))])
        #print(inloop,i,startloop,sum_outofloop,numofloop,sum(modlist[startloop:startloop+((N-startloop)%(i-startloop))]))
        break
    else:
        modset.add(X)
        ans+=X
        modlist[i]=X
        X**=2
        X%=M
    if i==N-1:
        break
print(ans)
#print(modlist)

Measured memory_bytes: 13400