akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;
int n,tote,to[N<<1],nxt[N<<1],con[N],w[N],ans;
void ins(int x,int y)
{
	to[++tote]=y;
	nxt[tote]=con[x];
	con[x]=tote;
}
void dfs(int v,int fa)
{
	int dep=-1;
	bool flag=0;
	for(int p=con[v];p;p=nxt[p])
		if(to[p]!=fa)
		{
			dfs(to[p],v);
			int tmp=w[v]&w[to[p]];
			for(int i=30;i>=0;i--)
				if((tmp>>i)&1) {dep=max(dep,i);break;}
			w[v]=w[v]|w[to[p]];
			flag=1;
		}	
	if(!flag) {w[v]=1;return ;}	
	for(int i=dep+1;i<=30;i++)
		if((w[v]>>i)&1) 
			dep=max(dep,i);
		else break;
	ans=max(ans,dep+1);
	int R=(1<<(dep+1)),T=((1<<30)-1)^(R-1);
	w[v]=(w[v]&T)|R;	
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);
	}
	dfs(1,0);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 6016
package main

import (
	"bytes"
	"fmt"
	"os"
)

func main() {
	var H, W int
	fmt.Scanf("%d%d", &H, &W)
	c := make([][]bool, H)
	for i := 0; i < H; i++ {
		c[i] = make([]bool, W)
	}
	var N int
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			var cc int
			fmt.Scanf("%d", &cc)
			c[i][j] = cc%2 == 1
			N += cc % 2
		}
	}
	N -= N % 2
	n := 0
	k := 0
	l := 0
	b := new(bytes.Buffer)
	var bx, by int
	for i := 0; ; i++ {
		if k >= H*W || H+W == 2 {
			goto BREAK
		}
		for j := 0; j < W-i*2-1; j++ {
			if k >= H*W {
				goto BREAK
			}
			x, y := i+j, i
			if n%2 == 1 && n < N {
				fmt.Fprintf(b, "%d %d %d %d\n", by+1, bx+1, y+1, x+1)
				l++
			}
			if c[y][x] {
				n++
			}
			bx, by = x, y
			k++
		}
		for j := 0; j < H-i*2-1; j++ {
			if k >= H*W {
				goto BREAK
			}
			x, y := W-i-1, i+j
			if n%2 == 1 && n < N {
				fmt.Fprintf(b, "%d %d %d %d\n", by+1, bx+1, y+1, x+1)
				l++
			}
			if c[y][x] {
				n++
			}
			bx, by = x, y
			k++
		}
		for j := 0; j < W-i*2-1; j++ {
			if k >= H*W {
				goto BREAK
			}
			x, y := W-i-j-1, H-i-1
			if n%2 == 1 && n < N {
				fmt.Fprintf(b, "%d %d %d %d\n", by+1, bx+1, y+1, x+1)
				l++
			}
			if c[y][x] {
				n++
			}
			bx, by = x, y
			k++
		}
		for j := 0; j < H-i*2-1; j++ {
			if k >= H*W {
				goto BREAK
			}
			x, y := i, H-i-j-1
			if n%2 == 1 && n < N {
				fmt.Fprintf(b, "%d %d %d %d\n", by+1, bx+1, y+1, x+1)
				l++
			}
			if c[y][x] {
				n++
			}
			bx, by = x, y
			k++
		}
	}
BREAK:
	fmt.Printf("%d\n", l)
	b.WriteTo(os.Stdout)
}


Measured memory_bytes: 11136
package main

import (
	"fmt"
)

func main() {
	var a, b, x int
	fmt.Scan(&a, &b, &x)

	left := a
	if a%x > 0 {
		left += x - a%x
	}

	right := b - b%x

	diff := (right - left) / x
	if diff < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(diff + 1)
}


Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
#define INF 100000000
using namespace std;
typedef pair<int,int> P;
int main()
{
	string search,ring;
	int n,ans=0;
	cin>>search>>n;
	while(n--){
		cin>>ring;
		bool cou=false;
		for(int i=0;i<(int)ring.size();i++){
			if(search[0]!=ring[i])continue;
			int pos=i;
			if((int)search.size()==1){ans++;goto ES;}
			for(int j=1;j<(int)search.size();j++){
				pos++;
				if(pos==(int)ring.size())pos=0;
				if(ring[pos]!=search[j])break;
				else if(j==(int)search.size()-1){ans++;goto ES;}
			}
		}ES:ans=ans;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 1200
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define MN 10000
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
char s[MN+5];
int Ask(int x)
{
    printf("%d\n",x-1);fflush(stdout);scanf("%s",s+1);
    if(s[1]=='V') exit(0);
    if(s[1]=='M') return 0;
    if(s[1]=='F') return 1;
}
int main()
{
    int l=1,r=read(),res=Ask(1);Ask(r);
    while(l<=r)
    {
        int mid=l+r>>1,now=Ask(mid);
        if((now^(mid&1)^1)==res) l=mid+1;
        else r=mid-1;
    }
    return 0;
}

Measured memory_bytes: 852
N = int(input())
now = 0
nowx = 0
nowy = 0
for i in range(N):
    t,x,y = map(int,input().split())
    d = (abs(x-nowx)+abs(y-nowy))
    if d > t-now:
        print('No')
        exit()
    if (t-now)%2 == 0:
        if d%2 == 0:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
    else:
        if d%2 == 1:
            now = t
            nowx = x
            nowy = y
        else:
            print('No')
            exit()
print('Yes')

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 100007;

int n,tim,ps[_],qs[_],pr[_],qr[_];
int bas[7][_],tran[_],gg[_],ggr[_];

int main()
{
	n=ty(),tim=ty();
	for(int i=1;i<=n;i++)ps[i]=ty(),pr[ps[i]]=i;
	for(int i=1;i<=n;i++)qs[i]=ty(),qr[qs[i]]=i;

	for(int i=1;i<=n;i++)bas[1][i]=ps[i],bas[2][i]=qs[i];
	for(int i=3;i<=6;i++)for(int j=1;j<=n;j++)bas[i][bas[i-2][j]]=bas[i-1][j];
	
	for(int i=1;i<=n;i++)tran[i]=qs[pr[qr[ps[i]]]],gg[i]=i;

	int xtim=(tim-1)/6,rtim=tim-xtim*6;
	while(xtim)
	{
		static int temp[_];
		if(xtim&1)
		{
			for(int i=1;i<=n;i++)temp[i]=gg[tran[i]];
			for(int i=1;i<=n;i++)gg[i]=temp[i];
		}
		for(int i=1;i<=n;i++)temp[i]=tran[tran[i]];
		for(int i=1;i<=n;i++)tran[i]=temp[i];
		xtim>>=1;
	}
	for(int i=1;i<=n;i++)ggr[gg[i]]=i;
	for(int i=1;i<=n;i++)printf("%d%c",gg[bas[rtim][ggr[i]]]," \n"[i==n]);
	
	return 0;
}


Measured memory_bytes: 6272
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int a, b; char c;
	cin >> a;
	int S[15] = { 0 };
	int H[15] = { 0 };
	int C[15] = { 0 };
	int D[15] = { 0 };
	for (int h = 1; h <= a; h++) {
		cin >> c >> b;
		if (c == 'S') { S[b]++; }
		if (c == 'H') { H[b]++; }
		if (c == 'C') { C[b]++; }
		if (c == 'D') { D[b]++; }
	}
	for (int h = 1; h <= 13; h++) {
		if (S[h] == 0) { cout << "S " << h << endl; }
	}
	for (int h = 1; h <= 13; h++) {
		if (H[h] == 0) { cout << "H " << h << endl; }
	}
	for (int h = 1; h <= 13; h++) {
		if (C[h] == 0) { cout << "C " << h << endl; }
	}
	for (int h = 1; h <= 13; h++) {
		if (D[h] == 0) { cout << "D " << h << endl; }
	}
}


Measured memory_bytes: 3080
#include <iostream>
#include <vector>

int main()
{
    int n;
    std::cin >> n;
    struct Button
    {
        bool checked{};
        int next{};
    };
    std::vector<Button> buttons(n);
    for (auto i = 0; i < n; ++i)
    {
        int a;
        std::cin >> a;
        buttons[i].next = a - 1;
    }
    int i{}, times{};
    for (auto i = 0; !buttons[i].checked; i = ((i == 1) ? 1 : buttons[i].next))
    {
        buttons[i].checked = true;
        ++times;
    }
    std::cout << (buttons[1].checked ? --times : -1) << std::endl;
    return 0;
}


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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)
int main(){
	int a,b,x,y;
	cin >> a >> b >> x >> y;
	cout << fixed << setprecision(20) << (double)a * (double)b / 2.0  << endl;
	if(!(a % 2 + b % 2) && a / 2 == x && b / 2 == y)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,k;
    cin >> h >> w >> k;
    vvint s(h,vint(w));
    REP(i,h){
        string str;
        cin >> str;
        REP(j,w){
            s[i][j] = (int)(str[j]-'0');
        }
    }
    int now = 0;
    int num = (1<<(h-1));
    int ans = INF;
    while(now<num){
        int cnt = 0;
        REP(i,h-1) cnt += ((now>>i)&1);
        int x  = 0;
        vvint si(h,vint(w,0));
        while(x<w){
            bool f = true;
            REP(i,h){
                if(i==0){ 
                    si[i][x]=s[i][x];
                }else if(((now>>(i-1))&1)==1){
                    si[i][x]=s[i][x];
                }else{
                    si[i][x] = s[i][x]+si[i-1][x];
                }
                if(si[i][x]>k){
                    x=0;
                    f=false;
                    break;
                }
                if(i==h-1||(((now>>i)&1)==1)){
                    if((x==0&&si[i][x]>k)||(x>0&&si[i][x]+si[i][x-1]>k)){
                        f=false;
                        break;
                    }else{
                        if(x>0){
                            si[i][x] += si[i][x-1];
                        }
                    }
                }
            }
            if(f){
                x++;
            }else{
                if(x==0){
                    cnt=INF;
                    break;
                }else{
                    cnt++;
                    REP(i,h){
                        si[i][x-1] = 0;
                    }
                }
            }
        }
        /*
        cout << now << ":" << cnt << endl;
        REP(i,h){
            REP(j,w){
                cout << si[i][j] << " ";
            }
            cout << endl;
        }
        */
        ans = min(cnt,ans);
        
        now++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main(){
  int K,flag;
  string S;
  cin>>K>>S;
  if(S.size()<=K) cout<<S;
  else {
    for(int i=0;i<K;i++)
      cout<<S[i];
    cout<<"...";
  }
    
    
}

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

int main() {
        long h;
        std::cin >> h;
        long sum = 0;
        long cur = h;
        int depth = 0;
        while (cur > 0) {
                sum += pow(2, depth);
                depth += 1;
                cur /= 2;                                                                                                       }
        std::cout << sum;                                                                                               
        return 0;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    //let n = read::<usize>();
    //let n = read::<u32>();
    let mut v = read_vec::<i32>();
    v.sort();
    println!("{} {} {}", v[0], v[1], v[2]);
}



Measured memory_bytes: 5024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    vector<int> A(3);
    int s=0,t=0;

    for(int i=0;i<3;i++){
        cin>>A.at(i);
        if(A.at(i)==5)s++;
        if(A.at(i)==7)t++;
    }
    if(s==2&&t==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define f(i,n) for(int i=0;i<int(n);i++)
#define MOD 1000000007
#define N 200000

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

    int sum=0;
    if(a==b) ++sum;
    else sum += 2;

    if(a==c or b==c);
    else ++sum; 
    cout<<sum;
}

Measured memory_bytes: 384
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

int a[305][305], ans[90005]; 
struct node
{ 
	int x; 
	int y;
}f[90005];

int main()
{
	int h, w, d, t;
	scanf("%d%d%d", &h, &w, &d);
	for (int i = 1; i <= h; i++)  
		for (int j = 1; j <= w; j++)
		{
			scanf("%d", &a[i][j]);   
			int n = a[i][j];   
			f[n].x = i;  
			f[n].y = j; 
		}   
	scanf("%d", &t); 
	for (int i = 1; i <= d; i++)
	{ 
		int l = i, r = h * w, s = 0;
		ans[i] = 0;    
		while (l <= r - d) 
		{
			s = s + abs(f[l].x - f[l + d].x) + abs(f[l].y - f[l + d].y);      
			l = l + d;     
			ans[l] = s; 
		}
	}  
	while (t--) 
	{
		int l, r;     
		scanf("%d%d", &l, &r);       
		printf("%d\n", ans[r] - ans[l]); 
	}
	return 0;
}

Measured memory_bytes: 2560
N, M = gets.split.map(&:to_i)
L = []
R = []
M.times do
  line = gets.split.map(&:to_i)
  L << line.shift
  R << line.shift
end

num =  R.min - L.max+ 1
if num > 0
  p num
else
  p 0
end

Measured memory_bytes: 3464
s = str(input())
list_s = list(s)
if len(list_s)%2 == 1:
    del list_s[-1]
else:
    del list_s[-1]
    del list_s[-1]

while True:
    if list_s[:len(list_s)//2] == list_s[len(list_s)//2:]:
        print(len(list_s))
        break
    else:
        del list_s[-1]
        del list_s[-1]


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

int main()
{
	ll A,B;
	cin >> A >> B;
	A--;
	ll temp = 0, ansA = 0, ansB = 0;
	if ((A/2) % 2 == 1) temp = 1;
	ansA = temp ^ A;
	if (A % 2 == 1) ansA = ansA ^ (A-1);
	temp = 0;
	if ((B/2) % 2 == 1) temp = 1;
	ansB = temp ^ B;
	if (B % 2 == 1) ansB = ansB ^ (B-1);
	//cout << ansA << " " << ansB << endl;
	if (A >= 0) cout << (ansA ^ ansB) << endl;
	else cout << ansB << endl;
	return 0;
}

Measured memory_bytes: 3576
n = int(input())
ha, hb, hc = 0, 0, 0
for _ in range(n):
    a, b, c = map(int, input().split())
    ha, hb, hc = max(hb, hc) + a, max(hc, ha) + b, max(ha, hb) + c
print(max(ha, hb, hc))


Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<algorithm>


using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9 + 7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 1e6+3;


int main() {
	string a;
	char s[1000] = {};
	cin >> a;
	for (int i = 0; i < 4; i++) {
		s[a[i]]++;
	}
	int flag = 0;
	for (int i = 0; i < 200; i++) {
		if (s[i] == 2) {
			flag++;
		}
	}
	if (flag == 2) {
		cout << "Yes" << endl;
	}
	else {

		cout << "No" << endl;
	}

}


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

namespace abc139
{
    class Program
    {
        public static int hantei(string x)
        {
            double count = x.Length;
            int count1 = 0;
            count = Math.Floor(count / 2);
            for(int i = 0; i < count; i++)
            {
                if (x[i] != x[x.Length - 1 - i])
                {
                    count1++;
                }
            }
            return count1;
        }
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            Console.WriteLine(hantei(S));
            Console.Read();
        }
    }
}

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

int main(){
  string S;
  cin>>S;
  ll countw=0;
  ll ans=0;

  for(int i=0; i<S.size();i++){
    if(S[i]=='W'){
      ans+=i-countw;
      countw++;
    }
  }
  cout<<ans<<endl;
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "OK" << endl;
}
void no()
{
    cout << "NG" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, a, b ;
    cin >> k >> a >> b ;
    FOR(i,a,b+1){
        if(i%k==0){
            yes() ;
            return 0 ;
        }
    }
    no() ;
    

    return 0;
}


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

int main(){
    using namespace std;

    long N;
    cin >> N;

    vector<long> h(N), dp(N, numeric_limits<long>::max() / 5);
    for(auto& i : h)cin >> i;

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);

    for(long i = 2; i < N; ++i)dp[i] = min(abs(h[i - 1] - h[i]) + dp[i - 1], abs(h[i - 2] - h[i]) + dp[i - 2]);

    cout << dp[N - 1] << endl;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

namespace modCalc {
    LL add() {
        return 0;
    }
    template<typename H, typename... T>
    LL add(H h, T... t) {
        return (h + add(t...))%mod;
    }

    template<typename H, typename... T>
    LL sub(H h, T... t) {
        return (h - add(t...) + mod)%mod;
    }

    LL mul() {
        return 1;
    }
    template<typename H, typename... T>
    LL mul(H h, T... t) {
        return (h*mul(t...))%mod;
    }

    LL pow(LL x, LL y) {
        LL res = 1;
        while(y != 0) {
            if(y%2) {
                res = mul(x, res);
                y--;
            }else{
                x = mul(x, x);
                y /= 2;
            }
        }
        return res;
    }

    LL div(LL x, LL y) {
        return mul(x, pow(y, mod - 2));
    }

    LL fact(LL n) {
        LL res = 1;
        FOR(i, 1, n + 1)
            res = mul(res, i);
        return res;
    }
}

using namespace modCalc;

bool check(string s) {
    bool res = s.find("AGC") == string::npos;
    FOR(i, 1, s.size()) {
        string t = s;
        swap(t[i - 1], t[i]);
        res = res && t.find("AGC") == string::npos;
    }
    return res;
}

int main() {
    LL N;
    cin >> N;
    vector<map<string, LL>> v(N + 1);
    v[1]["A"] = 1;
    v[1]["T"] = 1;
    v[1]["G"] = 1;
    v[1]["C"] = 1;
    FOR(i, 2, N + 1) {
        for(auto j = v[i - 1].begin();j != v[i - 1].end();j++) {
            string s = j->first;
            LL x = j->second;
            string atgc = "ATGC";
            for(int k = 0;k < 4;k++) {
                string sc = s + atgc[k];
                if(check(sc)) {
                    string t = sc.substr(max<int>(sc.size() - 3, 0), 3);
                    v[i][t] = add(v[i][t], v[i - 1][s]);
                }
            }
        }
    }

    LL res = 0;
    for(auto p : v[N]) {
        res = add(res, p.second);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 896
// import chie template :) {{{
import std.stdio,
       std.algorithm,
       std.array,
       std.string,
       std.math,
       std.conv,
       std.range,
       std.container,
       std.bigint,
       std.ascii,
       std.typecons;
// }}}
// nep.scanner {{{
class Scanner {
  import std.stdio;
  import std.conv : to;
  import std.array : split;
  import std.string : chomp;

  private File file;
  private char[][] str;
  private size_t idx;

  this(File file = stdin) {
    this.file = file;
    this.idx = 0;
  }

  private char[] next() {
    if (idx < str.length) {
      return str[idx++];
    }

    char[] s;
    while (s.length == 0) {
      s = file.readln.chomp.to!(char[]);
    }

    str = s.split;
    idx = 0;

    return str[idx++];
  }

  T next(T)() {
    return next.to!(T);
  }

  T[] nextArray(T)(size_t len) {
    T[] ret = new T[len];

    foreach (ref c; ret) {
      c = next!(T);
    }

    return ret;
  }

  void scan()() {}
  void scan(T, S...)(ref T x, ref S args) {
    x = next!(T);
    scan(args);
  }
}
// }}}

void main() {
  auto cin = new Scanner;
  int a, b, c;
  cin.scan(a, b, c);
  writeln(a + b >= c ? "Yes" : "No");
}


Measured memory_bytes: 256
X, N = map(int, input().split())
p = list(map(int, input().split()))

ans_i = 0
for i in range(N+1):
    if X-i not in p or X+i not in p:
        ans_i = i
        break

if X-ans_i not in p:
    print(X-ans_i)
elif X+i not in p:
    print(X+ans_i)


Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  int r=0,b=0;
  for(int i = 0; i < n; ++i){
    if(s[i] == 'R')r++;
    else b++;
  }
  if(r > b)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main(){

  int a[20],n=0,m=0;

  for(int i=0;i<20;i++) cin >> a[i];

  sort(a,a+10);
  reverse(a,a+10);

  sort(a+10,a+20);
  reverse(a+10,a+20);

  cout << a[0] + a[1] + a[2] << " " << a[10] + a[11] + a[12] << endl;

}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define print(a) cout << (a) << endl; 
typedef long long ll;
const int MOD = 1000000007; 
 
int main() {
    int n, ret = 0;
    cin >> n;
    if (n&1) ret += 1;
    ret += n/2;
    cout << ret << endl;  
    return 0;
}

Measured memory_bytes: 256
R = lambda: map(int, input().split())
 
n = int(input())
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(R())
    m = n // 3
    if a[0] ^ a[m] ^ a[2 * m]:
        ans = 'No'
    elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):
        ans = 'No'
    else:
        ans = 'Yes'
print(ans)


Measured memory_bytes: 14212
#include <cstdio>


int sum_value(int n)
{
	return n == 1 ? 1 : n + sum_value(n - 1);
}

int main()
{
	int n;
	scanf("%d", &n);
	int result = sum_value(n);
	printf("%d", result);
    return 0;
}



Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    if(n < 4 || (n > 4 && n < 7)){
        cout << "No";
        return 0;
    }
    if(n % 4 == 0 || n % 7 == 0){
        cout << "Yes";
        return 0;
    }
    for(int i = 0 ; i<=25; i++){
        for(int j = 0; j<=14; j++){
            if(4*i+7*j == n){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}

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

const ll MAXN = 200000;

ll N, H, ans=0, tmp=0;
vector<ll> A(MAXN, 0), B(MAXN, 0);

signed main(){
    cin >> N >> H;
    for(int i=0;i<N;i++) {
        ll a, b;
        cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    ll id = upper_bound(B.begin(), B.end(), A.back())-B.begin();
    for(int i=B.size()-1;i>=id;i--) {
        H-=B[i];
        ans++;
        if(H<=0) break;
    }
    if(H>0) {
        if(H%A.back()==0) ans += H/A.back();
        if(H%A.back()!=0) ans += 1+H/A.back();
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n,k; cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i+k<n;i++){
        if(a[i]<a[i+k]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        //cout<<a[i]<<endl;
    }
    return 0;
}



Measured memory_bytes: 3984
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,d,x,a,sum=0;
	cin >> n >> d >> x;
	for(int i=0;i<n;++i){
		cin >> a;
		sum += d / a;
		if(d % a){
			++sum;
		}
	}
	cout << sum + x << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >>n;
  vector<int> num(n);
  for(int i=0;i<n;i++){
    cin >> num.at(i);
    num.at(i)--;
  }
  string ans = "YES";
  int flag = 0;
  for(int i=0;i<n;i++){
    if(num.at(i) != i){
      if(num.at(num.at(i)) == i && flag ==0) {
	   	  flag++;
          swap(num.at(i),num.at(num.at(i)));
    	  continue;
      }
      else {
        ans="NO";
        break;
      }
    }
  }
  cout << ans << endl;
}


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

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

    if(n==0)
     break;

    int a[1000];
    for(int i=0; i<n; i++){
      cin >> a[i];
    }

    int dif = 1000001;

    for(int i=0; i<n-1; i++){
      for(int j=i+1; j<n; j++){
        int d = abs(a[i]-a[j]);

        if(d<dif){
          dif = d;
        }
      }
    }
    cout << dif << endl;
  }
  return 0;
}



Measured memory_bytes: 3052
n, y = map(int,input().split())
flag = False

for i in range(y//10000+1):
    for j in range(y//5000+1):
        tmp = y - 10000*i - 5000*j
        k = tmp//1000
        if i+j+k == n and k >= 0:
            print('{0} {1} {2}'.format(i,j,k))
            flag = True
            break
    if flag:
        break
if not flag:
    print('-1 -1 -1')


Measured memory_bytes: 41308
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b,h0=0;
    cin>>n>>a>>b;
    for(int i=1,h,k;i<=n;i++)
    {
        h=0; k=i;
        while(k>0)
        {
            h=h+k%10;
            k=k/10;
        }
        if(h>=a&&h<=b)  h0=h0+i;
    }
    cout<<h0<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define ff first
#define ss second
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
using namespace std;
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int MAXN = 6 ;
const int INF = INT_MAX;


int main (){
	string n ;
	cin >> n ;
	if ( n[1] == 'R')
		n[1] = 'B';
	else
		n[1] ='R' ;
	cout << n ;	

	
	return 0 ;

}
 


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

const ll INF = 1e18;
int n;
struct abdata{
    ll aa; ll bb; int no;
};
bool cmp1(const abdata &l, const abdata &r) {
    return l.aa == r.aa ? l.bb > r.bb : l.aa < r.aa;
}
bool cmp2(const abdata &l, const abdata &r) {
    return l.bb > r.bb;
}

int main() {
    cin >> n;
    vector<ll> A(n, 0);
    vector<ll> B(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> A.at(i) >> B.at(i);
    }
        vector<abdata> abvec;
        for(int i = 0; i < n; ++i) {
            abdata indata;
            indata.aa = A.at(i); indata.bb = B.at(i);
            indata.no = i;
            abvec.emplace_back(indata);
        }
        sort(abvec.begin(), abvec.end(), cmp1);
        ll ano1 = abvec.at(n/2-1).aa;
        ll ano2 = abvec.at(n/2).aa;
        sort(abvec.begin(), abvec.end(), cmp2);
        ll bno1 = abvec.at(n/2-1).bb;
        ll bno2 = abvec.at(n/2).bb;

        ll ans = 0;
        if(n % 2 == 0) {
            ans = (bno1+bno2) - (ano1+ano2) + 1;
        }else {
            ans = bno2 - ano2 + 1;
        }
        cout << ans << endl;
}

Measured memory_bytes: 12668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200025,inf=0x3f3f3f3f;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,cnt;
ll ans;
char ch[N];
int main(){
//	freopen("balance.in","r",stdin);
//	freopen("balance.out","w",stdout);
	scanf(" %s",ch+1);
	n=strlen(ch+1);
	cnt=0;
	for (int i=1;i<=n;i++)
	if (ch[i]=='B') cnt++;
	else ans+=cnt;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

	vector<int> H(N);

	for (auto &x : H) {
		cin >> x;
	}

	int ans = 0;
	int cur = 1000 * 1000 * 1000;
	int count = -1;
	for (auto x : H) {
		if (x <= cur) {
			++count;
			ans = max(ans, count);
		}
		else {
			count = 0;
		}
		cur = x;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >>n;
	vector<int> arr(n);
	int ans = 1;
	for(int i = 0; i < n; i++)
		cin >>arr[i];
	for(int i = 1; i < n; i++) {
		bool flag = true;
		for(int j = 0; j < i; j++) {
			if(arr[j] > arr[i]) {
				flag = false;
				break;
			}
		}
		if(flag) {
			ans++;
		}
	}
	cout <<ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;

using namespace std;

int main(){
    cs;
    int a,t=2;
    cin>>a;
    if(a==1||a==2||a==4) {cout<<4;return 0;}
    while(a!=1){
        if(a&1) a=3*a+1;
        else a/=2;
        t++;
    }
    cout<<t;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000



int main(){
	
	string S;
	cin>>S;
	S[3]='8';
	cout<<S<<endl;
	
    return 0;
}


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

int main() {
	int n;

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

		cin >> a >> b >> c;
		if (a>b && a>c) {
			if (b*b + c*c == a*a) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if (b>a && b>c) {
			if (a*a + c*c == b*b) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else {
			if (a*a + b*b == c*c) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  long long sum=0;
  cin>>n;

  for(int i=1;i<=n;i++)
  {
      if(i%3==0||i%5==0)
        continue;
      else
        sum+=i;
  }
  cout<<sum<<"\n";
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M; cin >> N >> M;
    vector<ll> H(N); rep(i, N){cin >> H.at(i);}
    vector<vector<ll>> AB(N);
    rep(i, M){
        ll a, b; cin >> a >> b;
        a--; b--;
        AB.at(a).push_back(b);
        AB.at(b).push_back(a);
    }
    ll cnt = 0;
    rep(i, N){
        bool ans = true;
        for (auto v: AB.at(i)){
            if (H.at(v) >= H.at(i)){ans = false; break;}
        }
        if (ans){
            cnt += 1;
        }
    }
    cout << cnt << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 9804
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = map(int, input().split())
        a[i] = x
        b[i] = y
    from collections import defaultdict
    if n == 1:
        print(1)
        return 
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

    print(n-max(d.values()))

main()

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

int n, u, k, uk;
int G[101][101] = {0};

int main() {
	cin >> n;
	for (int i=0; i<n; ++i) {
		cin >> u >> k;
		while (k --) {
			cin >> uk;
			G[u][uk] = 1;
		}
	}
	for (int i=1; i<=n; ++i) {
		for (int j=1; j<=n; ++j) {
			cout << (j==1 ? "" : " ") << G[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
 
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main(){
  int K;
  cin >> K;
  rep(i,K){
    cout << "ACL";
  }
}

Measured memory_bytes: 3568
#encoding: utf-8

N = int(input())

monsters = list(map(int, input().split()))

def gcd(x, y):
    if y > 0:
        return gcd(y, x % y)
    else:
        return x

if len(monsters) == 1:
    print(monsters[0])

else:
    elm = gcd(monsters[0], monsters[1])
    if len(monsters) != 2:
        for i in range(2, N):
            elm = gcd(elm, monsters[i])
print(elm)




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





int main()
{

    int a, b,c,d,f,g;
    cin>> a;

    cin>>b;
    cin>> c;
    cin >>d ;
    f=(a+b);
    g=(c+d);
    if(f>g){
        cout<<"Left";
    }else if(f<g) {
        cout<<"Right";
    }else  {
        cout<<"Balanced";
    }



    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
typedef long double ld;
int I=-1;
ld N,T,A,H[1<<17],B=1e18;
int main(void){
    cin>>N>>T>>A;
    F(N)cin>>H[i];
    F(N)if(abs(T-H[i]*.006-A)<B)B=abs(T-H[I=i]*.006-A);
    printf("%d\n",I+1);
    return 0;
}


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

const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
const int MAXN = 60;
int fac[MAXN], inv[MAXN];
int dp[MAXN][MAXN], n;
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i != MAXN; ++i) {
		fac[i] = mul(fac[i - 1], i);
		inv[i] = mul(inv[mod % i], mod - mod / i);
	}
	for (int i = 2; i != MAXN; ++i) inv[i] = mul(inv[i], inv[i - 1]);
	std::cin >> n;
	dp[1][0] = dp[1][1] = 1;
	for (int i = 1; i <= n; ++i)
		for (int j = 0; j <= n; ++j) {
			for (int o = 0; o <= n; ++o)
				for (int e = 0; e + o + i <= n; ++e) {
					if (!(o + e)) continue;
					if (o + e + j & 1) continue;
					if (o + e - j < 0) continue;
					int ra = o + e + j >> 1;
					int t = (LL) dp[i][j] * inv[o] % mod * inv[e] % mod;
					reduce(dp[i + o + e][std::abs(o - ra)] += t - mod);
				}
		}
	std::cout << mul(dp[n][0], fac[n]) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ACC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
//string alpha="abcdefghijklmnopqrstuvwxyz";
//int dx[]={1,-1,0,0};
//int dy[]={0,0,1,-1};
//int dx8[]={1,-1,0,0,1,1,-1,-1};
//int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
	int i,j;
	for(i=0;i<MAXN;i++)
	spf[i]=i;
	for(i=4;i<MAXN;i+=2)
	spf[i]=2;
	for(i=3;i*i<MAXN;i++)
	{
		if(spf[i]==i)
		{
			for(j=i*i;j<MAXN;j+=i)
			{
				if(spf[j]==j)spf[j]=i;
			}
		}
	}
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
int32_t main()
{
    ACC
    int T;
    T=1;
    //cin>>T;
    while(T--)
    {
      int n;
      cin>>n;
      cout<<1-n<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3644
using System;
using System.Linq;

public class Test{
    public static void Main(){
        var line1 = System.Console.ReadLine();
        var line2 = System.Console.ReadLine();
      	string[] str1 = line1.Split(' ');
      	//商品の総数
      	int n = int.Parse(str1[0]);
      	//選択する人気商品数
      	int m = int.Parse(str1[1]);      
      	//得票数
      	string[] str2 = line2.Split(' ');
      	int[] a = new int[n];
		for(int i=0; i<n; ++i){
          a[i] = int.Parse(str2[i]);
        }
       	//System.Console.WriteLine(a.Sum());
      
      	//人気商品数用変数
      	int pop = 0;

      	for(int i=0; i<n; ++i){
          if(judge(a, i, m)) pop++;
        }
        if(pop >= m){
       	  System.Console.WriteLine("Yes");
        } else {
          System.Console.WriteLine("No");
        }
    }
  
  	public static Boolean judge(int[] num, int i, int m){
      	if(num[i] < ((double)num.Sum()/(4*m))){
          return false;
        } else {
          return true;
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
    string ss;
    getline(cin,ss);
    
    int l = ss.length();

    
    while(true){
        l = l - 2;
        bool flg = true;
        REP(i,l/2){
            if (ss[i] != ss[l/2 + i]){
                flg = false;
            }
        }
        
        if (flg) break;
    }
    
    PRINTD(l);
   	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
	ll a;
	double b;
	cin >> a >> b;
	int bi = b * 100 + 0.5;
	a *= bi;
	a /= 100;
	cout << a << endl; 
	return 0;
}

Measured memory_bytes: 3736
import sys,collections;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

abc = "abcdefghijklmnopqrstuvwxyz"
s = S()
if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    exit()
if len(s) < 26:
    for a in abc:
        if not a in s:
            print(s+a)
            exit()
else:
    for i in range(len(s)-1):
        if s[-i-2] < s[-i-1]:
            ans = s[:-i-2]
            t = s[-i-2]
            for a in abc:
                if not a in ans and a > t:
                    print(ans+a)
                    exit()


Measured memory_bytes: 3436
#include<iostream>

using namespace std;

string c[2];

int check(){
	for(int i = 0; i < 2; i++) for(int j = 0; j < 3; j++){
		if(c[i][j] != c[1 - i][2 - j]) return 0;
	}
	return 1;
}

int main(){
	cin >> c[0] >> c[1];
	cout << (check() ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N = 1000000;
int arr[1000000];

int p(int num){
	for(int i = 0; i < N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for(int i = num; i < N; i++){
		if(arr[i]){
			return i;
		}
	}
}

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

  int x;
  cin >> x;

  cout << p(x) << endl;

  return 0;
}

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

using namespace std;

//3/0.08=36
/*
 *
 * 	//1.075~1.084
	double maxA=(A+1)/perA-1;
	double maxB=(B+1)/perB-1;
	double minA=A/perA;
	double minB=B/perB;

	if(minA>maxB||minB>maxA){
		cout << -1 << endl;
		return 0;
	}
	result=int(max(minA,minB));
 */
int main() {
	int A, B;

	const double perA = 0.08;
	const double perB = 0.1;
	int maxnum = (int) (100 / perA);
	cin >> A >> B;
	for (int i = 0; i <= maxnum; ++i) {
		if((int)(i*perA)==A&&(int)(i*perB)==B){
			cout<<i<<endl;
			return 0;
		}
	}

	int result=-1;

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt,m;
long G[21] ;
int A[1000001];
int tto(int k)
{
	if (k == 0) {
		G[0] = 1;
		return 1;
	}
	G[k] =tto(k-1) * 3 + 1;
	return G[k];
}
void insertionSort(int A[],int n,int g)
{
	for (int i = g; i < n; i++) {
		int v = A[i];
		int j = i - g;
		for (; j >= 0 && A[j] > v;) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}
void shellSort(int A[], int n)
{
	cnt = 0,m=0;
	
	while (true) {
		if (G[m + 1] > n)break;
		else m++;
	}
	for (int i = m ; i >= 0; i--)
		insertionSort(A,n,G[i]);
	m++;
}
int main()
{
	int n; scanf("%d", &n);
	tto(20);
	for (int i = 0; i < n; i++)
		scanf("%d", &A[i]);
	shellSort(A, n);
	printf("%d\n",m);
	for (int i = m - 1; i >= 0; i--) {
		if (i != m - 1)printf(" ");
		printf("%d", G[i]);
	}
	printf("\n%d\n",cnt);
	for (int i = 0; i < n; i++)
		printf("%d\n",A[i]);
	return 0;
}
//5 5 1 4 3 2


Measured memory_bytes: 7024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<int> ans(n, 0);
	for (int i = n - 1; i >= 0; --i) {
		int res = 0;
		for (int j = i + (i + 1); j < n; j += (i + 1)) res ^= ans[j];
		ans[i] = res ^ a[i];
	}
	int j_ans = 0;
	rep(i, n) j_ans += ans[i];
	dunk(j_ans);
	rep(i, n) {
		if (ans[i]) dunk(i + 1);
	}
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;

int main()
{
    int numTests;
    string veridict;
    map<string, int> dict;
    cin >> numTests;
    for (int i = 0; i < numTests; i++)
    {
        cin >> veridict;
        dict[veridict] = dict.count(veridict) > 0 ? dict[veridict] + 1 : 1;
    }
    //improve iteration over keys
    cout << "AC"
         << " x " << dict["AC"] << endl;
    cout << "WA"
         << " x " << dict["WA"] << endl;
    cout << "TLE"
         << " x " << dict["TLE"] << endl;
    cout << "RE"
         << " x " << dict["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3628
import numpy as np

N = int(input())
X = [int(_) for _ in input().split()]
X = np.array(X)

sumlist = []
for i in range(1, max(X)+1):
    minus = np.array([i] * N)
    res = X - minus
    vlist = map(lambda x: x**2, res)
    sumlist.append(sum(vlist))

print(min(sumlist))

Measured memory_bytes: 12448
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A_max = max(A)
A_max2 = sorted(A)[-2]
for a in A:
    if a==A_max:
        print(A_max2)
    else:
        print(A_max)


Measured memory_bytes: 13380
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] t = new int[N];
        int [] x = new int[N];
        int [] y = new int[N];
        String str = "Yes";
        int flag = 0;

        for(int i = 0 ; i < N ; i++){
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        for(int i = 0 ; i < N ; i++){
            if( (t[i] % 2 == 1) && (((x[i] + y[i])) % 2 == 1 ) && (((x[i] + y[i])) <= t[i])){
                continue;
            }
            else if ((t[i] % 2 == 0) && (((x[i] + y[i])) % 2 == 0 ) && (((x[i] + y[i])) <= t[i])) {
                continue;
            }

            else{
                flag = 1;
            }
        }

        if(flag == 1){
            str = "No";
        }

        System.out.println(str);
    }
}

Measured memory_bytes: 91288