akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def pf(s):
    print(s, flush=True)

def main():
    n = I()
    if n%2 == 0:
        return "{} {} {}".format(n,n,n//2)
    t = 4/n
    for i in range(1,3501):
        c = t - 1/i
        for j in range(i,3501):
            d = c - 1/j
            if d <= 0:
                continue
            e = 1 / d
            if e > 3501:
                continue
            f = math.ceil(e)
            if f > 0 and abs(d - 1/f) < eps:
                return '{} {} {}'.format(i,j,f)
            f = math.floor(e)
            if f > 0 and abs(d - 1/f) < eps:
                return '{} {} {}'.format(i,j,f)

    return -1



print(main())






Measured memory_bytes: 67432
def sq(a, b, mod):  # aのb乗を剰余,kは初期値#20191116-D-Knight
    if b == 0:
        return 1
    elif b % 2 == 0:
        return sq(a, b // 2, mod)**2 % mod
    else:
        return sq(a, b - 1, mod) * a % mod


def nCk(n, k, mod=10 ** 9 + 7):
    x = max(k, n - k)
    y = min(k, n - k)
    kkai = 1
    for i in range(2, y + 1):
        kkai = (kkai * i) % mod
    nkkai = 1
    for i in range(x + 1, n + 1):
        nkkai = (nkkai * i) % mod
    answer = sq(kkai, mod - 2, mod) * nkkai % mod
    return answer


n = int(input())
alist = sorted(map(int, input().split()))
aset = set(alist)
ai = alist[-1]
aset.remove(ai)
target = ai // 2
sbn = [abs(alist[i] - target) for i in range(n - 1)]
j = min(sbn)
aj = (target + j) if (target + j) in aset else target - j
print(ai, aj)


Measured memory_bytes: 16084
a,b,k = (int(x) for x in input().split())
if (b - a+1)<= k*2:
    for i in range(a,b+1):
        print(i)
else :
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)

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

using P = pair<int,int>;

ll num[2][51][51] = {};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;

    auto get_fraction = [&](string S){
        ll a = 0,b = 0;
        int n = S.size();
        bool dot = false;
        for(int i=0;i<n;i++){
            if(isdigit(S[i])){
                a = 10*a+(S[i]-'0');
                if(dot) b++; 
            }else dot = true;
        }
        ll c = 1;
        while(b--) c *= 10;
        ll g = gcd(a,c);
        a /= g,c /= g;
        return (P){a,c};
    };

    map<P,ll> mp;
    for(int i=0;i<N;i++){
        string S;
        cin >> S;
        auto [a,b] = get_fraction(S);
        map<int,int> now;
        for(auto& x:{2,5}){
            while(a%x==0){
                a /= x;
                now[x]++;
            }
        }
        for(auto& x:{2,5}){
            while(b%x==0){
                b /= x;
                now[x]--;
            }
        }
//        cerr << now[2] << " " << now[5] << "\n";
        mp[{now[2],now[5]}]++;
    }
    ll ans = 0,ans2 = 0;
    for(auto& [p,c1]:mp){
        auto [a,b] = p;
        if(2*a>=0 && 2*b>=0) ans += c1*(c1-1)/2;
        for(auto& [q,c2]:mp) if(p!=q){
            auto [c,d] = q;
            if(a+c>=0 && b+d>=0) ans2 += c1*c2;
        }
    }
    cout << ans+ans2/2 << "\n";
}

Measured memory_bytes: 3628
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String b = sc.next();
    List<String> l = new ArrayList<String>();
    l.add("A");
    l.add("T");
    l.add("C");
    l.add("G");
    l.remove(l.indexOf(b));
    if (b.equals("A") || b.equals("T")){
      System.out.println(l.get(0));
    }else{
      System.out.println(l.get(2));
    }
  }
}

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

using namespace std;
#define maxn 300010
int l[maxn],r[maxn];
    char a[maxn];
int main()
{
   int i,n;
    scanf("%d",&n);
    scanf("%s",a);
    l[0]=0;int t=0;
    for(i=1;i<n;i++)
        {
            if(a[i-1]=='W')
                t++;
            l[i]=t;
        }
        t=-1;
    for(i=n-1;i>=0;i--)
        {
            if(i==(n-1))
                t=0;
            else if(a[i+1]=='E')
                t++;
            r[i]=t;
        }
        t=maxn;
    for(i=0;i<n;i++)
        {
            l[i]+=r[i];
            if(l[i]<t)
                t=l[i];
        }
        printf("%d\n",t);
    return 0;
}


Measured memory_bytes: 2944
s=sorted(input())
t=sorted(input(),reverse=True)

if len(s)<len(t) and s[:len(s)]==t[:len(s)]:
    print('Yes')
    exit()
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        print('Yes')
        exit()
print('No')

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

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	int sum = 0;
	rep(i, m){
		int a;
		scanf("%d", &a);
		sum += a;
	}
	if(sum > n) cout << "-1" << endl;
	else cout << n - sum << endl; 
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i,j;
	string s;
	cin>>n>>s;
	for(i=0;i<n;i++)if(s[i]=='>')
		for(j=n-1;j>=0;j--){if(s[j]=='<')goto L;}
	L:cout<<n-min(i,n-j-1)<<endl;
}

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

int main() {
	int n; cin >> n;
	vector<int>a(n); for (auto&& x : a)cin >> x;

	long long ans = 0, cnt = 0;
	for (auto&& x : a) {
		if (x == 0)ans += cnt / 2, cnt = 0;
		else cnt += x;
	}
	if (cnt != 0)ans += cnt / 2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;
struct edge {
	ll from, to, cost;
};

int C, n;
int co[1005][1005] = { 0 };
int a[505][505][4] = { 0 };
int sa[505][505] = { 0 };
int res = 0;
int cnt = 0;//違う総数

int main() {
	cin >> C >> n;
	for (int i = 1; i <= n; i++) {
		string s;
		cin >> s;
		for (int j = 1; j <= n; j++) {
			co[i][j] = s[j - 1] - '0';
			if (co[i][j] == 0) co[i][j] = -1;
		}
	}
	for (int i = 1; i <= n / 2; i++) {
		for (int j = 1; j <= n / 2; j++) {
			a[i][j][0] = co[i][j];
			a[i][j][1] = co[i][n - j + 1];
			a[i][j][2] = co[n - i + 1][j];
			a[i][j][3] = co[n - i + 1][n - j + 1];
			bool f = false;
			for (int k = 0; k < 4; k++) {
				if (a[i][j][0] != a[i][j][k]) f = true;
			}
			if (f) {
				cnt++;
				sa[i][j] = -1;
			}
			else sa[i][j] = 1;
		}
	}
	if (cnt == 0) res++;
	//cout << "cnt:" << cnt << endl;
	for (int i = 1; i <= C - 1; i++) {
		int d;
		cin >> d;
		for (int i = 0; i < d; i++) {
			int r, c;
			cin >> r >> c;
			if (r <= n / 2 && c <= n / 2) {
				a[r][c][0] *= -1;
				bool f = false;
				for (int j = 0; j < 4; j++) {
					if (a[r][c][0] != a[r][c][j]) f = true;
				}
				if (!f) {
					cnt--;
					sa[r][c] = 1;
				}
				if (f) {
					if (sa[r][c] == 1) cnt++;
					sa[r][c] = -1;
				}
				//cout << "cnt0:" << cnt << endl;
			}
			else if (r <= n / 2 && c >= n / 2) {
				a[r][n - c + 1][1] *= -1;
				bool f = false;
				for (int j = 0; j < 4; j++) {
					if (a[r][n - c + 1][0] != a[r][n - c + 1][j]) f = true;
				}
				if (!f) {
					cnt--;
					sa[r][n-c+1] = 1;
				}
				if (f) {
					if (sa[r][n-c+1] == 1) cnt++;
					sa[r][n-c+1] = -1;
				}
				//cout << "cnt1:" << cnt << endl;
			}
			else if (r >= n / 2 && c <= n / 2) {
				a[n + 1 - r][c][2] *= -1;
				bool f = false;
				for (int j = 0; j < 4; j++) {
					if (a[n-r+1][c][0] != a[n-r+1][c][j]) f = true;
				}
				if (!f) {
					cnt--;
					sa[n-r+1][c] = 1;
				}
				if (f) {
					if (sa[n-r+1][c] == 1) cnt++;
					sa[n-r+1][c] = -1;
				}
				//cout << "cnt2:" << cnt << endl;
			}
			else {
				a[n + 1 - r][n + 1 - c][3] *= -1;
				bool f = false;
				for (int j = 0; j < 4; j++) {
					if (a[n - r + 1][n+1-c][0] != a[n - r + 1][n+1-c][j]) f = true;
				}
				if (!f) {
					cnt--;
					sa[n - r + 1][n+1-c] = 1;
				}
				if (f) {
					if (sa[n - r + 1][n+1-c] == 1) cnt++;
					sa[n - r + 1][n+1-c] = -1;
				}
				//cout << "cnt3:" << cnt << endl;
			}
		}
		if (cnt == 0) res++;
		//cout << "cnt:" << cnt << endl;
		//cout << endl;
	}
	out(res);
	return 0;
}


Measured memory_bytes: 12092
#include <stdio.h>

int main()
{
	int N = 0;
    int M = 0;
	scanf("%d %d", &N, &M);
    
    int A[N];
    int sum = 0;
    int i = 0;
    for(i = 0; i < N; i++){
        scanf("%d ", &A[i]);
        sum += A[i];
    }
    
    int count = 0;
	for(i = 0; i < N; i++){
        if((double)A[i] >= ((double)sum / (4. * (double)M))){
            count++;
        }
    }

    if(count >= M){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    //Debug
    /*
    printf("N : %d\n",N);
    printf("M : %d\n",M);
    printf("sum : %d\n",sum);
    printf("count : %d\n",count);
    printf("1/4M : %lf\n",((double)sum / (4. * (double)M)));
    printf("A : ");
    for(i = 0; i < N; i++){
        printf("%d ", A[i]);
    }
    */

	return 0;
}

Measured memory_bytes: 128
process.stdin.resume();
process.stdin.setEncoding("utf8");

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

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

const isPrime = (n) => {
  if (n < 2) return false;
  if (n === 2) return true;
  if (n % 2 === 0) return false;

  let l = Math.sqrt(n);
  for (let i = 3; i <= l; i += 2) {
    if (n % i === 0) return false;
  }
  return true;
};

reader.on("close", () => {
  let n = lines[0] - 0;
  let count = 0;
  for (let i = 1; i <= n; i++) {
    if (isPrime(lines[i] - 0)) count++;
  }
  console.log(count);
});



Measured memory_bytes: 23576
s = input()
t = input()

lens = len(s)
lent = len(t)

total = 100000000
for i in range(lens-lent+1):
    count = 0
    for j in range(lent):
        if s[i+j]!=t[j]:
            count+=1
    total = min(total,count)

if total == 100000000:
    print(lent)
else:
    print(total)
            


Measured memory_bytes: 9064
#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 pair<int,int> P;

const ll INF = 1e18;

struct Edge{ll u,v,cost;};
using Edges = vector<Edge>;

vector<ll> Bellman_ford(const Edges &edges,int V,int s){
    vector<ll> dist(V,INF);
    dist[s] = 0;
    for(int i = 0; i < V ; i++){
        for(auto e : edges){
            if(dist[e.u] == INF)continue;
            if(dist[e.v] > dist[e.u]+e.cost){
              dist[e.v] = dist[e.u]+e.cost;
            }
        }
    }
    return dist;
}

int main(){
  int n, m, p;
  cin >> n >> m >> p;
  Edges es;
  rep(i,m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;b--;
    es.push_back(Edge{a,b,(p-c)});
  }
  vector<ll> d = Bellman_ford(es,n,0);

  rep(i,n) {
    rep(j,sz(es)) {
      Edge e = es[j];
      if (d[e.v] != INF && d[e.v] > d[e.u] + e.cost) {
        d[e.v] = -INF;
      }
    }
  }
  ll res = max(-d[n-1],0LL);
  cout << (d[n-1] == -INF ? -1 : res) << endl;
 
  return 0;
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))

i = 0
ans = 0

while i < n:
    i1 = i
    last = a[i]
    while i1 < n:
        if last <= a[i1]:
            last = a[i1]
            i1 += 1
        else: break
    
    i2 = i
    while i2 < n:
        if last >= a[i2]:
            last = a[i2]
            i2 += 1
        else: break
    
    i = max(i1, i2)
    ans += 1

print(ans)

Measured memory_bytes: 19952
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

int main(){
    int n, m, value;
    cin >> n >> m;

    ll total_votes = 0;
    vector<int> myvs;
    for(int i = 0; i < n; i++) {
        cin >> value;
        myvs.push_back(value);
        total_votes += value;
    }
    ll ans = 0;
    for(int i = 0; i < len(myvs); i++) {
        if(myvs[i] >= total_votes / (4.0*m)) {
            ans++; // 4 * m * myvs[i] >= total_votes
        }
    }
    if(ans >= m) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
//#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define MOD 998244353
#define SIZE 3005

ll N;
int S;
int A[SIZE];
ll dp[SIZE][SIZE][3];

int main(){

	scanf("%lld %d",&N,&S);

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

		scanf("%d",&A[i]);
	}

	for(int i = 0; i <= N; i++){
		for(int k = 0; k <= S; k++){
			for(int p = 0; p < 3; p++){
				dp[i][k][p] = 0;
			}
		}
	}

	dp[0][0][0] = 1;

	/*
	 * 0:両方未定
	 * 1:左方決定
	 * 2:両方決定
	 * */

	for(ll i = 0; i < N; i++){
		for(int k = 0; k <= S; k++){

			dp[i+1][k][0] += dp[i][k][0];
			dp[i+1][k][0] %= MOD;

			if(k+A[i] <= S){

				dp[i+1][k+A[i]][1] += dp[i][k][0]*(i+1);
				dp[i+1][k+A[i]][1] %= MOD;

				dp[i+1][k+A[i]][2] += dp[i][k][0]*(i+1)*(N-i);
				dp[i+1][k+A[i]][2] %= MOD;
			}

			dp[i+1][k][1] += dp[i][k][1];
			dp[i+1][k][1] %= MOD;

			if(k+A[i] <= S){

				dp[i+1][k+A[i]][1] += dp[i][k][1];
				dp[i+1][k+A[i]][1] %= MOD;

				dp[i+1][k+A[i]][2] += dp[i][k][1]*(N-i);
				dp[i+1][k+A[i]][2] %= MOD;
			}

			dp[i+1][k][2] += dp[i][k][2];
			dp[i+1][k][2] %= MOD;
		}
	}

	printf("%lld\n",dp[N][S][2]);

	return 0;
}


Measured memory_bytes: 211584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<ll> A(N+1);
  vector<ll> B(N);
  ll sum1st=0;
  rep(i,N+1) {cin >> A[i]; sum1st+=A[i];}
  rep(i,N) cin >> B[i];

  for(int i=0;i<N;i++){
    if(A[i]==B[i]){
      A[i]=0; B[i]=0;
    }
    else if(A[i]>B[i]){
      A[i] -= B[i]; B[i]=0;
    }
    else{
      B[i] -= A[i];
      A[i] = 0;
      if(A[i+1] >= B[i]){
        A[i+1] -= B[i]; B[i]=0;
      }
      else{
        A[i+1] = 0; B[i]=0;
      }
    }
  }
  ll sum2nd = 0;
  rep(i,N+1) {sum2nd += A[i];}
  cout << sum1st - sum2nd << endl;

  return 0;
}


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

using namespace std;
#define int long long
#define double long double
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
#define FI first
#define SE second
typedef pair<int, int> pii;
#define l_b lower_bound
#define u_b upper_bound

string str;
vector<char> s;
int xs[100100];

signed main() {
    cin >> str;
    for (char &c:str) {
        if (c != 'x') {
            s.push_back(c);
        } else {
            xs[s.size()]++;
        }
    }
    rep(i, s.size()) {
        if (s[i] != s[s.size() - 1 - i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    int ans = 0;
    rep(i, (s.size() + 1) / 2) {
        ans += abs(xs[i] - xs[s.size() - i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter

n, *a = map(int, read().split())
counter = Counter(a).values()
ans = len(counter)
if (sum(counter) - ans) % 2 == 1:
    ans -= 1
print(ans)


Measured memory_bytes: 18332
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;
using T = tuple<int, int, lint>;

// 諸宣言
using Weight = lint;
using Flow = lint;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
    Edge(int s, int d, Weight w, Flow c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
    g[b].emplace_back(b, a, w, c);
}
void add_arc(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
}

// 二辺連結成分分解・橋の列挙 O(E+V)
pair<vector<int>, Edges> bridge(const Graph& g) {
    const int n = g.size();
    int idx = 0, s = 0, t = 0, k = 0;
    vector<int> ord(n, -1), onS(n), stk(n), roots(n), cmp(n);
    Edges brdg;
    function<void(int, int)> dfs = [&](int v, int u) {
        ord[v] = idx++;
        stk[s++] = v;
        onS[v] = true;
        roots[t++] = v;
        for (auto& e : g[v]) {
            int w = e.dst;
            if (ord[w] == -1)
                dfs(w, v);
            else if (u != w && onS[w])
                while (ord[roots[t - 1]] > ord[w]) --t;
        }
        if (v == roots[t - 1]) {
            brdg.emplace_back(u, v, 0);
            while (1) {
                int w = stk[--s];
                onS[w] = false;
                cmp[w] = k;
                if (v == w) break;
            }
            --t;
            ++k;
        }
    };
    for (int u = 0; u < n; u++) {
        if (ord[u] == -1) {
            dfs(u, n);
            brdg.pop_back();
        }
    }
    return make_pair(cmp, brdg);
}

int main(void) {
    int n, m;
    cin >> n >> m;
    Graph g(n);
    rep(m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        add_edge(g, a, b);
    }
    vector<int> cmp;
    Edges brdg;
    tie(cmp, brdg) = bridge(g);
    cout << brdg.size() << endl;
}
          

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 18:25:41 2020
abc145c
@author: manakamura
"""

n = int(input())

x=[]
y=[]
for i in range(n):
    tmp = input().split()
    a,b = list(map(lambda a: int(a), tmp))
    x.append(a)
    y.append(b)
#    print(a,b)

dis=[]

sum=0
for i in range(0,n):
    tmp=[]
    for j in range(0,i):
        tmp.append(dis[j][i])
    tmp.append(1)
    for j in range(i+1,n):
        l=0
        l+=(x[j]-x[i])**2
        l+=(y[j]-y[i])**2
        l=l**0.5
        sum+=l
        tmp.append(l)
#    print(tmp)
    dis.append(tmp)

#print(dis)

print(sum*2/n)

#print(sum/(n*(n-1)/2))    


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

int main() {
  string S;
  cin >> S;

  if (S == "AAA") {
    cout << "No" << endl;
  }
  else if (S == "BBB") {
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}


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

constexpr int MOD = 1e9+7;
template<int mod>
struct ModInt {
  int x;
 
  constexpr ModInt() : x(0) {}
  constexpr ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  constexpr ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }
  constexpr ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  constexpr ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  constexpr ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  constexpr ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  constexpr bool operator==(const ModInt &p) const { return x == p.x; }
  constexpr bool operator!=(const ModInt &p) const { return x != p.x; }
  constexpr ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t = 0;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  constexpr ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
 
using modint = ModInt<MOD>;

vector<modint> factorial(int max_n) {
    vector<modint> v(max_n + 1);
    v[0] = modint(1);
    for (int i = 0; i < max_n; i++) {
        v[i + 1] = v[i] * modint(i + 1);
    }
    return v;
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int X, Y;
    cin >> X >> Y;
    // M > 0 , N >0
    // X = M + 2N, Y = 2M + N
    // よって, 
    // X = M + 2N, 2Y = 4M + 2N
    // 2Y - X = 3 M, 
    // 2X - Y = 3 N, 
    // 
    int M = 2 * Y - X;
    int N = 2 * X - Y;
    if (M % 3 != 0 || N % 3 != 0 || M  < 0 || N < 0) {
        cout << 0 << endl;
        return 0;
    }
    M /= 3; N /= 3;
    // _{m + n} C_m = (M + N)! / M! N!

    auto fac = factorial(M + N);
    cout << fac[M + N] / fac[M] / fac[N] << endl;

    return 0;
}

Measured memory_bytes: 5504
#include <iterator>
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;
int main(int argc, char **argv) {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B;
  B.resize(M);
  for (int j = 0; j < M; j++) {
    cin >> B[j];
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int cur = 0;
    for (int j = 0; j < M; j++) {
      int A;
      cin >> A;
      cur += A * B[j];
    }
    cur += C;
    if (cur > 0)
      ++ans;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
#define MAX 114514
vector<P> G[MAX*5];
map<int,int> M[MAX];
int dist[MAX*5];
signed main(){
  int n,m;
  cin>>n>>m;
  int cnt=n;
  for(int i=0;i<m;i++){
    int p,q,c;
    cin>>p>>q>>c;
    p--;q--;
    auto add_edge = [&](int x){
      if(!M[x].count(c)){
	M[x][c]=cnt++;
	G[M[x][c]].push_back(P(x,0));
	G[x].push_back(P(M[x][c],1));
      }
    };
    add_edge(p);
    add_edge(q);
    G[M[p][c]].push_back(P(M[q][c],0));
    G[M[q][c]].push_back(P(M[p][c],0));
  }
  memset(dist,-1,sizeof(dist));
  priority_queue<P,vector<P>,greater<P> > q;
  dist[0]=0;
  q.push(P(dist[0],0));
  while(!q.empty()){
    P p=q.top();q.pop();
    int d=p.first,v=p.second;
    if(dist[v]<d) continue;
    for(P e:G[v]){
      int u=e.first,c=e.second;
      if(dist[u]<0||dist[u]>d+c){
	dist[u]=d+c;
	q.push(P(dist[u],u));
      }
    }
  }
  cout<<dist[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 82800
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

typedef struct
{
  char name[11];
  int i;
  int rate;
} hoge;

int upll__(const void *a, const void *b) { return strcmp(((hoge *)a)->name, ((hoge *)b)->name); }

int main()
{
  int n;
  scanf("%d", &n);
  hoge fuga[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%s%d", fuga[i].name, &fuga[i].rate);
    fuga[i].i = i;
  }
  qsort(fuga, n, sizeof(hoge), upll__);
  int cnt = 1;
  while (cnt)
  {
    cnt = 0;
    for (int i = 0; i < n - 1; i++)
    {
      if (!strcmp(fuga[i].name, fuga[i + 1].name))
      {
        if (fuga[i].rate < fuga[i + 1].rate)
        {
          hoge tmp = fuga[i];
          fuga[i] = fuga[i + 1];
          fuga[i + 1] = tmp;
          cnt++;
        }
      }
    }
  }
  for (int i = 0; i < n; i++)
    printf("%d\n", (fuga[i].i) + 1);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a + b == c || a + c == b || b + c == a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

using namespace std;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}
int main(){
  ll a,b,c,d;
  cin >> a>> b>>  c>> d;
  ll count =0,cans =0,dans=0 ,cdans=0;
  cans=b/c-(a-1)/c;
  dans=b/d-(a-1)/d;
  cdans =c*d/gcd11(c,d);
  count =b-a+1-(cans + dans -(b/cdans) +(a-1)/cdans);
  cout <<count      <<endl;
}

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

using namespace std;
typedef long long ll;

int lb(vector<int> a, int key) {
    int l = -1, r = (int)a.size();
    while(r - l > 1) {
        int mid = (l+r)/2;
        if (a[mid] >= key) r = mid; 
        else l = mid;
    }
    return r;
}
int ub(vector<int> a, int key) {
    int l = -1, r = (int)a.size();
    while(r - l > 1) {
        int mid = (l+r)/2;
        if (a[mid] > key) r = mid; 
        else l = mid;
    }
    return r;
}
int main() {
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll na = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll nc = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
        ans += nc*na;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


int main(){
  int a,b;
  cin >> a >> b;
  int  n = (b-a);
  int ans = n*(n+1)/2 - b;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
class Dice:
	
	def __init__(self, faces):
		self.faces = faces
		self.t = faces[0]
		self.s = faces[1]
		self.e = faces[2]
		self.w = faces[3]
		self.n = faces[4]
		self.b = faces[5]

	def roll(self, drct):
		t_ = self.t
		s_ = self.s
		e_ = self.e
		w_ = self.w
		n_ = self.n
		b_ = self.b
		if drct == 'S':
			self.t = n_
			self.s = t_
			self.n = b_
			self.b = s_
		elif drct == 'N':
			self.t = s_
			self.s = b_
			self.n = t_
			self.b = n_
		elif drct == 'E':
			self.t = w_
			self.e = t_
			self.w = b_
			self.b = e_
		elif drct == 'W':
			self.t = e_
			self.e = b_
			self.w = t_
			self.b = w_
		else:
			return
	
	def rotate_right(self):
		s_ = self.s
		w_ = self.w
		n_ = self.n
		e_ = self.e
		self.s = e_
		self.w = s_
		self.n = w_
		self.e = n_
	
	def is_identical(self, other):		
		directions = 'NWNNWW'
		for direction in directions:
			for i in range(4):
				self.rotate_right()
				if self.is_matchall(other): return True
			self.roll(direction)
#			print(str(self.t) + str(self.s) + str(self.w) + str(self.n) + str(self.e))
		return False

	def is_matchall(self, other):
		if self.t != other.t: return False
		if self.s != other.s: return False
		if self.e != other.e: return False
		if self.w != other.w: return False
		if self.n != other.n: return False
		if self.b != other.b: return False
		return True
		
faces1 = list(map(int, input().split()))
faces2 = list(map(int, input().split()))
dice1 = Dice(faces1)
dice2 = Dice(faces2)

if dice1.is_identical(dice2):
	print('Yes')
else:
	print('No')



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

using namespace std;

int s[105][105];
int flag[25][25];
int main(){
	int n, m, flag = 0;
	scanf("%d%d", &n, &m);
	int minn = min(n, m);
	int maxn = max(n, m);
	minn--;
	printf("%d %d\n", 100, 100);
	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= 100; j++){
			s[i][j] = 0;
		}
	}
	int cnt = min(n, m);
	for(int i = 0; i < 25; i++){
		for(int j = 0; j < 25; j++){
			if(minn){
				s[i * 4][j * 4] = 1;
				s[i * 4][j * 4 + 1] = 1;
				s[i * 4][j * 4 + 2] = 1;
				s[i * 4 + 1][j * 4] = 1;
				s[i * 4 + 1][j * 4 + 2] = 1;
				s[i * 4 + 2][j * 4] = 1;
				s[i * 4 + 2][j * 4 + 1] = 1;
				s[i * 4 + 2][j * 4 + 2] = 1;
				minn--;
				maxn--;
			}
			else{
				if(maxn){
					s[i * 4][j * 4] = 1;
					s[i * 4][j * 4 + 1] = 1;
					s[i * 4][j * 4 + 2] = 1;
					s[i * 4 + 1][j * 4] = 1;
					s[i * 4 + 1][j * 4 + 1] = 1;
					s[i * 4 + 1][j * 4 + 2] = 1;
					s[i * 4 + 2][j * 4] = 1;
					s[i * 4 + 2][j * 4 + 1] = 1;
					s[i * 4 + 2][j * 4 + 2] = 1;
					maxn--;
				}
			}
		}
	}
	for(int i = 0; i < 100; i++){
		for(int j = 0; j < 100; j++){
			printf("%c", cnt == n ? (s[i][j] ? '#' : '.') : (s[i][j] ? '.' : '#'));
		}
		printf("\n");
	}
}


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

#define BUF_SIZE 25
#define BITMAP_SIZE 33554432

int map[0xff] = {
  ['A'] = 0,
  ['C'] = 1,
  ['G'] = 2,
  ['T'] = 3,
};

int strtokey(char *str) {
  char *tmp;
  int i;
  int ans = strlen(str);
  // lsb 4bit: length, [31,5] -> key
  for(tmp = str, i=2; *tmp != '\0' && *tmp != '\n'; tmp++, i++) {
    ans |= (map[*tmp] << (i*2));
  }
  return ans;
}

#define CHAR_BITS (sizeof(char)*8)
#define CHAR_MASK (CHAR_BITS-1)
#define IDX(key) (key>>3)
#define VAL(key) (1 << (key&CHAR_MASK))

void insert(char *bitmap, char *str) {
  int key = strtokey(str);
  bitmap[IDX(key)] |= VAL(key);
}

int find(char *bitmap, char *str) {
  int key = strtokey(str);
  return !!(bitmap[IDX(key)] & VAL(key));
}

int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int queries;
  sscanf(line, "%d", &queries);

  // array size: 2bit*12+4bit-3bit
  static char bitmap[BITMAP_SIZE] = {0};

  int i;
  char flag;
  for(i = 0; i < queries; i++) {
    if(!fgets(line, BUF_SIZE, fp)) return 0;
    char command[10];
    char str[14];
    sscanf(line, "%s %s", command, str);
    switch(*command) {
      case 'i': // insert
        insert(bitmap, str);
        break;
      case 'f':
        flag = find(bitmap, str);
        printf("%s\n", flag ? "yes" : "no");
        break;
      default:
        break;
    }
  }
}


Measured memory_bytes: 3732
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll inf = -1*1e18;
ll n, w;
vector<vector<ll>> g;
#define br cout<<endl;
ll dp[105][100005];
ll arr[105][2];
 
int main()
{
 
cin>>n>>w;
memset(dp,0,sizeof dp);
    for (int i = 1; i <=n; i++)
    {
        cin >> arr[i][1]>>arr[i][0];
        
    }

 for (int i = 1; i <=n; i++)
    {
        for(int j=0;j<=w;j++)
        {
           if(j<arr[i][1])
           {
             dp[i][j]  =dp[i-1][j];
           }
           else
            dp[i][j]=max(dp[i-1][j-arr[i][1]]+arr[i][0],dp[i-1][j]);
        }
    }
    cout<<dp[n][w]<<endl;


  
}

Measured memory_bytes: 82304
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX



struct treap{
	struct node{
		int v;
		node *cl,*cr;
		int pri;
		int cnt;
		int minv;
		node(int iv){
			v=iv;
			minv=v;
			cnt=1;
			pri=((int)rand());
			cl=cr=NULL;
		}
	};
	
	node* root;
	treap(){
		root=NULL;
	}
	
	int get_cnt(node* t){ //( p??????[0,p)?????\??£????????????
		if(t==NULL)return 0;
		return t->cnt;
	}
	
	int get_minv(node* t){ 
		if(t==NULL)return 10000005;
		return t->minv;
	}
	
	void update(node* t){
		t->cnt=get_cnt(t->cl)+get_cnt(t->cr)+1;
		t->minv = min(t->v,min(get_minv(t->cl),get_minv(t->cr)));
	}
	
	
	node* merge(node* l,node* r){
		if(l==NULL)return r;
		else if(r==NULL)return l;
		
		node* res;
		if(l->pri<r->pri){//l??????
			res=l;
			l->cr = merge(l->cr,r);
		}
		else{//r??????
			res=r;
			r->cl = merge(l,r->cl);
		}
		update(res);
		return res;
	}
	
	typedef pair<node*,node*> nmp;
	
	nmp split(node* t,int k){ //(( [0,k),[k,n) ??§???t?????¬???
		if(t==NULL)return nmp(NULL,NULL);
		if(k<=get_cnt(t->cl)){
			nmp pa = split(t->cl,k);
			t->cl=pa.sec;
			update(t);
			return nmp(pa.fir,t);
		}
		else{
			nmp pa = split(t->cr,k-get_cnt(t->cl)-1);
			t->cr=pa.fir;
			update(t);
			return nmp(t,pa.sec);
		}
	}
	
	void insert(int iv,int k){//k?????????iv?????????
		nmp pa = split(root,k);
		
		node* t = new node(iv);
		t = merge(pa.fir,t);
		root = merge(t,pa.sec);
	}
	
	int erase(int k){//k??????????¶????(????????????)
		//pa.fir :: pb.fir (==k) :: pb.sec ??¨??????
		nmp pa = split(root,k);
		nmp pb = split(pa.sec,1);
		//printf("%d %d %d\n",get_cnt(pa.fir),get_cnt(pb.fir),get_cnt(pb.sec));
		int res=pb.fir->v;
		free(pb.fir);
		root = merge(pa.fir,pb.sec);
		return res;
	}
	
	int get_min(int l,int r){
		nmp pa =split(root,r+1);
		nmp pb =split(pa.fir,l);
		int res = get_minv(pb.sec);
		root = merge(merge(pb.fir,pb.sec),pa.sec);
		return res;
	}
	
	void shift(int l,int r){
		int rn=erase(r);
		insert(rn,l);
	}
	
	void chnum(int k,int iv){
		erase(k);
		insert(iv,k);
	}
	
	void out(node* t,int dep){
		if(t==NULL)return;
		out(t->cl,dep+1);
		rep(i,dep)printf("  ");
		printf("(%x v. %d minv. %d cnt. %d cl. %x cr. %x pri. %d)\n",t,t->v,t->minv,t->cnt,t->cl,t->cr,t->pri);
		out(t->cr,dep+1);
	}
	
	void out(){
		out(root,0);
	}
};


int main(void){
	srand(1234);
	
	treap tr;
	int n,iq;
	scanf("%d%d",&n,&iq);
	rep(i,n){
		int a;
		scanf("%d",&a);
		tr.insert(a,i);
	}
	
	//tr.out();
	//return 0;
	
	rep(i,iq){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		if(a==0){
			tr.shift(b,c);
		}
		else if(a==1){
			int p=tr.get_min(b,c);
			printf("%d\n",p);
		}
		else{
			tr.chnum(b,c);
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 10408
open Batteries
let rec sum lst =
  match lst with
  | [] -> 0
  | first :: rest -> first + sum rest

let n, m = Scanf.sscanf (read_line()) "%d %d" (fun n m ->n,m
)
let a = read_line () |> String.split_on_char ' ' |> List.map int_of_string
let _ = (if sum a > n then -1 else n - (sum a)) |> Printf.printf "%d\n"

Measured memory_bytes: 6292
//Tonight's the night and it is going to happen again and again.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define T ll t; cin>>t; while(t--)
#define mod 1000000007
#define mem(name,val) memset(name,val,sizeof(name))
#define f(n) for(ll i = 0;i<n;i++)
#define endl "\n"
ll gcd(ll a,ll b){if(b==0){return a;}return gcd(b,a%b);}
int main()
{
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
   #endif
   ll x,k,d,ans1,ans2=100000000000000000,min1;
   cin>>x>>k>>d;
   x=abs(x);
   ll y1=x/d;int c=0;
   if(k%2==0&&(y1&1)){y1++;c=1;}
   else if(k%2!=0&&(y1%2==0)){y1++;}
   if(y1<k)
   {
    ans1=abs(x-(d*y1));
    ans2=min(ans2,abs(x-(d*(y1+2))));
    min1=min(ans1,ans2);
    cout<<min1;
   }
   else if(y1==k)
   {
    ans1=x-d*y1;cout<<abs(ans1);
   }
   else
   {
    cout<<abs(x-k*d);
   } 
}

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

int main(){
	int A,B;
	cin >> A >> B;

	int ans=-1;
	for(int i=1; i<1010; i++){
		int tax8 = i*0.08;
		int tax10 = i*0.10;
		if(tax8 == A && tax10 == B) {ans = i; break; }
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt(), x;
		int[] c = new int[n];

		Arrays.fill(c, 0);
		for (int i=0; i<n; ++i)	{
			x = in.nextInt();
			++c[x];
		}

		for (int i=0; i<n; ++i) {
			x = Math.abs(n-1-i-i);
			--c[x];
		}

		for (int i=0; i<n; ++i) {
			if (c[i] != 0) {
				out.println(0);
				return ;
			}
		}

		int m = n / 2;
		int ans = 1;
		int mod = (int)(1e9+7);

		for (int i=0; i<m; ++i) {
			ans = (ans + ans) % mod;
		}

		out.println(ans);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}



Measured memory_bytes: 33592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> x(n); rep (i, n) cin >> x[i];
    ll ans = 0, best = 10000000000;
    repp (y, 1, 101) {
        ll tmp = 0;
        rep (i, n) {
            tmp += (x[i] - y) * (x[i] - y);
        }
        chmin(best, tmp);
    }
    cout << best << "\n";
    return 0;
}

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

int main() {
  int N, x, res;
  cin >> N;
  x = N;
  
  
  for(int i=100000000;i>0;i/=10){
    res += x / i;
    x %= i;
  }
  if(N % res == 0){
    cout << "Yes" << endl; 
  }
  else{
    cout << "No" << endl;  
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define mod 1000000007
int main()
{
ll i,n,j,k,z;
cin>>n;
vector<ll> v,b;map<ll,ll>m;
for(i=0;i<n;i++)
{
    cin>>z;
    v.push_back(z);
    m[z]++;
}
sort(v.begin(),v.end());
for(i=0;i<n-1;i++)
{
    if(v[i]!=v[i+1])
        b.push_back(v[i]);
}
b.push_back(v[i]);
ll counts=0;
for(i=0;i<b.size();i++)
{
    for(j=i+1;j<b.size();j++)
    {
        for(k=j+1;k<b.size();k++)
        {
            if(b[i]+b[j]>b[k])
            {
                counts=counts+(m[b[i]]*m[b[j]]*m[b[k]]);
            }
        }
    }
}
cout<<counts;
}


Measured memory_bytes: 3648
using CompLib.Util;
using System;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        var s = sc.Next();
        Console.WriteLine(new string('x', s.Length));

    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
	int a, b;
	char op;

    while(1) {
		scanf("%d %c %d", &a, &op, &b);
		if (op == '?') break; 
		switch (op) {
		case '+' : printf("%d\n", a + b); break;
		case '-' : printf("%d\n", a - b); break;
		case '*' : printf("%d\n", a * b); break;
		case '/' : printf("%d\n", a / b); break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		long x = sc.nextLong();
		long y = sc.nextLong();
		int length = 0;

		while (true){

			if (x > y){
				break;
			} else {
				length +=1;
			}
			x = x*2;
		}
		System.out.println(length);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
#define sf scanf
#define pf printf
#define REP(i,n) for (int (i) = 0;(i) < (n);++(i))
#define FORN(i,a,b) for (int i = (a);i <=(b); ++i)
#define FORD(i,a,b) for (int i = (a); i >= (b); --i)
#define SORT(list) sort(ALL((list)));
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SIZE(x) ((int)(x).size())
#define IOS  cin.tie(0),cout.tie(0); ios::sync_with_stdio(false);
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
 
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int main() {
    IOS
    
    int a,b;
    cin >> a >> b;
 
    for(double i=1;i<1300;i+=1){
        //cout << i << " " << i*0.08 << " " << i*0.1 << endl;
        if((int)(i*0.08) == a && (int)(i*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
 
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<pair<int,int>> E;
    for (int j=2;j<=N;j++) {
        E.emplace_back(1,j);
    }
    // now there are (N-1)(N-2)/2 pairs (i,j) s.t. dist(i->j)=2
    if (K > (N-1)*(N-2)/2) {
        cout << -1 << endl;
        return 0;
    }
    int l=0;
    for (int i=2;i<N;i++) {
        for (int j=i+1;j<=N;j++) {
            if ((N-1)*(N-2)/2 == K+l) break;
            E.emplace_back(i,j);
            l++;
        }
        if ((N-1)*(N-2)/2 == K+l) break;
    }

    cout << E.size() << endl;
    for (auto itr : E) {
        printf("%d %d\n", itr.first, itr.second); 
    }

    return 0;
}


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

int main()
{
	int n = 0;
	int s = 0;
	int result = 0;
	cin >> n;
	vector <int> a;
	vector <int> b;
	vector <int> c;
	for (int i = 0; i < n; i++) {
		cin >> s;
		a.push_back(s);
	}
	for (int i = 0; i < n; i++) {
		cin >> s;
		b.push_back(s);
		result += s;
	}
	for (int i = 0; i < n - 1; i++) {
		cin >> s;
		c.push_back(s);
	}
	int previous = -1;
	for (int i = 0; i < n; i++) {
		if (a[i] == previous + 1) { result += c[previous - 1]; }
		previous = a[i];
	}
	cout << result;
}

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

int main(void)
{
	string S;
	cin >> S;
	int a = 0, b = 0;

	for (int i = 0; i < S.length(); i += 2) {
		if (S[i] == '1')a++;
		if (S[i] == '0')b++;
	}
	for (int i = 1; i < S.length(); i += 2) {
		if (S[i] == '0')a++;
		if (S[i] == '1')b++;
	}
	int count = min(a, b);

	cout << count << endl;

	return 0;
}

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

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

    int A, B;
    string S;
    cin >> A >> B >> S;

    bool yes = true;
    for (int i = 0; i < S.size(); ++i) {
        if (i < A || A < i) {
            if (S.at(i) < '0' || '9' < S.at(i)) {
                yes = false;
                break;
            }
        } else if (i == A) {
            if (S.at(i) != '-') {
                yes = false;
                break;
            }
        }
    }
    cout << ((yes) ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
  int N, M, T;
  cin >> N >> M >> T;

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

  int ans = T;
  int t1 = a[N];
  int t2 = a[N];
  for (int i = N - 1; i >= 0; i--) {
    if (t2 - a[i] < M * 2 && a[i] != 0) {
      t2 = a[i];
    } else {
      int tmp = ans;
      ans -= (t1 - t2) + M;
      ans -= T - t1 < M ? T - t1 : M;
      t1 = t2 = a[i];
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3100