akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pi 3.14159265358979323846
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

void solve()
{
	string s,t;
	cin>>s>>t;
	cout<<t<<s;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long ll;

int main()
{
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  
  int val=min(b,d)-max(a,c);
  if(val<=0) cout<<0<<endl;
  else cout<<val<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

struct Point {
	int x;
	int y;
};

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

	int n; cin >> n;

	vector<Point> ps(n);
	for (auto& p : ps) {
		cin >> p.x >> p.y;
	}

	int ans = n;

	FOR_LT(i, 0, n - 1) {
		FOR_LT(j, i, n) {
			int score = n;
			int p = ps[j].x - ps[i].x;
			int q = ps[j].y - ps[i].y;

			FOR_LT(pi, 0, n) {
				bool has_next = false;
				FOR_LT(pj, 0, n) {
					if (pi == pj) continue;

					if (ps[pj].x - ps[pi].x == p && ps[pj].y - ps[pi].y == q) {
						has_next = true;
						break;
					}
				}

				if (has_next) score--;
			}
			ans = min(ans, score);
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define R(a) int a;cin>>a;
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mod 1000000007
#define f_arr(n) for(int i=0;i<n;i++)
#define r_arr(n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define all(x) x.begin(),x.end()
#define inf 1e18
#warning uncomment the #define int line before submitting
#define int long long int
using namespace std;

#ifndef ONLINE_JUDGE
template<typename T>    
void __p(T a) {
  cerr<<a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
  cerr<<"[";
  __p(a.first);
  cerr<<",";
  __p(a.second);
  cerr<<"]";
}
template<typename T>
void __p(std::vector<T> a) {
  cerr<<"[";
  for(auto it=a.begin(); it<a.end(); it++)
    __p(*it),cerr<<",]"[it+1==a.end()];
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
  __p(a1);
  __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr<<name<<" : ";
  __p(arg1);
  cerr<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  int bracket=0,i=0;
  for(;; i++)
    if(names[i]==','&&bracket==0)
      break;
    else if(names[i]=='(')
      bracket++;
    else if(names[i]==')')
      bracket--;
  const char *comma=names+i;
  cerr.write(names,comma-names)<<" : ";
  __p(arg1);
  cerr<<" | ";
  __f(comma+1,args...);
}
#define trace(...) cerr<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#endif

void test_case()
{
  R(h);R(w);R(k);
  vector<string> grid(h);
  for(int i=0;i<h;i++){
    cin>>grid[i];
  }
  int answer=0;
  for(int maskR=0;maskR<(1<<h);maskR++){
    for(int maskC=0;maskC<(1<<w);maskC++){
      int black=0;
      for(int row=0;row<h;row++){
        for(int col=0;col<w;col++){
          if((maskR>>row)%2 && (maskC>>col)%2 && grid[row][col]=='#'){
            black++;
          }
        }
      }
      if(black==k){
        answer++;
      }
    }
  }
  cout<<answer;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int t=1;
    // cin>>t;
    while(t--)
    {
        test_case();
    }

    cerr<<endl<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";

    return 0;
}


Measured memory_bytes: 3832
import sys

N, X, Y = map(int, input().split())
X -= 1
Y -= 1

d = [[sys.maxsize for _ in range(N)] for _ in range(N)]

for i in range(N):
  for j in range(N):
    d[i][j] = min(abs(j-i), abs(X-i) + 1 + abs(j-Y), abs(Y-i) + 1 + abs(j-X))

answer = [0 for _ in range(N-1)]

for h in range(N):
  for i in range(h+1, N):
    if h != i:
      answer[d[h][i]-1] += 1

for k in range(N-1):
  print(answer[k])

Measured memory_bytes: 86364
#include <bits/stdc++.h>
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)
#define rep(i, n) repi(i, 0, n)
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
// using P = pair<int, int>;
struct Vec{
        double x, y;
};
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;
}
using namespace std;
int main()
{
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        // cout << fixed << setprecision(15);
        string s;
        cin >> s;
        if (s.substr(s.length()-1, 1) == "s") s += "es";
        else s += "s";
        cout << s << endl;
        return 0;
}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  vector<long long> a(n); REP(i, n) cin >> a[i];
  long long mt1 = a[0];
  FOR(i, 1, n) {
    if (i % 2 == 0) mt1 += a[i];
    else mt1 -= a[i];
  }
  mt1 /= 2;
  vector<long long> ans(n);
  ans[0] = mt1;
  FOR(i, 1, n) ans[i] = a[i - 1] - ans[i - 1];
  REP(i, n) cout << ans[i] * 2 << (i == n - 1 ? '\n' : ' ');
  return 0;
}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j,k,x=0,y,z;
    cin>>n;
    long long int A[n];
    for(i=0;i<n;i++){
        cin>>A[i];
    }
    for(i=0;i<n-2;i++){
        for(j=i+1;j<n-1;j++){
            for(k=j+1;k<n;k++){
                if(A[i]+A[j]>A[k]&&A[i]+A[k]>A[j]&&A[j]+A[k]>A[i]&&(A[i]!=A[j]&&A[j]!=A[k]&&A[i]!=A[k]))
                    x+=1;
            }
        }
    }
    cout<<x;
    return 0;
}


Measured memory_bytes: 3652
a, b = gets.split.map(&:to_i)

if a < 0 && b < 0 && ((a % 2 == 0 && b % 2 == 0) || (a % 2 == 1 && b % 2 == 1) )
  puts "Negative"
elsif a <= 0 && b >= 0
  puts "Zero"
else
  puts "Positive"
end


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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

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

const int N = 54;

char a[N][N];

void incM(int y, int x) {
	if (a[y][x] == '#') return;
	++a[y][x];
}

void solve() {
	int h, w; scanf("%d%d", &h, &w);
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			char c; scanf(" %c", &c);
			if (c == '#') {
				a[i][j] = c;
				if (i) {
					if (j) incM(i-1, j-1);
					incM(i-1, j);
					if (j+1 < w) incM(i-1, j+1);
				}
				if (j) incM(i, j-1);
			} else {
				a[i][j] = '0';
				if (i) {
					if (a[i-1][j] == '#') ++a[i][j];
					if (j && a[i-1][j-1] == '#') ++a[i][j];
					if (j+1 < w && a[i-1][j+1] == '#') ++a[i][j];
				}
				if (j && a[i][j-1] == '#') ++a[i][j];
			}
		}
	}
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			putchar(a[i][j]);
		}
		puts("");
	}
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


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

#define int long long
#define mod 1000000007
#define p pair<int,int>
#define MAX 1000010

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    int v[] = {111,222,333,444,555,666,777,888,999};

    cout << *lower_bound(v,v+9,n) << endl;

    return 0;
}

Measured memory_bytes: 384
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import decimal
INF = 10**18
WHITE = 0
GRAY = 1
BLACK = 2

def Prim():
    d = [INF]*(n)
    c = [WHITE]*(n)
    p = [-1]*(n)

    d[0] = 0
    while True:
        minv = INF
        u = -1
        for i in range(n):
            if minv > d[i] and c[i] != BLACK:
                u = i
                minv = d[i]
        if u == -1:
            break
        c[u] = BLACK
        for v in range(n):
            if c[v] != BLACK and G[u][v] != INF:
                if d[v] > G[u][v]:
                    d[v] = G[u][v]
                    p[v] = u
                    c[v] = GRAY
    sum_g = 0
    for i in range(n):
        if p[i] != -1:
            sum_g += G[i][p[i]]
    return sum_g


if __name__ == "__main__":
    n = int(input())
    G = []
    for i in range(n):
        s = list(map(int,input().split()))
        G.append(s)
    for i in range(n):
        for j in range(n):
            if G[i][j] == -1:
                G[i][j] = INF
    ans = Prim()
    print(ans)


Measured memory_bytes: 6828
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,ans=0,x=0;string s;
  cin>>n>>s;
  rep(i,s.size()){
    if(s[i]=='I'){
      x++;
      ans=max(ans,x);
    }else x--;
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
B = [0]
for i in range(N):
    B.append(B[i]+A[i])
ans = float('inf')
for i in range(1, N):
    ans = min(ans, abs(s-(2*B[i])))
print(ans)

Measured memory_bytes: 100044
#include <bits/stdc++.h>
#define rep(i,n) REP(i,0,n)
#define int long long
#define REP(i,l,r) for(int i=l;i<r;i++)
using namespace std;
typedef pair<int,int> P;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
struct edge{
    int to,cost;
};
class dijkstra{
    int V;
    int d[100002];
    priority_queue<P,vector<P>,greater<P>>que;
    void update(int s,vector<edge> G[]){
        fill(d,d+V+1,100000000000ll);
        d[s]=0;
        que.push(make_pair(0,s));
        while(!que.empty()){
            P p=que.top();
            que.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            rep(i,G[v].size()){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    que.push(make_pair(d[e.to],e.to));
                }
            }
        }
    }
public:
    dijkstra(int v,int s,vector<edge> G[]){
        V=v;
        update(s,G);
    }
    int find(int e){
        return d[e];
;    }
};
signed main(){
    int n,ans=0;
    int h[20];
    cin>>n;
    rep(i,n){
        cin>>h[i];
        rep(j,i){
            if(h[i]<h[j])goto ioi;
        }
        ans++;
        ioi:;
    }
    cout<<ans<<endl;
}



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

int main()
{
  long long int N;
  cin >> N;
  vector<long long int> a(5);
  for (int i = 0; i < 5; i++)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  long long int ans = 0;
  ans = (N + (a[0] - 1)) / a[0] + 4;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
using namespace std;
int main(){
    while(1){
        int a,b;
        char op;
        cin>>a>>op>>b;
        if(op=='+') cout<<a+b<<endl;
        else if(op=='-') cout<<a-b<<endl;
        else if(op=='*') cout<<a*b<<endl;
        else if(op=='/') cout<<a/b<<endl;
        else if(op=='?'){
            break;
        }

    }
    return 0;

    
}


Measured memory_bytes: 3084
N, Q = gets.split.map(&:to_i)
edges = Hash.new { |h, k| h[k] = [] }

(N - 1).times do
  a, b = gets.split.map(&:to_i)

  edges[a - 1] << b - 1
  edges[b - 1] << a - 1
end

counter = Array.new(N, 0)

Q.times do
  idx, cnt = gets.split.map(&:to_i)

  counter[idx - 1] += cnt
end

answers = Array.new(N, 0)

queue = [[0, counter[0]]]
visited = Hash.new(false)

until queue.empty?
  idx, cnt = queue.shift

  next if visited[idx]
  visited[idx] = true

  answers[idx] = cnt

  edges[idx].each do |child|
    queue << [child, cnt + counter[child]]
  end
end

puts answers.join(' ')


Measured memory_bytes: 62972
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;

 int main()
 {
   int n;
   int total=100000;
   cin>>n;
   while(n--)
   {
     total=(int)(total*1.05);
     if(total%1000==0) continue;
     else total=(total/1000+1)*1000;          
   }
   cout<<total<<endl;
   //while(1);      
   return 0;    
 }
 
 

Measured memory_bytes: 2992
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
template<typename T>
struct BIT{
    //1-index
    //0-indexで取ると無限ループする
    private:
    V<T> arr;
    int n;

    public:
    BIT(int siz){
        n=siz;
        arr.assign(n+1,0);
    }
    //一点更新 aにvを加える
    void add(T a,T v){
        //x+=(x&-x) 初項a,それ以降a<=2^Nが列挙
        for(T x=a;x<=n;x+=(x&-x)){
            arr[x]+=v;
        }
    }
    T sum(T a){
        // 1からaまでの区間和
        T ret=0;
        for(T x=a;x>0;x-=(x&-x))ret+=arr[x];
        return ret;
    }
    T lower_bound(T w){// 区間和がw以上となる最小のindを返す
        if(w<=0)return 0;
        T x,r=1;//xは横の位置,rはrank
        while(r<n)r<<=1;
        for(T k=r;k>0;k>>=1){
            if(x+k<=n&&arr[x+r]<w){
                w-=arr[x+r];
                x+=k;
            }
        }
        return x+1;
    }
    T get(T x){//x番目に大きい数
        if(x<=0) return 0;
        T N=1;
        while(N*2<=n)N*=2;
        T v=0;
        for(T i=N;i>0;i/=2){
            if(v+i<=n&&arr[v+i]<x){
                x-=arr[v+i];
                v+=i;
            }
        }
        return v+1;
    }
    T query(int l,int r){
        return sum(r)-sum(l);
    }
};
ll n;
V<ll> a;
V<ll> sum;
V<P> dat;
ll solve(ll x){
    BIT<ll> bit(n+1);
    sum.assign(n+1,0);
    dat.clear();
    for(int i=0;i<n;i++){
        ll add;
        if(a[i]>x)add=1;
        else add=-1;
        sum[i+1]=sum[i]+add;
    }
    for(int i=0;i<=n;i++)dat.emplace_back(sum[i],i);
    sort(all(dat),greater<P>());
    ll res=0;
    for(int i=0;i<=n;){
        int j=i;
        while(j<=n&&dat[i].fi==dat[j].fi){
            res+=bit.sum(dat[j].se);
            j++;
        }
        j=i;
        while(j<=n&&dat[i].fi==dat[j].fi){
            bit.add(dat[j].se+1,1);
            j++;
        }
        i=j;
    }
    return res;
}
int main(){
    cin>>n;
    a.resize(n);
    V<ll> d(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll l=0,r=(1e10);
    while(r-l>1){
        ll mid=(l+r)/2;
        ll c=solve(mid);
        if(c>(n+1)*n/2/2)r=mid;
        else l=mid;
    }
    cout<<r<<"\n";
}

Measured memory_bytes: 5620
is_ok = True
W, H = [int(i) for i in input().split()]

matrix = list()
for _ in range(H):
    matrix.append([i for i in input().split()])

up = matrix[0]
not_up = [str(int(not int(i))) for i in up]

if abs(up.count("0") * 2 - W) >= 2:
    is_ok = False


same = 1

for line in matrix[1:]:
    if up[0] == line[0]:
        same += 1
        if up != line:
            is_ok = False
            break

    elif not_up[0] == line[0] and not_up != line:
        is_ok = False
        break

if abs(same * 2 - H) >= 2:
    is_ok = False


if is_ok:
    print("yes")
else:
    print("no")



Measured memory_bytes: 14432
import sys
import re
import queue
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	x = i_input()
	if x == 0:
		print("1")
	else:
		print("0")

	return


if __name__ == '__main__':
	main()

Measured memory_bytes: 10704
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int N;
vector<ll> A;
ll ans = 0;

void op() {
	sort(A.begin(),A.end());
	A[N-1] -= N;
	F0R(i,N-1) A[i] ++;
	ans++;
	sort(A.begin(),A.end());
}

int main() {
	cin >> N; A.resize(N);
	F0R(i,N) cin >> A[i];
	FOR(i,1,N) {
		sort(A.begin(),A.end());
		reverse(A.begin(),A.end());
		
		// while A[0] >> A[i]
		ll dif = max(0LL,(A[0]-A[i])/(N+1)-1);
		ans += dif*i;
		F0R(j,i) A[j] += dif*(-N+i-1);
		FOR(j,i,N) A[j] += dif*i;
		while (1) {
			sort(A.begin(),A.end());
			reverse(A.begin(),A.end());
			if (A[0]-A[i] >= N) op();
			else break;
		}
	}
	ll dif = max(0LL,A[0]-(N-1)-N);
	F0R(i,N) A[i] -= dif;
	ans += dif*N;
	sort(A.begin(),A.end());
	while (A[N-1] > N-1) op();
	cout << ans;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

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

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    string s; std::cin >> s;
    set<char> cnt;
    for (auto &c : s) cnt.insert(c);
    std::cout << (cnt.size() == 2 ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

int dig (int x)
{
    int r=0;
    while (x)
    {
        r+=x%10;
        x/=10;
    }
    return r;
}

main()
{
    fast;
    int n,i,ans=INT_MAX;
    cin>>n;
    for (i=1;i<n;i++)
        ans=min(ans,dig(i)+dig(n-i));
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    if(a == 0 || b == 0)
        return 0;
    if(b > a)
        swap(a, b);
    long long tmp;
    while((tmp = a % b) != 0){
        a = b;
        b = tmp;
    }
    return b;
}

long long lcm(long long a, long long b){ // Å¬ö{
    return a / gcd(a, b) * b;
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> d(n), v(n);
        for(int i=0; i<n; ++i)
            cin >> d[i] >> v[i];

        vector<int> ret(n, 1);
        for(int i=1; i<n; ++i){
            int x1 = d[i] * v[i-1];
            int x2 = d[i-1] * v[i];
            int y = gcd(x1, x2);
            x1 /= y;
            x2 /= y;

            long long z = lcm(ret[i-1], x1);
            ret[i] = x2 * (z / x1);

            z /= ret[i-1];
            for(int j=0; j<i; ++j)
                ret[j] *= z;
        }

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

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

int main() {
    int N;
    int a[110];
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];

    sort(a, a + N, greater<int>());
    int total = 0;
    for (int i = 0; i < N; ++i) {
        total += (i % 2 == 0)? a[i] : -a[i];
    }
    cout << total << endl;
}

Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    x = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(n):
        t += (min(abs(x[i]), abs(k - x[i])) * 2)
    print(t)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll n;
  std::cin>>n;

  ll r=1;
  while(r*r<n)r++;

  std::vector<ll> ans(n+1,0);

  rep(x,1,r+1){
    rep(y,1,r+1){
      rep(z,1,r+1){
        ll val=x*x+y*y+z*z+x*y+y*z+z*x;
        if(0<=val&&val<n+1)ans[val]++;
      }
    }
  }

  rep(i,1,n+1)std::cout<<ans[i]<<"\n";

  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
typedef unsigned long long ull;
typedef long long ll;
#define MAX 200005
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a-1)*(b-1) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int n, x, y, z;

pair<bool, vector<int>> process(vector<int> prev, int num)
{
	prev.pb(num);
	bool flag = 0;
	int start = 0;
	while (!flag)
	{
		flag = 1;
		int pos = 1;
		int sum = 0;
		for (int i = start; i < prev.size(); i++)
		{
			sum += prev[i];
			if (pos == 1)
			{
				if (sum > x)
				{
					flag = 0;
				}
				else if (sum == x)
				{
					sum = 0;
					pos = 2;
				}
			}
			else if (pos == 2)
			{
				if (sum > y)
				{
					flag = 0;
				}
				else if (sum == y)
				{
					sum = 0;
					pos = 3;
				}
			}
			else
			{
				if (sum > z)
				{
					flag = 0;
				}
				else if (sum == z)
				{
					return {1, prev};
				}
			}
		}
		if (start == prev.size())
		{
			break;
		}
		if (!flag)
		{
			start++;
		}
	}
	vector<int> updated;
	for (int i = start; i < prev.size(); i++)
	{
		updated.pb(prev[i]);
	}
	return {0, updated};
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> x >> y >> z;
	map<vector<int>, ll> m[n + 1];
	ll dp[n + 1];
	dp[0] = 0;
	vector<int> temp;
	m[0][temp] = 1;
	for (int i = 1; i <= n; i++)
	{
		dp[i] = 10 * dp[i - 1];
		for (auto it = m[i - 1].begin(); it != m[i - 1].end(); it++)
		{
			it->second %= mod;
			vector<int> prev = it->first;
			for (int num = 1; num <= 7; num++)
			{
				auto p = process(prev, num);
				if (p.first)
				{
					dp[i] += it->second;
				}
				else
				{
					m[i][p.second] += it->second;
				}
			}
			m[i][temp] += 3 * it->second;
		}
		dp[i] %= mod;
	}
	cout << dp[n] << endl;
	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;


int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int a = h1 * 60 + m1;
  int b = h2 * 60 + m2;
  int c = b - a;
  
  if (c == k) {
    cout << 0 << endl;
  }
  else {
    cout << c - k << endl;
  }
}



Measured memory_bytes: 3588
#include<stdio.h>

int main(){
  int gram, am, bm, cm, a, b, c, tmp, prc;
  while(1){
    scanf("%d", &gram);
    if(gram == 0){
      break;
    }
    prc = 10000;
    am = gram/200;
    bm = gram/300;
    cm = gram/500;
    for(a=0; a<=am; a++){
      for(b=0; b<=bm; b++){
	for(c=0; c<=cm; c++){
	  if(gram==200*a+300*b+500*c){
	    tmp = (a/5)*1520+(a%5)*380 + (b/4)*1870+(b%4)*550 + (c/3)*2244+(c%3)*850;
	    if(tmp < prc){
	      prc = tmp;
	    }
	  }
	}
      }
    }
    printf("%d\n", prc);
  }

  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <string.h>

int main(){
	char s[11];
	if(scanf("%s",s)==EOF){return 0;}
	
	int len = strlen(s);
	int count=0;
	int max =0;
	
	for(int i = 0; i <len; i++){
		if(s[i] == 'A' || s[i] == 'T' || s[i] == 'C' ||s[i] == 'G'){
			count ++;
		}else{
			if(max < count){max = count;}
			count = 0;
		}
	}
	if(max < count){max = count;}
	printf("%d\n", max);
	return 0;

}

Measured memory_bytes: 1712
using System;
using System.Collections.Generic;
using System.Linq;
 
public class Hello{
    public static void Main(){
        var cs = Console.ReadLine().ToCharArray();
        var c = Int32.Parse(cs[cs.Length - 1].ToString());
        
        var ret = "bon";
        if ((new int[] {2, 4, 5, 7, 9 }).Contains(c)) {
            ret = "hon";
        }
        
        if ((new int[] {0, 1, 6, 8}).Contains(c)) {
            ret = "pon";
        }
 
        System.Console.WriteLine(ret);
    }
}

Measured memory_bytes: 27692
n, q = map(int, input().split())

ln = []
lt = []
for i in range(n):
    name, time = input().split()
    time = int(time)
    ln.append(name)
    lt.append(time)

i = 0
totalT = 0
numElements = n
while True:
    if lt[i] <= q:
        totalT += lt[i]
        dispName = ln.pop(i)
        lt.pop(i)
        print(dispName, str(totalT), sep = ' ')
        numElements -= 1
        if numElements <= 0:
            break
        i = i%numElements
    else:
        totalT += q
        lt[i] -= q
        i = (i + 1)%numElements

    

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

int N, x;
bool used[200010];
int ans[200010];

signed main()
{
	cin >> N >> x;
	if (2 <= x && x <= 2*N-2) {
		cout << "Yes" << endl;
		for (int i=1; i<=2*N-1; i++) {
			used[i] = false;
			ans[i] = 0;
		}
		ans[(2*N-1)/2+1] = x;
		used[x] = true;

		if (x == 2*N-2) {
			ans[(2*N-1)/2-2+1] = 3;
			used[3] = true;
		} else {
			ans[(2*N-1)/2-2+1] = 2*N-2;
			used[2*N-2] = true;
		}
		

		ans[(2*N-1)/2-1+1] = 1;
		used[1] = true;
		ans[(2*N-1)/2+1+1] = 2*N-1;
		used[2*N-1] = true;
		int j = 1;
		for (int i=1; i<=2*N-1; i++) {
			if (ans[i] == 0) {
				while (used[j]) j++;
				ans[i] = j;
				used[j] = true;
			} 
		}
		for (int i=1; i<=2*N-1; i++) {
			cout << ans[i] << endl;
		}
	} else {
		cout << "No" << endl;
	}
}


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

using namespace std;

typedef long long int ll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

const ll L = 1e5+5;

vector <ll> a(L);
// vector <ll> b(L);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll N, x;
    cin >> N >> x;

    for(ll i=0; i<N; i++)
    {
        cin >> a[i];
        // b[i] = a[i];
    }

    ll cnt = 0;
    if(a[0]>x)
    {
        cnt+=(a[0]-x);
        a[0] = x;
    }
    for(ll i=1; i<N; i++)
    {
        if(a[i]+a[i-1]>=x)
        {
            cnt+=(a[i]-x+a[i-1]);
            a[i] = x-a[i-1];
        }
    }

    // for(ll i=0; i<N; i++)
    // {
    //     cout << a[i] << endl;
    // }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

int N;

void dfs(string s, char mx) {
  if (s.length() == N) {
    cout << s <<ln;
  } else {
    for (char c = 'a'; c <= mx; c++) {
      dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
    }
  }
}

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

  cin >> N;
  dfs("", 'a');

  return 0;
}

Measured memory_bytes: 1536
/***********************************************

    Md. Shahid-ul Islam
    Department of CSE, DIU
    fb- facebook.com/shahid.cse46

    CF Handle- ShA_hiD
    CodeChef Handle- shahid885
    Vjudge Handle- shahid109514 & ShA_hiD
    UVa Handle- shahid85

    #Happy_Coding_<3

***********************************************/

#include <bits/stdc++.h>

using namespace std;

/****************** TypeDef *******************/

typedef long long int ll;
typedef long int l;
typedef long double ld;
typedef double dd;
typedef unsigned long long ull;
typedef unsigned int ui;

/**********************************************/

int main()
{
    char s[55];
    int n, k;

    cin >> n >> k;
    cin >> s;
    k--;

    for(int i = 0; i < strlen(s); i++)
    {
    	if(i == k)
    	{
    		putchar(tolower(s[i]));
    	}

    	else
    	{
    		cout << s[i];
    	}
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<class T>
vector<T> divisor(T n) {
	vector<T> res;
	for (T i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res.emplace_back(i);
			if (i * i != n) res.emplace_back(n / i);
		}
	}
	sort(res.begin(), res.end());
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> yaku;
	yaku = divisor(N);

	Int len = yaku.size();

	Int ans = INF;
	Int temp;
	for (Int i = 0; i < len; i++) {
		temp = N / yaku[i];
		ans = min(temp + yaku[i] - 2, ans);
	}


	cout << ans << "\n";	
}


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

using namespace std;

int numbers[3]; 

int main () {
    scanf("%d%d%d", numbers + 0, numbers + 1, numbers + 2); //Read 3 numbers into numbers[0, [1] and [2]
    sort(numbers, numbers + 3);
    int ans = 10 * numbers[2] + numbers[0] + numbers[1];
    cout << ans << "\n";

    return 0;

}

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

ll addmod(ll a,ll b)
{
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a %=mod;
    b%=mod;
    return (a*b)%mod;
}
ll submod(ll a,ll b)
{
    ll x  = a-b;
    if(x<0)x+=mod;
    x%=mod;
    return x;
}
bool comp(pair<pi,ll>a,pair<pi,ll>b)
{
    if(a.fi.fi==b.fi.fi)return a.fi.se<b.fi.se;
    return a.fi.fi<b.fi.fi;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n,s; cin>>n>>s;
vi arr(n);
rep(i,0,n)cin>>arr[i];
vvi dp(n+1,vi(s+1,0));
dp[0][0] = 1;
rep(i,0,n)
{
    rep(j,0,s+1)
    {
        dp[i+1][j]+=dp[i][j]*2LL;
        dp[i+1][j]%=mod;
        if(j+arr[i]<=s)
        {
            dp[i+1][j+arr[i]]+=dp[i][j];
            dp[i+1][j+arr[i]]%=mod;
        }
    }
}
cout<<dp[n][s]<<endl;
return 0;
}
/*
5 10 10
22 23
17 19
13 17
8 12
2 6
*/


Measured memory_bytes: 73684
N,K = map(int,input().split())
L = list(map(int,input().split()))

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

if N < K :
    ans = abs(min(L[1:]) - L[0])
else :
    for i in range(1,K+1) :
        dp[i] = abs(L[0] - L[i])
    for i in range(K+1,N) :
        cost = float("inf")
        for j in range(i-K,i) :
            calc = dp[j] + abs(L[j] - L[i])
            if cost > calc :
                cost = calc
        dp[i] = cost

    ans = dp[N-1]

print(ans)


Measured memory_bytes: 56544
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#define int long long int
#define mod 1000000007
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	int j,arr[n];
	for(j=0;j<n;j++)
	{
		cin>>arr[j];
	}
	vector<int> vec1,vec2;
	for(j=0;j<n;j++)
	{
		if(arr[j]>=0)
		{
			vec1.push_back(arr[j]);
		}
		else
		{
			vec2.push_back(-arr[j]);
		}
	}
	sort(vec1.begin(),vec1.end());
	sort(vec2.begin(),vec2.end());
	if(k==n)
	{
		int prod=1;
		for(int x:arr)
		{
			prod*=x;
			prod%=mod;
		}
		if(prod<0)
		  prod+=mod;
		cout<<prod<<endl;
	}
	else if(vec1.size()==0)
	{
		if(k%2==0)
		{
			int prod=1;
			int ptr=vec2.size()-1;
			while(k!=0)
			{
				prod*=vec2[ptr];
				k--;
				ptr--;
				prod%=mod;
			}
			cout<<prod<<endl;
		}
		else
		{
			int prod=1;
			int ptr=0;
			while(k!=0)
			{
				prod*=vec2[ptr];
				k--;
				ptr++;
				prod%=mod;
			}	
			prod*=-1;
			if(prod<0)
			   prod+=mod;
			cout<<prod<<endl;
		}
	}
	else
	{
		if(vec2.size()==0||vec2.size()==1)
		{
			int prod=1;
			int ptr=vec1.size()-1;
			while(k!=0)
			{
				prod*=vec1[ptr];
				k--;
				ptr--;
				prod%=mod;
			}
			if(prod<0)
			{
				prod+=mod;
			}
			cout<<prod<<endl;
		}
		else
		{
			int neg=0,pos=0;
			int s2=vec2.size(),s1=vec1.size();
			for(j=0;j<=s2;j+=2)
			{
				if(j+s1>=k)
				{
					break;
				}
			}
			neg=j;
			pos=k-neg;
			int ptr1=s1-pos,ptr2=s2-neg;
			while(1)
			{
				if(ptr1+1>=s1||ptr2-2<0)
				{
					break;
				}
				else
				{
					int val1=vec1[ptr1]*vec1[ptr1+1];
					int val2=vec2[ptr2-1]*vec2[ptr2-2];
					if(val2>val1)
					{
						neg+=2;
						pos-=2;
						ptr1+=2;
						ptr2-=2;
					}
					else
					{
						break;
					}
				}
			}
			int prod=1;
			ptr1=s1-1,ptr2=s2-1;
			while(neg!=0)
			{
				prod*=vec2[ptr2];
				neg--;
				ptr2--;
				prod%=mod;
			}
			while(pos!=0)
			{
				prod*=vec1[ptr1];
				pos--;
				ptr1--;
				prod%=mod;
			}
			cout<<prod<<endl;
		}
	}
}


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

map<pair<ll,ll>,ll> mp;
const ll MAX_N = 1e6+5;
ll f[MAX_N] = {};
ll fuct(ll n) {
	if(f[n]!=0) return f[n];
	ll res = 1;
	for(ll i=1;i<=n;i++) {
		res *= i;
		res %= MOD;
		f[i] = res;
	}
	return res;
	/*/
	if(f[n] != 0) return f[n];
    if (n==0) return f[0] = 1;
	if(n==1) return f[1] = 1;
    else return f[n] = n*fuct(n-1)%MOD;
	*/
}

//aのb乗
ll calc(ll a, ll b) {
	ll res = 1;
	while(b > 0) {
		if(b & 1) res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
	/*
	if(mp.count(make_pair(a,b))) {
		return mp[make_pair(a,b)];
	}
    if (b==0){
      return mp[make_pair(a,b)] = 1;
    }else if (b==1){
      return mp[make_pair(a,b)] = a;
    }else if (b%2==0){
      ll tmp=calc(a,b/2);
      return mp[make_pair(a,b)] = tmp*tmp%MOD;
    }else{
      return mp[make_pair(a,b)] = a*calc(a,b-1)%MOD;
    }
	*/
}

ll x, y;

int main(){
	cin >> x >> y;
	if( !((2*x-y)%3== 0 && (2*y-x)%3 == 0) ) {
		cout << 0 << endl;
		return 0;
	}
	ll a = (2*x-y)/3;
	ll b = (2*y-x)/3;
  	if(a<0 || b<0) {
      cout << 0 << endl;
      return 0;
    }
	// cout << fuct(a+b) << endl;

	cout << fuct(a+b)*calc(fuct(a),MOD-2)%MOD*calc(fuct(b),MOD-2)%MOD << endl;
}


Measured memory_bytes: 6400
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl; 

    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
using namespace std;
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b,a % b);
}
int combination(int n, int k){
    int spaceOptimize[k+1];
    memset(spaceOptimize, 0, sizeof(spaceOptimize));
    spaceOptimize[0] = 1;
    for(int i=1;i<=n; i++){
        for(int j= min(i,k);j>0;j--){
            spaceOptimize[j] = spaceOptimize[j] + spaceOptimize[j-1];
        }
    }
    return spaceOptimize[k];
}
int count_permutation(int arr[], int n){
    int a[n];
    for(int i=0;i<n;i++){
        a[i] = i+1;
    }
    int count = 0;
    do {
        count++;
        if (equal(a, a + n, arr)){
            return count;
        }
    } while (next_permutation(a, a + n));
    return 0;
}

signed main(){
#ifndef ONLINE_JUDGE
    //freopen("input.txt","r", stdin);
#endif
    fastIO

    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy";
    else if( s == "Cloudy") cout << "Rainy";
    else if( s == "Rainy") cout << "Sunny";

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const ll mod = 1000000007;
int main() {
	ll X, v = 100, n = 0;
	scanf("%lld", &X);
	while (v < X) {
		v  = (ll)floor(1.01 * v);
		n++;
	}
	printf("%lld\n", n);
	return 0;
}


Measured memory_bytes: 3848
n = int(input())
p = list(map(int, input().split()))

ans = 0

for i in range(1, n - 1):
    if p[i] < p[i + 1] and p[i] > p[i - 1]:
        ans += 1
    elif p[i] > p[i + 1] and p[i] < p[i - 1]:
        ans += 1


print(ans)


Measured memory_bytes: 3068
# C - Splitting Pile
N = int(input())
a = list(map(int,input().split()))

lst = [0]*(N-1)
x = [a[0]]*(N-1)
y = [sum(a)-a[0]]*(N-1)
lst[0] = abs(x[0]-y[0])

for i in range(1,N-1):
    x[i] = x[i-1]+a[i] 
    y[i] = y[i-1]-a[i]
    lst[i] = abs(x[i]-y[i])
"""
print(x)
print(y)
print(lst)
"""
ans = min(lst)
print(ans)

Measured memory_bytes: 45208
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in

    let rec loop i acc =
        if i = n then acc else
            loop (i + 2) (acc lxor a.(i) lxor a.(i + 1))
    in
    let all = loop 0 0 in
    Array.iter (fun v -> Printf.printf "%d " (v lxor all)) a;
    print_newline ()
)

Measured memory_bytes: 7604
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int Q, l, r;
	int N=100000, x[100001];
	for(int i=1; i<=N; i++){
		x[i]=i;
	}
	set<int> p;
	scanf("%d", &Q);

	for(int i=2; i<=316; i++){
		if(x[i]==0){
			continue;
		}else{
			p.insert(i);
			for(int j=1; i*j<=N; j++){
				x[i*j]=0;
			}
		}
	}
	for(int i=317; i<=N; i++){
		if(x[i]!=0){
			p.insert(i);
		}
	}

	set<int> p2017;

	for(auto itr=p.begin(); itr!=p.end(); itr++){
		int pr=*itr;
		if(pr!=2){
			if(p.find((pr+1)/2)!=p.end()){
				p2017.insert(pr);
			}
		}
	}
	int pcount[100001];
	pcount[0]=0;
	pcount[1]=0;
	for(int i=1; i<N; i++){
		if(p2017.find(i+1)!=p2017.end()){
			pcount[i+1]=pcount[i]+1;
		}else{
			pcount[i+1]=pcount[i];
		}
	}

	for(int i=0; i<Q; i++){
		scanf("%d %d", &l, &r);
		printf("%d\n", pcount[r]-pcount[l-1]);
	}
	return 0;

}

Measured memory_bytes: 1920
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string s;
    cin >> N >> s;
    int cnt = 0;
    REP(i, N) {
        if (s[i] == 'R')
            cnt++;
    }
    if (cnt > N - cnt)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256