akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
using namespace std;

int main(){
   int c = 0;
   string s; cin >> s;
   for(int i = 0; i< s.length();i++){
    	if(s[i] == '+')c++;
    	else c--;
   }
   cout << c << endl;
   return 0;
}                  


Measured memory_bytes: 3596
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author vikas.k
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        int[] BIT;
        private static final int MAXN = 200005;

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();

            Long[] sum = new Long[N + 1];
            sum[0] = 0L;

            for (int i = 1; i <= N; i++) {
                sum[i] = in.nextLong();
                sum[i] -= K;
                sum[i] += sum[i - 1];
            }

            HashSet<Long> hash = new HashSet<>(Arrays.asList(sum));
            List<Long> mean = new ArrayList<>();
            mean.addAll(hash);

            Collections.sort(mean);

            BIT = new int[MAXN];
            long ans = 0;
            for (int i = 0; i <= N; i++) {
                int pos = Collections.binarySearch(mean, sum[i]);
                ans += get(pos + 1);
                //out.print(ans + " " + pos);
                add(pos + 1, 1);
            }
            out.println(ans);
        }

        private void add(int k, int v) {
            while (k < MAXN) {
                BIT[k] += v;
                k += k & -k;
            }
        }

        private int get(int k) {
            int ans = 0;
            while (k > 0) {
                ans += BIT[k];
                k -= k & -k;
            }
            return ans;
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

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

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

    }
}



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

using namespace std;

int main()
{
    int x, y;

    cin >> x >> y;

    if(y % 2 == 0 && 2 * x <= y && y <= 4 * x) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int next_combination(int sub)
{
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

int main()
{
    int n;
    cin >> n;
    v<int> N(5, 0);
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        switch (s[0])
        {
        case 'M':
            N[0]++;
            break;
        case 'A':
            N[1]++;
            break;
        case 'R':
            N[2]++;
            break;
        case 'C':
            N[3]++;
            break;
        case 'H':
            N[4]++;
            break;
        default:
            break;
        }
    }
    int bit = (1 << 3) - 1;
    ll ans = 0;
    for (; bit < (1 << 5); bit = next_combination(bit))
    {
        int c = 0;
        ll num = 1;
        for (int i = 0; i < 5; i++)
        {
            if (bit & (1 << i))
            {
                if (N[i] == 0)
                {
                    c++;
                }
                
                num *= N[i];

                if (c == 3)
                {
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
        ans += num;
    }

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

Measured memory_bytes: 3560
#include <stdio.h>
#include <math.h>
#define pai 3.14159265

int main(void)
{
	int r, t;
	int temp = 0;
	double x = 0, y = 0;
	int X, Y;
	
	while(1) {
		scanf("%d,%d", &r, &t);
		if(r == 0 && t == 0) break;
		x += r * sin(temp * pai / 180);
		y += r * cos(temp * pai / 180);
		temp += t;
	}
	X = (int)x;
	Y = (int)y;
	printf("%d\n%d\n", X, Y);
	return 0;
}


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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;++i){
        int p;
        cin >> p;
        v.push_back(p);
    }
    for(int ans=100;ans>=0;--ans){
        int cnt = 0;
        for(auto e: v){
            if(e >= ans)cnt++;
        }
        if(cnt >= ans){
            cout << ans << endl;
            break;
        }
    }

    return 0;
}



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


int main(){
  string s,t;
  cin >> s >> t;
  int n = s.size();
  int count = 0;
  rep(i,n){
    if(s[i] != t[i]) ++count;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3868
def main():
    n,m,x = map(int, input().split())
    A = list(map(int, input().split()))

    c1 = 0
    c2 = 0
    for a in A:
        if a < x:
            c1 += 1
        else:
            c2 += 1

    print(min(c1, c2))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
	int n, a[100000] = {0}, min = 1000000000, min2 = 1000000000;
	scanf("%d", &n);getchar();
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);getchar();
		if(a[i] <= min){
			min2 = min;
			min = a[i];
		}else if(a[i] <= min2){
			min2 = a[i];
		}
	}
	for(int i = min2; i >= 1; i--){
		int notcount = 0;
		for(int j = 0; j < n; j++){
			if(a[j] % i != 0){
				notcount++;
			}
			if(notcount > 1){
				goto label;
			}
		}
		if(notcount == 0 || notcount == 1){
			printf("%d\n", i);
			return 0;
		}
		label:{}
	}
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){
  int a;
  scanf("%d", &a);
  
  if(a%2 == 0){
    printf("%lf", (double)1/2);
  }else if(a == 1){
    printf("%d", 1);
  }else{
    printf("%lf", (double)((1+a)/2)/a);
  }
  return 0;
}


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

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int N;
ll cnt = 0;
vi A;

void solve(){
    rep(i,N){
        int buff = A[i];
        if(A[buff] == i)
            cnt++;
    }

    cout << cnt / 2 << endl;
}

int main(){
    cin >> N;
    A.resize(N,0);
    rep(i,N){
        cin >> A[i];
        A[i]--;
    }
        

    solve();
}


Measured memory_bytes: 640
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace std;

template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

ll dx8[8]={1,0,-1,0,1,-1,1,-1};
ll dy8[8]={0,1,0,-1,1,-1,-1,1};
ll dx4[4]={0,0,1,-1};
ll dy4[4]={1,-1,0,0};



int main(){
    IOS;
    make2(ll,n,m);
    vector <ll> s(m),c(m);
    fr(i,m) cin>>s[i]>>c[i];
    string ans="";
    fr(i,n) ans.push_back('.');
    bool flag=1;
    for(ll i=0;i<m;i++){
           if(ans[s[i]-1]=='.'){
                ans[s[i]-1]=c[i]+'0';
           }
           else if(ans[s[i]-1]!='0'+c[i]) flag=0;
    }
    if(ans[0]=='0' && n>1) flag=0;
    for(ll i=0;i<n;i++) if(ans[i]=='.') ans[i]='0';
    if(ans[0]=='0' && n>1) ans[0]='1';
    if(!flag) cout<<"-1 \n";
    else cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3624
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

int main(){
    int K;
    cin >> K;
    string S;
    for(int i = 0; i < K; i++){
        S += "ACL";
    }
    cout << S << endl;
}

Measured memory_bytes: 3664
(defun get-alice (lst &optional (acc nil))
  (if (null lst)
    acc
    (get-alice (cddr lst) (cons (car lst) acc))))


(defun get-bob (lst &optional (acc nil))
  (get-alice (cdr lst)))


(let* ((n (read))
       (l (sort (loop repeat n
                      collect (read))
                #'>))
       (alice (get-alice l))
       (bob (get-bob l)))

  (format t "~A~%" (- (reduce #'+ alice) (reduce #'+ bob))))


Measured memory_bytes: 24364
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

template<int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
			t = a / b;
			a -= t * b;
			std::swap(a, b);
			u -= t * v;
			std::swap(u, v);
		}
        return ModInt(u);
    }
    ModInt pow(long long e){
        long long a = 1, p = x;
        while(e > 0) {
            if (e & 1) {a = (a * p) % mod; e--;}
            else {p = (p * p) % mod; e /= 2;}
        }
        return ModInt(a);
    }
    friend std::ostream &operator<<(std::ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend std::istream &operator>>(std::istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

template<int mod> struct Combination {
    vector<ModInt<mod>> fact, ifact;
    Combination(int n) : fact(n+1), ifact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = (fact[i - 1] * i);
        ifact[n] = fact[n].inverse();
        for (int i = n; i > 0; i--) ifact[i - 1] = ifact[i] * i;
    }
    ModInt<mod> operator() (int n, int r) {
        if (r < 0 or r > n) return 0;
        return fact[n] * ifact[n-r] * ifact[r];
    }
    const ModInt<mod> &operator[] (int i) const {
        return fact[i];
    }
};

constexpr int MOD = 1'000'000'007;
constexpr int MAX = 2000200;

int main() {
	int k;
	string s;
	cin >> k >> s;
	const int n = int(s.length());
	
	ModInt<MOD> ans = 0, a = 25, b = 26;
	Combination<MOD> binom(MAX);
	for (int x = 0; x <= k; x++) {
		ModInt<MOD> res = binom(n + k - x - 1, n - 1);
		res *= a.pow(k - x) * b.pow(x);
		ans += res;
	}
	
	cout << ans << '\n';
	
	return 0;
}

Measured memory_bytes: 20068
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
#define Maxn 100005
int n,id[Maxn],par[Maxn],sz[Maxn];
long long a[Maxn];
map <long long,int> mp;
int main()	
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i)
	{
		scanf("%lld",&a[i]);
		mp[a[i]]=i;
		id[i]=i;
		sz[i]=1;
	}
	sort(id+1,id+n+1,[&](const int &x,const int &y)->bool{return a[x]>a[y];});
	for (int i=1;i<n;++i)
	{
		int x=id[i];
		par[x]=mp[a[x]-n+2*sz[x]];
		if (!par[x]) return (int)puts("-1")*0;
		sz[par[x]]+=sz[x];
	}
	for (int i=1;i<n;++i) a[id[n]]-=sz[id[i]];
	if (a[id[n]]) return (int)puts("-1")*0;
	for (int i=1;i<n;++i) printf("%d %d\n",id[i],par[id[i]]);
	return 0;
}

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

#define AndIamIronMan ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
 
using namespace std;
 
typedef long long int lli; 
 
int main(){
    
	lli th,ts,ah,as;
	cin>>th>>ts>>ah>>as;
	lli i=1;
	while(th>0 && ah>0){
		if(i%2==1){
			ah-=ts;
		}
		else{
			th-=as;
		}
		i++;
	}
//	cout<<"th"<<th;
	if(th<=0){
		cout<<"No";
	}
	else{
		cout<<"Yes";
	}
    return 0;
}

Measured memory_bytes: 3560
from collections import defaultdict

n = int(input())
al = list(map(int, input().split()))

dp = defaultdict(lambda: -10**18)
dp[(0,0,False)] = 0

for i in range(n):
    for j in range(i//2-1,i//2+2):
        dp[(i+1,j,False)] = max(
            dp[(i,j,False)],
            dp[(i,j,True)]
        )
        dp[(i+1,j,True)] = dp[(i,j-1,False)] + al[i]

print(max(
    dp[(n,n//2,False)],
    dp[(n,n//2,True)]
))


Measured memory_bytes: 321060
while(1):
    x = raw_input()
    x = x.split(" ")
    a = int(x[0])
    op = str(x[1])
    b = int(x[2])
    if(op == "?"):
        break
    elif(op == "+"):
        print a+b
    elif(op == "-"):
        print a-b
    elif(op == "*"):
        print a*b
    elif(op == "/"):
        print a/b



Measured memory_bytes: 4644
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

constexpr int dx[] = {-1, 0, 1, 0};
constexpr int dy[] = {0, -1, 0, 1};

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	string s;
	int q;
	cin >> s;
	cin >> q;
	bool is_rev = false;
	string rev = "";
	REP(i, q) {
		int t;
		cin >> t;
		if(t == 1) {
			is_rev = !is_rev;
		} else {
			int f;
			char c;
			cin >> f;
			cin >> c;
			f += static_cast<int>(is_rev);
			if(f != 2) {
				rev.append(1, c);
			} else {
				s.append(1, c);
			}
		}
	}
	if(!is_rev) {
		reverse(ALL(rev));
		cout << rev << s << endl;
	} else {
		reverse(ALL(s));
		cout << s << rev << endl;
	}

	return 0;
}


Measured memory_bytes: 960
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        int N = sc.nextInt();
        int M = sc.nextInt();
        int flags[] = new int[M];

        for (int i=0;i<M;i++) {
            int flag = 0;
            int k = sc.nextInt();
            for (int j=0;j<k;j++) {
                int s = sc.nextInt();
                flag |= 1 << s;
            }

            flags[i] = flag;
        }

        for (int i=0;i<M;i++) {
            int p = sc.nextInt();
            flags[i] |= p;
        }

        int ans = 0;
        int max = 1 << N;
        for (int i=0;i<max;i++) {
            int sw = (i << 1) | (1);
            boolean is_ok = true;
            for (int j=0;j<M;j++) {
                if (Integer.bitCount(sw & flags[j]) % 2 != 0) {
                    is_ok = false;
                    break;
                }
            }

            if (is_ok) {
                ans++;
            }
        }

        System.out.println(ans);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

Measured memory_bytes: 22100
s=list(input())
t=list(input())
al=lambda x:ord(x)-ord("a")+1 #文字に番号つける　aなら1.zなら26
moji=[0]*27 #その番号の文字は一致してるか 最初の０は数合わせ
moji_num=0 #文字の種類
l=len(s)
ans="Yes"
for i in range(l): #s,tで一致してるもの探す。
    if s[i]==t[i]:
        index=al(s[i])
        if moji[index]==0:
            moji[index]=1
            moji_num+=1
        if moji_num==26:
            break
            
want=[[] for i in range(27)] #その番号の文字がなりたい文字
wanted=[[] for i in range(27)] #その番号の文字になりたい文字
for i in range(l):
    s_str=s[i] #変えるかもしれない文字
    t_str=t[i]
    if s_str!=t_str:
        index1=al(s_str)
        index2=al(t_str)
        if moji[index1]==1 or moji[index2]==1: 
            ans="No"
            #print(i)
            break
        if len(want[index1])!=0: #もうなりたい文字がある
            if want[index1][0]!=t_str:
                ans="No"
                #print(i)
                break
        want[index1].append(t_str)
        if len(wanted[index2])!=0: #もうこの文字になりたい文字がいる
            if wanted[index2][0]!=s_str:
                ans="No"
                #print(i)
                break
        wanted[index2].append(s_str)
print(ans)

Measured memory_bytes: 10152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;

int n, res, x, t, ans;

int main(){
	cin>>x>>n;
	vector<int> vec(n, 0);
	set<int> s;
	for(int i = 0; i <= 101; ++i){
		s.insert(i);
	}
	for(int i = 0; i < n; ++i){
		cin>>vec[i];
		if(s.count(vec[i]))s.erase(vec[i]);
	}
	res = inf;
	for(auto t : s){
		if(abs(t - x) < res){
			res = abs(t - x);
			ans = t;
		}
	}
	cout<<ans<<endl;	
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
using namespace std;

int main() 
{
	fast;
	ll x; cin>>x; ll t = x;
	ll ans = 0;
	for(ll i = 0; ; i++)
	{
		if(x == 0)
		{
			break;
		}
		if(i+1 > x)
		{
			ans = min(ans+1,t);
			break;
		}
		x -= i+1;
		ans++;
	//	dbg(x);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

vector<int> G[101010];
int N,M,D[101010],A[101010],C[101010];
int Q,v[101010],d[101010],c[101010];

int main()
{
	scanf ("%d %d",&N,&M);
	for (int i=0;i<M;i++){
		int x,y;
		scanf ("%d %d",&x,&y);
		G[x].push_back(y);
		G[y].push_back(x);
	}

	scanf ("%d",&Q);
	for (int i=0;i<Q;i++) scanf ("%d %d %d",&v[i],&d[i],&c[i]);
	for (int i=1;i<=N;i++) D[i] = -1;

	for (int q=Q-1;q>=0;q--) if (D[v[q]] < d[q]){
		queue<int> Q;
		D[v[q]] = d[q];
		if (!C[v[q]]) A[v[q]] = c[q];
		Q.push(v[q]); C[v[q]] = 1;
		while (!Q.empty()){
			int x = Q.front(); Q.pop();
			for (auto &y : G[x]){
				if (D[y] < D[x] - 1){
					D[y] = D[x] - 1;
					if (!C[y]) A[y] = c[q];
					Q.push(y); C[y] = 1;
				}
			}
		}
	}

	for (int i=1;i<=N;i++) printf ("%d\n",A[i]);

	return 0;
}

Measured memory_bytes: 9336
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){
      lint n;
      cin>>n;
      lint d[13];
      fill(d,d+13,0);
      lint ans=0;
      rep(i,n){
          lint x; 
          cin>>x;
        d[x]++;
        }
        if(d[0]>0)cout<<0<<endl;
        else{
        rep(i,13){
            if(d[i]>2){
                cout<<0<<endl;
                return 0;
            }
        }
            if(d[12]>1){
                cout<<0<<endl;
                return 0;
            }
            vector<lint> x;
            vector<lint>y;
            x.push_back(0);
            rep(i,13){
                if(d[i]==2){
                    x.push_back(i);
                    x.push_back(24-i);
                }
                if(d[i]==1)y.push_back(i);
            }
            lint t=y.size();
            rep(i,1<<t){
                vector<lint> z;
                z.resize(0);
                rep(j,t){
                    if(i&(1<<j))z.push_back(y[j]);
                    else z.push_back(24-y[j]);
                }
            rep(j,x.size())z.push_back(x[j]);
            lint mn=INF;
            rep(j,z.size()){
                repp(k,j+1,z.size()){
                mn=min({mn,abs(z[k]-z[j]),24-abs(z[k]-z[j])});
                }
            }
             ans=max(mn,ans);
        }
        cout<<ans<<endl;
        }

        }
      
    
  

Measured memory_bytes: 3636
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
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 SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n, m; cin >> n >> m;
    using p = tuple<ll, ll, ll>;
    vector<p> v;
    REP(i, m) {
        ll p, y; cin >> p >> y;
        v.push_back(make_tuple(p, y, i));
    }
    sort(ALL(v));
    map<ll, ll> mc;
    map<ll, string> mp;
    REP(i, m) {
        ll tmp_p = get<0>(v[i]);
        ll tmp_y = get<1>(v[i]);
        ll tmp_i = get<2>(v[i]);
        char s[14];
        sprintf(s, "%06lld%06lld", tmp_p, mc[tmp_p]+1);
        mc[tmp_p]++;
        mp[tmp_i] = s;
    }
    REP(i, m) {
        cout << mp[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 19560
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    int n,m,x,a[120];
    cin>>n>>m>>x;
    for(int i=0;i<m;i++){
        cin>>a[i];
    }
    
    int r1=0;
    int r2=0;
    
    for(int p=0;p<x;p++){
        for(int i=0;i<m;i++){
            if(p==a[i]){
                r1+=1;
            }
        }
                         }
    
    for(int p=x;p<n+1;p++){
        for(int i=0;i<m;i++){
            if(p==a[i]){
                r2+=1;
            }
        }
                            }
    
    if(r1>=r2){
        cout<<r2<<endl;
    }else{
        cout<<r1<<endl;
    }
    
    
    
    
    
    return 0;
}








Measured memory_bytes: 256
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    if N ==1:
        print("Hello World")
    else:
        A = int(input())
        B = int(input())
        print(A+B)

if __name__ == '__main__':
    main()


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

bool all_diff(int a,int b, int c){
    return a!=b && b!=c && c!=a;
}

bool possible_triangle(int a,int b, int c){
    return (a+b>c) && (b+c>a) && (c+a>b);
}

int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("../input.txt", "r", stdin);

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

    int cnt = 0;
    for (int i = 0; i < L.size(); ++i) {
        for (int j = i+1; j < L.size(); ++j) {
            for (int k = j+1; k < L.size(); ++k) {
                if(possible_triangle(L[i],L[j],L[k]) && all_diff(L[i],L[j],L[k])){
                    //cout << i << " " << j << " " << k << "\n";
                    cnt++;
                }
            }
        }
    }

    cout << cnt;

}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll a[3];
  rep(i,3) R a[i];
  sort(a,a+3);
  pr(a[0]+a[1]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int x=0,y=0,z=0;
  scanf("%d%d",&x,&y);
  for(int i=0;i<2;i++)
  {
    if(x>y){
      z=z+x;
      x=x-1;
    }
  else if(x<y){
    z=z+y;
    y=y-1;
  }
    else if(x=y){
      z=z+x;
      x=x-1;
    }
  }
  printf("%d",z);
  return 0;
}
  

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
static void Main(string[] args){
  var N = int.Parse(Console.ReadLine());
  var list=new List<int>();
  for(int i=0;i<N;i++){
  list.Add(int.Parse(Console.ReadLine()));
  }
  list=list.Distinct().ToList();
  Console.WriteLine(list.Count());
}
}

Measured memory_bytes: 13280
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

void a()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b)
    {
        cout << c << endl;
    }else if(a == c)
    {
        cout << b << endl;
    } else{
        cout << a << endl;
    }
    return;
}

void b()
{

}

void c()
{

}

void d()
{

}

int main() {
    a();
    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++)
int main(){
string T; cin >> T; int S=T.size();
REP(i, S){ if(T[i]=='?'){ T[i]='D'; } }
cout << T << "\n";
}

Measured memory_bytes: 3752
#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;


int main(){
  int n;
  cin >> n;
  int res = 0;
  rep(i,n) {
    int l, r;
    cin >> l >> r;
    res += r - l + 1;
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 256
import math
from functools import reduce

def gcd(*numbers):
    return reduce (math.gcd, numbers)


k = int(input())
A=list()

for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
        a=(gcd(i,j,k))
        A.append(a)
print(sum(A))



Measured memory_bytes: 209480
tester = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s = input()

for i in tester:
    if i not in s:
        print(i)
        exit()

print("None")

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

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

    if(1<=a && a<=9){
        if(1<=b && b<=9){
            cout<< a*b <<endl;
        }

        else cout<<"-1"<<endl;
    }

    else cout<<"-1"<<endl;
}

Measured memory_bytes: 256
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#include <bits/stdc++.h>
using namespace std;

//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;

int h,w,c[10][10],a,r;

int main(){
    I(h); I(w);
    REP(i,10) REP(j,10) I(c[i][j]);
    REP(k,10) REP(i,10) REP(j,10) if (c[i][j] > c[i][k] + c[k][j]) c[i][j] = c[i][k] + c[k][j];
    REP(i,h) { REP(j,w) {
        I(a);
        r += a == -1 ? 0 : c[a][1];
    } }
    cout << r << endl;
}


Measured memory_bytes: 256
using System;
class ProgramD
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');

            ulong a = ulong.Parse(input[0]);
            ulong b = ulong.Parse(input[1]);

            if(a < b)
            {
                ulong tmp = a;
                a = b;
                b = tmp;
            }
            ulong r = a % b;
            while(r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }

            ulong c = b;
            ulong d = b;
            ulong count = 1;
            int frag = 0;

            for(ulong i = 2; i <= Math.Sqrt(c); i++)
            {
                while(c % i == 0)
                {
                    c /= i;
                    frag = 1;
                }

                if(frag == 1)
                {
                    count++;
                    frag = 0;
                }  

            }
            
            if(c != 1)
                count++;
          
            if(d == 1)
                count = 1;

            Console.WriteLine(count);
        }


        }

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int n; cin >> n;
  int a[101];
  rep(i, n) cin >> a[i];
  sort(a, a + n);
  int64_t sum = 0;
  int fixer = -1;
  rep(i, n) {
    if (a[i] % 10 && fixer < 0) {
      fixer = a[i];
    }
    sum += a[i];
  }
  if (sum % 10 == 0 && fixer > 0) {
    cout << sum - fixer << "\n";
  } else if (sum % 10 == 0 && fixer == -1) {
    cout << "0\n";
  } else {
    cout << sum << "\n";
  }
}


Measured memory_bytes: 256
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 1e5+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

// vector<int> adj[N];
// bool vis[N]={0};

// void dfs(int x)
// {
//     vis[x]=1;
        
//     for(auto it:adj[x])   
//     if(!vis[it])
//     dfs(it);
        
// }




int main()
{
    ll n,m,ans=0;
    lscf(n),lscf(m);

    ll a[N][3];

    rep(i,1,n+1)
    {
        rep(j,0,3)
        lscf(a[i][j]);
    }

    rep(i,0,8)
    {
        vector<ll>v;


        rep(j,1,n+1)
        {
             ll x=0;

            rep(k,0,3)
            {
                if((i/(1<<k))%2==0) 
                    x+=a[j][k];

                 else x-=a[j][k];
            }
            
            v.pb(x);
        
        }

        sort(all(v),greater<ll>());

            ll val=0;

        rep(l,0,m)
        val+=v[l];

        ans=max(ans,val);
    }
    

 

    lprin(ans);
    
    }

Measured memory_bytes: 3808
from itertools import accumulate

n, q = map(int, input().split())
s = list(input())
#print(s)
z = []
for i in range(n-1):
    if s[i] + s[i+1] == 'AC':
        z.append(1)
    else:
        z.append(0)
#print(z)

z = [0] + list(accumulate(z))
#print(z)

for j in range(q):
    l, r =  map(int, input().split())
    print(z[r-1] - z[l-1])


Measured memory_bytes: 9496
<?php  
//list($n, $k) = explode(' ', trim(fgets(STDIN))); 
list($n1, $n2) = str_split(trim(fgets(STDIN)), 2);
$a = 1;
  if(1 <= intval($n1) && intval($n1)<= 12){
    $a |= 2;
  }
  if(1 <= intval($n2) && intval($n2)<= 12){
    $a |= 4;
  }
switch ($a){
  case 1:
    printf('NA');
    break;
  case 3:
    printf('MMYY');
    break;
  case 5:
    printf('YYMM');
    break;
  case 7:
    printf('AMBIGUOUS');
    break;      
}

?>

Measured memory_bytes: 4728
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Map<Long, Integer> mm = new HashMap<>();
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = in.nextInt();
            long sum = 0;
            mm.put(0L, 1);
            long res = 0;
            for (int i = 0; i < n; ++i) {
                sum += a[i];
                if (mm.containsKey(sum)) {
                    res += mm.get(sum);
                    mm.put(sum, mm.get(sum) + 1);
                } else {
                    mm.put(sum, 1);
                }
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 89228
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1e9+7;
ll fac[100001];
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}


int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll ans=log2(n)+1;
    ans=pow(2,ans)-1;
    cout<<ans;

	return 0;
}


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

using namespace std;

int main() {
	long long int n;
	cin >> n;
	vector<long long int> p(n);
	for (long long int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	vector<long long int> a(n);
	vector<long long int> b(n);
	a[0] = 1;
	for (long long int i = 1; i < n; i++) {
		a[i] = a[i-1]+20000;
	}
	for (long long int i = n-1; i >= 0; i--) {
		b[p[i]] = 1000000000-(n-i)-a[p[i]];
	}
	cout << a[0];
	for (long long int i = 1; i < n; i++) {
		cout << ' ' << a[i];
	}
	cout << endl;
	cout << b[0];
	for (long long int i = 1; i < n; i++) {
		cout << ' ' << b[i];
	}
	cout << endl;
	return 0;
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return true; } return false;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return true; } return false;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> a(n);
  REP(i,n)cin >> a[i];
  int64 ans = 0;
  REP(i,n){
    if(i > 0 && a[i-1] > 0 && a[i] > 0){
      a[i]--;
      ++ans;
    }
    int64 cnt = a[i] / 2;
    ans += cnt;
    a[i] -= cnt * 2;
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int cnt=0;
	for(int i=0;i<s.size();i++){
		int j;
		for(j=i+1;j<s.size();j++){
			if(s[j]!=s[j-1])break;
		}
		cnt++;
		i=j-1;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
#include <unordered_map>
#include <stack>
#include <map>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmaxj(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; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; } //true==yes


#define INF 21474836

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

int main() {

	int R;
	cin >> R;

	double ans = 3.14 * R * 2.0f;

	cout << ans << endl;

}


Measured memory_bytes: 3240
d,n=map(int,input().split())

if d==0:
  cnt=0
  i=1
  while 1:
    if i%100!=0:
      cnt+=1
    if cnt==n:
      print(i)
      exit()
    i+=1
else:
  cnt=0
  i=1
  waru=100**d
  while 1:
    if i%waru==0 and (i//waru)%100 !=0 :
      cnt+=1
    if cnt==n:
      print(i)
      exit()
    i+=1


Measured memory_bytes: 40300
use proconio::*;

const MAX: usize = 1 << 18;

struct Solver {
    item: Vec<(u32, usize)>,
    query: Vec<Vec<(usize, usize)>>,
    elem: Vec<bool>,
    ans: Vec<u32>,
}

impl Solver {
    fn dfs1(&mut self, v: usize, mut dp: Vec<u32>) {
        let (a, b) = self.item[v];
        for i in (b..dp.len()).rev() {
            dp[i] = std::cmp::max(dp[i], dp[i - b] + a)
        }
        for &(w, k) in self.query[v].iter() {
            self.ans[k] = dp[w];
        }
        if 2 * v >= (1 << 9) {
            if self.elem[2 * v] {
                self.dfs2(2 * v, &dp, vec![(0, 0)]);
            }
            if self.elem[2 * v + 1] {
                self.dfs2(2 * v + 1, &dp, vec![(0, 0)]);
            }
        } else {
            if self.elem[2 * v] {
                self.dfs1(2 * v, dp.clone());
            }
            if self.elem[2 * v + 1] {
                self.dfs1(2 * v + 1, dp);
            }
        }
    }
    fn dfs2(&mut self, v: usize, dp: &[u32], mut p: Vec<(u32, usize)>) {
        let (a, b) = self.item[v];
        for i in 0..p.len() {
            let (x, y) = p[i];
            p.push((x + a, y + b));
        }
        for &(w, k) in self.query[v].iter() {
            let mut ans = 0;
            for &(a, b) in p.iter().filter(|p| p.1 <= w) {
                ans = std::cmp::max(ans, a + dp[w - b]);
            }
            self.ans[k] = ans;
        }
        if v >= MAX / 2 {
            return;
        } else {
            if self.elem[2 * v] {
                self.dfs2(2 * v, dp, p.clone());
            }
            if self.elem[2 * v + 1] {
                self.dfs2(2 * v + 1, dp, p);
            }
        }
    }
}

#[fastout]
fn run() {
    input! {
        n: usize,
        mut item: [(u32, usize); n],
        q: usize,
        ask: [(usize, usize); q],
    }
    while item.len() < MAX {
        item.push((0, 0));
    }
    item.insert(0, (0, 0));
    let mut query = vec![vec![]; MAX + 1];
    let mut elem = vec![false; MAX + 1];
    for (i, &(v, w)) in ask.iter().enumerate() {
        query[v].push((w, i));
        elem[v] = true;
    }
    for i in (2..=MAX).rev() {
        elem[i / 2] |= elem[i];
    }
    let mut solver = Solver {
        item: item,
        query: query,
        elem: elem,
        ans: vec![0; q],
    };
    solver.dfs1(1, vec![0; 100000 + 1]);
    for a in solver.ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 24892