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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define gcda(x,y) gcd(abs(x),abs(y))

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    ll n;
  	cin >> n;
  	if(n%2!=0) cout << 0 << endl;
  	else{
      	ll ans = 0;
      	n /= 2;
      	while(n>0){
          	n /= 5;
          	ans += n;
        }
      	cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

struct edge {
  int src, dst, col;
  edge(int s, int d, int c) : src(s), dst(d), col(c) { }
};
typedef vector<edge> edges;
typedef vector<edges> graph;

int vi[100050];
vector<int> cs[100050];

inline int X(int v) { return vi[v]; }
inline int I(int v, int j) { return vi[v] + 1 + 2 * j + 0; }
inline int O(int v, int j) { return vi[v] + 1 + 2 * j + 1; }

int main() {
  int N = in();
  int M = in();

  graph g(N);
  for (int i = 0; i < M; ++i) {
    int p = in() - 1;
    int q = in() - 1;
    int c = in();
    g[p].emplace_back(p, q, c);
    g[q].emplace_back(q, p, c);
  }

  int V = 0;
  for (int i = 0; i < N; ++i) {
    vi[i] = V;
    V++;
    for (const edge& e : g[i]) {
      cs[i].push_back(e.col);
    }
    sort(cs[i].begin(), cs[i].end());
    cs[i].erase(unique(cs[i].begin(), cs[i].end()), cs[i].end());
    V += 2 * cs[i].size();
  }

  graph h(V);
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < (int)cs[i].size(); ++j) {
      h[I(i, j)].emplace_back(I(i, j), O(i, j), 0);
      h[I(i, j)].emplace_back(I(i, j), X(i), 1);
      h[X(i)].emplace_back(X(i), O(i, j), 0);
    }
    for (const edge& e : g[i]) {
      int ci = lower_bound(cs[i].begin(), cs[i].end(), e.col) - cs[i].begin();
      int cd = lower_bound(cs[e.dst].begin(), cs[e.dst].end(), e.col) - cs[e.dst].begin();
      h[O(i, ci)].emplace_back(O(i, ci), I(e.dst, cd), 0);
    }
  }

  vector<int> D(V, INF);
  deque<pair<int, int>> Q;
  Q.push_back({X(0), 0});
  D[X(0)] = 0;

  while (!Q.empty()) {
    const int u = Q[0].first;
    const int c = Q[0].second;
    Q.pop_front();
    if (D[u] != c) {
      continue;
    }

    if (u >= X(N - 1)) {
      printf("%d\n", c + 1);
      return 0;
    }

    for (const edge& e : h[u]) {
      if (D[e.dst] > D[u] + e.col) {
        D[e.dst] = D[u] + e.col;
        if (e.col == 0) {
          Q.push_front({e.dst, D[e.dst]});
        } else {
          Q.push_back({e.dst, D[e.dst]});
        }
      }
    }
  }

  puts("-1");

  return 0;
}


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

#define INF 1e9
using namespace std;

int main() {

    int N, M; cin >> N >> M;

//    vector<int> a(M);
//    for (int i = 0; i < M; ++i) {
//        cin >> a[i];
//    }

    set<int> a;
    for (int i = 0; i < M; ++i) {
        int k; cin >> k;
        a.insert(k);
    }

    vector<long long> dp(N+2);
    for (int i = 0; i <= N; ++i) {
        dp[i] = -1;
    }

    dp[0] = 1;

    for (int i = 1; i <= N; ++i) {
//        auto result = find(a.begin(), a.end(), i);
//        if (result != a.end()) {
//            dp[i] = 0;
//            continue;
//        }

        auto result = a.find(i);
        if (result != a.end()) {
            dp[i] = 0;
            continue;
        }

        if (i == 1) {
            dp[i] = dp[0];
        } else {
            dp[i] = dp[i-1] + dp[i-2];
            dp[i] = dp[i] % 1000000007;
        }
    }

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

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

       int freq[n+1]={0};

        int arr[n+1];

         for(int i=2;i<=n;i++)
         {
           cin>>arr[i];

            freq[arr[i]]++;
         }
      for(int i=1;i<=n;i++)
        cout<<freq[i]<<endl;
}


Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef complex<db> cplx;
const int N=(1<<22)+5;
const db PI=acos(-1.00);
int rev[N];
cplx omega(int n,int k,int flag){
    return cplx(cos(2*PI*k/n),flag*sin(2*PI*k/n));
}

void dft(int n,cplx *t,int typ){
    for(int i=0;i<n;i++)
        if(i<rev[i])swap(t[i],t[rev[i]]);
    for(int step=1;step<n;step<<=1){
        cplx wn=cplx(cos(PI/step),typ*sin(PI/step));//涓诲崟浣嶆牴 
        for(int i=step<<1,j=0;j<n;j+=i){
            cplx w=cplx(1.0,0);
            for(int k=0;k<step;k++,w*=wn){
                cplx x=t[j+k],y=t[j+k+step]*w;
                t[j+k]=x+y,t[j+k+step]=x-y;
            }
        }
    }
}
void fft(int P,cplx *A,cplx *B,cplx*C){
    dft(P,A,1);
    dft(P,B,1);
    for(int i=0;i<=P;i++)C[i]=A[i]*B[i];
    dft(P,C,-1);
}

cplx A[N],B[N],C[N];
int n,m;

const int mod = 200003;
int g=0;
int ig[mod];
inline void findg(){
	while(1){
		++g;
		// cout << "chk" << g << endl;
		for(int j=0;j<mod;j++)ig[j]=-1;
		int flag=0;
		// cout << ig[1] << endl;
		for(int j=0,cur=1;j<mod-1;++j,cur=1ll*cur*g%mod){
			// cout << cur << ":" << ig[cur] << endl;
			// cout << j << ":" << cur << ":" << ig[cur] << endl;
			if(ig[cur]!=-1){flag=j+1;break;}
			ig[cur]=j;
		}
		// cout << flag << endl;
		// system("pause");
		if(!flag)break;
	}
	// cout << g << endl;
}

inline int qpow(int a,int b){
	int ret=1;
	for(;b;b>>=1,a=1ll*a*a%mod){
		if(b&1)ret=1ll*ret*a%mod;
	}
	return ret;
}

int main()
{
	ll ans=0;
	findg();
	cin >> n;
	for(int i=1;i<=n;i++){
		int t;scanf("%d",&t);
		ans-=1ll*t*t%mod;
		t=ig[t];
		if(t==-1)continue;
		// cout << t << endl;
		// cout << t << ":" << qpow(g,t) << endl;
		A[t]=A[t]+1.00;
		B[t]=B[t]+1.00;
	}
    // scanf("%d%d",&n,&m);
    // for(int i=0;i<=n;i++)scanf("%lf",&A[i].real());
    // for(int i=0;i<=m;i++)scanf("%lf",&B[i].real());
    int p=1,l=0;
    while(p<=(mod*2))p<<=1,l++;
    for(int i=0;i<p;++i)
        rev[i]=(rev[i>>1]>>1)|((i&1)<<(l-1));
    fft(p,A,B,C);
	for(int i=0;i<mod*2;i++){
		ll x = ll(C[i].real()/p+0.5);
		// if(x!=0)cout << x << ":" << qpow(g,i) << endl;
		ans+=x*qpow(g,i);
	}
	cout << ans/2 << endl;
    // for(int i=0;i<=m+n;i++){
    //     printf("%d ",int(C[i].real()/p+0.5));
    // }
    return 0;
}


Measured memory_bytes: 31520
#include<bits/stdc++.h>  
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(int i = a; i <=b; i++)
#define rep2(i,a,b) for(int i = a; i>=b; i--)
#define PB push_back 
#define MP make_pair
#define db long double
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define cases int testcases;cin>>testcases; while(testcases--)
#define INF 2000000000
const double PI = acos(-1);
const int N = 25;
#define eps 1e-6
#define MOD 1000000007

	int h,w;

	bool vis[N][N];
	int dist[N][N];
	char arr[N][N];
	void bfs(int x,int y)
	{
		queue<pair<int,int>> q;
		q.push(MP(x,y));
		vis[x][y] = true;
		dist[x][y] = 0;

		  while(! q.empty())
	      {
	        pair<int,int>  k = q.front();
	        q.pop();
	
			vector<pair<int,int>> v;
			v.PB(MP(k.first+1,k.second));
			v.PB(MP(k.first-1,k.second));
			v.PB(MP(k.first,k.second+1));
			v.PB(MP(k.first,k.second-1));
		
	        for(pair<int,int> i:v)
	        {	
	        	int a = i.first;
	        	int b = i.second;
	        	if(a <1 or a > h or b  < 1 or b > w)
	        	{
	        		continue;
	        	}
	        	if(arr[a][b] == '#')
	        	{	
	        		continue;
	        	}

	          if(!vis[a][b])
	          {
	            vis[a][b] = 1;
	            dist[a][b] = dist[k.first][k.second] + 1;
	            q.push(MP(a,b));
	          }
	        }



	      }
	}
		
	
	   

  int32_t main() 
  {
    IOS

  
        
        cin >> h >> w;

        
        for(int i = 1; i <= h; i++)
        {
        	for(int j = 1; j <= w; j++)
        	{
        		cin >>arr[i][j];
        	}
        }

     
        //bfs(3,1);


        //  for(int i = 1; i <= h; i++)
        // {
        // 	for(int j = 1; j <= w; j++)
        // 	{
        // 		cout << dist[i][j] << " ";
        // 	}
        // 	cout << endl;
        // }

      int ans1 = 0;

      for(int i = 1; i <= h; i++)
      {
      	for(int j = 1; j <= w; j++)
      	{
      		if(arr[i][j] == '#')
      		{
      			continue;
      		}
      		bfs(i,j);

      		int ans = 0;

    		  for(int xx = 1; xx <= h; xx++)
   			   {
     			 	for(int yy = 1; yy <= w; yy++)
     			 	{
     			 		ans = max(ans,dist[xx][yy]);
     			 		vis[xx][yy] = false;
     			 		dist[xx][yy] = 0;
     			 	}
     		   }
     		   ans1 = max(ans1,ans);
      	}
      }

      	cout << ans1;

    return 0;
      }
        

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

#define rep(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define repn(i, m, n) for (int (i) = (m) ; (i) < (int)(n) ; ++(i))
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define repn_rev(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= (m) ; --(i))

#define INF 2e9
#define ll long long
#define MOD 1e9+7

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain; 
 
int main() {
    int h, w;
    cin >> h >> w;
    int a[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];

    bool move = false;  /* コインを移動させているかどうか */
    int xf, yf;
    vector<pair<int, int>> x, y;

    rep(i, h) rep(j, w) {
        int tmp_x = j;
        if(i%2 == 1) tmp_x = w - j - 1;

        if(!move && (a[i][tmp_x]%2 == 1)) {
            xf = tmp_x, yf = i;
            move = true;
        }
        else if(move) {
            x.push_back(make_pair(xf, tmp_x));
            y.push_back(make_pair(yf, i));
            if(a[i][tmp_x]%2 == 1) move = false;
            else xf = tmp_x, yf = i;
        }
    } 

    cout << x.size() << endl;
    rep(i, x.size()) {
        cout << y[i].first + 1 << " " << x[i].first + 1 << " ";
        cout << y[i].second + 1 << " " << x[i].second + 1 << endl; 
    }

    return 0;
}


Measured memory_bytes: 5228
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws Exception{
        int n;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(br.readLine());
        System.out.println(n*n*n);
    }
}


Measured memory_bytes: 24160
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        a: [i64; n],
    }

    let mut i = 0;
    let one_i = loop {
        if a[i] == 1 {
            break i;
        }
        i += 1;
    };

    let left = one_i;
    let q = (left + k - 2) / (k - 1);
    let right = n - q * (k - 1) - 1;
    let rq = (right + k - 2) / (k - 1);
    let ans = q + rq;
    // dbg!(q, rq);
    println!("{}", ans);
}


Measured memory_bytes: 3260
import java.util.*;

public class Main {

    public static int r, s, p;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();
        r = sc.nextInt();
        s = sc.nextInt();
        p = sc.nextInt();

        String t = sc.next();

        ArrayList<Character> charList = new ArrayList<Character>();

        for (int i = 0; i < t.length(); i++) {
            charList.add(t.charAt(i));
        }

        int ans = 0;

        for (int i = 0; i < n; i++) {

            char opponent = t.charAt(i);

            if (i < k) {
                ans += calc(opponent);
                continue;
            }

            if (charList.get(i) == charList.get(i - k)) {

                charList.set(i, 'z');
                continue;
            }

            ans += calc(opponent);
        }

        System.out.println(ans);
        sc.close();
    }

    public static int calc(char opponent) {
        switch (opponent) {
        case 'r':
            return p;

        case 's':
            return r;

        case 'p':
            return s;
        }

        return 0;
    }
}

Measured memory_bytes: 27724
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

struct Node
{
    vector<int> next;
};
vector<Node> node;
ll ans;

void dfs(vector<int> search, int index){

    if(search[index] == 1){
        return ;
    }
    else{
        search[index] = 1;
    }

    bool flag = true;
    for(int i = 0; i < search.size(); i++){
        if(search[i] == 0) flag = false;
    }
    if(flag) ans++;

    for(int i = 0; i < node[index].next.size(); i++){
        dfs(search, node[index].next[i]);
    }

}



int main(){

    int N, M;
    cin >> N >> M;

    node.resize(N+1);
    int a, b;
    for(int i = 0; i < M; i++){
        cin >> a >> b;
        node[a].next.push_back(b);
        node[b].next.push_back(a);
    }

    vector<int> v(N+1);
    v[0] = 1;

    dfs(v, 1);
    cout << ans << endl;


}

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

using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int v[3];
	cin >> v[0] >> v[1] >> v[2];
	sort(v, v + 3);
	cout << v[0] <<" "<< v[1] <<" "<< v[2] << endl;
	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  cout << (b - a == c - b ? "YES" : "NO") << endl;


  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  vector<int> x(4,0);
  REP(i,4) cin>>x.at(i);
  cout<<(x.at(0)-x.at(2)) * (x.at(1)-x.at(3))<<endl;
}

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

using namespace std;
using ll = long long;

int main(void) {
  vector<int> vec(3);
  for (int i = 0; i < 3; i++) {
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  cout << vec[0] + vec[1] << endl;
  return 0;
}


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

int X,A,B;
int main (){
    cin >> X >> A >> B;
    if(A >= B) cout << "delicious" << endl;
    else if(B - A <= X)cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0;
            int cube = 1;
            x=int.Parse( Console.ReadLine());
            for(int i = 0; i < 3; i++)
            {
                cube  *= x;
            }
            Console.WriteLine(cube);
        }
    }
}



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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	string s;
	bool b = true;
	cin >> s;
	char c = 'a';
	rep(i, 26) {
		rep(i, s.size()) {
			if (s[i] == c) b = false;
		}
		if (b) {
			cout << c;
			return 0;
		}
		b = true;
		c++;
	}
	cout << "None";
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {

        static int D = (int)Math.Pow(10, 9) + 7;

        public static void Main(string[] args)
        {
            new Dictionary<string, int>();

            int N = int.Parse(Console.ReadLine());
            int[] ns = Read(Console.ReadLine());
            int max = (int)Math.Pow(10, 9);
            bool[] nums = new bool[max+1];

            for (int i = 0; i < N; i++)
            {
                int n = ns[i];
                if (!nums[n]) nums[n] = true;
                else
                {
                    Console.WriteLine("NO");
            Console.ReadLine();
                    return;
                }
            }

            Console.WriteLine("YES");

            Console.ReadLine();
        }




        private static int[] Read(string input)
        {
            string[] aaa = input.Split(' ');
            int num = aaa.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(aaa[i]);
            }
            
            return ints;
        }


    }


}


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

int main(void){
	long long A,B;
	cin >> A >> B;
	long long ans = 0;
	long long num = B-A+1;
	//Aが奇数で、Bが偶数の場合
	//1 2 3 4 5 6 を考えると23 45 
	if(A%2==1&&B%2==0){
		ans= A^B^ ((num-2)/2)%2;
	}
	else if(A%2==0&&B%2==1){
		ans = (num/2)%2;
	}else if(A%2==1&B%2==1){
		ans= A^((num-1)/2)%2;
	}else if(A%2==0&&B%2==0){
		ans = B^((num-1)/2)%2;
	}
	cout << ans << endl;
}	

Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int> >
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int> >
#define VPII vector<pair<int,int> >

#define INT ll

using namespace std;
/*........................................Define functions.........................................*/


/*....................................Define global variables .....................................*/



/*.........................................kemkemG0................................................*/
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);


	int N,M;
	cin>>N>>M;

	cout<<N*(N-1)/2 + M*(M-1)/2<<endl;
	

		

		return 0;
}




Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll mod = 1e9+7;
    ll ans = 1;
    int N;
    cin >> N;
    for(ll i=1;i<=N;i++) (ans *= i)%=mod;
    cout << ans << "\n";
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N, M; cin >> N >> M;
  N--,M--;
  cout<<N*M<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    vector<int> a(n);
    map<ll, ll> m;
    rep(i,n) {
        cin >> a[i];
        m[a[i]]++;
    }
    ll sum = 0;
    for (auto v : m) {
        sum += v.second*(v.second-1)/2;
    }

    rep(i,n) {
        ll tmp = m[a[i]];
        ll ans = sum-tmp*(tmp-1)/2+(tmp-1)*(tmp-2)/2;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 10240
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;
typedef pair<int, int> P;
vector<P> v[100001];

int dij(int s, int g) {

	int i;

	priority_queue<P, vector<P>, greater<P> > que;
	bool used[100001] = { false };

	que.push(P(0, s));

	while (!que.empty()) {
		P now = que.top();
		que.pop();

		int cost = now.first;
		int to = now.second;
		used[to] = true;
		if (to == g) {
			return cost;
		}

		for (i = 0; i < v[to].size(); i++) {

			int nextcost = cost + v[to][i].first;
			int next = v[to][i].second;

			if (used[next] == false) {
				que.push(P(nextcost, next));
			}
		}
	}
	return INF;
}

int main() {
	int N, M;
	int a, b, c, d;

	cin >> N >> M;
	char ch;
	for (int i = 0; i < M; i++) {
		cin >> a >> ch >> b >> ch >> c >> ch >> d;
		a--;
		b--;
		v[a].push_back(P(c, b));
		v[b].push_back(P(d, a));
	}
	int s, g, v, p;
	cin >> s >> ch >> g >> ch >> v >> ch >> p;
	cout << v - p - dij(s - 1, g - 1) - dij(g - 1, s - 1) << endl;
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))

int main(){
    FAST
    int n; cin >> n;
    int arr[n];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        sum += arr[i];
    }
    int ans = 1e9;
    for(int i = 0; i < n; i++){
        int s1 = 0;
        for(int j = 0; j <= i; j++){
            s1 += arr[j];
        }
        int s2 = sum - s1;
        ans = min(ans, abs(s1 - s2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3612
S = input()
a, b = S[0:2], S[-2:]

if "00" < a <= "12":
    if "00" < b <= "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif "00" < b <= "12":
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_3_A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            Console.WriteLine("{0} {1}", line.Min(),line.Max());
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 18296
#include<stdio.h>
int main(void)
{

int a,b,c,h;

	h=0;

scanf("%d %d %d",&a,&b,&c);

	if(a>b){
		h=b;
		b=a;
		a=h;
}


	if(b>c){
		h=c;
		c=b;
		b=h;
}


	if(a>b){
		h=b;
		b=a;
		a=h;
}

printf("%d %d %d\n",a,b,c);

return 0;
}


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

int main() {
  int n;
  cin >> n;
  multiset<int> st;
  rep(i,n) {
    int a;
    cin >> a;
    auto itr = st.upper_bound(-a);
    if (itr == st.end()) st.insert(-a);
    else {
      st.erase(itr);
      st.insert(-a);
    }
  }
  cout << st.size() << endl;
  return 0;
} 

Measured memory_bytes: 8204
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                             it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    while(true){
        int R,C;
        cin >> R >> C;
        if(R == 0) break;
        vector<vector<char> > F(R,vector<char>(C));
        rep(i,R) rep(j,C){
            int c;
            cin >> c;
            F[i][j] = c;
        }

        vector<int> masks;
        for(int i=0;i<12;i++){
            masks.push_back(pow(2,i));
        }
        int up = pow(2,R);
        int maxi = -1;
        for(int mask=0;mask<up;mask++){
            int sum = 0;
            for(int i=0;i<C;i++){
                int f = 0;
                for(int j=0;j<R;j++){
                    // ura
                    if(mask & masks[j]){
                        if(not F[j][i]) f++;
                    }else{
                        if(F[j][i]) f++;
                    }
                }
                sum += max(f,R-f);
            }
            maxi = max(maxi,sum);
        }
        cout << maxi << endl;
    }
    return 0;
}

Measured memory_bytes: 1368
#include<stdio.h>
int main(void)
{
	int sum,cnt,suusum;
	int tan,suu,avg2;
	float avg;
	cnt=0;
	sum=0;
	suusum=0;
	while(scanf("%d,%d",&tan,&suu)!=EOF){
		cnt++;
		sum=sum+tan*suu;
		suusum+=suu;
	}
	avg=(float)suusum/cnt;
	avg2=avg+0.5;
	printf("%d\n%d\n",sum,avg2);
	return 0;
}

Measured memory_bytes: 1020
#include "bits/stdc++.h"
using namespace std;
using lint = long long;

struct BIT{
  vector<int> bit;
  int N;
  BIT() {init();}
  BIT(int N) : N(N){init();}
  void init(){
    bit.clear();
    bit.resize(N + 1,0);
  }
  int sum(int i){
    int s = 0;
    while(i > 0){
      s += bit[i];
      i -= i&-i;
    }
    return s;
  }
  void add(int i,int x){
    while(i <= N){
      bit[i] += x;
      i += i & -i;
    }
  }
};

signed main(){
	lint N, K; cin >> N >> K;
	vector<lint> sum(N + 1, 0);
	for(int i = 0; i < N; i++){
		lint x; cin >> x; sum[i + 1] = sum[i] + x - K;
	}
	vector<lint> ss = sum, comp(N + 1);
	sort(ss.begin(), ss.end());
	ss.erase(unique(ss.begin(), ss.end()), ss.end());
	for(int i = 0; i <= N; i++){
		comp[i] = lower_bound(ss.begin(), ss.end(), sum[i]) - ss.begin();
	}
	BIT bit(500000);
	lint ans = 0;
	for(lint j = 0; j <= N; j++){
		ans += bit.sum(comp[j] + 1);
		bit.add(comp[j] + 1, 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N; cin >> N;
	int K; cin >> K;
	vector<int> H(N);
	for(int i=0; i<N; i++) cin >> H[i];

	int ans = 0;
	for(int i=0; i<N; i++) if(H[i]>=K) ans++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
n = int(input())
v = list(map(int, input().split()))

from collections import Counter

v1 = [v[i] for i in range(len(v)) if i%2 == 0]
v2 = [v[i] for i in range(len(v)) if i%2 != 0]

v1c = Counter(v1)
v1cs = v1c.most_common(1)[0][0]
v1c = sorted(v1c.values())

v2c = Counter(v2)
v2cs = v2c.most_common(1)[0][0]
v2c = sorted(v2c.values())

if v1cs != v2cs:
    ans = sum(v1c[:-1]) + sum(v2c[:-1])
else:
    if len(v1c) == 1 and len(v2c) == 1:
        ans = sum(v2c)
    elif len(v1c) == 1:
        ans = min(sum(v2c) - v2c[-2])
    elif len(v2c) == 1:
        ans = min(sum(v1c) - v1c[-2])
    else:
        ans = min(sum(v1c) - v1c[-2] + sum(v2c[:-1]), sum(v1c[:-1]) + sum(v2c) - v2c[-2])

print(ans)


Measured memory_bytes: 61700
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	llint i,n,A,B,C,ans=0;cin>>n>>A>>B>>C;
	llint m=max(105LL,n*2+5);
	vector<llint>kai(m+1);
	
	kai[0]=1;
	for(i=1;i<=m;i++){kai[i]=kai[i-1]*i%mod;}
	vector<llint>gya(m+1);
	gya[m]=1;
	llint bgen=kai[m];
	for(int h=0;h<30;h++){
		if((mod-2)&(1<<h)){gya[m]*=bgen;gya[m]%=mod;}
		bgen*=bgen;bgen%=mod;
	}
	for(i=m;i>0;i--){gya[i-1]=gya[i]*i%mod;}
	llint Ghan=gya[100-C]*kai[99-C]%mod;
	
	A*=Ghan;B*=Ghan;A%=mod;B%=mod;
	vector<llint>Arui(m+1);
	vector<llint>Brui(m+1);
	Arui[0]=1;
	for(i=0;i<m;i++){Arui[i+1]=Arui[i]*A%mod;}
	Brui[0]=1;
	for(i=0;i<m;i++){Brui[i+1]=Brui[i]*B%mod;}
	
	for(i=0;i<n;i++){
		ans+=Arui[n-1]*Brui[i]%mod*kai[n-1+i]%mod*gya[n-1]%mod*gya[i]%mod*A%mod*(n+i);
		ans%=mod;
		ans+=Brui[n-1]*Arui[i]%mod*kai[n-1+i]%mod*gya[n-1]%mod*gya[i]%mod*B%mod*(n+i);
		ans%=mod;
	}
	//cerr<<"de"<<ans<<endl;
	ans*=100;ans%=mod;
	ans*=Ghan;ans%=mod;
	cout<<ans<<endl;
	return 0;
}


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

int gcd(int a, int b){
	if(a==0 || b==0) return a==0?b:a;
	int d=0;
	while((a&1)==0 && (b&1)==0){a>>=1; b>>=1; d++;}
	while(a!=b){
		if((a&1)!=0){
			while((b&1)==0) b>>=1;
			if(a<b) b-=a; else if(a>b) a-=b;
		}else{
			while((a&1)==0) a>>=1;
			if(a<b) b-=a; else if(a>b) a-=b;
		}
	}
	return a<<d;
}

int main(void){
	int n, i;
	int a[100001];
	int l[100002], r[100002];
	scanf("%d", &n);
	for(i=1; i<=n; i++){
		scanf("%d", a+i);
	}
	l[0]=0;
	for(i=1; i<=n; i++){
		l[i] = gcd(l[i-1], a[i]);
	}
	r[n+1]=0;
	for(i=n; i>0; i--){
		r[i] = gcd(r[i+1], a[i]);
	}
	int max=0;
	for(i=1; i<=n; i++){
		int now=gcd(l[i-1], r[i+1]);
		if(now>max) max=now;
	}
	printf("%d\n", max);
}


Measured memory_bytes: 1280
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
jobs = {}
for _ in range(n):
  a,b = map(int,input().split())
  if a in jobs:
    jobs[a].append(b)
  else:
    jobs[a] = [b]

import heapq
cand = []
heapq.heapify(cand)

ans = 0
for i in range(1,m+1):
  if i in jobs:
    for j in jobs[i]:
      heapq.heappush(cand,-j)
  if cand:
    ans += -heapq.heappop(cand)
print(ans)

Measured memory_bytes: 25888
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
	  int n = sc.nextInt();
      int A = sc.nextInt();
      int B = sc.nextInt();
      if((B-A)%2==0){
        System.out.println("Alice");
      }else{
        System.out.println("Borys");
      }
    }
}

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

long long gcd(long long x, long long y){
	return y == 0 ? x : gcd(y, x % y);
}

int main(){
	int T;
	scanf("%d",&T);
	long long a, b, c, d, gcdbd;
	while (T--){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if (a < b || d < b) printf("No\n");
		else if (c >= b) printf("Yes\n");
		else{
			gcdbd = gcd(b, d);
			if (b - gcdbd + a % gcdbd > c) printf("No\n");
			else printf("Yes\n");
		}
	}
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
#a, b = map(int,input().split())
al = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

total = sum(al)
mn = abs(total-2*al[0])
x = 0
for i in range(1, n-1):
    x += al[i-1]
    y = total-x
    mn = min(mn, abs(x-y))

print(mn)


Measured memory_bytes: 30440
#include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);

	int i;
	int j=0;

	for(i=a;i<=b;i++){
		if(c%i==0){
			j++;
		}
	}
	printf("%d\n",j);

	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	int n;
	cin>>n;
	for(int i=0;i<=n;i++){
		getline(cin,a);
		int h=a.size();
		for(int j=0;j<=h-7;j++){
			if(a[j]=='H'&&a[j+1]=='o'&&a[j+2]=='s'&&a[j+3]=='h'&&a[j+4]=='i'&&a[j+5]=='n'&&a[j+6]=='o')
				a[j+6]='a';
		}
		if(i!=0)
		    cout<<a<<endl;
	}
    return 0;
}
 

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

int main(){
    int n;
    while(cin >> n, n){
        string c[n+2];
        c[0] = c[n+1] = "x";
        for(int i = 1; i <= n; i++)  cin >> c[i];

        bool con = false;
        for(int i = 1; i < n; i++){
            if(c[i] == "x" && c[i+1] == "x")    con = true;
        }

        if(con){
            cout << "none" << endl;
            continue;
        }

        int lower = -1e9-10, upper = 1e9+10;
        bool valid = true;
        for(int i = 1; i <= n; i++){
            if(c[i] == "x"){
                if(i%2){
                    if(c[i-1] != "x")   upper = min(upper, stoi(c[i-1])-1);
                    if(c[i+1] != "x")   upper = min(upper, stoi(c[i+1])-1);
                }else{
                    if(c[i-1] != "x")   lower = max(lower, stoi(c[i-1])+1);
                    if(c[i+1] != "x")   lower = max(lower, stoi(c[i+1])+1);
                }
            }else{
                if(i%2){
                    if(c[i-1] != "x" && stoi(c[i]) >= stoi(c[i-1]))   valid = false;
                    if(c[i+1] != "x" && stoi(c[i]) >= stoi(c[i+1]))   valid = false;
                }else{
                    if(c[i-1] != "x" && stoi(c[i]) <= stoi(c[i-1]))   valid = false;
                    if(c[i+1] != "x" && stoi(c[i]) <= stoi(c[i+1]))   valid = false;
                }
            }
        }

        valid &= lower <= upper;

        if(valid){
            if(lower == upper)  cout << lower << endl;
            else                cout << "ambiguous" << endl;
        }else{
            cout << "none" << endl;
        }

    }
    return 0;
}


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n, p;
	cin >> n >> p;
	int kol = 0;
	forn(i, n) {
		int a;
		cin >> a;
		if (a & 1)
			kol++;
	}
	if (!(p & 1)) {
		if (kol == 0) {
			cout << (1ll << n) << endl;
			return 0;
		}
	}
	if (p & 1) {
		if (kol == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << (1ll << (n - 1)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

void solve(){
    int n,p;
    cin>>n>>p;
    int t=n*3+p;
    out(t/2);

}

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

Measured memory_bytes: 256
#include<cstdio>
 
int n,m,q_n;
int a[2000001],q;
 
int main(void){
    scanf("%d%d%d",&n,&m,&q_n);
    for(int i=0;i<m;i++)scanf("%d",&a[i]);
    for(int i=0;i<q_n;i++){
    	scanf("%d",&q);
       	int flag=0,p=q,b=0;
       	for(int j=0;j<m;j++){
       		if(flag==1)continue;
       		if(a[j]%2==0)b=(b+a[j])%(n-j);
       		else b=(b-a[j]+(n-j)*100)%(n-j);
       		if(p==b)flag=1;
       		else if(p>b)p--;
       		if(j!=m-1){
       			if(b==n-j-1)b=0;
       		}
       	}
        printf("%d\n",1-flag);
    }
    return 0;
}

Measured memory_bytes: 1816
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll x; cin >> x;
  ll ans = 8, Max = 600;
  while(1)
  {
    if(x < Max) fin(ans); Max += 200; ans--;
  }
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(4); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i< n; i++)
typedef long long ll;
const double EPS = 1e-8;
const double PI = 2 * acos(0.0);

int gcd(int u, int v){
  while(u > 0){
    if(v > u) swap(u, v);
    u %= v;
  }
  return v;
}

int lcm(int u, int v){
  return u / gcd(u, v) * v;
}

double f(int P, int Q, int R, double theta){
  double a = (double)(Q - P) / Q;
  double dx = -(P - Q) * sin(theta) - a * R * sin(a * theta);
  double dy = (P - Q) * cos(theta) + a * R * cos(a * theta);
  return sqrt(dx*dx + dy*dy);
}

double calc(int P, int Q, int R){

  double end = (double)Q / P * 2 * PI;
  double res = 0;
  const int cnt = 500000;
  for(int i = 0; i < cnt; i++){
    double theta = end * i / cnt;
    double dtheta = end / cnt;
    res += dtheta * (f(P, Q, R, theta) + 4 * f(P, Q, R, theta + dtheta / 2)
		     + f(P, Q, R, theta + dtheta)) / 6;
  }
  return res;
}
int main(){
  int P, Q, R;
  while(cin >> P >> Q >> R && (P || Q || R)){
    double res = calc(P, Q, R);
    cout << fixed << setprecision(2);
    if(R == 0) cout << res * P / Q << endl;
    else cout << res * lcm(P, Q) / Q << endl;
  }
  return 0;
}

Measured memory_bytes: 932
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		sc.close();
		int c=0;
		for (int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == t.charAt(i)) continue;
			c++;
		}
		System.out.println(c);

	}

}


Measured memory_bytes: 41096
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(6-(a+b)==1) printf("1\n");
    else if(6-(a+b)==2) printf("2\n");
    else if(6-(a+b)==3) printf("3\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
using ll = long long;

int main() {
    ll N;
    cin >> N;
    ll tmp = 1;
    int ret = 1;
    while(true) {
        if(tmp <= N && N <= tmp*3) break;
        tmp *= 3;
        ++ret;
    }
    cout << ret << endl;
}


Measured memory_bytes: 3104