akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main() {
    int n;
    unsigned long long t[110];
    for (int i = 0; i < 110; ++i) {
      t[i] = 0;
    }
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> t[i];
    }
    
    sort(t,t+n);
    
    for (int i = 0; i < n -1 ; ++i){
      unsigned long long a;
      a = t[i+1] / __gcd(t[i],t[i+1]);
      t[i+1] = t[i] * a; 
    }
  
    cout << t[n - 1] << endl;
  
}

Measured memory_bytes: 256
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    i64 x, y, z;
    std::cin >> x >> y >> z;

    std::cout << (x%2 && y%2 && z%2
        ? std::min({x*y, y*z, z*x})
        : 0ll) << '\n';
}


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

int main() {
	int D, N;
	int answer;

	std::cin >> D >> N;

	int count = 1;
	int i = 1;
	while (true)
	{
		if (i % 100 == 0) {
			i++;
			continue;
		}
		if (count == N) {
			answer = static_cast<int>(std::pow(100, D))*i;
			break;
		}

		i++;
		count++;
	}

	std::cout << answer << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
long long int INF = 1000000000LL;
vector<long long int> dijkstra(int s, int v, vector< vector< pair<long long int,int> > > G){
  //s: ?§????, v: ????????°, G: ??£??\?????????
  priority_queue< pair<long long int, int> > wait;
  vector<long long int> result(v, INF);
  result[s] = 0LL;
  wait.push(make_pair(0LL, s));
  while(!wait.empty()){
    int nowpoint = wait.top().second;
    int nowcost = wait.top().first;
    wait.pop();
    if(nowcost <= result[nowpoint]){
      for(int i = 0; i < G[nowpoint].size(); ++i){
	int nextpoint = G[nowpoint][i].second;
	int nextcost = -nowcost + G[nowpoint][i].first;
	if(nextcost < result[nextpoint]){
	  wait.push(make_pair(-nextcost, nextpoint));
	  result[nextpoint] = nextcost;
	}
      }
    }
  }
  return result;
}



int main(){
  int n;
  while(cin >> n, n){
    long long int ans = 0LL;
    int p[n], deg[n];
    fill(deg,deg+n,-1);
    for(int i = 1; i < n; ++i){
      cin >> p[i];
      --p[i];
      ++deg[p[i]];
      ++deg[i];
    }
    long long int d[n];
    for(int i = 1; i < n; ++i){
      cin >> d[i];
      if(deg[i] && deg[p[i]]) ans += 3*d[i];
      else ans += d[i];
    }
    vector< vector< pair<long long int, int> > > G(n);
    for(int i = 1; i < n; ++i){
      if(deg[i] && deg[p[i]]){
	G[i].push_back(make_pair(d[i],p[i]));
	G[p[i]].push_back(make_pair(d[i],i));
      }
    }
    int s = -1;
    for(int i = 0; i < n; ++i){
      if(deg[i]) s = i;
    }
    vector<long long int> D = dijkstra(s,n,G);
    long long int M = 0LL;
    for(int i = 0; i < n; ++i){
      if(D[i] < INF && D[i] > M){
	s = i;
	M = D[i];
      }
    }
    D = dijkstra(s,n,G);
    M = 0LL;
    for(int i = 0; i < n; ++i)
      if(D[i] < INF)
	M = max(M,D[i]);

    ans -= M;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3256
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))

temp = max(c1)
if temp == 0:
    temp = 1

for i in range(temp):
    x1= c1[0] - i
    x2 = c1[1] - i
    x3 = c1[2] - i
    y1 = i
    y2 = c2[0] - x1
    y3 = c3[0] - x1
    
    if x1+y1 == c1[0] and x2+y1 == c1[1] and x3+y1 == c1[2] and x1+y2 == c2[0] and x2+y2 == c2[1] and x3+y2 == c2[2] and x1+y3 == c3[0] and x2+y3 == c3[1] and x3+y3 == c3[2]:
        print("Yes")
        break
    else:
        print("No")
        break

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

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

const long long INF = 1LL << 60;

int main() {
    int N=0;
    cin >> N;

    vector<ll> h(100010, -1);
    rep(i, N) cin >> h.at(i);

    vector<ll> dp(100010, INF);

    dp.at(0) = 0;
    rep(i, N){
        if(i >= 1) chmin(dp.at(i), dp.at(i-1) + (ll)abs(h.at(i) - h.at(i-1)));
        if(i >= 2) chmin(dp.at(i), dp.at(i-2) + (ll)abs(h.at(i) - h.at(i-2)));
    }

    cout << dp.at(N-1) << endl;

}




Measured memory_bytes: 1792
fun main() {
    val n = readLine()!!.toInt()
    val s = readLine()!!.toCharArray()
    var result = s.count { it == 'R' }.toLong() * s.count { it == 'G' }.toLong() * s.count { it == 'B' }.toLong()
    (0 until n).forEach { i ->
        (0 until n).forEach { d ->
            val j = i + d + 1
            val k = j + d + 1
            if (k <= n - 1 && s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) {
                result--
            }
        }
    }

    println(result)
}

Measured memory_bytes: 36760
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;
inline char get() {
	static char buf[100000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
inline void read(int &x) {
	static char c; x = 0; int sgn = 0;
	for (c = get(); c < '0' || c > '9'; c = get()) if (c == '-') sgn = 1;
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
	if (sgn) x = -x;
}

int n, k;
int h[N];
int dp[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read(n); read(k);
  for (int i = 0; i < n; i++) {
    read(h[i]);
  }
  for (int i = 1; i < n; i++) {
    dp[i] = INF;
    for (int j = max(0, i-k); j < i; j++) {
      dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
    }
  }
  cout << dp[n-1] << nl;
  return 0;
}


Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
vector<int> prime;

void Prime() {
    prime.emplace_back(2);
    for (int i = 3; i <= 999999; i += 2) {
        bool f = false;
        for (int j = 3; j <= sqrt(i); j += 2) {
            if (i%j == 0) {
                f = true;
                break;
            }
        }
        if (!f) prime.emplace_back(i);
    }
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    Prime();
    int n;
    while (cin >> n) {
        cout << upper_bound(prime.begin(), prime.end(), n) - prime.begin() << endl;
    }
}

Measured memory_bytes: 3332
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define pb push_back
#define ll long long int
# define pll pair<ll,ll>
# define fio ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

int main()
{   fio;
    ll n;
    cin>>n;
    cout<<((n+999)/1000)*1000-n;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

#define MAX_N 1001

struct S {
    int y, x;
    S(int y, int x) : y(y), x(x) {}
};

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

int W, H, N;
int X1[MAX_N], Y1[MAX_N], X2[MAX_N], Y2[MAX_N];

int compress(int *x1, int *x2, int w) {
    vector<int> xs;
    for (int i = 0; i < N; i++) {
        if (x1[i] - 1 >= 0) xs.push_back(x1[i] - 1);
        xs.push_back(x1[i]);
        xs.push_back(x2[i] - 1);
        if (x2[i] < w) xs.push_back(x2[i]);
    }
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    for (int i = 0; i < N; i++) {
        x1[i] = lower_bound(xs.begin(), xs.end(), x1[i]) - xs.begin();
        x2[i] = lower_bound(xs.begin(), xs.end(), x2[i]) - xs.begin();
    }
    return xs.size();
}

int main() {
    while (scanf("%d %d", &W, &H), W || H) {
        scanf("%d", &N);
        for (int i = 0; i < N; i++) {
            scanf("%d %d %d %d", &X1[i], &Y1[i], &X2[i], &Y2[i]);
        }
        int w = compress(X1, X2, W);
        int h = compress(Y1, Y2, H);

        bool F[h][w]; memset(F, 0, sizeof(F));
        for (int n = 0; n < N; n++) {
            for (int i = Y1[n]; i < Y2[n]; i++) {
                for (int j = X1[n]; j < X2[n]; j++) {
                    F[i][j] = true;
                }
            }
        }

        bool used[h][w]; memset(used, 0, sizeof(used));
        int cnt = 0;
        for (int y = 0; y < h; y++) {
            for (int x = 0; x < w; x++) {
                if (!used[y][x] && !F[y][x]) {
                    cnt++;
                    used[y][x] = true;
                    queue<S> q; q.push(S(y, x));
                    while (!q.empty()) {
                        S s = q.front(); q.pop();
                        for (int i = 0; i < 4; i++) {
                            int ny = s.y + dy[i], nx = s.x + dx[i];
                            if (!(0 <= ny && ny < h && 0 <= nx && nx < w)) continue;
                            if (!used[ny][nx] && !F[ny][nx]) {
                                used[ny][nx] = true;
                                q.push(S(ny, nx));
                            }
                        }
                    }
                }
            }
        }

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

Measured memory_bytes: 4600
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int cmp(const void *a, const void *b)
{
    return strcmp((const char *)a, (const char *)b);
}

int main()
{
    int N;
    scanf("%d", &N);

    char S[N][11];
    int times[N];

    for (int i = 0; i < N; i++)
    {
        scanf("%s", S[i]);
        times[i] = 1;
    }

    if (N == 1)
    {
        printf("%s\n", S[0]);
        return 0;
    }

    qsort(S, N, sizeof(char) * 11, cmp);

    int ans = 1;
    for (int i = 0; i < N - 1; i++)
    {
        if (strcmp(S[i], S[i + 1]) == 0)
        {
            times[i + 1] = times[i] + 1;
        }
        else
        {
            if (times[i] > ans)
            {
                ans = times[i];
            }
        }
    }
    if (times[N - 1] > ans)
    {
        ans = times[N - 1];
    }

    for (int i = 0; i < N; i++)
    {
        if (times[i] == ans)
        {
            printf("%s\n", S[i]);
        }
    }
    return 0;
}

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

int main(){
    int r,c;
    cin>>r>>c;
    
    int num[101][101]={};
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++) cin>>num[i][j];
        
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++) num[r][c]+=num[i][j];
        
    for(int i=0;i<r;i++){
        int sum=0;
        for(int j=0;j<c;j++) sum+=num[i][j];
        num[i][c]=sum;
    }
    
    for(int j=0;j<c;j++){
        int sum=0;
        for(int i=0;i<r;i++) sum+=num[i][j];
        num[r][j]=sum;
    }
    
    for(int i=0;i<=r;i++){
        for(int j=0;j<=c;j++){
            if(j) cout<<" "; 
            cout<<num[i][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define Mx 2000001

typedef long long  L;
typedef pair<L, L> pii;
L a,a1,a2,a3,b,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,r,s,t,
u,v,x,y,z,sum,mx,mn,flg,flg1,flg2,id1,id2,id3,id4,lim,id;
L A[Mx],B[Mx];
void solve(){
    mx=-1;c=0;
    for(L i=0;i<n;i++){
        if(i==0){
            d1=abs(A[i]+(k-A[n-1]));
            c+=d1;
            if(d1>mx){
                mx=d1;
                id1=n-1;id2=i;
            }
        }else{
            d1=abs(A[i]-A[i-1]);
            c+=d1;
            if(d1>mx){
                mx=d1;
                id1=i-1;id2=i;
            }
        }
    }
    c-=mx;
    printf("%lld\n",c);

}
int main()
{
    scanf("%lld%lld",&k,&n);
    for(L i=0;i<n;i++){
        scanf("%lld",&A[i]);
    }
    solve();
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 4352
s = input()
t = input()

s_l = len(s)
t_l = len(t)

max_count = 0
for i in range(0, s_l - t_l + 1):
  count = 0
  for j in range(0, t_l):
    if s[i+j] == t[j]:
      count += 1
  if count > max_count:
    max_count = count

diff = t_l - max_count
print(diff)


Measured memory_bytes: 9048
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Long[] array = new Long[6];
		long a = sc.nextLong();
		long b = sc.nextLong();
		long k = sc.nextLong();
		long noko = k-a;
		noko=b-noko;

		if(a-k>=0) {
			System.out.println(a-k+" "+b);
		}

		else if(a+b-k>=0) {
			System.out.println(0+" "+noko);
		}

		else {
			System.out.println(0+" "+0);
		}
	}
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll h,n;
    cin>>h>>n;
    vector<ll> ar(n);
    ll sum=0;
    for(ll x=0;x<n;x++)
    {
        cin>>ar[x];
        sum+=ar[x];
    }
    if(sum>=h){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

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

int main() {
	int N; cin >> N;
	vector<bool> a;
	string S1, S2; cin >> S1 >> S2;
	long ans;
	for(int i=0, j=0; i+j<N; ++i){
	    if(S1[i+j]!=S2[i+j]){
	        a.push_back(true);
	        ++j;
	    }
	    else a.push_back(false);
	}
	if(a[0]) ans=6;
	else ans=3;
	for(int i=1; i<a.size(); ++i){
	    if(a[i]){
	        if(a[i-1]) ans=(ans*3)%1000000007;
	        else ans=(ans*2)%1000000007;
	    }
	    else if(!a[i-1]) ans=(ans*2)%1000000007;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;


int max_n = 1000000;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(){
	ll n,m,a,b;
	cin >> n >> m;
	vector<P> v(m);
	for(int i = 0; i < m; i++) {
		cin >> a >> b;
		v[i] = mp(a-1,b-1);
	}
	UnionFind uf(n);
	ll ans = n*(n - 1)/2;//橋を全部取ったときの不便さ
	vector<ll> A;//答えを入れるvector
	//後ろから橋を足していくう
	for(int i = m-1; i >= 0; i--) {
		A.pb(ans);
		a = v[i].fs;
		b = v[i].sc;
		if (uf.issame(a,b)){
			continue;
		}
		ll sa = uf.size(a);
		ll sb = uf.size(b);
		ans -= sa * sb;
		uf.merge(a,b);
	}
	reverse(ALL(A));
	for(int i= 0; i< m; i++) {
		cout << A[i] << endl;
	}
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n,m,x;
int c[15],a[15][15];
int sum[15];

int32_t main()
{
    IOS
    cin>>n>>m>>x;
    for (int i=1;i<=n;i++)
    {
        cin>>c[i];
        for (int j=1;j<=m;j++) cin>>a[i][j];
    }

    int minn=inf;
    for (int i=0;i<(1<<n);i++)
    {
        memset(sum,0,sizeof(sum));
        int money=0;

        for (int j=0;j<n;j++)
            if (i&(1<<j))
        {
            money+=c[j+1];
            for (int k=1;k<=m;k++)
                sum[k]+=a[j+1][k];
        }
        int ok=1;
        for (int k=1;k<=m;k++)
            if (sum[k]<x) ok=0;
        if (ok) minn=min(minn,money);
    }
    if (minn==inf) cout<<-1<<endl;
    else cout<<minn<<endl;
}



Measured memory_bytes: 3580
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x,y,a,b,c=nm()

ans=0

p=sorted(nl())[::-1][:x]
q=sorted(nl())[::-1][:y]
r=sorted(nl())[::-1]

s=sorted(p+q+r)[::-1]

print(sum(s[:x+y]))



  

Measured memory_bytes: 28380
n = int(input())
s = input()

dp = [[0]*(n+1) for i in range(n+1)]

ans = 0
for i in range(n-1, -1, -1):
    for j in range(n-1, i, -1):
        if s[i] == s[j]:
            dp[i][j] = dp[i+1][j+1] + 1
        else:
            dp[i][j] = 0
        ans = max(ans, min(dp[i][j], j-i))

print(ans)

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

int N, A, B, C, D;
ll mod=1000000007, memo[1010][1010];
bool se[1010][1010];
const int arm=1050;
ll fac[arm], finv[arm], inv[arm];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<arm; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(int n, int k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}
ll modpow(ll a, ll b, ll m){
    ll res=1, p=0, now=a;
    b %= (m-1);
    for(int i=0; b>p; ++i){
        if(b&((ll) 1<<i)){
            res=(res*now)%m;
            p |= ((ll) 1<<i);
        }
        now=(now*now)%mod;
    }
    return res;
}
ll modinv(ll a, ll m){
    return modpow(a, m-2, m);
}
ll moddiv(ll a, ll b, ll m){
    return (a*modinv(b, m))%m;
}


ll solve(int num, int group){
    if(!se[num][group]){
        if(num==0) memo[num][group]=1;
        else if(group==A){
            if(num%group==0 && (group*C<=num && num<=group*D)){
            	memo[num][group]=finv[num/group];
            	for(int i=0; i<num; i += group){
            		memo[num][group]=(memo[num][group]*COM(num-i, group, mod))%mod;
            	}
            }
            else memo[num][group]=0;
        }
        else{
            ll now=1;
            for(int i=0; group*i<=num && i<=D; ++i){
                if(i==0 || C<=i){
                    memo[num][group]=(memo[num][group]+(now*solve(num-group*i, group-1))%mod)%mod;
                }
                now=(now*moddiv(COM(num-group*i, group, mod), i+1, mod))%mod;
            }
        }
        se[num][group]=1;
    }
    return memo[num][group];
}


int main() {
	cin >> N >> A >> B >> C >> D;
	COMinit(mod);
	cout << solve(N, B) << endl;
	return 0;
}


Measured memory_bytes: 8960
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vi a(n+1,0);
    int diff = 0;
    for(int i=0; i<n; ++i) {
        cin >> a[i+1];
        diff += abs(a[i+1]-a[i]);
    }
    a.pb(0);
    diff += abs(a[n]);
    for(int i=1; i<=n; ++i) {
        cout << diff + (abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])) << "\n";
    }
}



Measured memory_bytes: 1656
#include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int main() {
	int n,i;
	cin >> n;
	string s,t;
	int a[54];
	cin >> s;
	cin >> t;
	for(i=0;i<n;i++){
		if(s[i]==t[i]){
			a[i]=1;
		}else{
			a[i]=0;
		}
	}
	int start = 0;
	long long ans;
	int check=0;
	if(a[0]==0){
		ans = 6;
	}else{
		ans = 3;
	}
	for(i=0;i<n-1;i++){
		if(a[i]==1 && a[i+1]==0){
			ans *= 2;
			check = 0;
			ans = ans%1000000007;
		}else if(a[i]==1 && a[i+1] == 1){
			ans *= 2;
			check = 0;
			ans = ans%1000000007;
		}else if(a[i]==0 && a[i+1]==0){
			check +=1;
			if(check == 2){
				ans *= 3;
				check = 0;
				ans = ans%1000000007;
			}
		}else if(a[i]==0 && a[i+1]==1){
			check = 0;
			ans = ans%1000000007;
		}
	}
	ans = ans%1000000007;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
$s = <STDIN>;
chomp $s;
$N = length $s;
$flag = 0;
$A =  $s;
$B = reverse($A);
if($A ne $B ){$flag = 1;}
 
$T = ($N-1)/2;
$A =  substr($s, 0, $T);
$B = reverse($A);
if($A ne $B ){$flag = 1;}
 
if($flag == 0 ){
  print "Yes";
}else{
  print "No";
}

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

#define MAX_N 1120+1
#define MAX_K 14+1
#define MAX_L 187+1

vector<int> p;
int dp[MAX_N][MAX_K][MAX_L];

void init() {
    memset(dp, -1, sizeof(dp));
    bool f[MAX_N];
    memset(f, 1, sizeof(f));
    f[0] = f[1] = false;
    for (int i = 2; i <= MAX_N; i++) 
        if (f[i]) {
            p.push_back(i);
            for (int j = i+i; j <= MAX_N; j+=i)
                f[j] = false;
        }
}

int F(int n, int k, int l) {
    //cout << n << ' ' << k << ' ' << l << endl;
    if (dp[n][k][l] >= 0) return dp[n][k][l];
    if (k == 0) {
        if (n == 0) return 1;
        return 0;
    }
    if (n < 2) return 0;
    int c = 0;
    for (int i = 0; i < p.size() && p[i] <= n && i < l; i++) {
        c += F(n-p[i], k-1, i);
    }
    return dp[n][k][l] = c;
}

int main() {
    init();
    int n, k;
    while (cin >> n >> k) {
        if (n == 0 && k == 0) break;
        cout << F(n, k, p.size()) << endl;
    }
    return 0;
}

Measured memory_bytes: 13564
using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;

class Program
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        Console.WriteLine(3200 <= a ? s : "red");
        return;
    }
}

Measured memory_bytes: 27476
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1)*a%MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1)*a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b,a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size()>n) return kaijo_memo[n];
  if(kaijo_memo.size()==0) kaijo_memo.push_back(1);
  while(kaijo_memo.size()<=n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1]*kaijo_memo.size()%MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size()>n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size()==0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size()<=n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1]*mpow(gyaku_kaijo_memo.size(),MOD-2)%MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n==r) return 1;
  if(n<r||r<0) return 0;
  ll ret=1;
  if(n<=1e7){
    ret*=kaijo(n); ret%=MOD;
    ret*=gyaku_kaijo(r); ret%=MOD;
    ret*=gyaku_kaijo(n-r); ret%=MOD;
  }else{
    rep(i,r){
      ret*=n-i; ret%=MOD;
      ret*=mpow(r-i,MOD-2); ret%=MOD;
    }
  }
  return ret;
}

signed main(){
	ll n,m,k; cin>>n>>m>>k;
	ll ans=0LL;
	rep(i,k+1){
		ans+=nCr(n-1,i)%MOD*mpow(m-1,n-i-1)%MOD*m%MOD;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 7920
fun main(args: Array<String>) {
    val N = nextInt()
    val A = Array(N) { nextInt() }
    val (first, second) = A.sortedDescending()
    A.forEach {
        val ans = if (it == first) second else first
        println(ans)
    }
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun nextLong() = java.lang.Long.parseLong(next())
fun nextLong(offset: Long = 0L) = nextLong() + offset
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 57652
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
typedef pair < int , bool > Pi;
int main(){
  string s;
  cin >> s;
  vector< Pi > vc;
  bool prev = s[0] == 'e';
  int i;
  if(prev) i = 3, vc.push_back(Pi( 1, true));
  else i = 7, vc.push_back(Pi( 1, false));

  while( i < s.size() ){
    if(s[i] == 'e'){
      if(prev) vc.push_back(Pi( 1, true));
      else prev = vc.back().second = true, vc.back().first++;
      i += 3;
    }else{
      if(!prev) vc.push_back(Pi( 1, false));
      else prev = vc.back().second = false, vc.back().first++;
      i += 7;
    }
  }
  int ret = 0;
  for(int i = 1 ; i < vc.size() ; i++ ){
    if( vc[ret].first < vc[i].first) ret = i;
  }
  cout << (vc[ret].second ? "egg" : "chicken") << endl;
}

Measured memory_bytes: 1200
/*
                   ,.ood888888888888boo.,
              .od888P^""            ""^Y888bo.
          .od8P''   ..oood88888888booo.    ``Y8bo.
       .odP'"  .ood8888888888888888888888boo.  "`Ybo.
     .d8'   od8'd888888888f`8888't888888888b`8bo   `Yb.
    d8'  od8^   8888888888[  `'  ]8888888888   ^8bo  `8b
  .8P  d88'     8888888888P      Y8888888888     `88b  Y8.
 d8' .d8'       `Y88888888'      `88888888P'       `8b. `8b
.8P .88P            """"            """"            Y88. Y8.
88  888                                              888  88
88  888                                              888  88
88  888.        ..                        ..        .888  88
`8b `88b,     d8888b.od8bo.      .od8bo.d8888b     ,d88' d8'
 Y8. `Y88.    8888888888888b    d8888888888888    .88P' .8P
  `8b  Y88b.  `88888888888888  88888888888888'  .d88P  d8'
    Y8.  ^Y88bod8888888888888..8888888888888bod88P^  .8P
     `Y8.   ^Y888888888888888LS888888888888888P^   .8P'
       `^Yb.,  `^^Y8888888888888888888888P^^'  ,.dP^'
          `^Y8b..   ``^^^Y88888888P^^^'    ..d8P^'
              `^Y888bo.,            ,.od888P^'
                   "`^^Y888888888888P^^'"
*/

#include<bits/stdc++.h>
#define forn(i, n) for(int i=0;i<(int)(n);i++)
#define for1(i, n) for(int i=1;i<=(int)(n);i++)
#define ford(i, n) for(int i=(int)(n)-1;i>=0;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"
#define MAX 1e9+7
using namespace std;
typedef int64_t ll;
typedef vector<int> vi;
typedef vector<int64_t> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	
	int n;
	cin >> n;
	int temp;
	forn(i,n){
		cin >> temp;
		if(temp%2==0 && temp%3!=0 && temp%5!=0){
			cout << "DENIED\n";
			return 0;
		}
	}
	cout << "APPROVED\n";

	return 0;
	// you should actually read the stuff at the bottom
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases ( n=0, 1, negatives ? )
	* do smth instead of nothing and stay organized
*/



Measured memory_bytes: 256
import sys

n,h = map(int,input().split())
a,b = [0]*n,[0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
    
c = sorted(b,reverse = True)
maa = max(a)

ans = 0
for i in range(n):
    if c[i] > maa:
        ans += 1
        h -= c[i]
    else:
        break
        
    if h <= 0:
        print(ans)
        sys.exit()
        
ans += (h-1) // maa + 1
print(ans)

Measured memory_bytes: 46808
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int n = sc.nextInt();
			
			int[][] matrix = new int[10][10];
			
			for(int i = 1 ; i <= n ; i++ ) {
				String iStr = String.valueOf(i);
				char first = iStr.charAt(0);
				char last = iStr.charAt(iStr.length()-1);
				
				int x = first - '0';
				int y = last - '0';
				matrix[x][y]++;
			}
			
			long count = 0;
			for(int i = 1 ; i <= 9 ; i++) {
				for(int j = 1; j <= 9 ; j++ ) {
					if ( i == j && matrix[i][j] > 0 ){
						count += Math.pow(matrix[i][j],2); 
					}
					else {
						count += matrix[i][j] * matrix[j][i];
					}
				}
			}
			
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 34388
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	cout << fixed << setprecision(9);
	double n;
	cin>>n;
	cout<<pow(n/3,3);
	
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3


def main():
    n, k, q = (int(z) for z in input().split())
    scores = [k - q for _ in range(n)]
    for _ in range(q):
        a = int(input()) - 1
        scores[a] += 1
    ress = ["Yes" if score > 0 else "No" for score in scores]
    print(*ress, sep="\n")


if __name__ == "__main__":
    main()


Measured memory_bytes: 10196
import java.util.*;

public class Main {
  
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int a = 0;
        int b = 0;
        int c = 0;
        for (char ch : S.toCharArray()) {
            switch(ch) {
            case 'a' : a++;
                       break;
            case 'b' : b++;
                       break;
            case 'c' : c++;
            }
        }
        int max = Math.max(Math.max(a, b), c);
        int limit = (S.length()+2)/3;
        System.out.println(limit < max ? "NO" : "YES");
    }
}


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

using namespace std;

int main() {
	int N;
	cin >> N;
	N *= 2;
	vector<int> L(N);
	for (int i = 0; i < N; ++i) {
		cin >> L[i];
	}

	int count = 0;
	sort(L.begin(), L.end());
	for (int i = 0; i < N; i += 2) {
		count += min(L[i], L[i+1]);
	}
	cout << count << endl;
}

Measured memory_bytes: 764
fun main(args: Array<String>){
    val line: String = readLine() as String
    val abc=line.split(" ")
    val a = abc[0].toInt()
    val b = abc[1].toInt()
    val c = abc[2].toInt()
    if (a+b>=c){
        print("Yes")
    }else{
        print("No")
    }
}

Measured memory_bytes: 37820
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pa;
const ll MOD = 1e9 + 7;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
}
//-----------------------------------------------------------//

int main() {
    init();
    int N, a, b;
    cin >> N;
    vector<vector<int>> E(N);
    vector<pair<int, int>> V;
    rep(i, N - 1) {
        cin >> a >> b;
        a--;
        b--;
        E[a].eb(b);
        E[b].eb(a);
        V.eb(a, b);
    }
    int max_c = 0;
    rep(i, N) max_c = max(max_c, (int)E[i].size());

    map<pair<int, int>, int> D;
    vector<bool> used(N, false);
    queue<int> q;
    q.emplace(0);
    vector<priority_queue<int, vector<int>, greater<int>>> PQ(N);
    while (!q.empty()) {
        int x = q.front();
        q.pop();
        int c = 0;
        for (auto e : E[x]) {
        	if(used[e])continue;
            while (!PQ[x].empty()) {
                if (c != PQ[x].top()) break;
                PQ[x].pop();
                c++;
            }
            PQ[e].emplace(c);
            q.emplace(e);
            D[make_pair(x, e)] = D[make_pair(e, x)] = c++;
        }
        used[x] = true;
    }
    cout << max_c << endl;
    for (auto v : V) cout << D[v] + 1 << endl;
    return 0;
}


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

using namespace std;

const int INF = 1 << 30;

int main()
{
  int N, Ma, Mb;
  int dp[401][401];
  fill_n(*dp, 401 * 401, INF);

  cin >> N >> Ma >> Mb;
  dp[0][0] = 0;
  for(int i = 0; i < N; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    for(int j = 400; j >= a; j--) {
      for(int k = 400; k >= b; k--) {
        dp[j][k] = min(dp[j][k], dp[j - a][k - b] + c);
      }
    }
  }

  int ret = INF;
  for(int i = 1; i < 401; i++) {
    for(int j = 1; j < 401; j++) {
      // i : j = Ma : Mb
      if(i * Mb == j * Ma) ret = min(ret, dp[i][j]);
    }
  }

  if(ret == INF) ret = -1;
  cout << ret << endl;
}

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

using namespace std;

typedef long long LL;

int n;
string s;
map <string, int> h;

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> s;
        sort(s.begin(), s.end());
        h[s]++;
    }
    LL ans = 0;
    for (auto const &e: h) {
        ans += LL(e.second) * (e.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

long long a[120][2],sum,k;

int main()
{
    char s[120];
    cin>>s>>k;
    int f=1;
    for(int i=0; s[i]!='\0'; i++)
        if(s[i]!='1')
        {
            if(k<=i)cout<<1;
            else
                cout<<s[i];
            f=0;
            break;
        }
        if(f)cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	bool ok = false;
	queue<int> q;
	q.push(0);
	while(!q.empty())
	{
		int at = q.front(); q.pop();
		if(at == n)
		{
			ok = true;
			break;
		}
		else if(at > n)
			continue;
		else{
		q.push(at + 4);
		q.push(at + 7);
		}
	}
	if(ok)
		puts("Yes");
	else
		puts("No");
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
  int m,fund,years,n;
  int sort;
  double interest;
  int charge;
  int max,money,stock,i;
  cin>>m;
  while(m-->0){
    cin>>fund>>years>>n;
    max=0;
    while(n-->0){
      cin>>sort>>interest>>charge;
      money=fund;
      stock=0;
      for(i=0;i<years;i++){
	stock+=(int)((double)money*interest);
	if(sort==1){money+=stock;stock=0;}
	money-=charge;
      }
      if(max<money+stock)max=money+stock;
    }
    cout<<max<<endl;
  }
}

Measured memory_bytes: 0
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_num(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int a, b;
int n;
int s[1010], t[1010];

int main() {
	cin >> a >> b >> n;
	bool isng = false;
	REP(i, n) {
		cin >> s[i] >> t[i];
		if ((s[i]<=a&&a < t[i]) || (s[i] < b&&b<=t[i])||(a<=s[i]&&t[i]<=b)) {
			isng = true;
		}
	}
	cout << (isng ? 1 : 0) << endl;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define M 1000005
#define FI first
#define SE second
#define MP std::make_pair
#define PB push_back
#define mod 998244353
#define base 233
#define INF 1000000000
typedef long long ll;

int read() {
	int ans = 0; char c = getchar();
	while (c < '0' || c > '9') c = getchar();
	while (c >= '0' && c <= '9') ans = ans * 10 + c - '0', c = getchar();
	return ans;
}
void Write(int x) {
	if (x < 10) putchar(x + '0');
	else Write(x / 10), putchar(x % 10 + '0');
	return;
}
int main() {
	Write(read() ^ 1);
	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;

int a,b;
int N;
int A[1000];
int main(void)
{
	fill(A,A+1000,0);
	cin>>a>>b;
	cin>>N;
	for(int i=0;i<N;i++){
		int k,s;
		cin>>k>>s;
		for(int q=k;q<s;q++){
			A[q]=1;
		}
	}
	for(int i=a;i<b;i++){
		if(A[i]==1){
			cout<<1<<endl;
			break;
		}
		if(i==(b-1)){
			cout<<0<<endl;
		}
	}

	


	return 0;
}


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

int main(){
    int n, k;
    long long ans = 1000000000;
    cin >> n >> k;
    vector <long long> h;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        h.push_back(a);
    }

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

    for(int i=0;i<=n-k;i++){
        ans = min(ans, abs(h[i]-h[i+k-1]));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <utility>
#include <vector>
 
static const int MAXN = 2e5 + 4;
static const int ALPHA = 26;
 
static int n;
static char s[MAXN];
static std::vector<int> occ[ALPHA];
static std::vector<std::pair<int, int>> p;
static int dest[MAXN];
 
namespace bit {
    int t[MAXN];
    inline void add(int pos) { for (++pos; pos < MAXN; pos += (pos & -pos)) t[pos] += 1; }
    inline int sum(int rg) { int ans = 0; for (++rg; rg; rg -= (rg & -rg)) ans += t[rg]; return ans; }
    inline int sum(int lf, int rg) { return sum(rg) - sum(lf); }
}
 
int main()
{
    scanf("%s", s);
    n = strlen(s);
 
    for (int i = 0; i < n; ++i) occ[s[i] - 'a'].push_back(i);
 
    int odd = -1;
    for (int i = 0; i < ALPHA; ++i) {
        if (occ[i].size() & 1) {
            if (odd == -1) odd = i;
            else {puts("-1"); return 0; }
        }
        for (int j = 0; j < occ[i].size() / 2; ++j)
            p.push_back({ occ[i][j], occ[i][occ[i].size() - 1 - j] });
    }
    std::sort(p.begin(), p.end(), [] (const std::pair<int, int> a, const std::pair<int, int> b) {
        return a.first < b.first;
    });
 
    for (int i = 0; i < n / 2; ++i) {
        dest[p[i].first] = i;
        dest[p[i].second] = n - 1 - i;
    }
    if (odd != -1) dest[occ[odd][occ[odd].size() / 2]] = n / 2;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += bit::sum(dest[i], n);
        bit::add(dest[i]);
    }
 
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 4596
import itertools
s = input()
s2 = s

t = []
t2 = []
u = []
ans = int(s)
p = 0
digit = 0
for i in range(len(s)):
    u.append([])
for i in range(len(s)):
    t.append(i)
    if i != len(s) - 1:
        t2.append(i)
    u[i].append(i)
    u[i].append(s[i])
addli = []
for k in range(1, len(s)):
    for balls in itertools.combinations(t2, k):
        for call in balls:
            if p != 0:
                call = call - digit
            r2 = s2
            s3 = r2[:call + 1]
            s2 = r2[call + 1:]
            ss3 = s3
            addli.append(int(ss3))
            p += 1
            digit += len(s3)
            if len(balls) == p:
                addli.append(int(s2))
        ans += sum(addli)

        addli = []
        p = 0
        s2 = s
        digit = 0
print(ans)

Measured memory_bytes: 3444
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<set>

using namespace std;
using ll = long long;

const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int k, a, b;cin >> k >> a >> b;
    int c = b / k;

    if (c * k >= a){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1
 
print(b, end='')

Measured memory_bytes: 40188
bingo = []
flag = [0, 0, 0, 0, 0, 0, 0, 0, 0]
bingo.extend(input('').split(' '))
bingo.extend(input('').split(' '))
bingo.extend(input('').split(' '))
N = int(input(''))

for i in range(N):
    b = input('')
    if b in bingo:
        flag[bingo.index(b)] = 1

if(flag[0] * flag[1] * flag[2] == 1 or flag[3] * flag[4] * flag[5] == 1 or flag[6] * flag[7] * flag[8] == 1 or flag[0] * flag[3] * flag[6] == 1 or flag[1] * flag[4] * flag[7] == 1 or flag[2] * flag[5] * flag[8] == 1 or flag[0] * flag[4] * flag[8] == 1 or flag[2] * flag[4] * flag[6] == 1):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

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

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

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll n,m;
    cin >> n >> m;

    vector<ll> a(m);
    vector<ll> b(m);
    vector<vector<bool>> key(m,vector<bool>(n,false));
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        for(int j = 0; j < b[i]; j++){
            ll tmp;
            cin >> tmp;
            key[i][tmp-1] = true;
        }
    }

    vector<ll> dp(1 << n,INF);

    dp[0] = 0;

    for(int i = 0; i < (1 << n); i++){
        for(int j = 0; j < m; j++){
            ll tr = 0;
            ll bit = 1;
            for(int k = 0; k < n; k++){
                if(key[j][k]){
                    tr += bit;
                }
                bit <<= 1;
            }
            if(dp[i | tr] > dp[i] + a[j]){
                dp[i | tr] = dp[i] + a[j];
            }
        }
    }

    cout << (dp[(1 << n) - 1] < INF ? dp[(1 << n) - 1] : -1) << endl;

    return 0;
}

Measured memory_bytes: 384
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;


ll f(ll a,ll b){
  ll c=0;
  while(a||b){
    a/=10;
    b/=10;
    c++;
  }
  return c;
}


int main()
{ 

IOS;

ll n;cin>>n;


ll ans=100;


for(ll i=1;i*i<=n;i++){
  if(n%i==0){
    ans=min(ans,f(i,n/i));
  }
}

cout<<ans;

//end_routine();

return 0;
 
}


Measured memory_bytes: 3656