akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
    int N,L,sum=0,min=99999999,ans;
    cin>>N>>L;
    for(int i=0;i<N;i++){
        sum+=L+i;
    }
    for(int i=0;i<N;i++){
        int a=sum-i-L;
        if(abs(sum-a)<min) min=abs(sum-a),ans=a;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
X = int(input())

a = 2
b = 1

n = int((X ** (1 / 5)) // 1) * 100
# print(n)


for a in range(1, n + 10):
    minus = 1
    b5 = (a ** 5) - X
    if b5 < 0:
        minus = -1
        b5 *= - 1
    b = int(pow(b5, (1 / 5)))
    if (a ** 5 - b ** 5 * minus) == X:
        # print(X)
        print(a, b * minus)
        # print(a, b * minus)
        exit()



Measured memory_bytes: 62372
#include<cstdio>
#include<algorithm>
using namespace std;const int N=1e3+10;char mp[N][N];char res1[N][N];char res2[N][N];
int n;int m;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",mp[i]+1);
	for(int i=1;i<=n;i++)res1[i][1]='#';for(int i=1;i<=n;i++)res2[i][m]='#';
	for(int i=1;i<=n;i++)res1[i][m]='.';for(int i=1;i<=n;i++)res2[i][1]='.';
	for(int i=1;i<=n;i+=2)for(int j=2;j<m;j++)res1[i][j]='#';
	for(int i=2;i<=n;i+=2)for(int j=2;j<m;j++)res2[i][j]='#';
	for(int i=2;i<=n;i+=2)for(int j=2;j<=m;j++)res1[i][j]=mp[i][j];
	for(int i=1;i<=n;i+=2)for(int j=1;j<m;j++)res2[i][j]=mp[i][j];
	for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)printf("%c",res1[i][j]);printf("\n");}
	printf("\n");
	for(int i=1;i<=n;i++){for(int j=1;j<=m;j++)printf("%c",res2[i][j]);printf("\n");}
	printf("\n");return 0;
}

Measured memory_bytes: 2176
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
b=list(map(int,input().split()))
ans=[]
while True:
    f=False
    for i in range(len(b)-1,-1,-1):
        if b[i]!=i+1:
            continue
        else:
            ans.append(b[i])
            b.pop(i)
            f=True
            break
    if not b:
        break
    if not f:
        print(-1)
        exit()
for i in range(n):
    print(ans[n-1-i])

Measured memory_bytes: 38640
#if 1

#include <bits/stdc++.h>
using namespace std;
int n;
int a[55];
int sum;

int main() {
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    for(int i = 1;i <= n;i++) {
        for(int j = i+1;j <= n;j++) {
            sum += a[i]*a[j];
        }
    }
    cout << sum;
}

#endif


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
bool check(string s,int i,int j) {
    string ss = s.substr(i,j-i+1);
    string sss= ss;
    reverse(ss.begin(),ss.end());
    return ss==sss;
}
int main() {
	// your code goes here
long double n;
cin>>n;
n/=3;
cout<<setprecision(10)<<fixed<<n*n*n<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;
int main() {
  long n, v;
  cin >> n >> v;
  vector<long> a[4];
  for (int i = 0; i < 4; ++i) {
    a[i].resize(n);
    for (int j = 0; j < n; ++j)
      cin >> a[i][j];
  }
  multiset<long> ab, cd;
  for (long x : a[0])
    for (long y : a[1])
      ab.insert(x + y);
  for (long x : a[2])
    for (long y : a[3])
      cd.insert(x + y);
  long ct = 0;
  for (auto ab_it = ab.begin(); ab_it != ab.end();) {
    long x = *ab_it;
    auto ab_next = ab.upper_bound(x);
    if (cd.count(v - x)) {
      ct += distance(ab_it, ab_next) *
            distance(cd.lower_bound(v - x), cd.upper_bound(v - x));
    }
    auto first_past_rem = cd.lower_bound(v - x);
    if (first_past_rem == cd.begin())
      break;
    ab_it = ab.lower_bound(v - *prev(first_past_rem));
  }
  cout << ct << endl;
}


Measured memory_bytes: 96884
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
#define Rep(i,a) for(int i = 0; i < a; i++)
using namespace std;
const int N = 200010;
typedef long long LL;
int n, fa[N], w[N], ch[N][2], d[N];
typedef pair<LL, LL> node;
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define x first
#define y second
vector<node> f[N], a, b;
void merge(vector<node> &c, vector<node> &a, vector<node> &b) {
	int l = a.size(), i = 0, j = 0;
	while (i < l || j < l) {
		if (i == l) c.pb(b[j++]);
		else if (j == l) c.pb(a[i++]);
		else if (a[i] <= b[j]) c.pb(a[i++]);
		else c.pb(b[j++]);
	}
}
bool check(LL mx) {
	rep(i,1,n) { vector<node>().swap(f[i]); f[i].clear(); }
	dep(i,n,1) if (!d[i]) f[i].pb(mp(LL(w[i]), LL(w[i])));
	else {
		if (f[ch[i][0]].size() > f[ch[i][1]].size()) swap(ch[i][0], ch[i][1]);
		int l = f[ch[i][0]].size(), r = f[ch[i][1]].size(), j = 0, lc = ch[i][0], rc = ch[i][1];
		if (!l || !r) return false;
		a.clear(), b.clear();
		Rep(k,l) {
			while (j + 1 < r && f[lc][k].y + f[rc][j + 1].x <= mx) j++;
			if (f[lc][k].y + f[rc][j].x <= mx) a.pb(mp(f[lc][k].x + w[i], f[rc][j].y + w[i]));
		}
		int len = a.size(); dep(k,len - 1, 0) b.pb(mp(a[k].y, a[k].x));
		merge(f[i], a, b);
        len = f[i].size(); rep(k,1,len - 1) f[i][k].y = min(f[i][k].y, f[i][k - 1].y);
	}
	return f[1].size() > 0;
}
int main() {
	scanf("%d",&n);
	rep(i,2,n) scanf("%d%d",&fa[i],&w[i]);
	rep(i,2,n) ch[fa[i]][d[fa[i]]++] = i;
	LL l = -1, r = 1LL * N * N;
	while (l + 1 < r) {
		LL mid = (l + r) >> 1;
		if (check(mid)) r = mid; else l = mid;
	}
	printf("%lld\n",r);
	return 0;
}

Measured memory_bytes: 29276
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramC
    {
        static void Main()
        {
            int n = NextInt, m = NextInt;
            var h = IntList;
            var array = Enumerable.Repeat(0, n).ToArray();
            var count = Enumerable.Repeat(0, n).ToArray();
            for (int i = 0; i < m; i++)
            {
                int a = NextInt - 1, b = NextInt - 1;
                count[a]++;
                count[b]++;
                if (h[a] > h[b]) array[a]++;
                if (h[a] < h[b]) array[b]++;
            }

            System.Console.WriteLine(Enumerable.Range(0, n).Count(i => array[i] == count[i]));
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


Measured memory_bytes: 49708
// Problem : D - Road to Millionaire
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


#include<bits/stdc++.h>
#define 	ll		    long long
#define 	rep(i,a,n)  for(int i=a;i<n;i++)
#define 	MOD 		1000000007
#define 	vp 			vector<pair<int,int> >
#define 	ff 			first
#define 	ss 			second
#define 	pb 			push_back
#define 	all(x) 		(x.begin(),x.end())
#define 	dg(x)		cerr<<"--- x = "<<x<<"\n"
#define 	endl		"\n"


using namespace std;
const int N = 1e5;
ll ar[N];

void solve(){
	int n; cin >> n;
	ll money = 1000;
	rep(i,1,n+1)
		cin >> ar[i];
		
	rep(i,2,n+1){
		if(ar[i] > ar[i-1]){
				ll q =  money / ar[i-1];
				money =  money % ar[i-1];
				money += (ar[i] * q);
		}
	}
	cout << money ;
	
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a;
#define lcoutln(a) cout << a << endl;
#define lcerr(a) cerr << a;
#define lcerrln(a) cerr << a << endl;
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007

signed main()
{
	init();
	solve();
}

int sx, sy, tx, ty;
int x, y;

void init()
{
	cin >> sx >> sy >> tx >> ty;
	x = tx - sx;
	y = ty - sy;
}



void solve()
{
	rep(i, y) cout << 'U';
	rep(i, x) cout << 'R';
	rep(i, y) cout << 'D';
	rep(i, x) cout << 'L';
	cout << 'L';
	rep(i, y+1) cout << 'U';
	rep(i, x+1) cout << 'R';
	cout << 'D';
	cout << 'R';
	rep(i, y+1) cout << 'D';
	rep(i, x+1) cout << 'L';
	cout << 'U' << endl;

}


Measured memory_bytes: 256
N=gets.to_i
a=gets.split.map(&:to_i)
left = Array.new(N+1, 0)  # left[i]:  [0, i)のgcd
right = Array.new(N+1, 0) # right[i]: [i, N)のgcd
N.times do |i|
    left[i+1] = a[i].gcd(left[i])
end
(0..N-1).to_a.reverse.each do |i|
    right[i] = a[i].gcd(right[i+1])
end
ans = 0
N.times do |i|
    l = left[i]
    r = right[i+1]
    ans = [ans, l.gcd(r)].max
end
puts ans



Measured memory_bytes: 14348
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
typedef int64_t ll;


int main() {
    ll N, P, ans = 0, Odd = 0, Even = 0;
    cin >> N >> P;
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        if (a % 2 == 0){
            Even++;
        }
        else {
            Odd++;
        }
    }
    for (int i = 0; i <= Odd; i += 2){
        ll a = 1;
        for (int j = 0; j < i; j++){
            a = a * (Odd - j) / (j + 1);
        }
        ans += a;
    }
    ans *= pow(2, Even);
    if (P == 0){
        cout << ans << endl;
    }
    else {
        cout << (ll)pow(2, N) - ans << endl;
    }


}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main
{
	static int base[][]=new int[12][12];
	static int ans;
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())
		{
			
			String str;
			for(int i=0;i<12;i++)
			{
				str=in.next();
				for(int j=0;j<12;j++)
				{
					if(str.charAt(j)=='0')
						base[i][j]=0;
					else if(str.charAt(j)=='1')
						base[i][j]=1;
				}
			}
			ans=0;
			for(int i=0;i<12;i++)
				for(int j=0;j<12;j++)
				{
					if(base[i][j]==1)
					{
						solve(i,j);
						ans++;
					}
				}
			System.out.println(ans);
			
		}
	}
	public static void solve(int m, int n)
	{
			if(base[m][n]==1)
			{
				base[m][n]=2;
				if(m-1>=0&&base[m-1][n]==1)
					solve(m-1,n);
				if(m+1<12&&base[m+1][n]==1)
					solve(m+1,n);
				if(n-1>=0&&base[m][n-1]==1)
					solve(m,n-1);
				if(n+1<12&&base[m][n+1]==1)
					solve(m,n+1);
			}
	}
}

Measured memory_bytes: 11000
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(a<b && b<c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;


ll x,y;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);

cin >>x>>y;

int ans =0;
while (x<=y) {
ans++;
x*=2;
}

cout<<ans<<endl;
  

  return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n)
    {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }

    int ans = 1001001001;
    for (int bit = 0; bit < (1 << n); bit++)
    {
        int price = 0;
        vector<int> algo(m, 0);
        for (int i = 0; i < n; i++)
        {
            if (bit & (1 << i))
            {
                price += c[i];
                rep(j, m) algo[j] += a[i][j];
            }
        }
        bool ck = true;
        rep(i, m)
        {
            if (algo[i] < x)
                ck = false;
        }
        if (ck)
            ans = min(ans, price);
    }

    cout << (ans == 1001001001 ? -1 : ans) << '\n';
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,m,k[1000],i,a[201],b[201],c[201],p,j,flg;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d",&k[i]);
	}
	for(i=1;i<=2*n;i++) a[i]=i;
	for(i=0;i<m;i++){
		flg=0;
		if(k[i]==0){
			k[i]=n; flg=1;
		}
		for(j=1;j<=k[i];j++){
			b[j]=a[j];
		}
		p=1;
		for(j=k[i]+1;j<=2*n;j++){
			c[p]=a[j];
			p++;
		}
		if(flg==0){
			for(j=1;j<p;j++){
				a[j]=c[j];
			}
			for(j=p;j<=2*n;j++){
				a[j]=b[j-p+1];
			}
		}
		else{
			p=1;
			for(j=1;j<=n;j++){
				a[p]=b[j];
				a[p+1]=c[j];
				p+=2;
			}
		}
	}
	for(i=1;i<=2*n;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}

Measured memory_bytes: 2692
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

bool check(const V<ll> &P) {
    ll now = -1;
    for(auto &&e : P) {
        if(now > e) return false;
        now = e;
    }
    return true;
}

bool solve() {
    ll N;
    cin >> N;
    V<ll> P(N);
    for(auto &&e : P) cin >> e;
    for(ll i = 0; i < N; i++) for(ll j = i; j < N; j++) {
        auto cpy = P;
        swap(cpy[i], cpy[j]);
        if(check(cpy)) return true;
    }
    return false;
}

int main() {
    cout << (solve() ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:56 on 2019-09-28.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    ll even = n / 2;
    double odd = n - even;
    cout << fixed << setprecision(10) << odd / n << endl;
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main(){
    int a,b,N; 
    cin >> a >> b >> N;
    int s[N],f[N];
    for(int i=0;i<N;i++){
        cin >> s[i] >> f[i];
    }
    int flag,fin;
    for(int i=0;i<N;i++){
        if(f[i]<=a){
            flag = 0;
        }else if(b<=s[i]){
            flag = 0;
        }else{
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 3132
import sys
import numpy as np
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


A, B, K = mi()

for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A //= 2
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B //= 2

print(A, B)


Measured memory_bytes: 12408
#include <bits/stdc++.h>
using namespace std;
const int maxn= 1e5+10;
int n, m;
int p[maxn];
int main () {
    scanf ("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf ("%d%d", &a, &b);
        p[a]++; p[b]++;
    }
    bool ok = true;
    for (int i = 1; i <= n; i++) if (p[i]%2!=0)
        ok = false;
    if (ok) printf ("YES\n");
    else printf ("NO\n");
}


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

int main(){
	int n;
	cin >> n;
	vector<double> x(n);
	double t;
	for(int i = 0; i < n; i++) {
		cin >> x[i];
	}
  	sort(x.begin(), x.end());
  	for(int i = 0; i < n-1; i++) {
		x[i+1] = (x[i+1] + x[i])/2;
	}
	printf("%.7lf\n", x[n-1]);
}


Measured memory_bytes: 256
def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

s = [0] * (100001)
for i in range(1, 10**5+1): 
    if i%2 == 1 and is_prime(i) and is_prime((i+1)//2):
        s[i-1] = 1

lst = [0] * (100001)
for i in range(10**5):
    lst[i+1] = lst[i] + s[i]

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

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

Graph G;
vector<vector<ll>> dp;

void dfs(int v, int p = -1) {
    dp[v][0] = dp[v][1] = 1;

    for (auto nv : G[v]) {
        if (p == nv)
            continue;
        dfs(nv, v);
        (dp[v][0] *= (dp[nv][0] + dp[nv][1])) %= MOD;
        (dp[v][1] *= dp[nv][0]) %= MOD;
    }
}

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

    int N;
    cin >> N;
    G.resize(N);
    dp.resize(N, vector<ll>(2));
    for (int i = 0; i < N - 1; ++i) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    int s = 0;
    dfs(s);
    cout << (dp[s][0] + dp[s][1]) % MOD << endl;

    return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,a,b; cin>>n>>a>>b;
	string s; cin>>s;
	vector<int> qual(n,false);
	int x=a+b, y=b;
	for (int i=0; i<n; i++) {
		if(s[i]=='a') {
			if(x>0) qual[i]=true, x--;
		} else if(s[i]=='b') {
			if(x>0&&y>0) qual[i]=true, x--, y--;
		}
	}
	for (int i=0; i<n; i++) {
		cout<<(qual[i]?"Yes":"No")<<"\n";
	}
	return 0;
}


Measured memory_bytes: 1232
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200010;
int d1[N],d2[N],n;
int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            int x,y;
            cin>>x>>y;
            d1[i]=x+y;
            d2[i]=x-y;
        }
        sort(d1+1,d1+1+n);
        sort(d2+1,d2+1+n);
        cout<<max(d1[n]-d1[1],d2[n]-d2[1])<<'\n';
    }
    return 0;
}


Measured memory_bytes: 5228
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)

int main() { 
  int n;cin>>n;
  int a=INF,b = 0;
  rep(i,n){
    int c;cin >>c;
    a = min(a,c);
    b = max(b,c);
  }
  cout << b-a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;cin>>n;
  int x=(n+1000-1)/1000;
  cout<<x*1000-n<<endl;
}

Measured memory_bytes: 3612
uses
	SysUtils,
	Classes;

procedure MainProc;
	var
		text : string;
		strlist : TStringList;
	begin
	ReadLn(text);
	strlist := TStringList.Create;
	try
		strlist.Delimiter := ' ';
		strlist.DelimitedText := text;
		strlist.Sort;
		if strlist.Count = 3 then
			WriteLn(StrToInt(strlist[0]) + StrToInt(strlist[1]) + (StrToInt(strlist[2]) * 10));
	finally
			FreeAndNil(strlist);
			end;
	end;

begin
MainProc;
end.

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

using namespace std;

typedef long long ll;

ll n, k;
const ll maxk = 1e5+5;
ll dp[2][maxk]; // use former i to distribute k's ways
ll s[2][maxk]; //prefix sum dp
ll MOD = 1e9+7;

int main()
{
  cin >> n >> k;
  for(ll i = 0ll; i <= k; i++) s[0][i]=s[1][i]=0ll;
  ll tmp; bool c = 0;
  //first
  cin >> tmp;
  dp[c][0ll] = 1ll, s[c][0ll] = 1ll;
  //not k bugged
  for(ll i = 1ll; i <= k; i++) {dp[c][i] = (i<=tmp)?1ll:0ll; s[c][i] = (s[c][i-1ll] + dp[c][i])%MOD;}//no mod
  //other
  for(ll i = 2ll; i <= n; i++)
  {
    //for(int i = 0; i <= k; i++) cout << dp[c][i] << endl;
    //cout << "nxt" << endl;
    cin >> tmp;
    //dp[c^1][0ll] = i; bugged
    //s[c^1][0ll] = i; bugged
    for(ll j = 0ll; j <= k; j++) //to distribute
    {
      ll canleft = j - tmp; //to distribute - now can distibute
      if(canleft> 0ll) dp[c^1][j] = ((s[c][j]-s[c][canleft-1ll])+MOD)%MOD; //dp[mark] + dp[mark+1] + ... + dp[j]
      else dp[c^1][j] = s[c][j];
      s[c^1][j] = (s[c^1][j-1ll]+dp[c^1][j])%MOD;
    /*
      dp[c^1][j] = 0;
      for(ll x = 0; x <= min(tmp,j) ; x++)
        dp[c^1][j] = (dp[c^1][j] + dp[c][j-x])%MOD;
    */
    }
    c ^= 1;
  }
  cout << dp[c][k] << endl;
  return 0;
}


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

#define double long double
#define int long long
#define ALL(x) x.begin(),x.end()
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 998244353 
#define F(i, a, n) for(i=a;i<n;i++)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)


int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    string s;
    SI(s);
    vi inversionRight;
    vi inversionLeft;
    int n = s.length();
    F(i, 0, n - 1)
    {
    	if(s[i] == 'R' && s[i + 1] == 'L')
    	{
    		inversionRight.pb(i);
    		inversionLeft.pb(i + 1);
    	}
    }
    int dp[n];
    memset(dp, 0, sizeof(dp));
    F(i, 0, n)
    {
    	if(s[i] == 'R')
    	{
    		int x = *lower_bound(ALL(inversionRight), i);
    		if((x - i) % 2)
    			dp[x + 1]++;
    		else
    			dp[x]++;	
    	}
    	if(s[i] == 'L')
    	{
    		int x = lower_bound(ALL(inversionLeft), i) - inversionLeft.begin();
    		if(inversionLeft[x] != i)
    			x--;
    		x = inversionLeft[x];
    		if((i - x) % 2)
    			dp[x - 1]++;
    		else
    			dp[x]++;
    	}
    }
    
    F(i, 0, n)
    	cout << dp[i] << " ";
    cout << "\n";
    
    #ifdef LOCAL
    	cout<<endl<<endl<<"Time: "<<(float)clock()/CLOCKS_PER_SEC<<" seconds"<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 2372
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int a,b,c;
      //string s;
      cin >> a >> b >> c;
      //cin >> s;
      if(c<=(a+b))cout << "Yes" << endl;
      else cout << "No" << endl;
      //cout << 2018 << s.substr(4,6) << endl;
      return 0;
    }

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

bool x_dp[2][40100];
bool y_dp[2][40100];

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

  int x, y;
  cin >> x >> y;

  int pos_x = 0, pos_y = 0;

  int n = s.size();

  vector<int> xv, yv;
  REP(i, n) {
    if(s[i] == 'F') pos_x++;
    else break;
  }

  int now = 1;
  int len = 0;
  for (int i = pos_x + 1; i < n; i++) {
    if (s[i] == 'F') {
      len++;
    } else {
      if(len > 0) {
        if(now == 0) xv.push_back(len); 
        else yv.push_back(len);
      }
      now = 1 - now;
      len = 0;
    }
  }
  if(len > 0) {
    if(now == 0) xv.push_back(len); 
    else yv.push_back(len);
  }

  x_dp[0][pos_x + 20000] = true;
  int x_sum = pos_x;
  REP(i, (int)xv.size()) {
    x_sum += xv[i];
    for(int j = -x_sum; j <= x_sum; j++){
      x_dp[(i + 1) % 2][j + 20000] = x_dp[i % 2][j + 20000 - xv[i]] || x_dp[i % 2][j + 20000 + xv[i]];
    }
  }

  y_dp[0][20000] = true;
  int y_sum = pos_y;
  REP(i, (int)yv.size()) {
    y_sum += yv[i];
    for(int j = -y_sum; j <= y_sum; j++){
      y_dp[(i + 1) % 2][j + 20000] = y_dp[i % 2][j + 20000 - yv[i]] || y_dp[i % 2][j + 20000 + yv[i]];
    }
  }

  Yes(x_dp[(int)xv.size() % 2][x + 20000] && y_dp[(int)yv.size() % 2][y + 20000])

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
void solve()
{
	vector<vector<int>>a(3,vector<int>(3));
	vector<vector<int>>c(3,vector<int>(3));
	rep(i,3)rep(j,3)cin>>a[i][j];
	int n;
	cin>>n;
	vector<int>b(n);
	rep(i,n)cin>>b[i];
	rep(i,3)rep(j,3){
		rep(k,n){
			if(b[k]==a[i][j])c[i][j]=1;
		}
	}
	bool bingo=false;
	rep(i,3){
		int cnt=0;
		rep(j,3){
		if(c[i][j])cnt++;
		}
		if(cnt==3){
			bingo=true;
		}
	}
	rep(i,3){
		int cnt=0;
		rep(j,3){
		if(c[j][i])cnt++;
		}
		if(cnt==3){
			bingo=true;
		}
	}
	int cnt=0;
	int cnt2=0;
	rep(i,3){
		if(c[i][i])cnt++;
	}
	if(cnt==3){
			bingo=true;
	}
	rep(i,3){
		if(c[i][2-i])cnt2++;
	}
	if(cnt2==3){
			bingo=true;
	}
	if(bingo){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}


}

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


Measured memory_bytes: 256
from math import sqrt


def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(sqrt(n)) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


N = int(input())

result = 0
for p, e in prime_factorize(N):
    i = 1
    while e >= i:
        result += 1
        e -= i
        i += 1
print(result)


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

int main(){
	int a,b;
	cin>>a>>b;
	double x,y,z,w;
	x=a/0.08;
	y=(a+1)/0.08;
	z=b/0.1;
	w=(b+1)/0.1;
	int ans;
	if(w>x&&y>z)cout<<ceil(max(x,z));
	else cout<<-1;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int r,d,x;
    cin>>r>>d>>x;
    for(int i=1;i<=10;i++)
    {
        x=r*x-d;
        cout<<x<<endl;
    }
    return 0;
}

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

int main(void){
	int i;
	char a[100];
	scanf("%s",a);
	for(i=0;i<strlen(a);i++){
		if(a[i]!=',')printf("%c",a[i]);
		else printf(" ");
	}
	printf("\n");
	return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int n;
long long ret;
vector<int> adj[200000];

void dfs(int u, int p) {
    for (int v : adj[u])
        if (v != p) {
            ret -= (long long) (min(u, v) + 1) * (n - max(u, v));
            dfs(v, u);
        }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> n;
    for (int i=0; i<n-1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    for (int i=0; i<n; i++)
        ret += (long long) (i + 1) * (n - i);
    dfs(0, -1);

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 23824
#include <vector>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n, m, r, ax[100009], ay[100009], bx[100009], by[100009], p[85]; vector<int> d[10009];
int main() {
	while (scanf("%d%d%d", &n, &m, &r), n | m | r) {
		r *= 4;
		for (int i = 0; i < n; i++) scanf("%d%d", &ax[i], &ay[i]);
		for (int i = 0; i < m; i++) {
			scanf("%d%d", &bx[i], &by[i]);
			d[bx[i]].push_back(by[i]);
		}
		for (int i = 0; i < 10000; i++) sort(d[i].begin(), d[i].end());
		for (int i = -r; i <= r; i++) {
			p[i + r] = sqrt(r * r - i * i);
		}
		long long ret = 0;
		for (int i = 0; i < n; i++) {
			for (int j = -r; j <= r; j++) {
				int cx = ax[i] + j;
				if (0 <= cx && cx < 10000) {
					int ptl = lower_bound(d[cx].begin(), d[cx].end(), ay[i] - p[j + r]) - d[cx].begin();
					int ptr = lower_bound(d[cx].begin(), d[cx].end(), ay[i] + p[j + r] + 1) - d[cx].begin();
					ret += ptr - ptl;
				}
			}
		}
		for (int i = 0; i < 10000; i++) d[i].clear();
		printf("%lld\n", ret);
	}
	return 0;
}

Measured memory_bytes: 6088
import java.util.*;
class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt(),n=sc.nextInt();
        long ans = 0;
        int count = 0;
        while(count<n){
            ans ++;
            boolean marker = true;
            long tmp = ans;
            for(int i = 0;i<d;i++){
                if(tmp%100==0){
                    tmp/=100;
                } else {
                    marker =false;
                    break;
                }
            }
            if(marker&&tmp%100!=0){
                count ++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#include<cstdio>
#include<cstring>
using namespace std;

int ss; char chr;
inline int read(){
	ss=0; chr=getchar();
	while(chr<'0'||chr>'9') chr=getchar();
	while('0'<=chr&&chr<='9') ss=ss*10+chr-'0',chr=getchar();
	return ss;
}

const int N=1e5+7;
int n,m,pren[N],num,hhh;
int tot=-1,last[N],pre[2*N],to[2*N];
int idx,dfn[N],low[N],vis_p[N];
bool vis_e[N],bridge[N];

inline void add(int xx,int yy){
	++tot;
	pre[tot]=last[xx];
	to[tot]=yy;
	last[xx]=tot;
}

void tarjan(int u){


	vis_p[u]=1;
	dfn[u]=low[u]=++idx;
	for(int c=last[u],v;c!=-1;c=pre[c])
		if(!vis_e[c])
		{
			vis_e[c]=vis_e[c^1]=true;
			v=to[c];
			if(!vis_p[v])
			{
				pren[v]=u;
				tarjan(v);
				if(low[v]<low[u]) low[u]=low[v];
				if(dfn[u]<low[v])
				{
					++num;
					bridge[v]=true;
				}
			}
			else
				if(vis_p[v]==1&&dfn[v]<low[u])
					low[u]=dfn[v];
		}
	vis_p[u]=2;
}

int main(){
	n=read(); m=read();
	memset(last,-1,sizeof(last));
	int i,u,v;
	for(i=1;i<=m;++i)
	{
		u=read(); v=read();
		add(u,v); add(v,u);
	}
	pren[1]=1;
	tarjan(1);
	for(i=1;i<=n;++i)
		if(bridge[i])
			hhh++;
			printf("%d",hhh);
}


Measured memory_bytes: 640
from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def mod_inv(a, m):
    return pow(a, m-2, m)


MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))


_lcm = 1
for a in A:
    _lcm = lcm(_lcm, a)

ans = _lcm * sum([mod_inv(s, MOD) for s in A]) % MOD

print(int(ans % MOD))


Measured memory_bytes: 6140
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define sec second
#define fir first
#define mo 1000000007
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)

ll mod(ll n) { return (n % (ll)mo + (ll)mo)%(ll)mo;}
int main(){
	ll n;
	cin>>n;
	
	vector<ll> cnt(60005,0);
	
	rep(x,1,101){
		rep(y,1,101){
			rep(z,1,101){
				ll a = x*x + y*y + z*z + x*y + y*z + z*x;
				++cnt[a];
			}
		}
	}
	rep(i,1,n+1){
		cout<<cnt[i]<<endl;
	}
}
		 

Measured memory_bytes: 3676
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (auto ss : s) {
		if (ss + n > 'Z')
			cout << (char)(ss + n - 26);
		else
			cout << (char)(ss + n);
	}
	cout << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define endl "\n"

int main()
{
  i64 X;
  cin >> X;
  for (i64 i = 0;; i++)
    if (1800 - 200 * i <= X)
    {
      cout << i + 1 << endl;
      return 0;
    }
  return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

#define sz(x) (int)(x).size()
#define pb push_back
#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

mt19937 rng (chrono::steady_clock::now().time_since_epoch().count() );

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int MX = 3e5 + 12; //check the limits, dummy

int main()
{

    ios_base::sync_with_stdio (0);
    cin.tie (0);

    ll a, b;
    cin >> a >> b;
    ll g = __gcd (a, b);

    ll ans = (a * b) / g;

    cout << ans << '\n';

    return  0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  if (n % k == 0)
    cout << 0 << endl;
  else
    cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n,i,x1,x2,min,max;
    long long sum;
    scanf("%d %d",&n,&x1);
    min = x1;
    max = x1;
    sum = x1;
    for( i = 2;n >= i;i++){
        scanf("%d",&x2);
        if(min >= x2){
            min = x2;
        }else{
            min = min;
        }
        if(max <= x2){
            max = x2;
        }else{
            max = max;
        }
        sum = sum + x2;
    }
    printf("%d %d %lld\n",min,max,sum);
    
    return 0;
}


Measured memory_bytes: 2740
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>

const int MOD_CONST = 1000000007;

using namespace std;


bool comp(const pair<int, int>& task1, const pair<int, int>& task2) {
	if (task1.second < task2.second) {
		return true;
	}
	else if (task1.second == task2.second) {
		return task1.first > task2.first;
	}
	return false;
}
int main() {
	int n;
	cin >> n;
	vector<pair<int, int>> task;

	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		task.emplace_back(make_pair(a, b));

	} 

	long long time = 0;
	sort(task.begin(), task.end(), comp);


	bool canFinish = true;
	for (int i = 0;i < n; i++) {
		time += task[i].first;
		if (time > task[i].second) {
			canFinish = false;
			break;
		}
	}

	cout << (canFinish ? "Yes" : "No") << endl;
}

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

int main() {
	int n; scanf("%d", &n);

	multiset <int> s;

	vector <int> a(n + 1);
	for(int i = 1; i <= n; i++) {
		int x; scanf("%d", &x);
		a[i] = x;
		s.insert(x);
	}

	for(int i = 1; i <= n; i++) {
		s.erase(s.find(a[i]));

		printf("%d\n", *(--s.end()));

		s.insert(a[i]);
	}

	return 0;
}

Measured memory_bytes: 13184
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            String str = sc.next();
            if(str.equals("-")) break;
            int m = sc.nextInt();
            for(int i=0; i<m; i++){
                int h = sc.nextInt();
                str = str.substring(h) + str.substring(0, h);
            }
            System.out.println(str);
        }
    }
}


Measured memory_bytes: 26244
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	char b;
	cin >> b;
	
	char ans;
	if (b == 'A') {
		ans = 'T';
	} else if (b == 'C') {
		ans = 'G';
	} else if (b == 'G') {
		ans = 'C';
	} else {
		ans = 'A';
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
using pll = pair<ll, ll>;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using ti3 = tuple<int, int, int>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
#pragma warning(disable:4996)
#define INF 1000000000000000.0
int main() {
	int n;
	while (cin >> n, n) {
		vector<string> buf(n);
		for (auto &a : buf) {
			string b;
			cin >> b;
			a += b[0];
			for (int i = 0; i < b.length() - 1; i++) {
				switch (b[i]) {
				case 'a':case'i':case'u':case'e':case'o':
					a += b[i + 1];
				}
			}
		}
		sort(ALL(buf));
		if (buf.end() - unique(ALL(buf))) {
			cout << -1 << endl;
			continue;
		}
		int ans = 0;
		rep(i, buf.size()-1) {
			int k = -1;
			rep(j, buf[i].size()) {
				if (buf[i][j] != buf[i + 1][j]) {
					ans = max(ans, j + 1);
					k = 0;
					break;
				}
			}
			if (k)ans = max(ans, (int)buf[i].length() + 1);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
const ll mod = 998244353;
int gcd(int a, int b) {
	if (a < b)swap(a, b);
	return b == 0 ? a : gcd(b, a%b);
}
int ans, k;
int main() {
	cin >> k;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= k; j++) {
			for (int p = 1; p <= k; p++) {
				ans += gcd(i, gcd(j, p));
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
	cin >> s;
	int ret = s.size(), d = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == 'S') d++;
		if(s[i] == 'T' && d >= 1) ret -= 2, d--;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
 #include<string.h>
 int main(void)
 {
     char S[100];
     int N,i,j=0,T;

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

     if(strlen(S)==N){
     T=N/2;
     for(i=0;i<T;i++)
      if(S[i]==S[T+i]) j++;

     if((T==j)&&(N%2==0)) printf("Yes\n");
     else                 printf("No\n");
 }
     return 0;
 }



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

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

    int alen = A.length(), blen = B.length();


    int ans = 0;
    if( alen == blen ){
        for( int i = 0; i < alen; ++i ){
            if( A[i] > B[i] ){
                ans = 1;
                break;
            } else if( A[i] < B[i] ){
                ans = -1;
                break;
            }
        }
    } else if( alen > blen ){
        ans = 1;
    } else {
        ans = -1;
    }


    if( ans == 1 ) cout << "GREATER" << endl;
    else if( ans == -1 ) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#pragma GCC optimize("Ofast")
int main(){
	long long x,y=1,m=100;
	scanf("%lld",&x);
	while(1){
		m=m*1.01;
		if(m>=x){ printf("%lld", y); return 0; }
		y++;
	}
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<vector>
#include<algorithm>
#include<cctype>
#include<math.h>
#include<stdlib.h>
#include<stack>
#include<ctime>
#include<bitset>
#include<list>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define eps 1e-4
inline int lowbit(int x){return x&-x;}
//inline int the_mod(int &a,int &b){a=((a)%(b)+(b))%(b);}
const int N = 1e6+10;
const long long mod = (long long)998244353;
const int INF=0x3f3f3f3f;
const long long LINF=(1LL<<62);
typedef long long LL;
typedef unsigned long long ULL;
//#define LOCAL
const double PI = acos(-1.0);
using namespace std;

int a[3005];

int main(){
#ifdef LOCAL
    freopen("out.txt", "w", stdout);
#endif // LOCAL
    int n;
    scanf("%d",&n);
    int sum = 0;
    for(int i = 0; i < n; i++){
      scanf("%d",&a[i]);
      sum+=(a[i]-1);
    }
    printf("%d\n",sum);
    return 0;
}



Measured memory_bytes: 256