akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	ll N,T,ans=0;
	cin >> N >> T;
	vector<ll> A(N),B(N);
	FOR(i,0,N)cin>>A[i]>>B[i];
	vector<P> AB(N);
	FOR(i,0,N)AB[i].first=A[i],AB[i].second=B[i];
	SORT(AB);
	FOR(i,0,N)A[i]=AB[i].first;
	FOR(i,0,N)B[i]=AB[i].second;
	vector<ll> dp2(3008,0);
	FOR(i,0,N)ans = max(ans,B[i]);
	FOR(i,0,N-1){
		vector<ll> dp1(3008);
		FOR(j,0,T){
			if(j<A[i]){
				dp1[j] = dp2[j];
			}else{// 2mukasi
				if(dp2[j]<=dp2[j-A[i]]+B[i]){
					dp1[j] = dp2[j-A[i]]+B[i];
					if(j-A[i]<T)ans = max(ans,dp1[j]);
				}else{
					dp1[j] = dp2[j];
				}
			}
			ans = max(ans,dp1[j]+B[i+1]);
		}
		dp2 = dp1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(void)
{
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a < b && b < c)
  {
      cout << "Yes" << endl;
  }
  else
  {
      cout << "No" << endl;
  }
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
const long long llINF = 1LL << 60;
map<int, int> mp;
int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	int minusNum = 0;
	ll ans = 0;
	ll absMin = llINF;
	rep(i, n) {
		cin >> a[i];
		ans += abs(a[i]);
		absMin = min(absMin, abs(a[i]));
		if (a[i] < 0) {
			minusNum++;
		}
	}
	if (minusNum % 2 == 1) {
		ans -= ll(2) * absMin;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4016
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    ll x, y;
    cin >> x >> y;
    if (x % y == 0){
        cout << -1 << endl;
    }else{
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/*Lucky_Glass*/
#include<bits/stdc++.h>
using namespace std;
string A,B;
int totA[26],totB[26];
int main(){
	cin>>A>>B;
	for(int i=0;i<A.length();i++)
		totA[A[i]-'a']++;
	for(int i=0;i<B.length();i++)
		totB[B[i]-'a']++;
	sort(totA,totA+26);
	sort(totB,totB+26);
	for(int i=0;i<26;i++)
		if(totA[i]!=totB[i]){
			printf("No\n");
			return 0;
		}
	printf("Yes");
	return 0;
}

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

bool solve(){
	int n;
	cin >> n;
	if(n == 0)return false;
	vector<int> x(n);
	for(int i=0;i<n;i++)
		cin >> x[i];

	vector<vector<int>> dp(n+1,vector<int>(n+1));
	for(int i=0;i<n-1;i++){
		if( abs( x[i] - x[i+1] ) <= 1 )
			dp[i][i+1] = 2;
	}

	for(int d=1;d<n;d++){
		for(int l=0;l<n;l++){
			if( l + d >= n )continue;
			for(int r=l;r<l+d;r++){
				// cout << l << " " << r << " " << r + 1 << " " << l+d << endl;
				dp[l][l+d] = max(dp[l][l+d], dp[l][r] + dp[r+1][l+d]);
			}
			if( l - 1 >= 0 && l + d + 1 < n){
				if( dp[l][l+d] == d + 1 && abs( x[l-1] - x[l+d+1] ) <= 1 ){
					dp[l-1][l+d+1] = max(dp[l-1][l+d+1] ,dp[l][l+d] + 2);
				}
			}
		}
		// cout << endl;
	}
	cout << dp[0][n-1] << endl;
	return true;
}

int main(void){

	while(solve()){}

	return 0;
}

Measured memory_bytes: 3244
//#pragma GCC optimize(2)
//#include<bits/stdc++.h>
//using namespace std;
//stack <char> q;
//char a[1200000];
//inline int read() {
//	int X=0,w=0;
//	char ch=0;
//	while(!isdigit(ch)) {
//		w|=ch=='-';
//		ch=getchar();
//	}
//	while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
//	return w?-X:X;
//}
//int main() {
//	freopen("fusion.in","r",stdin);
//	freopen("fusion.out","w",stdout);
//	scanf("%s",a+1);
//	int m;
//	cin>>m;
//	for(int i=1; i<=m; i++) {
//		int x,y;
//		x=read();
//		y=read();
//		while(!q.empty()) q.pop();
//		for(int j=x; j<=y; j++) {
//			if(q.empty()) {
//				q.push(char(a[j]));
//				continue;
//			}
//			char w=q.top();
//			char at=a[j];
//			q.push((char)a[j]);
//			if(w==at) {
//L1:
//				;
//				if(w=='z') {
//					q.pop();
//					q.pop();
//				} else {
//					q.pop();
//					q.pop();
//
//					at=(char)w+1;
//					if(q.empty()) {
//						q.push(at);
//						continue;
//					}
//					w=q.top();
//					q.push(at);
//					if(at==w) goto L1;
//				}
//			}
//		}
//		if(q.empty()) puts("Yes");
//		else puts("No");
//	}
//	return 0;
//}








































#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
char s[560000];
int n,m;
int to[560000][30],nxt[560000][30];
inline int read() {
	int ret=0;
	char c=getchar();
	while((c>'9')||(c<'0'))c=getchar();
	while((c>='0')&&(c<='9'))ret=(ret<<1)+(ret<<3)+c-'0',c=getchar();
	return ret;
}
void pre() {
	for(int i=1; i<=n+2; i++) {
		for(int j=0; j<=26; j++) to[i][j]=n+2;
		for(int j=0; j<=19; j++) nxt[i][j]=n+2;
	}
	for(int i=n; i; i--) {
		to[i][s[i]]=i+1;//更新自己这一位
		for(int j=s[i]+1; j<=26; j++) to[i][j]=to[to[i][j-1]][j-1]; //从k变到j（合并操作）
		nxt[i][0]=to[i][26];//记录消除完的情况
		for(int j=1; j<20; j++) nxt[i][j]=nxt[nxt[i][j-1]][j-1]; //更新多段消除完的情况
		for(int j=0; j<26; j++) if(to[i][j]==n+2) to[i][j]=to[nxt[i][0]][j]; //如azzabcd…即对于前面没有算出东西的情况中，先消除掉一部分再进行计算。
	}
}
bool check(int l,int r) {
	for(int i=19; i>=0; i--) {
		if(nxt[l][i]==r+1) return true;
		if(nxt[l][i]<=r) l=nxt[l][i];
	}
	return false;
}
int main() {
// 	freopen("fusion.in","r",stdin);
// 	freopen("fusion.out","w",stdout);
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1; i<=n; i++) s[i]-='a';
	pre();
	m=read();
	while(m--) {
		int l=read(),r=read();
		if(check(l,r)) puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 119936
#import <Foundation/Foundation.h>
typedef long long Int;
int main() {
	Int n,k;
	scanf("%lld %lld",&n,&k);
	Int ans=0;
	for(Int i=0;i<n;i++){
		Int h;
		scanf("%lld",&h);
		if(h>=k) ans++;
	}
	printf("%lld",ans);
}

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

int main() {
  int n, d;
  cin >> n >> d;
  int x[n][d];
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < d; j++) {
      cin >> x[i][j];
      //cout << x[i][j] << endl;
    }
  }

  int ans = 0;
  for(int i = 0; i < n-1; i++) {
    for(int j = i+1; j < n; j++) {
      int sum = 0;
      for(int k = 0; k < d; k++) {
        sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      }
      //cout << sum << endl;
      if((int)sqrt(sum) == (double)sqrt(sum)) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    string s; cin>>s;
    ll ans=0,cnt=0;
    rep(i,s.size()){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            cnt++;
            ans=max(ans,cnt);
        }else cnt=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3584
package main

import . "fmt"

func main() {
  var s string
  slice0 := []string{"xxx"}
  slice1 := []string{"oxx","xox","xxo"}
  slice2 := []string{"oox","oxo","xoo"}
  slice3 := []string{"ooo"}
  Scan(&s)
  if contains(slice0,s) {
    Println("700")
  } else if contains(slice1,s) {
    Println("800")
  } else if contains(slice2,s) {
    Println("900")
  } else if contains(slice3,s) {
    Println("1000")
  } else {
    Println("0")
  }
}

func contains(slice []string,str string) bool {
  for _,s := range slice {
    if s == str {
      return true
    }
  }
  return false
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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;
}

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

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
  }
  rep(i, N) {
    if (A[i] % 2 == 1)
      continue;
    if (A[i] % 3 == 0 || A[i] % 5 == 0)
      continue;
    cout << "DENIED" << endl;
    return 0;
  }
  cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
S = LS2()
Q = I()
K = LI()


def query(k):
    res = 0
    a = 0  # (i-k,i] にあるDの個数
    b = 0  # (i-k,i] にあるMの個数
    c = 0  # (i-k,i] にある(D,M)の個数
    for i in range(N):
        if i >= k:
            if S[i-k] == 'D':
                a -= 1
                c -= b
            elif S[i-k] == 'M':
                b -= 1
        if S[i] == 'D':
            a += 1
        elif S[i] == 'M':
            b += 1
            c += a
        elif S[i] == 'C':
            res += c
    return res


print(*[query(k) for k in K],sep='\n')


Measured memory_bytes: 121976
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        for(int i = 0;i<s.length();i++){
            int j = i;
            int tmp = 0;
            while(j!=s.length()&&(s.charAt(j)=='A'||s.charAt(j)=='C'||s.charAt(j)=='G'||s.charAt(j)=='T')){
                tmp ++;
                ans = Math.max(ans,tmp);
                j++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22228
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
 
		int l = scan.nextInt();
		double a = (double)l / 3.0;
 
		System.out.printf("%.12f" , Math.pow(a, 3));
	}
}

Measured memory_bytes: 36016
#pragma GCC optimize("O3")
 #pragma GCC optimize("unroll-loops")
 #pragma GCC optimize("fast-math")
#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define int long long
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
int get(int x, vector<int>&a) {
    for (int i = 0; i < a.size(); ++i) {
        x = x / a[i] * a[i];
    }
    return x;
}

signed main() {
    accell();
    int n;
    cin >> n;
    vector<int>a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int l = 1;
    int r = 1e18 + 1;
    while (r - l > 1) {
        int m = l + r >> 1;
        if (get(m, a) >= 2)
            r = m;
        else
            l = m;
    }
    if (get(r, a) != 2) {
        cout << -1;
        return 0;
    }
    int ansl = r;
    l = 1;
    r = 1e18 + 1;
    while (r - l > 1) {
        int m = l + r >> 1;
        if (get(m, a) > 2)
            r = m;
        else
            l = m;
    }
    int ansr = l;
    cout << ansl << ' ' << ansr << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main( void ) {

	int a[5], i, j, temp;

	for ( i = 0; i < 5; i++ ) { scanf( "%d", &a[i] ); }

	for ( i = 0; i < 5; i++ ) {

		for ( j = 0; j < 4; j++ ) {

			if ( a[j] < a[j+1] ) {

				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;

			}

		}

	}

	for ( i = 0; i < 4; i++ ) { printf( "%d ", a[i] ); }

	printf( "%d\n", a[4] );

	return 0;

}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;

class A2{
  public static void Main(){
    int max = -1,A_int;
    string A;
    Stack<string> stack = new Stack<string>();
    string[] str = Console.ReadLine().Split(' ');
    for(int i = 0;i < str.Length;i++){
      if(str[i] == "+"){
        A_int = int.Parse(stack.Pop()) + int.Parse(stack.Pop());
        A = A_int.ToString();
        stack.Push(A);
      }
      else if(str[i] == "-"){
        A_int = (-1) * int.Parse(stack.Pop()) + int.Parse(stack.Pop());
        A = A_int.ToString();
        stack.Push(A);
      }
      else if(str[i] == "*"){

        A_int = int.Parse(stack.Pop()) * int.Parse(stack.Pop());
        A = A_int.ToString();
        stack.Push(A);
      }
      else{
      stack.Push(str[i]);
      max++;
      }
    }
      Console.WriteLine(stack.Pop());
  }
}



Measured memory_bytes: 10116
import java.util.*;

public class Main {
	static public void main(String args[]){
		Scanner sc=new Scanner(System.in);
		 
		 String str=sc.next();
		 int len=str.length();
		 int i=0,j=len-1;	 
		 while(i<j){
		 	if(str.charAt(i++)!=str.charAt(j--)){
				System.out.println("No");
				System.exit(0);
		 	}
		 }
		 
		 i=0;
		 j=(len-1)/2;
		 j-=1;
		 while(i<j){
		 	if(str.charAt(i++)!=str.charAt(j--)){
				System.out.println("No");
				System.exit(0);
		 	}
		 }
		 
		 i=(len+3)/2;
		 i-=1;
		 j=len-1;
		  while(i<j){
		 	if(str.charAt(i++)!=str.charAt(j--)){
				System.out.println("No");
				System.exit(0);
		 	}
		 }
		 
		 System.out.println("Yes");
	}
}

Measured memory_bytes: 35544
#include<stdio.h>
int main()
{
    int N,K,h[100000],n,i;
    scanf("%d%d",&N,&K);
    for(i=0,n=0;i<N;i++){
    scanf("%d",&h[i]);
    if(h[i]>=K){
        n=n+1;
      }
    }
    printf("%d\n",n);
    return 0;
}

Measured memory_bytes: 512
def f(n):
  c=0
  while n>0:
    n%=format(n, 'b').count('1')
    c+=1
  return c

N=int(input())
X=input()
nums=[0]+[f(i) for i in range(1, N+1)]

a=0
b=0
for i in range(N):
  if X[i]=='0':
    a+=1
  else:
    b+=1

s=0
t=0
if b>1:
  for i in range(N):
    s=(s+int(X[i])*pow(2, N-1-i, b+1))%(b+1)
    t=(t+int(X[i])*pow(2, N-1-i, b-1))%(b-1)
else:
  for i in range(N):
    s=(s+int(X[i])*pow(2, N-1-i, b+1))%(b+1)
    
if b==1:
  for i in range(N):
    if X[i]=='0':
      tmp=(s+pow(2, N-1-i, b+1))%(b+1)
      print(nums[tmp]+1)
    else:
      print(0)
  exit()

for i in range(N):
  if X[i]=='0':
    tmp=(s+pow(2, N-1-i, b+1))%(b+1)
    print(nums[tmp]+1)
  else:
    tmp=(t-pow(2, N-1-i, b-1))%(b-1)
    print(nums[tmp]+1)


Measured memory_bytes: 12624
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

/*  ll t=1;
    while(t<n) t*=2;
木の最底辺の大きさを決める*/ 
ll seg[2*MAX_N-1];
void segmake(ll n, ll a[n] ,ll t){
    rep(i,0,t) seg[t-1+i]=i<n?a[i]:a[n-1];
    while(t/=2) rep(i,0,t) seg[t+i-1]=gcd(seg[2*(t+i)],seg[2*(t+i)-1]); 
}

ll seggcd(ll from, ll to, ll a, ll l, ll r){
    return (l>=from && r<=to) ? seg[a] : (to<(l+r)/2+1) ? seggcd(from,to,2*a+1,l,(l+r)/2) : (from>(l+r)/2) ? seggcd(from,to,2*a+2,(l+r)/2+1,r) : gcd( seggcd(from,to,2*a+2,(l+r)/2+1,r) , seggcd(from,to,2*a+1,l,(l+r)/2) );
    // if(l>=from && r<=to) return seg[a];
    // if( to<(l+r)/2+1 ) return seggcd(from,to,2*a+1,l,(l+r)/2);
    // if( from  > (l+r)/2 ) return seggcd(from,to,2*a+2,(l+r)/2+1,r);
    // return gcd( seggcd(from,to,2*a+2,(l+r)/2+1,r) , seggcd(from,to,2*a+1,l,(l+r)/2) ) ;
}

void segupdate(ll a, ll b, ll t){
    ll c=t-1+a;
    seg[c]=b;
    while(c>0){
        c--; c/=2;
        seg[c]=gcd(seg[2*(c+1)],seg[2*(c+1)-1]);
    }
}

int main(void){
    // char ;
    ll n,ans=0;
    scanf("%lld",&n);
    ll a[n];
    rep(i,0,n){
        scanf("%lld",&a[i]);
    }

    ll t=1;
    while(t<n) t*=2;
    segmake(n,a,t);

    ans=seggcd(1,n-1,0,0,t-1);
    ans=max2( ans , seggcd(0,n-2,0,0,t-1) );

    rep(i,1,n-1){
        ans = max2( ans , gcd( seggcd(0,i-1,0,0,t-1) , seggcd(i+1,n-1,0,0,t-1) ) );
    }

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


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
ll a[L];
int check(int i, int j, int k)
{
	if(a[i] == a[j])return 0;
	if(a[k] == a[j])return 0;
	if(a[i] == a[k])return 0;
	if(a[i]+a[j]<=a[k])return 0;
	if(a[k]+a[j]<=a[i])return 0;
	if(a[i]+a[k]<=a[j])return 0;
	if(abs(a[i]-a[j])>=a[k])return 0;
	if(abs(a[k]-a[j])>=a[i])return 0;
	if(abs(a[i]-a[k])>=a[j])return 0;
	return 1;
}
void fff()
{
	ll ans = 0;
	int n;
	cin >> n;
	FOR(i,0,n)cin >> a[i];
	sort(a,a+n);
	FOR(i,0,n)
	{
		FOR(j,i+1,n)
		{
			FOR(k,j+1,n)
			{
				ans+=check(i,j,k);
			}
		}
	}
	cout << ans<<ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main(){
	llong N;
	vector<llong> A;

	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; i++)
		cin >> A[i];

	// dp[now][change]
	vector<vector<llong> > dp(N, vector<llong>(2,0));
	dp[0][1] = -inf;
	for (int i = 0; i < N-1; i++) {
		dp[i+1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i]);
		dp[i+1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i]);
	}

	cout << max(dp[N-1][0] + A[N-1], dp[N-1][1] - A[N-1]) << endl;

	return 0;
}

Measured memory_bytes: 6528
using System;

public class B {
    public static void Main(){
        string[] line = Console.ReadLine().Split(' ');
        int N = int.Parse(line[0]);
        int K = int.Parse(line[1]);
        int count = 0;
        for (int current = K;current<=N;current*=K)
        {
            count++;
        }
        Console.WriteLine(count+1);
    }
}


Measured memory_bytes: 11092
import math
N = int(input())
for n in range(1, N+1):
    nn = int(n**0.5+1)
    ans = 0
    for x in range(1, nn):
        for y in range(1, nn):
            d = n-x*x-y*y-x*y
            if d < 0:
                break
            l, r = 0, nn
            while (r-l) > 1:
                m = (r+l)//2
                z = m*m+m*(x+y)
                if z == d:
                    ans += 1
                    break
                elif z < d:
                    l = m
                else:
                    r = m
    print(ans)


Measured memory_bytes: 69868
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////


int main(){
	ll N;
	cin >> N;
	mint ans = pw(10, N) - pw(9,N)*2+pw(8, N);
	cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

struct edge {
    int to, cost;
};

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<edge>>g(N);
    rep(i, M){
        int l, r, d;
        cin >> l >> r >> d;
        l --;
        r --;
        edge e1 = {r, d};
        g[l].push_back(e1);
        edge e2 = {l, -d};
        g[r].push_back(e2);
    }
    vector<bool> visit(N);
    vector<int> cs(N);
    rep(i, N){
        if(! visit[i]){
            // 未探索の連結グラフを処理.
            queue<int> qs;
            qs.push(i);
            while(! qs.empty()){
                int p = qs.front();
                qs.pop();
                rep(j, g[p].size()){
                    edge e = g[p][j];
                    // 右向きが正.
                    if(! visit[e.to]){
                        cs[e.to] = e.cost + cs[p];
                        visit[e.to] = true;
                        qs.push(e.to);
                    }else if (cs[e.to] != e.cost + cs[p]){
                        cout << "No" << endl;
                        return 0;
                    }
                }

            }

        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define MOD 1000000007

long long dp[4][4][4][110];

int main() {
    const string moji[] = {"A", "C", "G", "T"};
    string out[] = {"AGC", "GAC", "ACG", "AAGC", "ACGC", "AGGC", "ATGC", "AGAC", "AGCC", "AGGC", "AGTC"};
    int N;
    cin >> N;

    for (int i=0; i<4; i++) {
        for (int j=0; j<4; j++) {
            for (int k=0; k<4; k++) {
                dp[i][j][k][3] = 1;
            }
        }
    }
    dp[0][2][1][3] = 0;
    dp[2][0][1][3] = 0;
    dp[0][1][2][3] = 0;

    for (int n=4; n <= N; n++) {
        for (int i=0; i<4; i++) {
            for (int j=0; j<4; j++) {
                for (int k=0; k<4; k++) {
                    for (int m=0; m<4; m++) {
                        string str = moji[i] + moji[j] + moji[k] + moji[m];
                        bool ok = true;
                        for (int g=0; g<11; g++) {
                            if (str.find(out[g]) != std::string::npos) {
                                ok = false;
                                break;
                            }
                        }
                        if (ok) {
                            dp[j][k][m][n] += dp[i][j][k][n-1];
                            dp[j][k][m][n] %= MOD;
                        }
                    }
                }
            }
        }
    }

    long long ans = 0;
    for (int i=0; i<4; i++) {
        for (int j=0; j<4; j++) {
            for (int k=0; k<4; k++) {
                ans += dp[i][j][k][N];
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace AtcoderExpress
{
    class Program
    {
        static void Main(string[] args)
        {
            var NMQ = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = NMQ[0];
            var M = NMQ[1];
            var Q = NMQ[2];

            var Route = new long [N+1,N+1];
            for (int i = 0; i < M; i++)
            {
                var LR = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                var L = LR[0];
                var R = LR[1];
                Route[L, R]++;
            }

            for (int i = 1; i <= N; i++)
            {
                for (int j = 1; j <= N; j++)
                {
                    Route[i, j] += Route[i, j - 1];
                }
            }

            for (int i = 0; i < Q; i++)
            {
                var PQ = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                var S = PQ[0];
                var G = PQ[1];

                var ans = 0L;
                for (int j = S; j <= G; j++)
                {
                    ans += Route[j, G] - Route[j, S - 1];
                }
                Console.WriteLine(ans);
            }
            
        }
    }
}


Measured memory_bytes: 17968
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#define int long long
using namespace std;
signed main() {
	int n, a, b = 0, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> a;
		if (b < a) { ans++; }
		b = a;
	}
	cout << ans - 1 << endl;
}


Measured memory_bytes: 3108
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int a, b;
	cin >> a >> b;
	if (a > b){
		cout << a - 1 << endl;
	}
	else{
		cout << a << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, *D = map(int, open(0).read().split())
ok = 1
e = 0
for i in range(N):
    if e < i:
        ok = 0
    e = max(e, i+D[i]//10)
e = N-1
for i in range(N-1, -1, -1):
    if e > i:
        ok = 0
    e = min(e, i-D[i]//10)
print("yes" if ok else "no")


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

int main(){

    int q;
    cin >> q;
    set<int> st;
    for(int i = 0; i < q; ++i){
        int com, x;
        cin >> com;
        if(com != 3){
            cin >> x;
        }
        if(com == 0){
            st.insert(x);
            cout << st.size() << endl;
        }
        else if(com == 1){
            cout << (st.find(x) != st.end()) << endl;
        }
        else if(com == 2){
            st.erase(x);
        }
        else{
            int L, R;
            cin >> L >> R;
            auto l = st.lower_bound(L);
            auto r = st.upper_bound(R);
            for(auto it = l; it != r; ++it){
                cout << *it << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 12468
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
    int H, W;
    while(true) {
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for(int i = 0; i < H; i++) {
            for(int v = 0; v < W; v++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2968
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] == 1:
		print (0)
		exit()
	else:
		print (-1)
		exit()
b = set(a)
if len(b) == 1 and a[0] != 1:
	print (-1)
	exit()

x = 1
cnt = 0
for i in a:
	if i == x:
		x += 1
	else:
		cnt += 1
if cnt == n:
	print (-1)
else:
	print(cnt)

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n; cin >> n;
    vector<ll> a(n);
    ll xo = 0;
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
        xo ^= a[i];
    }

    for (ll i = 0; i < n; ++i) {
        cout << (xo ^ a[i]) << ' ';
    }

    cout << endl;
}

Measured memory_bytes: 4780
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include <iomanip>

using namespace std;

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

  int n,k;
  cin >> n;
  cin >> k;
  long double res = 0;
  int m;
  if(n > k){
    m = k;
    res += (long double)(n - k + 1)/n;
  }else{
    m = n + 1;
  }

  for(int i = 1; i < m; ++i){
    int p = ceil(log2((long double)k/i));
    res += pow(0.5, p) * ((long double)1/n);
  }

  cout << setprecision(13);
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = list(input())
    for _ in range(len(S)):
        S.pop()
        if S[:len(S) // 2] == S[len(S) // 2:]:
            print(len(S))
            break


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
(defun main ()
  (let* ((n (read))
	 (s (loop for i from 1 to n  sum i))
	 (a (* 3  (loop for i from 1 to (floor n 3)  sum i)))
	 (b (* 5  (loop for i from 1 to (floor n 5)  sum i)))
	 (c (* 15 (loop for i from 1 to (floor n 15) sum i))))
    (format t "~a~%" (+ (- s a b) c))))
(main)

Measured memory_bytes: 24340
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

typedef struct {
	vector <int> to;
	int cost;
} edge;
typedef struct {
	bool a;
	bool b;
} P;
int main( void ){
	ll N, A, B; cin >> N >> A >> B;
	if (N == 1){
		if ( A != B)
			cout << 0 << endl;
		else
			cout << 1 << endl;
		return 0;
	}
	if (A > B){
		cout << 0 << endl;
		return 0;
	}
	cout << B*(N-2) - A*(N-2) + 1 << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
import math

def factoring(x):
    ans = []
    for i in range(1, int(math.sqrt(x))+1):
        if x%i == 0:
            ans.append(i)
            ans.append(x // i)
    return sorted(ans)

n, m = map(int, input().split())

facts = factoring(m)
for i in facts[::-1]:
    if i <= int(m/n):
        print(i)
        exit()

Measured memory_bytes: 3188
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue,copy
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])
def graph():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b=inpm()
        a-=1
        b-=1
        g[a].append(b)
        g[b].append(a)
    return n,m,g

def graphm():
    n=inp()
    g=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append([b,w])
        g[b].append([a,w])
    return n,g

def main():
    n,g=graphm()
    que=[0]
    ans=[-1 for _ in range(n)]
    ans[0]=0
    while len(que)>0:
        x=que.pop(0)
        for i in range(len(g[x])):
            go=g[x][i][0]
            if ans[go]==-1:
                que.append(go)
                if g[x][i][1]%2==0:
                    ans[go]=ans[x]
                else:
                    ans[go]=1-ans[x]
    print(*ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 80300
import scala.io.StdIn._
object Main {
 def main(args :Array[String]) = {
	var mtrl = readLine.split(" ").map(_.toInt)
	val (i, j) = (mtrl(0)*mtrl(1), (2*mtrl(0))+(2*mtrl(1)))
	println(i+" "+j)
 }
}

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

int main(){
    string s;
    cin >> s;
    int sum = 0;
    for (int i = 0; i < s.size(); i++){
        sum += (s[i] - '0');
    }
    cout << (sum%9 == 0 ? "Yes\n" : "No\n");
}


Measured memory_bytes: 3724
n = int(input())
x = input()
cnt1 = x.count('1')
x10 = int(x,2)

if cnt1 > 1:
  x10mod_m = x10 % (cnt1-1)
  x10mod_p = x10 % (cnt1+1)
else:
  x10mod_m = 0
  x10mod_p = 0

ans = []
for i in range(n):
  if x[i] == '1':
    if cnt1 == 1:
      print(0)
      continue
    cntx = cnt1-1
    mod = ( x10mod_m - pow(2,n-1-i,cntx) ) % cntx
  else:
    cntx = cnt1+1
    mod = ( x10mod_p + pow(2,n-1-i,cntx) ) % cntx
    
  cnt = 1
  mod = format(mod, 'b')
  
  while True:
    if mod == '0':
      break
    mod = format( int(mod,2) % mod.count('1'), 'b')
    cnt += 1
  print(cnt)

Measured memory_bytes: 84332
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n;
    cin >> n;
    int a=0;
    int b=0;
    int c=0;
    int d=0;

    for (int i=0;i<=n-1;i++)
    {
        string s;
        cin >> s;

        if (s=="AC")
        {
            a++;
        }
        else if (s=="WA")
        {
            b++;
        }
        else if (s=="TLE")
        {
            c++;
        }
        else
        {
            d++;
        }
    }

    cout << "AC x " << a << endl;
    cout << "WA x " << b << endl;
    cout << "TLE x " << c << endl;
    cout << "RE x " << d << endl;

    return 0;
}

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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

// #define int long long
#define YES "YES"
#define NO  "NO"

using namespace std;

signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  // flag = true;

  string s[3];
  for (int i = 0; i < 3; ++i) cin >> s[i];

  cout << "A" << s[1].substr(0, 1) << "C" << endl;


  // cout << num << endl;
  // cout << (flag ? "H" : "D") << endl;
  
  return 0;
}


Measured memory_bytes: 256
let main () =
  let a = Scanf.scanf "%d\n" Batteries.identity in
  let b = Scanf.scanf "%d\n" Batteries.identity in
  let c = Scanf.scanf "%d\n" Batteries.identity in
  let x = Scanf.scanf "%d\n" Batteries.identity in
  let xs = ref [] in
  for i = 0 to a do
    for j = 0 to b do
      for k = 0 to c do
        xs := (i,j,k) :: !xs;
      done
    done
  done;
  let count = List.fold_left (fun acc (a,b,c) -> if 500 * a + 100 * b + 50 * c == x then acc + 1 else acc) 0 !xs in
  Printf.printf "%d\n" count

let _ = main ()


Measured memory_bytes: 9344
from collections import deque
from copy import copy
import sys
input = sys.stdin.readline
N,M = (int(x) for x in input().split())
connection ={i:[] for i in range(0,N+1)}
connection[0] =[1]
#connection[1] =[0]
#構造入力
for i in range(M):
    a,b = (int(x) for x in input().split())
    connection[a].append(b)
    connection[b].append(a)

# 幅優先探索
parent ={i:-1 for i in range(1,N+1)} #親＝通過済、通過してない部屋はー１
parent[1] =0
children = deque()
children.extend(connection[1])
for i in children:
    parent[i] =1
while children:
    next =children.popleft()

    for i in connection[next]:
        if parent[i] != -1:
            continue
        else:
            parent[i] =next

            children.append(i)
#出力
print("Yes")
for i in range(2,N+1):
    print(parent[i])

Measured memory_bytes: 54076
#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

class Debugger {
public:
	template<typename T>
	void printVector(vector<T> const &vec, bool printSize=true){
		if(printSize){
			cout << vec.size() << endl;
		}
		for(auto &elem : vec){
			cout << elem << " ";
		}
		cout << endl;
	}

	template<typename T>
	void printMatrix(vector<vector<T>> const &matrix){
		cout << matrix.size()<< " ";
		if(!matrix.empty()){
			cout << matrix[0].size();
		}
		cout << endl; 
		for(auto &vec : matrix){
			printVector(vec, false);
		}
		cout << endl;
	}
};

#define ll long long
const int maxN = 100005;
const ll INF = 1000000000000000000LL;

class TaskA {
private:
	Debugger debugger;

public:
	void solveOne(int it){
		int x;
		cin >> x;
		cout << (x >= 30 ? "Yes":"No") << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};


int main(){
	ios_base::sync_with_stdio(false);
	TaskA solver;
	solver.solve();
	return 0;
}


Measured memory_bytes: 3624
/**Bismillahir Rahmanir Raheem
    Author:Refat(BSMRSTU)**/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 1e5 + 5;
const int M = 1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    int test=1;ll ans=1,h,n,cnt=0;
    ///scanf("%d",&test);
    for(int cs=1; cs<=test; cs++) {
        scanf("%lld",&h);
        n=h;
        while(n>1){
           n/=2ll;cnt++;
           ans+=powl(2,cnt);
        }
        printf("%lld\n",ans);
    }
    return 0;
}



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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll q;
    cin>>q;
    ll totori = 0;
    priority_queue<int,vector<int>> l;
    priority_queue<int,vector<int>,greater<int>> r;
    ll now1=0,now2=0;
    ll suml=0,sumr=0;
    int cnt=0;
    while(q--){
        int p;
        cin>>p;
        if(p==1){
            ll a,b;
            cin>>a>>b;
            totori += b;
            if(cnt==0) now1 = a;
            else if(cnt==1){
                now2 = a;
                if(now1>now2) swap(now1,now2);
            }
            else{
                if(now1>a){
                    l.push(a);
                    suml += a;
                    if(cnt%2==1){
                        now2 = now1;
                        now1 = l.top();
                        suml -= l.top();
                        l.pop();
                    }
                    else{
                        sumr += now2;
                        r.push(now2);
                        now2 = now1;
                    }
                }
                else if(now2<a){
                    r.push(a);
                    sumr += a;
                    if(cnt%2==1){
                        now1 = now2;
                        now2 = r.top();
                        sumr -= r.top();
                        r.pop();
                    }
                    else{
                        l.push(now1);
                        suml += now1;
                        now1 = now2;
                    }
                }
                else if(now1<=a && a<=now2){
                    if(cnt%2==1){
                        now1=a,now2=a;
                    }
                    else{
                        l.push(now1), r.push(now2);
                        suml += now1, sumr += now2;
                        now1=a,now2=a;
                    }
                }
            }
            cnt++;
        }
        else{
            ll ans = totori;
            if(cnt%2){
                ans += now1 * (cnt/2) - suml;
                ans += sumr - now1 * (cnt/2);
            }
            else{
                ans += now1 * (cnt/2 - 1) - suml;
                ans += sumr - now1 * (cnt/2 - 1);
                ans += now2 - now1;
            }
            cout << now1 << " " << ans << "\n";
        }
    }
}

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

int main() {
    string S;
    cin >> S;
    string a ,b , c, d;
    a = S[2];
    b = S[3];
    c = S[4];
    d = S[5];
    if (a == b && c == d ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    X, K, D = parseMap(split(readline()))
    X = abs(X)
    if X ÷ D < K
        K -= X ÷ D
        X -= D * (X ÷ D)
        if K % 2 == 1
            println(abs(X - D))
        else
            println(abs(X))
        end
    else
        X = abs(X)
        X -= D * K
        println(abs(X))
    end

end

main()

Measured memory_bytes: 163180
#include <iostream>
#include <string>
using namespace std;
int main() {
  int N;
  string s, t, u;
  cin >> N;
  cin >> s;
  cin >> t;
  cin >> u;
  int ret = 0;
  for (int i=0; i<N; i++) {
    if (s[i] == t[i] && t[i] == u[i]) continue;
    if (s[i] == t[i] || t[i] == u[i] || u[i] == s[i]) ret++;
    else ret += 2;
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;


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; }

int main(){
  int N, K; cin >> N >> K;
  vector<ll> h(N+100,0); for(int i = 0; i < N; i++) cin >> h.at(i);
  vector<ll> dp(N+100,INF);
  
  dp.at(0) = 0;
  for(int i = 0; i < N; i++){
      for(int j = 1; j <= K; j++){
          chmin(dp.at(i+j),dp.at(i)+abs(h.at(i)-h.at(i+j)));
      }
  }
  cout << dp.at(N-1) << endl;
}



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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<int>l(Q), r(Q);
	vector<int>sum(N + 1, 0);

	for (int i = 0; i < Q; i++) {
		cin >> l[i] >> r[i];
	}

	for (int i = 1; i < N; i++) {
		if (S[i - 1] == 'A'&&S[i] == 'C') {
			sum[i + 1] = sum[i] + 1;
		}
		else {
			sum[i + 1] = sum[i];
		}
	}

	for (int i = 0; i < Q; i++) {
		int ans = sum[r[i]] - sum[l[i]];
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 2256