akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  vi a(5);
  rep(i, 5) cin >> a[i];
  rep(i, 5) {
    if (a[i] == 0) {
      cout << i + 1 << endl;
      return;
    }
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3612
require 'prime'

N = gets.to_i
factors = N.prime_division

num = 0
factors.each do |prime|
    exp = prime[1]
    next if exp == 0
    s = 0
    for i in 1..9999999
        s += i
        # puts prime[0].to_s << "^" << i.to_s
        if s > exp
            break
        end
        num += 1
    end
end

puts num

Measured memory_bytes: 14448
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 400010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int ans = 1;
    rep(i,2,x+1){
        int b = i;
        if (b*i > x) continue;
        while(b*i <= x){
            b *= i;
        }
        chmax(ans,b);
    }
    PRINT(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int a,b,c;
	
	cin>>a>>b>>c;
	
	if((a==b && a!=c && b!=c) || (b==c && b!=a && a!=c) || (a==c && a!=b && b!=c))
	{
	    cout<<"Yes"<<endl;
	}
	else
	{
	    cout<<"No"<<endl;
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    map<string, ll> mp;
    rep(i, 0, n) {
        string s;
        cin >> s;
        sort(all(s));
        mp[s]++;
    }
    ll ans = 0;
    for (auto i : mp) {
        ans += i.second * (i.second - 1LL) / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11136
local mmi, mma = math.min, math.max
r = {}
for i = 1, 26 do r[i] = 51 end
n = io.read("*n", "*l")
t = {}
for i = 1, n do
  s = io.read()
  for j = 1, 26 do t[j] = 0 end
  for j = 1, #s do
    v = s:sub(j, j):byte() - 96
    t[v] = t[v] + 1
  end
  for j = 1, 26 do
    r[j] =mmi(r[j], t[j])
  end
end
for i = 1, 26 do
  io.write(string.char(i + 96):rep(r[i]))
end
io.write("\n")


Measured memory_bytes: 760
#include <cstdio>
#define ll long long
#define bi(x) (1ll<<x)
#define rep(i,j,k) for (i=j;i<=k;i++)
using namespace std;
const int N=1e5+5;
int n,T,i;
ll A,B,l1,r1,l2,r2,l3,r3,ans;
int main()
{
//	freopen("or.in","r",stdin);
//	freopen("or.out","w",stdout);
	scanf("%lld%lld",&A,&B);
	if (A==B) { printf("1\n"); return 0; }
	for (T=62;T>=0;T--) {
		if ((A&bi(T))!=(B&bi(T))) break;
		if (A&bi(T)) A^=bi(T);
		if (B&bi(T)) B^=bi(T);
	}
	for (i=T-1;i>=0;i--)
		if (B&bi(i)) break;
	i++;
	l1=A; r1=bi(T)-1;
	l2=A+bi(T); r2=bi(T+1)-1;
	l3=bi(T); r3=bi(T)+bi(i)-1;
	if (r3<l2) ans=r1-l1+1 + r2-l2+1 + r3-l3+1;
	else ans=r1-l1+1 + r2-l3+1;
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
    ll n,ans;
    cin >> n;
    vector<ll> a(n),b(n),c(n);
    rep(i,n-1)cin >> b[i];
    ans = b[0];
    rep(i,n-2){
        ans += min(b[i],b[i+1]);
    }
    ans += b[n-2];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int target = N;
    int sum = 0;
    while (N > 0){
        sum += N % 10;
        N /= 10;
    }

    if (target % sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

int main() {
    long n, d, ans = -1e9;
    cin >> n >> d;
    if (d >= n) {
        cout << n << endl;
    } else {
        cout << n - 1 << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int D,M;
  int c[30];
  int s[370][30];
  int t[400];
  int last[30]={};
  int ans=0;
  int p[100002],q[100002];
  
  scanf("%d",&D);
  for(int i=1;i<=26;i++)
    last[i]=0;
  for(int i=1;i<=26;i++)
    scanf("%d",c+i);
  for(int i=1;i<=D;i++)
   for(int j=1;j<=26;j++)
     scanf("%d",&s[i][j]);
  for(int i=1;i<=D;i++)
    scanf("%d",t+i);
  scanf("%d",&M);
  for(int i=1;i<=M;i++)
    scanf("%d %d",p+i,q+i);
  for(int i=1;i<=M;i++){
    ans=0;
    t[p[i]]=q[i];
    for(int k=1;k<=26;k++)
      last[k]=0;
    for(int d=1;d<=D;d++){
      ans+=s[d][t[d]];
      last[t[d]]=d;
      for(int j=1;j<=26;j++){
        ans-=c[j]*(d-last[j]);
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 2508
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORP(i, m, n) for(int i = m; i < n+1; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
using UnweightedGraph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
const int INF = 2000000000ll;
const long double PI = acosl(-1);
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; }



int power(int a, int b) {return b?power(a*a,b/2)*(b%2?a:1):1;}
int perm(int N, int K){
    int x=1;
    for(int i=1;i<=K;i++)
    {
        x=x*(N-i+1);
    }
    return x;
}
int factorial(int N) {return perm(N,N);}
int comb(int N,int K) {return factorial(N)/factorial(K)/factorial(N-K);}
int hcomb(int N, int K) {return comb(N+K-1, N-1);}

int dtoi(double d) {return round(d);}

int isprime(int n) {
    if (n < 2) return 0;
    for (int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return 0;
    }
    return 1;
}

int mystoll(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}

template<class T>
int SUM(T a) {
    int sum = 0;
    for(auto iter : a) sum += iter;
    return sum;
}

void solve(int X);

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int X;
    cin >> X;
    solve(X);
    return 0;
}

void solve(int X) {
    int ans = 0;
    FORP(i,-200,200) FORP(j,-200,200) if (power(i,5)-power(j,5) == X) {
        cout << i << " " << j << endl; 
        return;
    }
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_d && sh test.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_d && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_d && sh submit.sh
*/


Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = (s); i < (int)(n); i++)
#define INF 100000000

using namespace std;

int main() {
   int x,a,b;
   cin >> x >> a >> b;
   if(a>=b)
   cout << "delicious" << endl;
   else if(b-a<=x)
   cout << "safe" << endl;
   else 
   cout << "dangerous" << endl;
}

Measured memory_bytes: 256
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <iostream>
# include <fstream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <math.h>
# include <algorithm>
using namespace std;
# define pi acos(-1.0)
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define For(i,n,a) for(int i=n; i>=a; --i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define Fo(i,n,a) for(int i=n; i>a ;--i)
typedef long long LL;
typedef unsigned long long ULL;

queue<int>a[305];
int b[305];
bool c[305];

int main()
{
    int n,m,min_=300,num;
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            cin>>num;
            a[i].push(num);
        }
    }
    mem(c,0);
    for(int j=1; j<=m; j++)
    {
        mem(b,0);
        for(int i=1; i<=n; i++)
        {
            while(c[a[i].front()])a[i].pop();
            b[a[i].front()]++;
        }
        int max_=0;
        for(int i=1; i<=m; i++)max_=max(max_,b[i]);
        min_=min(min_,max_);
        for(int i=1; i<=m; i++)
        {
            if(max_==b[i])
            {
                c[i]=1;
                break;
            }
        }
    }
    cout<<min_<<endl;
    return 0;
}

























Measured memory_bytes: 768
package main

import (
	"fmt"
)

func main(){
	var N,D,X int
	fmt.Scan(&N,&D,&X)
	A := make([] int,N)
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
	}
	count := 0
	ans := 0
	for i := 0; i < N; i++ {
		count = (D - 1) / A[i] + 1
		ans = ans + count	
	}
	fmt.Println(ans+X)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7L;

int a,b;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>a>>b;

int num=a*b;

if(num%2) cout<<"Odd"<<endl;
else cout<<"Even"<<endl;

}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var hs=new Dictionary<string,int>();
		int p=1,o=n;
		for(int i = 0;i<n;i++) {
			var e=sc.S;
			if(hs.ContainsKey(e)){
				hs[e]++;
				int z=hs[e];
				if(p<z){p=z;o=1;}
				else if(p==z){o++;}
			}
			else{hs.Add(e,1);}
		}
		var a=new string[o];
		int j=0;
		foreach(var e in hs){
			if(e.Value==p){
				a[j]=e.Key;
				j++;
			}
		}
		Array.Sort(a,StringComparer.Ordinal);
		Console.WriteLine(String.Join("\n",a));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 43256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string in;
	cin >> in;
	const string str = "CODEFESTIVAL2016";
	int res = 0;
	for (int i = 0; i < 16; ++i)
	{
		if (in[i] != str[i])
			res++;
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int kind[8] = {};
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = 0;
    rep(i, N) {
        int a; cin >> a;
        a /= 400;
        a = min(a, 8);
        if (a == 8) ans++;
        else kind[a] = 1;
        //cout << a << endl;
    }
    int ans1 = 0;
    rep(i, 8) ans1 += kind[i];
    cout << max(1, ans1) << " " <<ans1 + ans<< endl;
    

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int main(){
    int n,l[200];
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)scanf("%d",&l[i]);
    std::sort(l,l+2*n);
    int ans=0;
    for(int i=0;i<2*n;i+=2)ans+=l[i];
    printf("%d",ans);
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  int w;
  cin>>w;
  for(int i=0;i<s.size();i++){
    if(i%w==0){
      cout<<s[i];
    }
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  char s[100];
  int t[100]={0},i;
 scanf("%s",s);
  for(i=0;s[i]!=0;i++){
    t[s[i]-'a']++;
  }
  for(i=0;i<27;i++){
    if(t[i]%2!=0) {printf("No");return 0;}
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//ライブラリ予定
//ネットワークフロー：蟻本p188～
class NetworkFlow {
public:
	//引数：頂点数
	NetworkFlow(){}
	NetworkFlow(int size) {
		G.resize(size);
		used.resize(size);
	}

	//fromからtoへ向かう容量capの辺をグラフに追加する
	void add_edge(int from, int to, int cap) {
		Edge e1 = { to, cap, (int)G[to].size() };
		G[from].push_back(e1);
		Edge e2 = { from, 0, (int)G[from].size() - 1 };
		G[to].push_back(e2);
	}

	//sからtへの最大流を求める
	int max_flow(int s, int t) {
		int flow = 0;
		while (true) {
			fill(used.begin(), used.end(), false);
			int f = dfs(s, t, INF);
			if (f == 0)return flow;
			flow += f;
		}
	}




private:
	//型と変数
	struct Edge { int to, cap, rev; };//辺を表す構造体（行き先、容量、逆辺）
	vector<vector<Edge>> G;   //グラフの隣接リスト表現
	vector<bool> used;//DFSで既に調べたかのフラグ

					  //関数
					  //増加パスをDFSで探す
	int dfs(int v, int t, int f) {
		if (v == t)return f;
		used[v] = true;
		REP(i, (int)G[v].size()) {
			Edge& e = G[v][i];
			if (!used[e.to] && e.cap > 0) {
				int d = dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
};
using NF = NetworkFlow;




//変数
int H, W;
vector<vector<bool>> exist;
pair<int, int> start, goal;

NF nf;




//サブ関数
//入力
void input()
{
	cin >> H >> W;
	exist = vector<vector<bool>>(H, vector<bool>(W, false));
	nf = NetworkFlow(H + W + 2);

	string tmps;
	REP(i, H) {
		cin >> tmps;
		REP(j,W){
			switch (tmps[j]) {
			case 'S':
				start = make_pair(i, j);
				exist[i][j] = true;
				break;
			case 'T':
				goal = make_pair(i, j);
				exist[i][j] = true;
				break;
			case 'o':
				exist[i][j] = true;
				break;
			}
		}
	}
}

//計算
void calc()
{
	//始点と終点設置
	nf.add_edge(H + W, start.first + W, INF);
	nf.add_edge(H + W, start.second, INF);
	nf.add_edge(goal.first + W, H + W + 1, INF);
	nf.add_edge(goal.second, H + W + 1, INF);
	
	REP(i, H)REP(j, W)if (exist[i][j]) {
		nf.add_edge(i + W, j, 1);
		nf.add_edge(j, i + W, 1);
	}

	/*
	//横の辺を追加
	REP(i, H)REP(j, W)if (exist[i][j])
		FOR(k, j + 1, W)if (exist[i][k])
			nf.add_edge(trans(i, j), trans(i, k), 1);
	//縦の辺を追加
	REP(j, W)REP(i, H)if (exist[i][j])
		FOR(k, i + 1, H)if (exist[k][j])
			nf.add_edge(trans(i, j), trans(k, j), 1);
	*/
}


//出力
void output()
{
	if (start.first == goal.first || start.second == goal.second) {
		cout << -1 << endl;
	}
	else {
		cout << nf.max_flow(H + W, H + W + 1) << endl;
	}
}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


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

int main()
{
	string original;
	int n;
	getline(cin, original);
	cin >> n;
	//cout << original << endl;
	//cout << n << endl;
	while (n--) {
		string order;
		cin >> order;
		int a, b;
		cin >> a >> b;
		if (order == "print") {
			cout << original.substr(a, b - a + 1) << endl;
		}
		else if (order == "replace") {
			string tmp;
			cin >> tmp;
			for (int i = a; i <= b; i++) {
				original[i] = tmp[i - a];
			}
			//cout << "replace ????????????" << original << endl;
		}
		else if (order == "reverse") {
			string tmp = "";
			for (int i = b; i >= a; i--) {
				tmp += original[i];
			}
			//cout << tmp << endl;
			for (int i = a; i <= b; i++) {
				original[i] = tmp[i - a];
			}
			//cout << "reverse ????????????" << original << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1224
n = int(raw_input().strip())
commands = []
for i in range(n):
    commands.append(raw_input().strip())


d = [False]*67108870

def hash(s):
    ret = 0
    i = 0
    for dg in s:
        if dg == 'A':
            ret += 0 * 4**i
        elif dg == 'C':
            ret += 1 * 4**i
        elif dg == 'G':
            ret += 2 * 4**i
        elif dg == 'T':
            ret += 3 * 4**i
        i += 1
    return ret

def insert(d,s):
    h = hash(s)
    d[h] = True

def find(d,s):
    h = hash(s)
    if d[h]: print 'yes'
    else: print 'no'

for c in commands:
    c += 'C'
    if c[0] == 'i':
        insert(d,c[7:])
    else:
        find(d,c[5:])

Measured memory_bytes: 617900
#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(x) x.begin(),x.end()

using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;

template<typename T>
void printVec(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << v << ",";
  }
  cout << "]" << endl;
}

int f(int xx,int jj) {
  if(xx!=0) return jj+1;
  return jj;
}

//場所 未満フラグ 条件達成個数
int dp[105][2][105];
int main() {
  string s;
  int k;
  cin >> s >> k;
  int n = s.size();
  vi a(n,0);
  rep(i,n) a.at(i) = s.at(i) - '0';

  dp[0][0][0] = 1;
  rep(i,n) rep(j,2) rep(l,105) rep(x,j ? 10 : a.at(i) + 1) {
    dp[i+1][j or x < a.at(i)][f(x,l)] += dp[i][j][l];
  }

  cout << dp[n][1][k] + dp[n][0][k] << endl;

  return 0;
}


Measured memory_bytes: 3672
N=int(input())
A=list(map(int,input().split()))
xminusy=A[0]-sum(A[1:])
ans=abs(A[0]-sum(A[1:]))
for i in range(1,N-1):
    xminusy+=A[i]*2
    if abs(xminusy)<=ans:ans=abs(xminusy)
print(ans)

Measured memory_bytes: 24832
#include<stdio.h>


int main()
{
int a,b,x,y,z;

scanf("%d%d",&a,&b);

x=a+b;
y=a-b;
z=a*b;

if(x>=y && x>=z)
    printf("%d",x);

 else if(y>=x && y>=z)
    printf("%d",y);
else
    printf("%d",z);

}




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

int main() {
    ll n;
    cin >> n;
    vector<ll> counts(100001,0);
    for (ll i=1; i<=100000; i++) {
        ll min = 100001;
        for (ll j=1; i-j>=0; j*=9) if (counts[i-j]<min) min = counts[i-j];
        for (ll j=1; i-j>=0; j*=6) if (counts[i-j]<min) min = counts[i-j];
        counts[i] = min+1;
    }
    cout << counts[n];
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define maxn 100005
using namespace std;

int main(){
    int n;
    cin >> n;
    int h[maxn];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    int dp[maxn];
    fill(dp, dp+maxn, 0x7fffffff);
    dp[0] = 0;
    for(int i=0; i<n; i++){
        int temp = 0;
        if(i+1 < n){
            temp = abs(h[i+1]-h[i]) + dp[i];
            if(temp < dp[i+1])
                dp[i+1] = temp;
        }
        if(i+2 < n){
            temp = abs(h[i+2]-h[i]) + dp[i];
            if(temp < dp[i+2])
                dp[i+2] = temp;
        }
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,n,a) for(ll i=n-1;i>=a;i--)
#define nl "\n"
#define LLMAX 1e18
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define fastread cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
#define online_judge

const ll MOD=1e9+7;

ll pow(ll n, ll e){
  if(e==0)
    return 1;
  else if(e==1)
    return n;
  else if(e%2==0)
    return pow(n,e/2)*pow(n,e/2);
  else
    return pow(n,e/2)*pow(n,e/2)*n;
}

bool prime(ll n){
  ll ct=0;
  rep(i,2,sqrt(n)+1){
    if(n%i==0)
      return false;
  }
  return true;
}

void solve(){
  fastread;
  ll n,m,temp,mi,q,ma=0,t;
  ll k;
  cin >> n >> k;
  vector<ll> v(n+1);
  rep(i,0,n)
    cin >> v[i];
  ll l=1,r=1e9;
  ll ans=1e9;
  while(l<=r){
    ll mid=l+(r-l)/2;
    ll sum=0;
    rep(i,0,n){
      temp=(v[i]%mid)?v[i]/mid:v[i]/mid-1;
      sum+=temp;
    }
    if(sum<=k){
      ans=min(ans,mid);
      r=mid-1;
    }
    else
      l=mid+1;
  }
  cout << ans;
}

int main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
  #endif
  clock_t start, end;
  start = clock();
  solve();
  end=clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC); 
    cerr << "Time taken by program is : " << fixed  
         << time_taken << setprecision(5); 
    cerr << " sec " << endl;
  return 0;
}

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

int main() {

    int n, tl;
    cin >> n >> tl;
    int bst = INT_MAX;
    for (int i=0; i<n; i++) {
        int c, t;
        cin >> c >> t;
        if (t <= tl) {
            bst = min(bst, c);
        }
    }

    if (bst == INT_MAX) {
        cout << "TLE";
    }
    else {
        cout << bst;
    }

}

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

using namespace std;

int main(){
        int a;
        string s;

        cin >> a >> s;

        if (a >= 3200){
                cout << s << endl;
        }
        else if ( a < 3200){
                cout << "red" << endl;
        }
        return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main() {
	ll N, K;
	cin >> N >> K;
	ll a[N + 1];
	map<ll, ll>mp;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		mp[a[i]]++;
	}	
	vector<ll>v;
  	for(auto p: mp){v.push_back(p.second);}
  	sort(v.begin(),v.end());
  	ll ans=0;
  	ll x=v.size();
  	for(int i=0; i<N; i++){
      if(x>K){
        ans+=v[i];
      	x--;
      }
      else{
    	break;
      }
    }
  cout<<ans<<endl;
}




Measured memory_bytes: 16500
#include <iostream>

using namespace std;

const int kMaxV = 1000001;

int b[kMaxV], f[kMaxV], d;
int n, a, g;

int G(int a, int b) { return !b ? a : G(b, a % b); }

void R(int i, int a) {
  for (; a > 1; a /= f[a]) {
    d |= b[f[a]] > 0 && b[f[a]] < i;
    b[f[a]] = i;
  }
}

int main() {
  for (int i = 2; i < kMaxV; i++) {
    if (!f[i]) {
      for (int j = i; j < kMaxV; j += i) {
        f[j] = i;
      }
    }
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    g = G(a, g);
    R(i, a);
  }
  if (!d) {
    cout << "pairwise coprime";
  } else if (g == 1) {
    cout << "setwise coprime";
  } else {
    cout << "not coprime";
  }
  return 0;
}

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

ll modpower(ll a, ll r, ll mod){ //a^r
    ll x = 1;
    a %= mod;
    while (r > 0) {
        if (r & 1) x = x * a % mod;
        r >>= 1;
        a = a * a % mod;
    }
    return x;
}

ll modinv(ll a, ll mod){
    return modpower(a, mod-2, mod);
}

vector<ll> fact;
vector<ll> invfact;

void set_fact(ll n, ll mod){
    fact.resize(n+1, 1);
    invfact.resize(n+1, 1);
    for (ll i = 2; i <= n; i++) {
        fact[i] = fact[i-1] * i % mod;
    }
    invfact[n] = modinv(fact[n], mod);
    for (ll i = n-1; i >= 2; i--) {
        invfact[i] = invfact[i+1] * (i+1) % mod;
    }
    return;
}

ll comb(ll n, ll k, ll mod) {
    if (k > n || k < 0) return 0;
    if (k == n || k == 0) return 1;
    return fact[n] * invfact[n-k] % mod * invfact[k] % mod;
}

ll comb_rep(ll n, ll k, ll mod) {
    return comb(n+k-1, k, mod);
}


int main() {
    ll N, M;
    cin >> N >> M;
    ll mod = 998244353;
    set_fact(5000010, mod);
    
    ll ans = comb_rep(N, 3*M, mod);
    
    for (ll i = 2*M+1; i <= 3*M; i++) {
        ll ex = N*comb_rep(N-1, M*3-i, mod) % mod;
        ans += mod - ex;
    }
    
    for (ll i = M+1; i <= N; i++) {
        if ((3*M-i)%2 == 1) continue;
        if (i > M*3) break;
        ll ex = comb(N, i, mod) * comb_rep(N, (3*M-i)/2, mod) % mod;
        ans += mod - ex;
    }
    cout << ans%mod << endl;
    return 0;
}


Measured memory_bytes: 78336
import java.io.*;
import java.util.*;

public class Main{

	
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		int a=sc.nextInt(),b=sc.nextInt();
		out.println(Math.min(b/a, sc.nextInt()));
		out.close();

	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
		
	}
}


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e;i++)
#define pb push_back
#define fst first
#define snd second

typedef long long ll;

int main() {
    int n; cin >> n;
    int a[n]; fore(i, 0, n) cin >> a[i];
    fore(i, 0, n) {int x; cin >> x; a[i] -= x;}
    sort(a, a + n, greater<int>());
    int i = 0, res = 0;
    while(a[i] > 0) res += a[i], i++;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
use std::cmp::{max, min};
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, a: [usize; n]);
    let s: Vec<_> = a
        .iter()
        .scan(0, |s, &ai| {
            *s += ai;
            Some(*s)
        })
        .collect();
    let diff = |a, b| if a > b { a - b } else { b - a };
    let mut ab = vec![(std::usize::MAX / 10, 0, 0); n];
    let mut i = 1usize;
    let l = |i, _| s[i - 1];
    let r = |i, j| s[j - 1] - s[i - 1];
    for j in 2..(n - 1) {
        let mut previ = i;
        while r(i, j) > l(i, j) && j - 1 > i {
            previ = i;
            i += 1;
        }
        let mut x = diff(r(i, j), l(i, j));
        let y = diff(r(previ, j), l(previ, j));
        if x > y {
            i = previ;
            x = y;
        }
        ab[j] = (x, r(i, j), l(i, j));
    }

    let mut cd = vec![(std::usize::MAX / 10, 0, 0); n];
    let mut i = 3usize;
    let l = |i, j| s[i - 1] - s[j - 1];
    let r = |i, _| s[n - 1] - s[i - 1];
    for j in 2..(n - 1) {
        while i <= j {
            i += 1;
        }
        let mut previ = i;
        while r(i, j) > l(i, j) && n - 1 > i {
            previ = i;
            i += 1;
        }
        let mut x = diff(r(i, j), l(i, j));
        let y = diff(r(previ, j), l(previ, j));
        if x > y {
            i = previ;
            x = y;
        }
        cd[j] = (x, r(i, j), l(i, j));
    }
    let mut ret = std::usize::MAX;
    for i in 2..(n - 1) {
        let (_, a, b) = ab[i];
        let (_, c, d) = cd[i];
        let m0 = min(a, min(b, min(c, d)));
        let m1 = max(a, max(b, max(c, d)));
        ret = min(ret, diff(m0, m1));
        assert_eq!(a + b + c + d, s[n - 1]);
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 1e5+5;
vector <int> adj[MAXN];
int cache[MAXN];
void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int dfs(int s)
{
	if(cache[s] != -1)
	{
		return cache[s];
	}
	bool leaf = true;
	int ans = INT_MIN;
	for(int u:adj[s])
	{
		leaf = false;
		ans = max(ans,dfs(u));
	}
	if(leaf)
	{
		return cache[s] = 0;
	}
	else
	{
		return cache[s] = 1 + ans;
	}
}
int32_t main()
{
  //c_p_c();
  memset(cache,-1,sizeof(cache));
  int n,m;
  cin >> n >> m;
  for(int i=0;i<m;i++)
  {
  	int x,y;
  	cin >> x >> y;
  	adj[x].push_back(y);
  }
  int res = INT_MIN;
  for(int i=1;i<=n;i++)
  {
  	res = max(res,dfs(i));
  }
  cout<<res<<endl;
  return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  map<int,int> mp;
  ll ans = 0;
  rep(i,n) {
    int sa = i-a[i];
    int wa = a[i]+i;
    ans += mp[sa];
    mp[wa]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 21136
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
using namespace std;
ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x);
        x=(x*x);
        y=y/2;
    }
    return res;
}
int main()
{
    ll n,W;
    cin>>n>>W;
    ll val[n+1],wt[n+1],knap[n+1][W+1];
    for(ll i=0;i<n;i++)
        cin>>wt[i]>>val[i];
//         W=8
//         val{2,3,1,4}//see video abdul bari
//         wt{3,4,6,5}
//         0 1 2 3 4 5 6 7 8 i--->
// vi wi 0 0 0 0 0 0 0 0 0 0 j---v (downwards)
//  2  3 1 0 
//  3  4 2 0
//  1  6 3 0
//  4  5 4 0
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=W;j++)
        {
            if(i==0||j==0)
                knap[i][j]=0;
            else if(j>=wt[i-1])
                knap[i][j]=max(knap[i-1][j],knap[i-1][j-wt[i-1]]+val[i-1]);
            else
                knap[i][j]=knap[i-1][j];
        }
    }
    cout<<knap[n][W];
}

Measured memory_bytes: 79104
H,W=map(int,input().split())
a=[list(input()) for i in range(H)]
flag=True
while flag:
    if ['.']*W in a:
        a.remove(['.']*W)
        H-=1
    else:
        flag=False
flag=True
b=[[row[i] for row in a] for i in range(W)]
while flag:
    if ['.']*H in b:
        b.remove(['.']*H)
        W-=1
    else:
        flag=False
a=[[row[i] for row in b] for i in range(H)]
for i in range(H):
    s=''.join(a[i])
    print(s)

Measured memory_bytes: 3316
n, k = map(int, input().split())
s = input()
s += 'X'

ans = 0
r = 0
l = 0
count = 1 if s[0]=='0' else 0

while r < n:
    if count <= k:
        ans = max(ans, r-l+1)
        if s[r]=='1' and s[r+1]=='0':
            count += 1
        r += 1
    else:
        if s[l]=='0' and s[l+1]=='1':
            count -= 1
        l += 1

print(ans)

Measured memory_bytes: 3316
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

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

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	// ???????????°
	int vertical = Integer.parseInt(br.readLine());
	// ?¨?????????°
	int horizontal = Integer.parseInt(br.readLine());

	// ???????????????????´?????????°??????????????????
	List<int[]> changeRequests = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] changeRequestStr = br.readLine().split(",");
	    int[] changeRequest = new int[2];
	    changeRequest[FIRST_NUMBER] = Integer.parseInt(changeRequestStr[FIRST_NUMBER]);
	    changeRequest[SECOND_NUMBER] = Integer.parseInt(changeRequestStr[SECOND_NUMBER]);
	    changeRequests.add(changeRequest);
	}

	// ?????\???????????????????´???????????????????????????????
	int[] outputArray = getDrawedArray(changeRequests, vertical, horizontal);

	// ???????????????????????????????????¨????????????????????????????????????1??????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    /**
     * ?????? ???????????????????????????????????\??????????????????
     * 
     * @param changeRequests
     * @param vertical
     * @param horizontal
     * @return ?????\?????????
     */
    private static int[] getDrawedArray(List<int[]> changeRequests, int vertical, int horizontal) {
	// ?????\?????????????????????????????????????????????
	// ?????????????????????????????¨?????\????????????????????´???????????????outputArray[0]????????¨?????????
	int[] outputArray = new int[vertical + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ?????????????????????????£????????????\????????????
	for (int[] changeRequest : changeRequests) {
	    int mediator = 0;
	    mediator = outputArray[changeRequest[FIRST_NUMBER]];
	    outputArray[changeRequest[FIRST_NUMBER]] = outputArray[changeRequest[SECOND_NUMBER]];
	    outputArray[changeRequest[SECOND_NUMBER]] = mediator;

	}

	return outputArray;

    }

}

Measured memory_bytes: 24256
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>

#define LL long long int
#define pb push_back
#define mp make_pair
#define MAX 100005
#define MOD 1000000007

using namespace std;

int main() {
	double pie = 3.14159265358979323846;
	int r;
	cin>>r;
	cout<<2*pie*r<<endl;
    return 0;
}



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

#define int long long

signed main(){
    int n;
    int a[100010];

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

    int l[100010] = {};
    int r[100010] = {};
    for(int i = 0;i < n;i++){
        if(l[i] == 0){
            l[i+1] = a[i];
        }else{
            l[i+1] = __gcd(l[i], a[i]);
        }
    }

    for(int i = n-1;i >= 0;i--){
        if(r[i+1] == 0){
            r[i] = a[i];
        }else{
            r[i] = __gcd(r[i+1], a[i]);
        }
    }

    int ans = max(l[n-1], r[1]);

    for(int i = 1;i < n-1;i++){
        ans = max(ans, __gcd(l[i], r[i+1]));
    }

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


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

int main(){
  int ten_a,ten_b;
  int ans_a=0,ans_b=0,ans_big;
  for(int i=0;i<4;i++){
    cin >> ten_a;
    ans_a += ten_a;
  }
  for(int i=0;i<4;i++){
    cin >> ten_b;
    ans_b += ten_b;
  }
  cout << max(ans_a,ans_b) << endl;
}
  
  

Measured memory_bytes: 1160
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define MOD 998244353LL
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}

bool prime[1000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.

    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    int n,m;
    cin >> n>> m;
    int a[m];
    rep(i, 0, m){
    	cin >> a[i];
    }
    sort(a, a+m);
    vi temp;
    rep(i, 1, m){
    	temp.pb(a[i]-a[i-1]);
    }
    sort(all(temp));
    

    n--;
    int ans = 0;
    rep(i, 0, m-1-n){
    	ans += temp[i];
    }
    cout << ans;
}

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

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int n; cin >> n;
        vector<int> v(n, 0);
        int xo= 0;
        lp(i, n) { cin >> v[i]; xo^= v[i]; }
        lp(i, n) {
                xo^= v[i];
                cout << xo<< " ";
                xo^= v[i];
        }
return 0;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main(){
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	int a = pow(100, n);
	if(k==100) ans = a*(k+1);
	else ans = a*k;
	cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  int64_t x;
  mint(int64_t x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(int64_t t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  //for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> frac, ifrac;
  combination(int n):frac(n+1), ifrac(n+1) {
    assert(n < mod);
    frac[0] = 1;
    for (int i = 1; i <= n; ++i) frac[i] = frac[i-1]*i;
    ifrac[n] = frac[n].inv();
    for (int i = n; i >= 1; --i) ifrac[i-1] = ifrac[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return frac[n]*ifrac[k]*ifrac[n-k];
  }
} C(1000000);

#define N 1010

//head

int n, a, b, c, d;
mint dp[N][N];
bitset<N> check[N];
mint dfs(int i, int j) {
  if(check[i].test(j)) return dp[i][j];
  check[i].set(j);
  if(i == n) return dp[i][j] = 1;
  if(j > b-a) return dp[i][j] = 0;
  mint &res = dp[i][j];
  mint now = C.ifrac[a+j].pow(c);
  for(int kakeru = c; kakeru <= d; kakeru++) {
    int x = (a+j)*kakeru+i;
    if(x > n) break;
    res += dfs(x, j+1) * C.frac[n-i] * C.ifrac[n-x] * now * C.ifrac[kakeru];
    now *= C.ifrac[a+j];
  }
  res += dfs(i, j+1);
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> a >> b >> c >> d;
  cout << dfs(0, 0) << endl;
}

Measured memory_bytes: 26972
n=int(input())
mod=10**9+7
A=list(map(int,input().split()))

a=sum(A)
a=(a**2)

b=0
for i in range(n):
  b+=(A[i])**2
if a-b<0:
  c=a-b
  while c<=0:
    c+=mod
  
  ans=c//2
  ans=ans%mod

else:
  ans=(a-b)//2
  ans=ans%mod

print(ans)

Measured memory_bytes: 31544