akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
set<int> g[125252];
int cnt[125252];

int main(){
  scanf("%d",&n);
  REP(i,n-1){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    g[a].insert(b);
    g[b].insert(a);
  }
  queue<int> leaves;
  REP(i,n)if(g[i].size()==1)leaves.push(i);
  while(!leaves.empty()){
    int p = leaves.front(); leaves.pop();
    int to = *g[p].begin();
    // erase to
    for(int yo : g[to]){
      g[yo].erase(to);
      if(g[yo].size()==1)leaves.push(yo);
      if(yo != p && g[yo].size()==0){
        puts("First");
        return 0;
      }
    }
  }
  puts("Second");
  return 0;
}


Measured memory_bytes: 15744
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N_MAX 200001

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

int main(){
  int N,count=1;
  char S[N_MAX][11];
  scanf("%d",&N);
  for(int a=0;a<N;a++)scanf("%s",S[a]);
  qsort(S,N,sizeof(S[0]),upordown);
  for(int a=0;a<N-1;a++){
    if(0!=strcmp(S[a],S[a+1]))count++;
  };
  printf("%d",count);
};


Measured memory_bytes: 5716
import sys
sys.setrecursionlimit(1000000)


class memoRec():
    def __init__(self, n):
        self.max_n = 110000
        self.memo = [n] * self.max_n
        self.memo[0] = 0
        self.n = n

    def power6(self, s, i):
        self.memo[i] = min(self.memo[i], self.memo[i - s] + 1)
        if i - s * 6 < 0:
            return
        return self.power6(s * 6, i)

    def power9(self, s, i):
        self.memo[i] = min(self.memo[i], self.memo[i - s] + 1)
        if i - s * 9 < 0:
            return
        return self.power9(s * 9, i)

    def search(self, s):
        memo = self.power6(1, s)
        memo = self.power9(1, s)
        if s + 1 == self.n + 1:
            return
        return self.search(s + 1)


n = int(input())
mr = memoRec(n)
mr.search(1)
print(mr.memo[n])


Measured memory_bytes: 89760
A, B, C, X, Y = map(int, input().split())
cost = 0
if A + B > 2 * C:
  P = min(X, Y)
  X -= P
  Y -= P
  cost += 2 * C * P
if A > 2 * C:
  cost += 2 * C * X
  X = 0
if B > 2 * C:
  cost += 2 * C * Y
  Y = 0
cost += A * X + B * Y
print(cost)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    int H, W; cin >> H >> W;
    vector<vector<int>> a(H+5, vector<int>(W+5, 0)), b(H+5, vector<int>(W+5, 0));
    repr(i, 1, H+1) repr(j, 1, W+1) cin >> a[i][j];
    repr(i, 1, H+1) repr(j, 1, W+1) cin >> b[i][j];

    vector<vector<vector<bool>>> dp(H+5, vector<vector<bool>>(W+5, vector<bool>(H*W*81, false)));
    dp[1][1][abs(a[1][1]-b[1][1])] = true;

    repr(i, 1, H+1) repr(j, 1, W+1) rep(k, (H+W)*81) if(dp[i][j][k]) {
        if (i+1 <= H) {
            dp[i+1][j][abs(k + a[i+1][j]-b[i+1][j])] = true;
            dp[i+1][j][abs(k - a[i+1][j]+b[i+1][j])] = true;
        }
        if (j+1 <= W)  {
            dp[i][j+1][abs(k + a[i][j+1] - b[i][j+1])] = true;
            dp[i][j+1][abs(k + b[i][j+1] - a[i][j+1])] = true;
        }
    }

    rep(k, H*W*81) if(dp[H][W][k]) { cout << k << endl; return 0; }

    return 0;
}

Measured memory_bytes: 463360
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  int x,n;
  cin >> x >> n;
  vb check(101,false);
  REP(i,n) {
    int p;
    cin >> p;
    check[p]=true;
  }
  int c=0;
  int ans=-1;
  while(1) {
    if(!check[x+c]) {
      ans=x+c;
    }
    if(!check[x-c]) {
      ans=x-c;
    }
    if(ans!=-1) break;
    c++;
  }
  cout << ans << endl;
  return 0;
}


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



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }




    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int[] s = sc.intarr;
        int N = s[0];
        if (N % 2 == 0) wr.wri(N);
        else wr.wri(N * 2);
    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
//const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int ca){
    int A,B,C,X,Y; cin>>A>>B>>C>>X>>Y;
    ll ans=INF;
    for (int i = 0; i <= 2*max(X, Y); i+=2) {
        ll tmp=C*i;
        //cout<<tmp<<endl;
        int a=max(0,X-i/2), b=max(0,Y-i/2);
        tmp+=a*A+b*B;
        //cout<<i<<" "<<tmp<<endl;
        chmin(ans,tmp);
    }
    cout<<ans<<endl;

}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


Measured memory_bytes: 256
//In the name of God

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 1e5 + 5;

void solve() {
	int n;
	ll d;
	cin >> n >> d;
	d *= d;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= d) {
			ans++;
		}
	}
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(false);	
    cin.tie(NULL);
	int tt = 1;
	// cin >> tt;
	for (int tc = 1; tc <= tt; tc++) {
		// cout << "Case " <<;
		solve();
		// cout << chk(2);
	}
}

Measured memory_bytes: 3648
#include "iostream"
#include "string"
using namespace std;

int main() {
	string s;
	cin >> s;
	for (int i = 0; i+1 < s.size(); i++) {
		if (s[i] == 'S'&&s[i + 1] == 'T') {
			s.erase(s.begin() + i);
			s.erase(s.begin() + i);
			i-=2;
			if (i == -2)i = -1;
		}
	}
	cout << s.size();
	cout << endl;
	return 0;
}

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

ll n,m,a[100009],sum;

ll f(ll x){
    ll num=0,y=n-1;
    rep(i,n){
        while(y>=0&&a[i]+a[y]>=x){
            sum+=a[y]*(n-i);
            y--;
        }
        sum+=(n-y-1)*a[i];
        num+=n-y-1;
    }
    return num;
}

int main(){
    cin>>n>>m;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    ll l=0,r=1e18;
    while(l+1<r){
        ll mid=(l+r)/2;
        if(f(mid)<m)r=mid;
        else l=mid;
    }
    sum=0ll;
    cout<<l*(m-f(l))+sum<<endl;
    assert(m-f(l)<=0);
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
using namespace std;
int main() {
	int num = 0;
	cin >> num;

	if (1200 <= num) {
		cout << "ARC" << "\n";
	}
	if (1200 > num) {
		cout << "ABC" << "\n";
	}
	cin >> num;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char const *argv[]) {
	int r,g;
	std::cin >> r;
	std::cin >> g;
	std::cout << g + (g-r) << '\n';
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())
a = str(input())
b = str(input())
c = str(input())
x = int(0)
i =int(0)
j=int(0)
for i in range(n):
    j=0
    if a[i] == b[i]:
        if a[i] == c[i]:
            j=0
        else:
            j=1
    elif a[i] == c[i]:
        j=1
    elif b[i] == c[i]:
        j=1
    else:
        j=2
    x = x+j

print(x)


Measured memory_bytes: 3064
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		String A = sc.next();
		String B = sc.next();
		String C = sc.next();

		int count =0;
		for(int i = 0;i < n;i++){
			if(A.charAt(i) == B.charAt(i) && A.charAt(i) == C.charAt(i)){
				
			}else if(A.charAt(i) == B.charAt(i) || A.charAt(i) == C.charAt(i) ||B.charAt(i) == C.charAt(i)){
				count++;
			}else{
				count += 2;
			}
		}
		System.out.println(count);

		
	}
	
}



class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



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

int main()
{
   string a,b;
   cin >> a;
   cin >> b;
   //if(a==b) cout << 0;
   int count = 0,len_b,len_a,i;
   len_b = b.length();
   len_a = a.length();
   if(a==b) cout << 0;
   else{
       for(i=0;i<len_a;i++){
           if(a[i]!=b[i]) count+=1;
       }
       cout << count + len_b-len_a;
   }
   
   return 0;
}

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

int N;
long long inf = -1e14;

int main(){
	cin >> N;
	vector<long long> v(3*N+1,0);
	long long L[N+1] = {0},R[N+1] = {0};
	priority_queue<long long> Q,S;
	long long l = 0,r = 0;
	for(int i=1;i<=3*N;i++){
		cin >> v[i];
		if(i<=N){
			Q.push(-v[i]);
			l -= v[i];
		}
		if(i>2*N){
			S.push(v[i]);
			r  += v[i];
		}
	}
	L[0] = -l;
	R[N] = r;
	for(int i=N+1;i<=2*N;i++){
		Q.push(-v[i]);
		long long p = Q.top();
		Q.pop();
		l -= v[i]+p;
		L[i-N] = -l;
		//cout << -l << endl;
	}
	reverse(v.begin()+1,v.end());
	for(int i=N+1;i<=2*N;i++){
		S.push(v[i]);
		long long p = S.top();
		S.pop();
		r += v[i]-p;
		R[2*N-i] = r;
	}
	long long ans = inf;
	for(int i=0;i<=N;i++){
		if(ans < L[i]-R[i]) ans = L[i]-R[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 6516
var lines = [];


var readline = require("readline");
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', function (x) {
  lines.push(x);
});

rl.on('close', function () {

  var tmp = lines.shift().split(" ");

  var N = Number(tmp[0]);
  var M = Number(tmp[1]);
  var C = Number(tmp[2]);

  var tmp = lines.shift().split(" ");
  var A = Array(N + 1); A.fill(0);
  var B = Array(M + 1); B.fill(0);

  var counter = 0;

  for (var i = 0; i < M; i++) {
    B[i + 1] = Number(tmp[i]);
  }
  for (var i = 0; i < N; i++) {
    tmp = lines[i].split(" ");
    A[i + 1] = Array(M + 1);
    for (var j = 0; j < M; j++) {
      A[i + 1][j + 1] = Number(tmp[j]);
    }
  }



  for (var i = 0; i < N; i++) {
    var result = 0;

    for (var j = 0; j < M; j++) {
      result = result + A[i + 1][j + 1] * B[j + 1];
    }
    result = result + C;

    if (result > 0) { counter++; }

  }
  console.log(counter);
});


Measured memory_bytes: 7756
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,x,d;
    cin >> n >> d >> x;
    rep(i,n){
        int a;
        cin >> a;
        x += (d-1)/a + 1;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
int a[100100], b[100100];

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	ll ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		if ((a[i] + ans) % b[i] == 0)continue;
		ans += b[i] - (a[i] + ans) % b[i];
	}
	cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int N;
    cin >> N;
    string str;
    cin >> str;
    int R = 0, G = 0, B = 0;
    for (int i = 0; i < N; i++)
    {
        if (str[i] == 'R')
            R++;
        else if (str[i] == 'G')
            G++;
        else
            B++;
    }
    ll sum = 0;
    for (int i = 0; i < N; i++)
    {
        if (str[i] == 'R')
        {
            sum += 1LL * G * B;
            R--;
        }
        else if (str[i] == 'G')
        {
            sum += 1LL * R * B;
            G--;
        }
        else
        {
            sum += 1LL * R * G;
            B--;
        }
    }
    ll cnt = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            if ((i + j) % 2 == 0)
            {
                int k = (i + j) / 2;
                if ((str[i] != str[j]) && (str[i] != str[k]) && (str[j] != str[k]))
                {
                    cnt++;
                }
            }
        }
    }
    cout << sum - cnt << "\n";
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    int len[n+1];
    rep(i, n)cin >> len[i] >> len[i+1];

    ll dp[105][105] = {};//lからrまで行列積の最小の乗算回数

    //連鎖行列積を求める数i
    for(int i = 2; i <= n; ++i){
        for(int l = 1; l+i-1 <= n; ++l){
            int r = i+l-1;
            dp[l][r] = INF;
            //(M_l*...*M_c)*(M_c+1*...*M_r)
            for(ll c = l; c < r; ++c){
                dp[l][r] = min(dp[l][r], dp[l][c] + dp[c+1][r] + len[l-1]*len[c]*len[r]);
            }
        }
    }

    cout << dp[1][n] << endl;
}


Measured memory_bytes: 3188
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long[] a = IntStream.range(0, n).mapToLong(i -> scanner.nextLong()).toArray();
			// l[i]=gcd(a_0,..,a_(i-1))
			long[] l = new long[n + 1];
			l[0] = 0L;
			IntStream.rangeClosed(1, n).forEach(i -> l[i] = gcd(l[i - 1], a[i - 1]));
			// r[i]=gcd(a_i,...a_(n-1))
			long[] r = new long[n + 1];
			r[n] = 0L;
			IntStream.rangeClosed(1, n).map(i -> n - i).forEach(i -> r[i] = gcd(r[i + 1], a[i]));
			System.out.println(IntStream.range(0, n).mapToLong(i -> gcd(l[i], r[i + 1])).max().getAsLong());
		}
	}

	/**
	 * mとnの最大公約数を返す
	 * 
	 * @param m
	 * @param n
	 * @return mとnの最大公約数
	 */
	private static long gcd(long m, long n) {
		if (0L == n) {
			return m;
		}
		return gcd(n, m % n);
	}
}


Measured memory_bytes: 62196
x,n= map(int,input().split())
u = 100
num_str=input().split()
s=list(map(int, num_str))
m  = list(range(-100,200)) 
for k in s:
    m.remove(k)
for l in m:
    a = l - x
    if abs(u) > abs(a):
        u = a
print(u+x)

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

 
int main()
{
    int X,A,B,C;
    int i=0;
    int j=0;
    int k=0;
    int kosu=0;
  
 // 整数の入力
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &X);
  
  X=X/50;
  
   for(i=0;i<=A;i++){
     for(j=0;j<=B;j++){
       for(k=0;k<=C;k++){
         if(X==(10*i)+(2*j)+k) kosu++;
       }
     }
   }
  
     

  printf("%d\n",kosu);

return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000009
#define MK make_pair
#define EB emplace_back
#define PB push_back
#define F first
#define S second
using namespace std;
void solve()
{
	int n;
	cin>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++) cin>>a[i]>>b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	ll X, Y; 
    if (n % 2 == 1) {
        X = a[n/2];
        Y = b[n/2];
    } else {
        X = a[n/2 - 1] + a[n/2];
        Y = b[n/2 - 1] + b[n/2];
    }
 
    cout << Y-X+1 <<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 4764
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int i;
  string s;
  
  cin >> s;
  
  for (i=0;i<s.size();i++) cout << 'x';
  cout << endl;
  
  return 0;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  string c[h];
  rep(i, h) {
    cin >> c[i];
  }
  rep(i, h){
    cout << c[i] << endl;
    cout << c[i] << endl;
  }
}


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

int main(void)
{
    int N;
    cin >> N;
    vector<int> a(N);
    unordered_map<int ,int> entry;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        entry[a[i]]++;
    }

    ll removal = 0;
    for(auto itr : entry){
        ll key = itr.first;
        ll value = itr.second;

        if(key == value) continue;
        if(key > value) removal += value;
        if(key < value) removal += value - key;
    }

    cout << removal << endl;

    return 0;
}


Measured memory_bytes: 7704
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll N;
string S;

int main() {
	cin >> N >> S;
	if (N & 1) {
		cout << "No" << endl;
		return 0;
	}
	bool flag = true;
	for (ll n = 0; n < N / 2; n++) {
		if (S[n] != S[n + N / 2])flag = false;
	}
	if (flag)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/detail/ceil_and_floor.hpp
#ifndef DETAIL_CEIL_AND_FLOOR_HPP
#define DETAIL_CEIL_AND_FLOOR_HPP

namespace tools {
  template <typename T>
  constexpr T floor(T lhs, T rhs);

  template <typename T>
  constexpr T ceil(T lhs, T rhs);

  template <typename T>
  constexpr T floor(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        lhs / rhs :
      lhs < 0 && rhs >= 0 ?
        -ceil<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -ceil<T>(lhs, -rhs) :
        floor<T>(-lhs, -rhs);
  }

  template <typename T>
  constexpr T ceil(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        (lhs - 1 + rhs) / rhs :
      lhs < 0 && rhs >= 0 ?
        -floor<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -floor<T>(lhs, -rhs) :
        ceil<T>(-lhs, -rhs);
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/ceil.hpp
#ifndef CEIL_HPP
#define CEIL_HPP


/*
usage:

tools::ceil(5, 3) // => 2 (i.e., ceil(5 / 3))
*/

#endif

// main.cpp

int main() {
  i64 A, B;
  std::cin >> A >> B;
  std::cout << tools::ceil(B - 1, A - 1) << std::endl;
  return 0;
}

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

using namespace std;

#define ll long long


int main(){
  map<char , int>mp;
  for(int i = 0; i< 4;++i)
    {
      char c;cin >> c;
      mp[c]++;
    }
  bool f=true;
  for(auto&&e:mp)
    {
      if(e.second != 2)f = false;
    }
  if(f)cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

using namespace std;

int main(){

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

if ((a > 0 && b >= a )|| (a <= b && b < 0 && (b-a+1)%2 == 0)) cout << "Positive";
else if (a <= 0 && b >= 0) cout << "Zero";
else if (a <= b && b < 0 && (b-a+1)%2 != 0) cout << "Negative" ;
}

Measured memory_bytes: 3604
import math

def main():
    H, W = map(int, input().split())
    if H > W:
        H, W = W, H
    if H % 3 == 0 or W % 3 == 0:
        print(0)
        exit()
    ans = H

    candi_h = []
    candi_w = []
    if W % 2 == 0:
        candi_h.append(math.floor(H / 3))
        candi_h.append(math.ceil(H / 3))
        candi_w = [W // 2, W // 2]
    else:
        candi_h.append(math.floor(H*(W+1)/(3*W+1)))
        candi_h.append(math.ceil(H*(W+1)/(3*W+1)))
        candi_h.append(math.floor(H*(W-1)/(3*W-1)))
        candi_h.append(math.ceil(H*(W-1)/(3*W-1)))
        candi_w = [W // 2, W // 2 + 1]
    for h in candi_h:
        if h != 0:
            a1 = h * W
            a2 = (H - h) * candi_w[0]
            a3 = (H - h) * candi_w[1]
            diff = max([a1, a2, a3]) - min([a1, a2, a3])
            if diff < ans:
                ans = diff

    candi_h = []
    candi_w = []
    if H % 2 == 0:
        candi_w.append(math.floor(W / 3))
        candi_w.append(math.ceil(W / 3))
        candi_h = [H // 2, H // 2]
    else:
        candi_w.append(math.floor(W*(H+1)/(3*H+1)))
        candi_w.append(math.ceil(W*(H+1)/(3*H+1)))
        candi_w.append(math.floor(W*(H-1)/(3*H-1)))
        candi_w.append(math.ceil(W*(H-1)/(3*H-1)))
        candi_h = [H // 2, H // 2 + 1]
    for w in candi_w:
        if w != 0:
            a1 = w * H
            a2 = (W - w) * candi_h[0]
            a3 = (W - w) * candi_h[1]
            diff = max([a1, a2, a3]) - min([a1, a2, a3])
            if diff < ans:
                ans = diff

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62596
n=int(input())
old_t = 0
old_x = 0
old_y = 0
for i in range(n):
  t, x, y = map(int, input().split())
  if (t - old_t) < abs(x-old_x)+abs(y-old_y) or (t - old_t)%2 != (abs(x-old_x)+abs(y-old_y))%2:
    print("No")
    break
  old_t, old_x, old_y = t, x, y
else:
  print("Yes")


Measured memory_bytes: 9080
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
 
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>
 
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n"
#define MOD 1000000007
 
const long double PI = 3.141592653589793236L;
 
typedef long long int ll;
typedef long double ld;
 
using namespace std;


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

    int n = s.size();
    int m = t.size();
    int ans = INT_MAX;

    for(int i = 0; i < n; i++)
    {
        bool is_valid = true;
        int count = 0;
        for(int j = 0; j < m; j++)
        {
            if(i + j >= n)
            {
                is_valid = false;
                break;
            }
            if(s[i + j] != t[j])
            {
                count++;
            }
        }
        if(is_valid)
            ans = min(ans, count);
    }
    cout << ans << "\n";
    
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int T = 1;
    //cin >> T;
 
    while (T--)
    {
        solve();
    }
    
    return 0;
}
 


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string s,k;
  cin >>s;
  int a=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0') k+='0';
    if(s[i]=='1') k+='1';
    if(s[i]=='B') {
      if(k.size()!=0) k.erase(k.begin()+(k.size()-1));
      }
    }
  cout << k<<endl;
}


Measured memory_bytes: 256
a, b, c, d = map(int, input().split())


def calc(x, n):
    return x // n


def gcd(a, b):
    if b == 0:
        return a
    elif b == 1:
        return 1
    else:
        return gcd(b, a % b)


l = c * d // gcd(c, d)
x = (a - 1) - calc(a - 1, c) - calc(a - 1, d) + calc(a - 1, l)
y = b - calc(b, c) - calc(b, d) + calc(b, l)
print(y - x)


Measured memory_bytes: 3060
a, b = [int(v) for v in input().split()]

count = 1
div = 3
if a % 2 == 0 and b % 2 == 0:
    count += 1
while a % 2 == 0:
    a //= 2
while b % 2 == 0:
    b //= 2
if a < b:
    a, b = b, a
while b >= div * div:
    if a % div == 0 and b % div == 0:
        count += 1
    while a % div == 0:
        a //= div
    while b % div == 0:
        b //= div
    div += 2
    if a < b:
        a, b = b, a
if b > 1 and a % b == 0:
    count += 1

print(count)

Measured memory_bytes: 38640
N=int(input())
D=list(map(int,input().split()))
C=[0]*N
for i in range(N):
    C[D[i]]+=1
ans=1
if D[0]>0 or C[0]>1:
    print(0)
else:
    for j in range(2,max(D)+1):
        if C[j-1]==1:
            continue
        else:
            ans*=C[j-1]**C[j]
    print(ans%998244353)

Measured memory_bytes: 13892
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        int K = sc.nextInt();
        
        int[] r = new int[N+1];
        int[] l = new int[N+1];
        int pr = 1;
        int pl = 1;
        
        for (int i = 0; i < N; i++) {
            int in = sc.nextInt();
            if (in < 0) {
                l[pl] = -in;
                pl++;
            } else if (in > 0) {
                r[pr] = in;
                pr++;
            } else {
                // in == 0
                K--;
            }
        }
        Arrays.sort(l, 0, pl);
        
        long min = Integer.MAX_VALUE;
        
        for (int i_r = K; i_r >= 0; i_r--) {
            int i_l = K - i_r;
            
            if (i_r >= pr || i_l >= pl) continue;
            int cand1 = r[i_r]     + l[i_l] * 2;
            int cand2 = r[i_r] * 2 + l[i_l];
            min = Math.min(Math.min(min, cand1), cand2);
        }
        so.println(min);
    }
}


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

int check(int a,int b,int c){
	if (a == b || a == c || b == c) return 0;
	if (a + b <= c) return 0;
	if (a + c <= b) return 0;
	if (c + b <= a) return 0;
	return 1;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	
	vector<int> L(n);
	for (int &l: L) cin >> l;

	int ans = 0;
	for (int i = 0; i < n - 2; i++)
		for (int j = i + 1; j < n - 1; j++)
			for (int k = j + 1; k < n; k++)
				ans += check(L[i],L[j],L[k]);
	cout << ans;
	return 0;
}

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

int main(){
  	int N, T, A, i, j, k;
    double tmp;
    cin >> N >> T >> A;
    int H[N];
    for(i = 0; i < N; i++){
        cin >> H[i];
    }

    double MIN = INT_MAX;
    for(j = 0; j < N; j++){
        tmp = T - H[j] * 0.006 - A;
        MIN = min(abs(tmp), MIN);
        if(abs(tmp) == MIN){
            k = j;
        }
    }

    cout << k + 1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
using namespace std;
#define MAXK 10

int n,k;
bool dis[MAXK+5];
vector<int>lik;
int zz[MAXK];

bool Check(int x) {
	while(x) {
		bool flag=false;
		for(int i=0;i<lik.size();i++)
			if(lik[i]==x%10) {
				flag=true;break;
			}
		if(!flag) return false;
		x/=10;
	}
	return true;
}
int main() {
	int a;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=k;i++)
		scanf("%d",&a),dis[a]=true;
	for(int i=0;i<MAXK;i++)
		if(!dis[i])
			lik.push_back(i);
	while(!Check(n))
		n++;
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi=3.14159265358979323846264338;
const int MOD=1000000007;




string s;
int arr[200001];
int main(){
	
	int t;
	cin>>t;
	string k="ACL";
	string l="";
	for(int i=0;i<t;i++)l+=k;
	cout<<l<<endl;
  	return 0;
}
		
		
		

Measured memory_bytes: 3448
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  ll ans;
  if( k&1 ) ans = b-a;
  else ans = a-b;
  if( abs(ans)>1000000000000000000 ) cout<<"Unfair"<<endl;
  else cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

signed main(void) {
    int n,m,c;
    cin >> n >> m >> c;
    vi l(c);
    rep(i,c) cin >> l[i];
    vector<vi> ball(c);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        a--;
        ball[a].push_back(b);
    }
    vi t;
    rep(i,c){
        sort(all(ball[i]));
        rep(j,min(l[i],(ll)ball[i].size()))t.push_back(ball[i][ball[i].size()-1-j]);
    }
    sort(all(t));
    int ans = 0;
    rep(i,min(m,(ll)t.size()))ans += t[t.size()-1-i];
    cout << ans << endl;
}



Measured memory_bytes: 8760
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}



use std::cmp;
use std::ascii::AsciiExt;
use std::iter::Iterator;

fn main() {
    input! {
        s:String,
    }

    let first = &s[0..2];
    let last = &s[2..4];


    let firstNum : i32 = first.parse().unwrap();
    let lastNum : i32 = last.parse().unwrap();


    if firstNum > 0 && firstNum < 13 && lastNum < 13 && lastNum > 0 {
        println!("AMBIGUOUS");
    } else if firstNum <= 12 && firstNum > 0{
        println!("MMYY");
    } else if  lastNum <=  12 && lastNum >0 {
        println!("YYMM")
    }else {
        println!("NA")
    }
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}



Measured memory_bytes: 3656
integer(8) N
integer(8) P
integer(8) ans
integer(8) i
read*,N,P

ans=1
if(N==1)ans=P
do i=2,int(P**(1.0/N))
  if(mod(P,i**N)==0)then
    ans=i
  endif
end do
print"(i0)",ans
end

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

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

    int count = 0;
    string ans = s;
    for(int i=0; i<n; i++){
        if(s[i] == '('){
            count += 1;
        }
        if(s[i] == ')'){
            if(count >= 1) count -= 1;
            else ans = '(' + ans;
        }
    }
    for(int i=0; i<count; i++){
        ans += ')';
    }
    cout << ans << endl;
    return 0;
}

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

int main(void){
  int n;
  list<int> lst;
  list<int>::iterator itr=lst.begin();
  
  cin >> n;
  for (int i=0; i<n; i++){
    int q;
    cin >> q;
    if (q==0){
      int x;
      cin >> x;
      itr = lst.insert(itr, x);
    } else if (q==1){
      int p;
      cin >> p;
      if (p>0) while (p--) itr++;
      else while (p++) itr--;
    } else { // q==2
      itr = lst.erase(itr);
    }
  }
  
  for (itr = lst.begin(); itr != lst.end(); itr++){
    cout << *itr << endl;
  }
  
  return 0;
}


Measured memory_bytes: 18616
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        P: [u64; N]
    }
    let mut ans = 0;
    let mut maxP = 0;
    for i in 0..N{
        ans += P[i];
        maxP = max(maxP,P[i]);
    }
    println!("{}", ans - maxP/2);
}

Measured memory_bytes: 4352
S = str(input())
Q = int(input())

fwd = ""
rev = ""
now = 1

for i in range(Q) :
  Qn = list(map(str, input().split()))
  
  if Qn == ["1"] :
    now *=-1
  else :
    if now == 1 :
      if Qn[1] == "1" :
        fwd = Qn[2] + fwd
      if Qn[1] == "2" :
        rev = rev + Qn[2]
    else : 
      if Qn[1] == "1" :
        rev = rev + Qn[2]
      if Qn[1] == "2" :
        fwd = Qn[2] + fwd

ans = fwd + S + rev
if now == -1 :
  ans = ans[::-1]
print(ans)

Measured memory_bytes: 4468
#include<iostream>
using namespace std;
int main()
{
	int m,n,a[1000]={0},b[1000]={0},num[1000]={0},count=0;
	cin>>n>>m;
	for (int i=1;i<=m;i++){
		cin>>a[i]>>b[i];
		num[a[i]]++;num[b[i]]++;
	}
	for (int i=1;i<=n;i++)
		if (num[i]==1){
			count++;
			num[i]=0;int j=1;
			for (;j<=m;j++)
				if (a[j]==i){
					num[b[j]]--;
					i=0;
					break;
				}
				else if (b[j]==i){
					num[a[j]]--;
					i=0;
					break;
				}
			a[j]=0;b[j]=0;
		}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	md := strings.Fields(nextLine())
	m, _ := strconv.Atoi(md[0])
	d, _ := strconv.Atoi(md[1])

	var count int
	for i := 1; i <= m; i++ {
		for j := 10; j <= d; j++ {
			d10 := j / 10
			d1 := j - (d10 * 10)
			if d1 >=2 && d10 >= 2 && i == d1*d10 {
				count++
			}
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
from sys import stdin, exit
import numpy as np

N, *XY = map(int, stdin.read().split())
XY = np.array(XY).reshape(N, 2)

XYsum = np.abs(XY).sum(axis=1)
if any(XYsum % 2 != XYsum[0] % 2):
    print(-1)
    exit()

xymax = XYsum.max()
d = [] if xymax % 2 == 1 else [1]
for i in range(41):
    di = 2**i
    if xymax < di:
        break
    d.append(di)
d.reverse()
print(len(d))
print(' '.join(map(str, d)))

for X, Y in XY:
    x, y = 0, 0
    w = ''
    for di in d:
        if abs(X-(x-di)) + abs(Y-y) <= di:
            w += 'L'
            x -= di
        elif abs(X-(x+di)) + abs(Y-y) <= di:
            w += 'R'
            x += di
        elif abs(X-x) + abs(Y-(y-di)) <= di:
            w += 'D'
            y -= di
        else:
            w += 'U'
            y += di
    print(w)

Measured memory_bytes: 12620
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cassert>
#include<queue>
#include<iostream>
#include<climits>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define rep(i,a,b) for(register int i=(a);i<(b);++i)
#define pb push_back
#define mp make_pair
#define mx(a,b) (a>b?a:b)
#define mn(a,b) (a<b?a:b)
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;
using namespace std;

namespace IO
{
    const uint32 Buffsize=1<<15,Output=1<<24;
    static char Ch[Buffsize],*S=Ch,*T=Ch;
    inline char getc()
    {
        return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
    }
    static char Out[Output],*nowps=Out;
    
    inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

    template<typename T>inline void read(T&x)
    {
        x=0;static char ch;T f=1;
        for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
        for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
        x*=f;
    }

    template<typename T>inline void write(T x,char ch='\n')
    {
        if(!x)*nowps++='0';
        if(x<0)*nowps++='-',x=-x;
        static uint32 sta[111],tp;
        for(tp=0;x;x/=10)sta[++tp]=x%10;
        for(;tp;*nowps++=sta[tp--]^48);
        *nowps++=ch;
        if(nowps-Out>=1<<23)flush();
    }
}
using namespace IO;

void file()
{
#ifndef ONLINE_JUDGE
    FILE*DSD=freopen("water.in","r",stdin);
    FILE*CSC=freopen("water.out","w",stdout);
#endif
}

inline void Chkmin(int&u,int v){u>v?u=v:0;}

inline void Chkmax(int&u,int v){u<v?u=v:0;}

inline void Chkmax(ll&u,ll v){u<v?u=v:0;}

inline void Chkmin(ll&u,ll v){u>v?u=v:0;}

const int MAXN=2e5+7,mod=1e9+7;

static int fac[MAXN],inv[MAXN];

inline int power(int u,int v)
{
	register int sm;
	for(sm=1;v;v>>=1,u=(ll)u*u%mod)if(v&1)
		sm=(ll)sm*u%mod;
	return sm;
}

static int B,W;

inline void init()
{
	read(B),read(W);
}

inline int C(int u,int v){return u<v?0:(ll)fac[u]*inv[v]%mod*inv[u-v]%mod;}

static int prb,prw;

inline int ad(int u,int v){return(u+=v)>=mod?u-mod:u;}

inline void solve()
{
	fac[0]=1;
	Rep(i,1,W+B)fac[i]=(ll)fac[i-1]*i%mod;
	inv[W+B]=power(fac[W+B],mod-2);
	Repe(i,W+B,1)inv[i-1]=(ll)inv[i]*i%mod;
	Rep(i,1,W+B)
	{
		write(((1ll+mod+mod-prb-prw)*500000004ll+prw)%mod);
		prb=(prb+(ll)power(2,mod-1-i)*C(i-1,B-1))%mod;
		prw=(prw+(ll)power(2,mod-1-i)*C(i-1,W-1))%mod;
	}
	flush();
}

int main()
{
    init();
    solve();
    return 0;
}

Measured memory_bytes: 6272