akhauriyash/Code-Regression huggingface dataset:
using System.Linq;
using System.Collections.Generic;
using System;

public class hello
{
    public static string[] dot;
    public static int plen, cnum, width, cspace;
    public static void Main()
    {
        while (true)
        {
            plen = int.Parse(Console.ReadLine().Trim());
            if (plen == 0) break;
            cnum = int.Parse(Console.ReadLine().Trim());
            width = int.Parse(Console.ReadLine().Trim());
            cspace = int.Parse(Console.ReadLine().Trim());
            dot = new string[width + 1];
            for (int i = 0; i <= width; i++) dot[i] = new string('.', i);
            var text = new List<string>();
            while (true)
            {
                var s = Console.ReadLine().Trim();
                if (s == "?") break;
                addText(text, s);
            }
            addDot(text);
            print(text);
        }
    }
    static void print(List<string> t)
    {
        var pc = plen * cnum;
        var imax = t.Count() / (pc);
        var line = new string[cnum];
        for (int i = 0; i < imax; i++)
        {
            for (int j = 0; j < plen; j++)
            {
                for (int k = 0; k < cnum; k++)
                {
                    var p = i * pc + j + k * plen;
                    line[k] = t[p];
                }
                var spL = new string('.', cspace);
                Console.WriteLine(string.Join(spL, line));

            }
            Console.WriteLine("#");
        }
        Console.WriteLine("?");
    }
    static void addDot(List<string> t)
    {
        var pg = (t.Count() + plen * cnum - 1) / (plen * cnum);
        var adddot = pg * plen * cnum - t.Count();
        for (int i = 0; i < adddot; i++) t.Add(dot[width]);
    }
    static void addText(List<string> t, string s)
    {
        if (s == "") { t.Add(dot[width]); return; }
        var imax = (s.Length + width - 1) / width;
        var p = 0;
        for (int i = 0; i < imax; i++)
        {
            if (i == imax - 1)
            {
                var ss = s.Substring(p);
                t.Add(ss + dot[width - ss.Length]);
            }
            else
            {
                var ss = s.Substring(p, width);
                t.Add(ss);
                p += width;
            }
        }
    }
}


Measured memory_bytes: 16180
inp_ls = input().split(" ")
a,b,c,d = [int(e) for e in inp_ls[:4]]

turn = 0
while True:
	if a <= 0:
		print("No")
		break
	if c <= 0:
		print("Yes")
		break
	if turn % 2 == 0:
		c -= b
	else:
		a -= d
	turn += 1

Measured memory_bytes: 9144
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int W = scan.nextInt();
        int H = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int r = scan.nextInt();
        if(0 <= x-r && x+r <= W && 0 <= y-r && y+r <= H){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26424
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int a = int.Parse(input[2]);
        int b = int.Parse(input[3]);*/
//        string temp = ReadLine();
        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
        WriteLine(a/3);
    }
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


inline bool check(string s){
    string ss = s;
    reverse(allof(ss));
    return ss==s;
}

int main() {
string s;
    cin>>s;
    if(!check(s)){
        puts("No");
        return 0;
    }
    if(!check(s.substr(0, sz(s)/2))){
        puts("No");
        return 0;
    }
    puts("Yes");

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static class Node {
		int key;
		Node left;
		Node right;
		
		public Node(int key) {
			this.key = key;
		}
	}
	
	Node root;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			if(s.startsWith("i")) {
				insert(sc.nextInt());
			}else {
				inorder(root);
				System.out.println();
				preorder(root);
				System.out.println();
			}
		}
		sc.close();
	}
	
	void preorder(Node u) {
		if(u == null) return;
		System.out.print(" " + u.key);
		preorder(u.left);
		preorder(u.right);
	}
	
	void inorder(Node u) {
		if(u == null) return;
		inorder(u.left);
		System.out.print(" " + u.key);
		inorder(u.right);
	}
	
	void insert (int key) {
		Node y = null;
		Node x = root;
		Node z = new Node(key);
		while (x != null) {
			y = x;
			if(z.key < x.key) {
				x = x.left;
			} else {
				x = x.right;
			}
		}
		if(y == null) {
			root = z;
		} else if (z.key < y.key) {
			y.left = z;
		}else {
			y.right = z;
		}
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


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

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rept(i,n) for(int i=n;i>0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(v) v.bigin(),v.end()

using namespace std;

int main(){
    int h,n;
    
    cin>>h>>n;
    int a[n];
    rep(i,n){
        cin>>a[i];
        h-=a[i];
        }
    if(h<=0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}




Measured memory_bytes: 3944
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
                        
using namespace std;
                        
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
                        
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define ghost signed
#define left left228
#define right right228
#define complex complex228
#define count count228
#define sin sin228
#define list list228

const int N = 2005;
const int MOD = 1e9 + 7;

int cnt[N], p[N];

struct inverse
{
	int inv;
	int cop;
	inverse() {inv = cop = 0;}
	inverse(int _inv, int _cop) {
		inv = _inv, cop = _cop;
	}
};
inverse operator*(inverse A, inverse B) {
	inverse AB = inverse();
	AB.cop = A.cop + B.cop;
	AB.inv = (A.inv + B.inv) % MOD;
	for (int i = 1; i < N; ++i) {
		AB.inv += (((cnt[i] * B.cop) % MOD) * ((p[i - 1] * A.cop) % MOD)) % MOD;
		AB.inv %= MOD;
	}
	return AB;
}

ghost main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n + 1);
	for (int i = 1; i <= n; ++i) cin >> a[i], ++cnt[a[i]];
	for (int i = 1; i < N; ++i) p[i] = p[i - 1] + cnt[i];
	inverse A = inverse();
	A.cop = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			if (a[i] > a[j]) ++A.inv;
		}
	}
	inverse res = inverse();
	while (k) {
		if (k & 1) {
			res = res * A;
		}
		A = A * A;
		k >>= 1;
	}
	cout << res.inv << '\n';
	return 0;
} // kek ;
// Ого! Кажетсья это $#@!



















Measured memory_bytes: 256
N = gets.chomp.to_i
AS = []
N.times { AS.push(gets.chomp.to_i) }

arr = [AS[0]]
arr2 = [[AS[0]]]

1.upto(N - 1) do |i|
  if AS[i] <= arr[0]
    arr.unshift(AS[i])
    arr2.unshift([AS[i]])
    next
  end
  if AS[i] > arr[-1]
    arr[-1] = AS[i]
    arr2[-1].push(AS[i])
    next
  end
  a = 0
  b = arr.size - 1
  while a < b
    c = (a + b) / 2
    if arr[c + 1] < AS[i]
      a = [c, a + 1].max 
    elsif arr[c] >= AS[i]
      b = [c, b - 1].min
    else
      a = b = c
    end
  end
  arr[c] = AS[i]
  arr2[c].push(AS[i])
end

puts arr.size


Measured memory_bytes: 10644
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<iostream>
#include <stdlib.h>
#include<ctime>
#include <string>
#include<string.h>
#include<algorithm>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a > b + b)
	{
		cout << a - b - b << endl;
	}
	else
	{
		cout << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){rev|=c=='-';c=Getchar();if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------head---------------------------------------------

const int inf=0x3f3f3f3f;
const int N=200005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,k,ans,fa[N];
vi g[N];

inline int dfs(int x){
	int mx=0;
	for(int y:g[x])
		gmax(mx,dfs(y));
	mx++;
	if(mx==k&&fa[x]!=1) ans++,mx=0;
	return mx;
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	read(n,k);
	for(int i=1;i<=n;i++)
		read(fa[i]);
	if(fa[1]!=1) ans++;
	for(int i=2;i<=n;i++)
		g[fa[i]].pb(i);
	for(int i:g[1])
		dfs(i);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    string a; cin >> a;

    vec A(N);
    REP(i, N) A[i] = a[i] - '1';
    
    bool f = true;
    REP(i, N) if(A[i] == 1) f = false;

    if(f){
        REP(i, N) A[i] /= 2;
    }

    int ans = 0;
    REP(i, N) if(A[i] == 1){
        if((i & (N - 1)) == i) ans++;
    }
    ans %= 2;
    if(f) ans *= 2;
    Out(ans);


    return 0;
}


Measured memory_bytes: 9244
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int W = sc.nextInt();

		int[] w = new int[N];
		int[] v = new int[N];

		for (int i = 0; i < N; i++) {
			w[i] = sc.nextInt();
			v[i] = sc.nextInt();
		}

		long[][] dp = new long[N + 1][W + 1];
		for (int i = 0; i <= W; i++) {
			dp[N][i] = 0;
		}

		for (int i = N - 1; i >= 0; i--) {
			for (int j = 0; j <= W; j++) {
				if (j < w[i]) {
					dp[i][j] = dp[i + 1][j];
				} else {
					dp[i][j] = Math.max(
							dp[i + 1][j],
							dp[i + 1][j - w[i]] + v[i]);
				}
			}
		}

		out.println(dp[0][W]);

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 127316
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;


struct SegmentTree {
  using T = pair<int, lint>; // (len, sum)
  static T op(const T& x, const T& y) { return max(x, y); }
  static constexpr T e() { return {0, 0}; }

  const int n;
  V<T> t;
  SegmentTree(int n) : n(n), t(2 * n, e()) {}
  T& operator[](int i) { return t[i + n]; }
  void build() { for (int i = n - 1; i; --i) t[i] = op(t[2 * i], t[2 * i + 1]); }
  T acc(int l, int r) const {
    T resl = e(), resr = e();
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) resl = op(resl, t[l++]);
      if (r & 1) resr = op(t[--r], resr);
    }
    return op(resl, resr);
  }
  void set(int i, const T& x) {
    t[i += n] = x;
    while (i >>= 1) t[i] = op(t[2 * i], t[2 * i + 1]);
  }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // dp[i] := a[i]で終わるもの
  // dp[i] = max{(dp[j] + 1) | j < i and a[j] < a[i]}
  int n; cin >> n;
  V<> a(n); for (auto&& e : a) cin >> e;
  V<> idx(n);
  iota(begin(idx), end(idx), 0);
  sort(begin(idx), end(idx), [&](int i, int j) { return a[i] != a[j] ? a[i] < a[j] : i > j; });
  SegmentTree dp(n);
  for (int i : idx) {
    auto p = dp.acc(0, i);
    dp.set(i, {p.first + 1, p.second + a[i]});
  }
  auto res = dp.acc(0, n).second;
  cout << res << '\n';
}


Measured memory_bytes: 6852
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

int main()
{
	std::string S, T, U;
	unsigned long long A, B;

	std::cin >> S >> T >> A >> B >> U;

	if (S.compare(U) == 0) {
		--A;
	}
	else {
		--B;
	}

	std::cout << A << " " << B;



	return 0;
}

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

int main() {
  string S;
  cin>>S;
  vector<int>A(11);
  int a=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A'||S.at(i)=='T'||S.at(i)=='G'||S.at(i)=='C'){
      a++;
    }
    else{
      A.at(i)=a;
      a=0;
    }
  }
  A.at(10)=a;
  sort(A.begin(),A.end());
  cout<<A.at(10)<< endl;
}
    
     


Measured memory_bytes: 256
#include <stdio.h>

int x, y;

int main(void) {
    while (1) {
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) break;
        if (x < y) {
            printf("%d %d\n", x, y);
        } else {
            printf("%d %d\n", y, x);
        }
    }
    
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;

/*
べき乗の計算
*/

using ull = unsigned long long;

/*
  aのn乗を m を法として計算したものを返す
  O[logn]
  [x^nは(x^2)^(n/2)に等しい]ことを利用して，
  再帰関数を用いて実装する．
*/

ull power(ull x, ull n, ull M){
  ull res = 1;
  if( n > 0 ){
    res = power(x, n / 2, M);
    if( n % 2 == 0) res = (res*res) % M;
    else res =(((res * res) % M) * x ) % M;
  }
  return res;
}



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

  int mod = 1e9 + 7;
  ull ans = power(m, n, mod);

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3100
n=int(input())
d=dict()
for a in map(int,input().split()):
  if a not in d:
    d[a]=1
  else:
    d[a]+=1
m=int(input())
t=dict()
for a in map(int,input().split()):
  if a not in t:
    t[a]=1
  else:
    t[a]+=1
  if a not in d:
    d[a]=0
ans="YES"
for i in t.keys():
  if not t[i]<=d[i]:
    ans="NO"
print(ans)

Measured memory_bytes: 67424
#include<iostream>
using namespace std;
void change(int a,int b,int c)
{
    if(a>b)
    {int sum=a;
        a=b;
        b=sum;
    }
    if(a>c)
    { int sum=a;
        a=c;
        c=sum;
    }
    if(b>c)
    {int sum=c;
        c=b;
        b=sum;
    }
cout<<a<<" "<<b<<" "<<c<<endl;
}

int main()
{
    int num1,num2,num3;
    cin>>num1>>num2>>num3;
    change(num1,num2,num3);
    
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s; cin >> s;
  if(s.size() % 2 == 1) {
    cout << "No" << endl;
  } else {
    for(int i = 0; i < s.size(); i++) {
      if(i % 2 == 0) {
        if(s[i] != 'h') {
          cout << "No" << endl;
          return 0;
        }
      } else {
        if(s[i] != 'i') {
          cout << "No" << endl;
          return 0;
        }
      }
    }
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> V[1000005];
ll ans[1000005];
ll book[1000005];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, m;
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        ll x, y;
        cin >> x >> y;
        V[x].push_back(y);
        V[y].push_back(x);
    }
    queue<ll> Q;
    Q.push(1);
    ll cnt = 0;
    book[1] = 1;
    while(!Q.empty())
    {
        ll p = Q.front();
        Q.pop();
        cnt++;
        for(int i = 0; i < V[p].size(); i++)
        {
            ll op = V[p][i];
            if(book[op] == 0)
            {
                book[op] = 1;
                ans[op] = p;
                Q.push(op);
            }
        }
    }
    //cout << ""
    int bj = 0;
    for(int i = 2; i <= n; i++)
    {
        if(ans[i] == 0)
        {
            bj = 1;
            break;
        }
    }
    if(bj == 1)
    {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    for(int i = 2; i <= n; i++)
    {
        cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 34988
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>

using namespace std;

#define MAX(a, b)  a>b?a:b

int main()
{
	int h, w, n;
	int paint;

	cin>>h>>w>>n;

	paint = MAX(h,w);

	cout<<(n+paint-1)/paint<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int k;

int main() {
  cin >> k;
  
  // kが10と互いの素かどうか
  if (k % 2 == 0 || k % 5 == 0) {
    cout << "-1";
  } else {

    int ans = 1;
    ll remain = 7;
    
    for (int i = 0; i <= k; i++) {
      remain %= k;
      if (remain == 0) break;
      ans += 1;
      remain = remain * 10 + 7;
    }
    cout << ans;
  }
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

/* greedy, implementation */

const int maxn = 1e5;
int A[maxn], B[maxn];

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    int n;
    while (cin >> n) {
        for (int i = 0; i < n; i++)
            cin >> A[i];
        for (int i = 0; i < n; i++)
            cin >> B[i];
        int i = 0, j = 0;
        for (; j < n; ) {
            if (A[j] > B[j]) {
                while (i < n && B[i]-A[i] <= 1)
                    i++;
                if (i == n)
                    break;
                const int x = (B[i]-A[i])/2;
                const int d = min(x,A[j]-B[j]);
                B[j] += d;
                A[i] += 2*d;
                if (A[j] == B[j])
                    j++;
            }
            else
                j++;
        }
        if (j == n)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


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

using namespace std;

#define int long long

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

    int n;
    cin >> n;

    vector<int> v(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }

    //後ろからみてく
    for (int i = 0; i < n - 1; ++i)
    {
        int& r = v[n - i - 1];
        int& l = v[n - i - 2];

        if (l <= r)
        {
            continue;
        }

        l--;

        if (l <= r)
        {
            continue;
        }

        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

// -------------------------------------------------------
const int MAX = 1010101;

ll binom[100][100];

void binom_init() {
  binom[0][0] = 1;
  binom[1][0] = 1;
  binom[1][1] = 1;

  repe(i, 2, 50) {
    binom[i][0] = 1;
    repe(j, 1, i) { binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j]; }
  }
}

ll N, A, B;
ll v[100];

int main() {
  binom_init();
  cin >> N >> A >> B;
  rep(i, 0, N) { cin >> v[i]; }
  sort(v, v + N, greater<ll>());
  ll sum = 0;
  rep(i, 0, A) { sum += v[i]; }
  long double sumd = sum;
  cout << setprecision(20) << fixed << sumd / A << endl;

  ll lastv = v[A - 1];
  ll lastvcnt = 0;
  ll ulastv = 0;
  rep(i, 0, N) {
    if (v[i] > lastv) ++ulastv;
    if (v[i] == lastv) ++lastvcnt;
  }

  ll ans = 0;
  if (ulastv == 0) {
    repe(i, A, B) {
      ll num = i - ulastv;
      ans += binom[lastvcnt][num];
    }
  } else {
    ll num = A - ulastv;
    ans += binom[lastvcnt][num];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <functional>
#include <bitset>

#include <boost/range/irange.hpp>
using boost::irange;

#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;

#include <boost/function_output_iterator.hpp>


using namespace std;


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

    int n;
    cin >> n;
    vector<int> ls(n);
    for(auto& l : ls) cin >> l;
    const auto s = accumulate(begin(ls), end(ls), 0);
    const auto max = *max_element(begin(ls), end(ls));
    if(max < s-max)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  double res = 0;
  for(int i = 0; i < n; i++){
    double a;
    cin >> a;
    res += 1.0/a;
  }
  printf("%.10lf\n", 1.0 / res);
}

Measured memory_bytes: 256
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 300 + 5 ;
int n , k , dp[N][N][N] ;
string s ;

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

	cin >> s ;
	cin >> k ;

	n = _sz(s) ;

	for (int l = n - 1 ; l >= 0 ; l --) {
		for (int r = l + 1 ; r <= n ; r ++) {
			for (int t = 0 ; t <= k ; t ++) {
				if (r - l == 1) dp[l][r][t] = 1 ;
				else {
					if (s[l] == s[r - 1]) dp[l][r][t] = dp[l + 1][r - 1][t] + 2 ;
					else {
						dp[l][r][t] = max(dp[l][r][t] , dp[l + 1][r][t]) ;
						dp[l][r][t] = max(dp[l][r][t] , dp[l][r - 1][t]) ;
						if (t) dp[l][r][t] = max(dp[l][r][t] , dp[l + 1][r - 1][t - 1] + 2) ;
					}
				}
			}
		}
	}

	cout << dp[0][n][k] << '\n' ;
}

Measured memory_bytes: 110848
#include <stdio.h>

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

    int a[N + 1], b[N + 1], out[N + 1];
    for (int i = 1; i < N + 1; i++)
        scanf("%d", &a[i]);

    int count = 0;
    for (int i = N; i > 0; i--) {
        int sum = a[i];
        for (int j = i + i; j < N + 1; j += i)
            sum += b[j];
        if (b[i] = sum % 2)
            out[count++] = i;
    }
    
    printf("%d\n", count);
    while (count--)
        printf("%d ", out[count]);

    return 0;
}

Measured memory_bytes: 3072
<?php
// ??????????????????????????????
function bomber($data, $x, $y){
	if($x > 0 && $y > 0 && $x < 9 && $y < 9 && $data[$y][$x] > 0){
		// ??????
		$data[$y][$x] = 0;

		// ?????????????????????????????????
		for($i = 1; $i <= 3; $i++){
			$data = bomber($data, $x-$i, $y);
			$data = bomber($data, $x+$i, $y);
			$data = bomber($data, $x, $y-$i);
			$data = bomber($data, $x, $y+$i);
		}

	}

	return $data;
}


// ????????????????????°??????
$count = intval(fgets(STDIN));


$dataset = array();	// ????????????????????¨???????????????
$total = 11 * $count;	// ???????????§??\?????????????¨???????????????????????????????????????????11??????????????????+8???+x??§?¨?+y??§?¨?
$now = 0;		// ?????????????????????????????????????¨??????¨

while($line = fgets(STDIN)){
	$line = trim($line);
	// ???????????????????????????????????????????¨????
	if($line == ""){
		$now++;
		$dataset[$now] = array();
		$col = 1;
	}else{
		if($col == 10){
			// y??§?¨?
			$dataset[$now]["y"] = intval($line);
		}else if($col == 9){
			// x??§?¨?
			$dataset[$now]["x"] = intval($line);
			$col++;
		}else{
			$dataset[$now][$col] = array();
			for($row = 1; $row <= 8; $row++){
				$dataset[$now][$col][$row] = intval(substr($line, $row-1, 1));
			
			}
			$col++;
		}
	}
	
	


	$total--;
	if($total < 1) break;
}


foreach($dataset as $key => $data){
	// ??????????????????????????????????????????
	$x = $data["x"]; 
	$y = $data["y"];
	
	// ??????????????????????¶????
	unset($data["x"]);
	unset($data["y"]);
	
	// ???????????????
	$data = bomber($data, $x, $y);
	
	echo "Data {$key}:\n";
	foreach($data as $row){
		echo implode($row)."\n";
	}

}

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

int main(){
  int N;
  cin >> N;
  vector<string> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  string ans = "Yes";
  for(int j=0; j<N-1; j++){
    string S1 = vec.at(j);
    string S2 = vec.at(j+1);
    int size = S1.size() - 1;
    if(S1.at(size) != S2.at(0)){
      ans = "No";
    }
    for(int k=0; k<N; k++){
      if((j != k) && vec.at(j) == vec.at(k)){
        ans = "No";
      }
    }
  }
  cout << ans  << endl;    
}

Measured memory_bytes: 256
s = gets.chomp.to_s
n = s.length
s1 = s[0..(n-3)/2]
s2 = s[(n+1)/2..n-1]
 
def kaibun(m)
  result = true
  for i in 1..(m.length) do
    if m[i-1] != m[-i] then
      result = false
      break
    end
  end
  return result
end
   
if kaibun(s) && kaibun(s1) && kaibun(s2) then
  print 'Yes'
else
  print 'No'
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	set<int>st;
	int n,val, flag=0; cin>>n;
	for(int i=0;i<n;i++){
		cin>>val;				
		if(st.count(val)) 
			flag=1;
		st.insert(val);
	}
	cout<<(flag?"NO":"YES")<<'\n';
	return 0;
}


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

int main(){
  bool is_prime[100000];

  is_prime[0] = is_prime[1] = false;
  for(int i=2; i<100000; i++){
    is_prime[i] = true;
  }

  for(int i=2; i*i<100000; i++){
    if(is_prime[i]){
      for(int j=i*i; j<100000; j+=i){
	is_prime[j] = false;
      }
    }
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
      break;

    for(int i=n-1; i>=2; i--){
      if(is_prime[i]){
	cout << i << ' ';
	break;
      }
    }
    for(int i=n+1; i<=60000; i++){
      if(is_prime[i]){
	cout << i << endl;
	break;
      }
    }
  }

  return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;

signed main(){
    int S;
    cin >> S;
    int x, y;
    const int m = 1000000000;
    x = (m - (S % m))%m;
    y = (x + S)/m;
    cout << "0 0 1000000000 1 " << x << " " << y << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C, K = map(int, input().split())

cnt = 0
cntA = min(A, K)

K -= cntA
if K == 0:
    print(cntA)
    exit()

cntB = min(B, K)
K -= cntB

if K == 0:
    print(cntA)
    exit()

cntC = min(C, K)
K -= cntC

print(cntA - cntC)
exit()


Measured memory_bytes: 9132
import math
a = int(input())
b = math.sqrt(a)   
count = 10 ** 8
for i in range(1,round(b)+1):
    if a % i == 0:
        j = a // i
        if len(str(i)) >= len(str(j)):
            if count > len(str(i)):
                count = len(str(i))
        else:
            if count > len(str(j)):
                count = len(str(j))
print(count)

Measured memory_bytes: 3064
/*#          #  # # # # #  # # # # #  # # # # #  #          #
  #          #  #       #  #       #  #          #          #
  # # # # # ##  # # # # #  ## # # #   # # # # #  # # # # # ##
  #          #  #       #  #    #             #  #          #
  #          #  #       #  #      #   # # # # #  #          #*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define iofile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define ump unordered_map<int,int>
#define st set<int>
#define ust unordered_set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define sumofdigits(sum,num) int sum = 0; while (n != 0) { sum = sum + n % 10; n = n/10; }
#define int2str(str,n) n=boost::lexical_cast<int>(str);
#define float2str(str,n) n=boost::lexical_cast<float>(str);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
int32_t main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        pair<int,int> arr[n];
        rep(i,n)
        {
            int tt;
            cin>>tt;
            arr[i]=make_pair(tt,i);
        }
        sort(arr,arr+n);
        rep(i,n)
        {
            cout<<arr[i].second+1<<" ";
        }
    }
    return 0;
}


Measured memory_bytes: 2432
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// Union-Find木 //////////

struct UnionFind{
  vector<int> par,siz;						//par[i]:iの親の番号
  UnionFind(int N):par(N),siz(N,1ll){		//最初は全てが根であるとして初期化
    for(int i=0; i<N; i++) par[i]=i;
  }
  
  int root(int x){						//データxが属する木の根
    if(par[x]==x) return x;
    return par[x]=root(par[x]);
  }
  
  void unite(int x,int y){				//xとyの木を併合
    int rx=root(x);
    int ry=root(y);
    if(rx==ry) return;
    if(siz[rx]<siz[ry]) swap(rx,ry);
    siz[rx]+=siz[ry];
    par[ry]=rx;
  }
  
  bool same(int x,int y){				//x,yが属する木が同じならtrueを返す
    int rx=root(x);
    int ry=root(y);
    return rx==ry;
  }
  
  int size(int x){
    return siz[root(x)];
  }
};

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

int main(){
  ll N,M;
  cin>>N>>M;
  ll A[M],B[M],ANS[M];
  REP(i,M){
    cin>>A[i]>>B[i];
    ANS[i]=N*(N-1)/2;
  }
  
  UnionFind P(N+1);
  for(int i=M-1; i>0; --i){
    ll cnt=P.size(A[i])*P.size(B[i]);
    if(P.same(A[i],B[i])) ANS[i-1]=ANS[i];
    else ANS[i-1]=ANS[i]-cnt;
    P.unite(A[i],B[i]);
  }
  
  REP(i,M) co(max(ANS[i],0ll));
  return 0;
}

Measured memory_bytes: 6332
import sys
sys.setrecursionlimit(2000000)

from fractions import gcd
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))



n=int(input())
aa=[]
aa=list(map(int,input().split()))
# for i in range(n):
#     aa.append(randint(1,10**6))

bb=lcm(aa)
mod=10**9+7
ans=0
for i in range(n):
    ccc=div(bb,aa[i])
    ans=int((ccc%mod+ans%mod)%mod)
print(int(ans))

Measured memory_bytes: 74712
#include <iostream>
#include <string>
#include <vector>

int dist(int a, int b, int X, int Y) {
    // either go directly, or go via express lane
    return std::min(b - a, abs(X - a) + abs(Y - b) + 1);
}

int main(int argc, char **argv) {
    int N; // 3 <= N <= 2 * 10^3
    int X;
    int Y;
    std::cin >> N >> X >> Y;

    std::vector<int> lengths(N, 0);
    for (int i = 1; i <= N - 1; i++) {
        for (int k = i + 1; k <= N; k++) {
            lengths[dist(i, k, X, Y)]++;
        }
    }

    for (int i = 1; i < N; i++) {
        std::cout << lengths[i] << std::endl;
    }

    return 0;
}


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


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                int[] X = new int[100001];
                
                long ans = 0; 
                for(int i=1; i<=N; i++){
                    long A = scan.nextLong();
                    int P = (int) A;
                    X[P]++;
                    ans = ans + A;
                }
                
                int Q = scan.nextInt();
                for(int i=1; i<=Q; i++){
                    long B = scan.nextLong();
                    long C = scan.nextLong();
                    int BI = (int)B;
                    int CI = (int)C;
                    X[CI] = X[CI] + X[BI];
                    long E = (long)X[BI];
                    ans = ans - B*E + C*E;
                    X[BI] = 0;
                    
                    System.out.println(ans);
                }
        }               
}


Measured memory_bytes: 62844
#include<iostream>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cassert>
#include<climits> 

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define MAX 300002
 
using namespace std;
typedef unsigned long long ull;

ull extgcd(ull a,ull b,ull& x,ull& y)
{
  ull d = a;
  if(b != 0){
    d = extgcd(b,a%b,y,x);
    y -= (a/b)*x;
  }
  else
    x = 1,y = 0;
  return d;
}

ull mod_inv(ull a,ull m)
{
  ull x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}


int n,m,L,R,keta;
char s[MAX],o[5];
set<ull> ans;
const ull B = 9973ULL;
const ull inv = 9063375710536127837ULL;
//const ull B = 973;
ull H,Bmax[MAX];

 

int main()
{
 
  //cout << ULLONG_MAX << endl;
  //cout << mod_inv(1000000007ULL,18446744073709551615ULL) << endl; 

  Bmax[0] = 1ULL;
  REP(i,1,MAX)Bmax[i] = Bmax[i-1] * B;
  L = R = keta = 0;
  scanf("%d %d",&n,&m);
  scanf("%s",&s[0]);
  H = s[0];


  rep(_,m)
    {
      scanf("%s",&o[0]);
 
      if(o[0] == 'R')
	{
	  if(o[1] == '+')
	    {
	      H = H * B + s[++R];
	    }
	  else
	    {
	      //H = (H - s[R--]) * invB;
	      H = (H - s[R--]) * inv;
	    }
	}
      else
	{
	  if(o[1] == '+')
	    {
	      H = H - Bmax[R-L] * s[L++];
	    }
	  else
	    {
	      H = H + Bmax[R+1-L] * s[L-1];
	      L--;
	    }
	}
      /*
	cout << "Bmax = " << Bmax << endl;
	cout << "[" << L << "," << R << "]" << endl;
	cout << "s : ";
	REP(i,L,R+1)cout << s[i];
	cout << endl;
	cout << "hash : " << H << endl;
      */
      ans.insert(H);
    } 
  
  cout << ans.size() << endl;
 
  return 0;
}

Measured memory_bytes: 17904
#in the name of allah
import sys
import math as mt
import bisect
input=sys.stdin.buffer.readline  
t=1
#t=int(input())
for _ in range(t):
    n,m,k=map(int,input().split())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    pref_a=[0]*(n+1)
    pref_b=[0]*(m+1)
    for i in range(n):
        pref_a[i+1]=pref_a[i]+a[i]
    for i in range(m):
        pref_b[i+1]=pref_b[i]+b[i]
    maxi=0
    for i in range(n+1):
        if k>=pref_a[i]:
            k1=k-pref_a[i]
            pos=bisect.bisect_right(pref_b,k1)        
            maxi=max(maxi,pos+i-1)
        else:
            break
    print(maxi)        
        
        

Measured memory_bytes: 116176
using System;
using System.Linq;

namespace abc064_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool[] a = new bool[8];
            int secret = 0;
            for (int i = 0; i < n; i++)
            {
                if (x[i] < 3200) a[x[i] / 400] = true;
                else secret++;
            }
            int ret = 0;
            for (int i = 0; i < 8; i++)
            {
                if (a[i]) ret++;
            }
            Console.WriteLine(Math.Max(1, ret) + " " + (ret + secret));
        }
    }
}

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

using namespace std;
typedef long long ll;
const int MAXN = 100010;

int n;
ll a[MAXN];

void solve() {
  sort(a, a + n);
  ll mid = a[n-1] / 2;
  auto iter = lower_bound(a, a + n, mid);
  if (*iter * 2 - a[n-1] >= a[n-1] - *(iter-1) * 2) {
    iter--;
  }
  cout << a[n-1] << " " << *iter << endl;
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


Measured memory_bytes: 1024
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int[] a = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
        string[] s = new string[a[0]];
        for (int i = 0; i < a[0]; i++) {
            s[i] = Console.ReadLine();
            for (int j = 0; j < 2; j++) {
                Console.WriteLine(s[i]);
            }
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int seen[100005][3];
vector<int> graph[100005];

int main(){
    int n,m;
    cin >> n >> m;
    rep(i,n)rep(j,3) seen[i][j] = -1;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a;--b;
        graph[a].push_back(b);
    }
    int s,t;
    cin >> s >> t;
    --s;--t;
    queue<pair<int,int>> q;
    q.push(P(3*s+0,0));
    while(!q.empty()){
        int now = q.front().first / 3;
        int c = q.front().first % 3;
        int len = q.front().second;
        q.pop();
        if(seen[now][c]>=0) continue;
        seen[now][c] = len;
        c = (c+1)%3;
        for(int j:graph[now]){
            if(seen[j][c]>=0) continue;
            q.push(P(3*j+c,len+1));
        }
    }
    if(seen[t][0]>=0) cout << seen[t][0] / 3 << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 10228
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<' ';
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n; cin>>n;
    vint h(n);
    rep(i,n)cin>>h[i];
    int ans = 0, max = 0;
    rep(i,n){
        if(h[i]>=max){ans++ ; max = h[i];}
    }
    cout<<ans<<endl; return 0;
}


Measured memory_bytes: 256