akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
	
#define int long long
#define double long double 
#define PI 3.141592653589793
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
// Use for file I/O;
#define FIN string _fname = "homework"; \
			string _is = _fname + ".in", _os = _fname + ".out"; \
			freopen(_is.c_str(), "r", stdin); \
			freopen(_os.c_str(), "w", stdout);

using namespace std;
	
int gcd(int a, int b) {
    while (b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

const int INF = 4e18 + 10;
const int INF2 = 2e18 + 10;
const int INF3 = 2e10;
const int MAXN = 100000;
const int LOGN = 19;
const int MOD = 1e9 + 7;
const int EPS = 1e-9;
const int MULT = 2e5;
const int MCNST = MOD * MOD * 8;

int dp[MAXN][2];
vector<vector<int>> g;

void dfs(int v, int p) {
	int a0 = 1, a1 = 1;
	for (int u: g[v]) {
		if (u != p) {
			dfs(u, v);
			a0 = (dp[u][0] + dp[u][1]) * a0 % MOD;
			a1 = a1 * dp[u][0] % MOD;
		}
	}

	dp[v][0] = a0;
	dp[v][1] = a1;
}

int32_t main() {
	FAST;
	
	int n;
	cin >> n;
	g.resize(n);

	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);
	}

	dfs(0, -1);

	cout << (dp[0][0] + dp[0][1]) % MOD;
}

Measured memory_bytes: 18388
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

const ll INF = 10010010010010;

int main() {
    ll N;
    cin >> N;

    ll ans = INF;
    for (ll ii = 1; ii*ii <= N; ++ii){
        if (N % ii == 0){
            ll tmp = ii - 1 + N / ii - 1;
            ans = min(tmp, ans);
        }
    }

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,k;
    cin >> a >> b >> k;
    vector<int> ans;
    for(int i=1; i <= min(a,b); i++){
        if((a % i == 0) && (b % i == 0)){
            ans.push_back(i);
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans[k-1] << endl;
    
    return 0;
}


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

namespace ACLBeginnerContest
{
    class Program
    {
        static void Main(string[] args)
        {
            // 課題C - Connect Cities(2020/9/26)

            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int M = int.Parse(str[1]);

            UnionFind uf = new UnionFind(N);
            int c1, c2;

            for (int i = 0; i < M; i++)
            {
                str = Console.ReadLine().Split(' ');
                c1 = int.Parse(str[0]) - 1;
                c2 = int.Parse(str[1]) - 1;

                uf.Union(c1, c2);

            }

            int cnt = -1;

            for(int i = 0; i < N; i++)
            {
                if (uf.Parents[i] < 0) cnt++;
            }

            Console.Write(cnt);

        }
    }


    /// <summary>
    /// Union-Findアルゴリズムの実装クラス
    /// </summary>
    class UnionFind
    {
        // 親要素のインデックスを保持する
        // 親要素が存在しない(自身がルートである)とき、マイナスでグループの要素数を持つ
        public List<int> Parents { get; set; }
        public UnionFind(int n)
        {
            this.Parents = new List<int>();
            for (int i = 0; i < n; i++)
            {
                // 初期状態ではそれぞれが別のグループ(ルートは自分自身)
                // ルートなのでマイナスで要素数(1個)を保持する
                this.Parents.Add(-1);
            }
        }

        // 要素xのルート要素はどれか
        public int Root(int x)
        {
            // 親がマイナスの場合は自分自身がルート
            if (this.Parents[x] < 0) return x;
            // ルートが見つかるまで再帰的に探す
            // 見つかったルートにつなぎかえる
            this.Parents[x] = Root(this.Parents[x]);
            return this.Parents[x];
        }

        // 要素xの属するグループの要素数を取得する
        public int Size(int x)
        {
            // ルート要素を取得して、サイズを取得して返す
            return -this.Parents[this.Root(x)];
        }

        // 要素x, yが同じグループかどうか判定する
        public bool Same(int x, int y)
        {
            return this.Root(x) == this.Root(y);
        }

        // 要素x, yが属するグループを同じグループにまとめる
        public bool Union(int x, int y)
        {
            // x, y のルート
            x = this.Root(x);
            y = this.Root(y);
            // すでに同じグループの場合処理しない
            if (x == y) return false;

            // 要素数が少ないグループを多いほうに書き換えたい
            if (this.Size(x) < this.Size(y))
            {
                var tmp = x;
                x = y;
                y = tmp;
            }
            // まとめる先のグループの要素数を更新
            this.Parents[x] += this.Parents[y];
            // まとめられるグループのルートの親を書き換え
            this.Parents[y] = x;
            return true;
        }
    }

}


Measured memory_bytes: 41604
N=int(input())
X=[0]*N
Y=[0]*N
for i in range(N):
  X[i],Y[i]=map(int,input().split())
li=[]
for i in range(N):
  for j in range(i,N):
    if i!=j:
      li.append(((X[i]-X[j])**2+(Y[i]-Y[j])**2)**(1/2))
print(sum(li)*2*(N-1)/((N**2-N)))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long dp[3001][3001][2];
long long solve(vector<int> &v,int i, int j, bool turn)
{
    if(i>j)
    {
        return 0;
    }
    if(dp[i][j][turn]!=-1)
    {
        return dp[i][j][turn];
    }
    if(turn==1)
    {
        return dp[i][j][turn] =  max(v[i]+solve(v,i+1,j,0),v[j]+solve(v,i,j-1,0));
    }
    else
    {
        return dp[i][j][turn] = min(solve(v,i+1,j,1),solve(v,i,j-1,1));
    }
}
int main() 
{
    int n;
    cin>>n;
    vector<int> v(n+1);
    memset(dp,-1,sizeof dp);
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        sum+=v[i];
    }
    long long  x = solve(v,1,n,1);
    long long y = (sum - x);
    cout<<x-y<<endl;
    return 0;
}


Measured memory_bytes: 144600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

bool isprime(int x){
	for(int i = 2;i*i<=x;i++){
		if(x%i == 0)return false;
	}
	return x!=1;
}
int gcd(int a, int b) 
{ 
    // Everything divides 0  
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    // base case 
    if (a == b) 
        return a; 
   
    // a is greater 
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 





void solve(){
	ins(morty);
	int rick = INF;
	FOR(i,1,27){
		int tmp = 0;
		int tmp1=  0;
		FOR(i1,0,morty.size()){
			if(morty[i1] == i-1+'a')tmp1 = 0;
			else tmp1++;
			tmp = max(tmp,tmp1); 
		}
		rick = min(tmp,rick);
	}
	out(rick);
}

int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Measured memory_bytes: 256
import sys

n = int(sys.stdin.readline().rstrip())

def base_convert(n, base):
    res = []
    b = abs(base)
    while n:
        q, r = divmod(n, b)
        res.append(r)
        n = b * q // base
    try:
        return int(''.join(list(map(str, res)))[::-1])
    except:
        return 0

def main():
    return base_convert(n, -2)

if __name__ == '__main__':
    ans = main()
    print(ans)

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



//入力table
int N,K;
long long h[110000];
//dptable
long long dp[110000];
const long long INF = 1LL << 60;
int main(){
    cin>>N>>K;
    for(int i=0;i<N;i++)cin>>h[i];
    //dptable初期化
    for(int i=0;i<110000;i++)dp[i]=INF;
    //初期値
    dp[0]=0;

    for(int i=0;i<N;i++){
        for(int j=1;j<=K;j++){
            dp[i+j]=min(dp[i]+abs(h[i+j]-h[i]),dp[i+j]);
        }
    }
    cout<<dp[N-1]<<endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

// mod. m での a の逆元 a^{-1} を計算する
// 逆元をかければ割ったことになる
//かけた後MODするの忘れない
ll modinv(ll a) {
    ll b = MOD, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll n;cin>>n;
  unordered_map<ll,ll> a;
  ll x,y;
  for(i=0;i<n+1;i++){
    cin>>buf;
    if(a.find(buf)==a.end()){
      a.insert({buf,i});
    }
    else{ 
      x=a[buf];
      y=i;
    }
  }
  ll z=x+n-y;
  ll comb=n+1,comc=1;
  for(i=1;i<=n+1;i++){
    res=(comb-comc)%MOD;
    if(res<0)res+=MOD;
    cout<<res<<endl;
    qmod(comb,n+1-i);
    qmod(comb,modinv(i+1));
    if(i<=z+1){
      qmod(comc,z-i+1);
      qmod(comc,modinv(i));
    }
  }
  
  return 0;
}

Measured memory_bytes: 5284
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long q,w,e,k;
	cin>>q>>w>>e>>k;
	if(q>=k)
	cout<<k;
	else
	if(q+w>=k)
	cout<<q;
	else
	cout<<q-(k-q-w);
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
using ll = long long;
const ll MOD=1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

signed main(){
  ll n,l;
  cin>>n>>l;
  vector<ll> X(n),A(n);
  for(auto &I:X){cin>>I;}
  for(auto &I:A){cin>>I;}
  vector<ll> dp(l+2,0);
  vector<ll> nx(l+2);
  dp[l]=1;
  for(ll i=n-1;i>=0;i--){
    for(auto &I:nx){I=0;}
    for(ll j=l;j>=0;j--){
      dp[j]+=dp[j+1];
      dp[j]%=MOD;
    }
    if(A[i]==0){
      nx[X[i]]=dp[X[i]+1];
    }
    else{
      for(ll j=X[i];j<l;j+=A[i]){
	nx[j]=dp[j+1];
      }
    }
    dp=nx;
  }
  ll ans=0;
  for(auto &I:dp){ans+=I; ans%=MOD;}
  if(ans<0){ans+=MOD;}
  cout<<ans<<endl;

  
  return 0;
}



Measured memory_bytes: 3288
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int a[200000];
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		a[i]=nextint();
	}
	rsorta_d32(a, n, 1, 0);
	long ans=0;
	for(int i=1; i<n; i++){
		ans+=a[n-1-(i/2)];
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 2912
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
string s=to_string(n);
ll sum=0;
for(int i=0;i<s.size();i++){
    sum+=s.at(i)-'0';
}
if(n%sum==0){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
}












Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define ALL(x) x.begin(), x.end()
#define INF (1001000000)
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i:c)
#define EXIST(cs,v) (find(ALL(cs),(v))!=cs.end())
#define SORT(c) sort((c).begin(),(c).end())
#define UNIQ(c) (c).erase(unique((c).begin(),(c).end()), (c).end());
#define P(p) cout<<(p)<<endl;

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

    string s;
    cin >> s;

    int cnt_zero = 0;
    int cnt_one = 0;
    REP(i, s.length()) {
        if (stoi(s.substr(i,1)) == 0) cnt_zero++;
        else cnt_one++;
    }
    P(2*min(cnt_zero, cnt_one));


    return 0;
}


Measured memory_bytes: 512
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    long k = nl();

    long[] a = nal(n);
    long[] f = nal(n);

    Arrays.sort(a);
    Arrays.sort(f);

    long ng = -1;
    long ok = 1_000000000_000000000L;
    while (ok - ng > 1) {
      long s = (ok + ng) / 2;

      long ret = 0;
      for (int i = 0; i < n; i++) {
        long x = a[i];
        long y = f[n - i - 1];

        long v = Math.max(x * y - s, 0);
        v = (v + y - 1) / y;

        ret += v;
      }

      if (ret <= k) {
        ok = s;
      } else {
        ng = s;
      }

    }
    System.out.println(ok);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define f first
#define s second

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 1e9+7;

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        res %= MOD;
        a = a * a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}

ll inverse(ll n) {
    return binpow(n, MOD-2);
}

vector<bool> is_prime;
vi primes;
void create_primes(int maxN) {
	is_prime.assign(maxN + 1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i * i <= maxN; ++i) if (is_prime[i]) {
		primes.push_back(i);
		for (int j = i * i; j <= maxN; j += i) 
			is_prime[j] = false;
	}
}

map<int, int> lcmm;

int maxN = 1e6;


int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	vi arr (N);
	F0R(i, N) cin >> arr[i];

	create_primes(maxN);
	for (int x : arr) {
		map<int, int> factorisation;
		
		for (int p : primes) {
			while (x % p == 0) {
				x /= p;
				factorisation[p]++;
			}
		}
		if (x != 1) factorisation[x]++;

		for (pair<int, int> data : factorisation) {
			lcmm[data.first] = max(lcmm[data.first], data.second);
		}
	}

	ll lcm_num = 1;
	for (pair<int, int> data : lcmm) lcm_num = (lcm_num * binpow(data.first, data.second)) % MOD;

	ll total = 0;
	for (int x : arr) {
		map<int, int> factorisation;
		
		for (int p : primes) {
			while (x % p == 0) {
				x /= p;
				factorisation[p]++;
			}
		}
		if (x != 0) factorisation[x]++;

		ll res = lcm_num;
		for (pair<int, int> data : factorisation) {
			res *= inverse(binpow(data.first, data.second));
			res %= MOD;
		}
		total += res;
		total %= MOD;
	}
	print(total);
}


Measured memory_bytes: 4168
n = int(input())
list_h= list(map(int,input().split()))
check = 0
for i in range(n-1):
    if list_h[i+1] > list_h[i]:
        check = 0
    elif list_h[i+1] == list_h[i] and check == 0:
        list_h[i] -= 1
    elif list_h[i+1] < list_h[i] - 1:
        check = 2
    elif list_h[i+1] == list_h[i] - 1:
        list_h[i] -= 1
        check += 1
    if  check == 2:
        break
if check <= 1 or n == 1:
    print("Yes")
else:
    print("No")
#print(list_h)

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

int main(){
	ll n,m,l;
	cin >> n >> m >> l;
	ll a[n][m];
	ll b[m][l];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> a[i][j];
		}
	}
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			cin >> b[i][j];
		}
	}
	ll c[n][l] = {};
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			for(int k = 0; k < m; k++){
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			if(j != l - 1)cout << c[i][j] << " ";
			else cout << c[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3320
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

int main()
{
	int N,M,X,Y;
	cin >> N >> M >> X >> Y;
	int x[100] = { -1000 };
	int y[100] = { 1000 };
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> y[i];
	}
	sort(x, x + N, greater<int>());
	sort(y, y + M);

	if (x[0] >= y[0] || x[0] >= Y || y[0] <= X) {
		cout << "War" << endl;
	}
	else {
		cout << "No War" << endl;

	}
	return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        mut N: i64,
    }
    let mut ans = 1;
    while N>1{
        N /= 2;
        ans *= 2;
    }
    println!("{}",ans);
}

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

int L[260000];
int A[510000];
int R[260000];
long long c = 0;

void merge(int l, int m, int r) {
	int n1 = m - l;
	int n2 = r - m;
	for (int i = 0; i < n1; i++) {
		L[i] = A[l + i];
	}
	for (int i = 0; i < n2; i++) {
		R[i] = A[i + m];
	}
	L[n1] = INT_MAX;
	R[n2] = INT_MAX;
		
	int i = 0, j = 0;

	for (int k = l; k < r; k++) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i++;
		}
		else {
			A[k] = R[j];
			j++;
		}
		c++;
	}
}

void mergeSort(int l,int r) {
	if (l + 1 < r) {
		int m = (l + r) / 2;
		mergeSort(l, m);
		mergeSort(m, r);
		merge(l, m, r);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	mergeSort(0, N);
	for (int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << c << endl;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long A = l[0], B = l[1], C = l[2], D = l[3];
            var E = C * D / Gcd(C, D);

            var remStartC = A % C == 0 ? A : A + C - (A % C);
            var remStartD = A % D == 0 ? A : A + D - (A % D);
            var remStartE = A % E == 0 ? A : A + E - (A % E);
            var remEndC = B - (B % C);
            var remEndD = B - (B % D);
            var remEndE = B - (B % E);

            var diffC = (remEndC - remStartC) / C + 1;
            var diffD = (remEndD - remStartD) / D + 1;
            var diffE = (remEndE - remStartE) / E + 1;

            var total = B - A + 1;

            Console.WriteLine(total - (diffC + diffD - diffE));
        }

        static long Gcd(long a, long b)
        {
            if (b > a) return Gcd(b, a);
            if (b == 0) return a;
            return Gcd(b, (a % b));
        }
    }
}

Measured memory_bytes: 13268
N, M = list(map(int, input().split(' ')))
d = {}
ans = []
# test !!!
#for i in range(100000):
#    p, y = (i%10), i
for i in range(M):
    p, y = list(map(int, input().split(' ')))
    if p not in d:
        d[p] = list()
    d[p].append(y)
    ans.append((p, y))
indexof = {}
for key in d:
    d[key] = sorted(d[key])
    indexof[key] = {}
    i = 1
    for v in d[key]:
        indexof[key][v] = i
        i += 1
for ken, t in ans:
    print('%s%s' % (str(ken).zfill(6), str(indexof[ken][t]).zfill(6)))

Measured memory_bytes: 77152
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)

int		main(void)
{
	int i = 1, x;
	cin >> x;
	while (x){
		cout << "Case " << i++ << ": " << x << endl;
		cin >> x;
	}
	return (0);
}



Measured memory_bytes: 3080
//
//  main.cpp
//  atcoder
//
//  Created by Hisaki Kobayashi on 2020/04/14.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
const int MAX_N = 200000;

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

ll dp[200000];
ll h[200000];
ll MAX_len = 200000000000;

int main(int argc, const char * argv[]) {
    int N,K; cin >> N >> K;
    
    for(ll i=0;i<sizeof(dp)/sizeof(*dp);i++){
        dp[i]=MAX_len;
        h[i] = -1;
    }
    
    for(ll i=0;i<N;i++){
        cin >> h[i];
    }
    
    dp[0]=0;
//    dp[1]=abs(h[1]-h[0]);
    
    for(ll i=1;i<N;i++){
        ll min_val = MAX_len;
        for(ll k=1;k<=K;k++){
            if(i-k<0){
                break;
            }
            min_val = min(min_val,dp[i-k]+abs(h[i-k]-h[i]));
        }
        dp[i]=min_val;
    }
    
    cout << dp[N-1] << endl;
                  
                  

    
    
    

    
    return 0;
}




Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
int main(){
  ll N; cin >> N;
  ll ans = (N*(N-1))/2;
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

llong pow(int x, int n) {
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}

void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}

int main() {
    int h, w, d, q, a;
    int ans[90001], x[90001], y[90001];
    cin >> h >> w >> d;
    REP(i, h) {
        REP(j, w) {
            cin >> a;
            x[a] = i;
            y[a] = j;
        }
    }

    for (int i = d + 1; i <= h * w; ++i) {
        ans[i] = ans[i - d] + abs(x[i] - x[i - d]) + abs(y[i] - y[i - d]);
    }

    cin >> q;
    int l, r;
    REP(i, q) {
        cin >> l >> r;
        cout << ans[r] - ans[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ll)(1e9)+7)

int main(){
	int n;
	string s[2];
	cin >> n >> s[0] >> s[1];
	string t="";
	for(int i=0; i<n; i++){
		if(s[0][i]==s[1][i]) t+='1';
		else{
			t+='0';
			i++;
		}
	}
	ll ans=3;
	if(t[0]=='0') ans*=2;
	for(int i=1; i<t.length(); i++){
		int j;
		if(t[i-1]=='0' && t[i]=='0') j=3;
		if(t[i-1]=='0' && t[i]=='1') j=1;
		if(t[i-1]=='1') j=2;
		ans=ans*j%mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s1 = input()
s2 = input()

count = 0
i = 0
if s1[0] == s2[0]:
    i += 1
    count = 3
else:
    count = 6
    i += 2
while i < n:
    if s1[i - 1] == s2[i - 1]:
        if s1[i] == s2[i]:
            count *= 2
            i += 1
        else:
            count *= 2
            i += 2
    else:
        if s1[i] == s2[i]:
            i += 1
        else:
            count *= 3
            i += 2
print(count % (10 ** 9 + 7))


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
	int n, k, a;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a;
	}
	for(int i = 0; ; i++){
		if(n <= (k-1) * i + k){
			cout << i + 1 << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, n int
	fmt.Scanf("%d %d", &x, &n)

	sc.Split(bufio.ScanWords)

	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	for i:=0; i < 100; i++ {
		if !contains(a, x-i) {
			fmt.Println(x-i)
			return
		}
		if !contains(a, x+i) {
			fmt.Println(x+i)
			return
		}
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


func contains(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}

Measured memory_bytes: 1824
/*input
1100
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

vector<char> v;
int main()
{
	IOS;
	string s;
	cin>>s;
	int ans=SZ(s);

	for(char c:s){
		if(SZ(v)&&v.back()+c=='0'+'1') v.pop_back();
		else v.pb(c);
	}
	cout<<ans-SZ(v)<<'\n';

	return 0;
}


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

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,l,a[200010],ans;
signed main()
{
	n=read();l=read();
	for(int i=1;i<=n;i++) a[i]=read();
	ans=1;
	for(int i=2;i<n;i++)
		if(a[i]+a[i+1]>a[ans]+a[ans+1])
			ans=i;
	if(a[ans]+a[ans+1]<l) printf("Impossible\n");
	else 
	{
		printf("Possible\n");
		for(int i=1;i<ans;i++) printf("%d\n",i);
		for(int i=n-1;i>ans;i--) printf("%d\n",i);
		printf("%d\n",ans);
	}
	return 0;
}

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

int main(void) {
	char a[32], b[32], c[32];
	char buf[128], *ch;
	int diff = (int)('A') - (int)('a');

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	sprintf(a, "%s", ch);
	ch = strtok(NULL, " ");
	sprintf(b, "%s", ch);
	ch = strtok(NULL, " ");
	sprintf(c, "%s", ch);

	printf("%c%c%c\n", (char)((int)a[0] + diff), (char)((int)b[0] + diff), (char)((int)c[0]) + diff);

	return 0;
}


Measured memory_bytes: 2028
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#include<queue>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384
using namespace std;
using ll =long long;
using P = pair<int,int>;

#define MAX_H 500
#define MAX_W 500

int n;
int dist[MAX_H][MAX_W];
int uesd[MAX_H][MAX_W];

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

int main(int argc, const char * argv[]) {
    cin >> n;
    
    vector<int> order;
    for(int h=0; h<n; h++){
        for(int w=0; w<n; w++){
            int number;
            cin >> number;
            order.push_back(number);
            dist[h][w] = min(min(w, h), min((n-1)-w, (n-1)-h));
            uesd[h][w] = 1;
        }
    }
    
    int res=0;
    for(int i=0; i<order.size(); i++){
        
        int x=(order[i]-1)%n;
        int y=(order[i]-1)/n;
        queue<P> que;
        que.push(P(x, y));
        
        res+=dist[y][x];
        uesd[y][x] = 0;
        
        while(que.size()){
            P p = que.front();
            que.pop();
            
            for(int i=0; i<4; i++){
                int nx = p.first+dx[i];
                int ny = p.second+dy[i];
                
                if(nx<0 || n<=nx || ny<0 || n<=ny) continue;
                
                if(dist[ny][nx]>dist[p.second][p.first]+uesd[p.second][p.first]){
                    dist[ny][nx]=dist[p.second][p.first]+uesd[p.second][p.first];
                    que.push(P(nx, ny));
                }
            }
        }
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 6356
def main():
    examA()

def examA():
    S = SI()
    if S[-1]=="s":
        ans = S+"es"
    else:
        ans = S+"s"
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10544
def main():
    import sys
    input = sys.stdin.readline

    A, B, M = map(int, input().split())
    *a, = map(int, input().split())
    *b, = map(int, input().split())

    ret = min(a) + min(b)
    for _ in range(M):
        x, y, c = map(int, input().split())
        x -= 1
        y -= 1
        ret = min(ret, a[x] + b[y] - c)
    print(ret)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 18616
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define double long double

const int N=305;

int n;
int a[N], f[N];
bool vis[N][N][N];
double cache[N][N][N];

double dp(int a, int b, int c)
{
	if(a<0 || b<0 || c<0)
		return 0;
	if(a==0 && b==0 && c==0)
		return 0;
	double &ans=cache[a][b][c];
	if(vis[a][b][c])
		return ans;
	vis[a][b][c]=1;
	ans=n + a*dp(a-1, b, c) + b*dp(a+1, b-1, c) + c*dp(a, b+1, c-1);
	ans/=(a+b+c);
	return ans;
}

int32_t main()
{
	IOS;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		f[a[i]]++;
	}
	double ans=dp(f[1], f[2], f[3]);
	cout<<fixed<<setprecision(12)<<ans;
	return 0;
}

Measured memory_bytes: 465152
/* 
	Author: ankrypt
*/

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

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>

long long N, M, A, C;
long double B;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
string S = "";

int main() {
	scanf("%lld", &A);
	cin >> B;
	// double ans1 = A * B * 1.0;
	// cout << ans1 << " \n";
	// printf("%0.12lf\n", ans1);
	ll ans = (ll)floor(A * B * 1.0);
	// ll ans = A * B;
	cout << ans << " \n";

	
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i) 
#define per(i,a,b) for(int i=a;i>=b;--i)
#define rvc(i,S) for(int i=0;i<(int)S.size();++i)

#define pb push_back
#define fi first
#define se second
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define maxn 400020
#define N 8000020

using namespace std;
int n,m;
int col[maxn]; 
vector<int> g[maxn];
string s;
int vis[maxn];
int cnt[maxn][2];
void dfs(int x)
{ vis[x]=1; 
  for(int i=0;i<g[x].size();i++)
    { int u=g[x][i];
      cnt[x][col[u]]++;
      if(!vis[u])  dfs(u);
	}
}
int used[maxn];
queue<int> Q;
void bfs()
{ rep(i,1,n) if(cnt[i][0]==0||cnt[i][1]==0) { Q.push(i); used[i]=1;} 
  while(!Q.empty())
  { int u=Q.front();Q.pop();
    for(int i=0;i<g[u].size();i++)
      {int v=g[u][i];
       cnt[v][col[u]]--;
	   if(used[v]==0&&(cnt[v][0]<=0||cnt[v][1]<=0))
	     {used[v]=1;
	      Q.push(v);
		 }
	  }
  }
  rep(i,1,n) if(used[i]==0)  {puts("Yes");return ;}
  puts("No");
}

int main()
{ cin>>n>>m;
  cin>>s;
  rep(i,1,n) if(s[i-1]=='A') col[i]=0; else  col[i]=1;
   
  rep(i,1,m)
    {  int x,y; scanf("%d%d",&x,&y); 
       if(x!=y) g[x].pb(y),g[y].pb(x);
	   else     g[x].pb(x); 
	}
   rep(i,1,n)
    { if(!vis[i])  dfs(i);	}	
   bfs();	
	
return 0;	
}

Measured memory_bytes: 26756
import java.util.Scanner;

public class Main {

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

		int max = sc.nextInt();
		long ans = 0;
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a < max) ans += max - a;
			max = Math.max(max, a);
		}

		System.out.println(ans);

		sc.close();

	}

}

Measured memory_bytes: 59756
// Created by Bingoo on 7/8/2020.
#include"bits/stdc++.h"
using namespace std ;
#define ll  long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

template <class ...Args>
auto &see(const Args &...args) {return ((cerr << " " << args), ...) << '\n';}
#define bug(...)  cerr << "[ "#__VA_ARGS__" ] = "; see(__VA_ARGS__) << '\n';
//C++17
template<typename... Args>
void read(Args&... args){((cin >> args), ...);}
template<typename... Args>
void write(Args... args){((cout << args << " "), ...);}


vector<int> dp(100005,-1) ;
vector<int> h(100005);
int N ;

int solve(int n){
    if(n==N)return 0 ;

    if(dp[n] != -1)return dp[n] ;

    int r1,r2=INT_MAX;

    r1= abs(h[n]-h[n+1])+solve(n+1);

    if(n+2 <=N)r2= abs(h[n]-h[n+2]) + solve(n+2) ;

    return dp[n] = min(r1,r2);
}

int main(){
    IOS

    cin >> N ;

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

    cout << solve(1) <<'\n' ;


}

Measured memory_bytes: 8604
#include<iostream>
#include<vector>
#include<algorithm>
using Int = long long;


int main() {

	Int N;
	std::cin >> N;

	std::vector<Int> a(N);
	for (int i = 0; i < N; i++)std::cin >> a[i];
	
	std::vector<Int> num(100000 + 1);

	for (int i = 0; i < N; i++) {
		num[a[i]]++;
	}

	Int ans = 0;
	for (int i = 1; i < 100000; i++) {
		Int res = num[i - 1] + num[i] + num[i + 1];
		ans = std::max(ans, res);
	}

	std::cout << ans << std::endl;

}

Measured memory_bytes: 1792