akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
string s,t;

	bool ans=false;
	cin >>s>>t;
	for(int i=0;i<s.size();i++){
	ans|=(s==t);
	s.push_back(s[0]);
	s.erase(s.begin());
	}
	cout<<solve(ans)<<endl;
}

Measured memory_bytes: 256
def mod_inverse(n, mod=10**9+7):
    return pow(n, mod-2, mod)


def combination(n, k, mod=10**9+7):
    numer = denom = 1
    for i in range(k):
        numer = (numer * (n-i)) % mod
        denom = (denom * (i+1)) % mod
    return (numer * mod_inverse(denom, mod)) % mod


mod = 10**9+7
n, a, b = map(int, input().split())
ans = (pow(2, n, mod) - 1 - combination(n, a) - combination(n, b)) % mod
print(ans)


Measured memory_bytes: 39152
N, M = map(int, input().split())

likes_list = []
for i in range(N):
    likes_list.append(list(map(int, input().split())))

people_likes = dict()
for likes in likes_list:
    num = likes[0]
    for i in range(num):
        try:
            people_likes[likes[1:][i]] += 1
        except KeyError:
            people_likes[likes[1:][i]] = 1

count = 0
for v in people_likes.values():
    if v == N:
        count += 1

print(count)



Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

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

int main() {
  int A, B, K; cin >> A >> B >> K;
  vector<int> ans;
  for (int i = 1; i < 101; i++) {
    if (A%i==0 && B%i==0) {
      ans.pb(i);
    }
  }
  sort(ans.rbegin(), ans.rend());
  cout << ans[K-1] << endl;
  return 0;
}


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

int num[105];

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> num[i];
    }
    int ans = 0;
    sort(num + 1, num + n + 1);
    for (int i = 1; i <= n - 2; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k <= n; k++)
            {
                if (num[k] - num[j] < num[i] && num[i] + num[j] > num[k] && num[i] != num[j] && num[j] != num[k])
                    ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
st = []
for i in range(n):
    st.append(list(input().split()))
x = input()
t = 0
for i in range(n):
    if st[i][0] == x:
        temp = i
        break
for i in range(temp + 1, n):
    t += int(st[i][1])
print(t)

Measured memory_bytes: 9076
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  int N,K,p[200000];
  cin>>N>>K;
  for (int i(0);i<N;i++) cin>>p[i];
  double a[200000];
  for (int i(0);i<N;i++){
    a[i] = (double)(p[i]+1)/2;
    //cout << a[i] <<" ";
  }
  //cout << endl;
  double ans(0),tmp(0);
  for (int i(0);i<K;i++){
    tmp += a[i];
  }
  ans = max(tmp,ans);
  for (int i(K);i<N;i++){
    tmp -= a[i-K];
    tmp += a[i];
    ans = max(tmp,ans);
  }
  cout <<setprecision(10) <<  ans << endl;
  return 0;
}



Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
	int a[4],b[4],c[4],k;
	for(k=0;k<=3;k++)
	{
		scanf("%d %d",&a[k],&b[k]);
		if(a[k]==1)
		{
			c[k]=b[k]*6000;
		}
		else if(a[k]==2)
		{
			c[k]=b[k]*4000;
		}
		else if(a[k]==3)
		{
			c[k]=b[k]*3000;
		}
		else
		{
			c[k]=b[k]*2000;
		}
	}
	for(k=0;k<=3;k++)
	{
		printf("%d\n",c[k]);
	}
	return 0;
}

Measured memory_bytes: 600
N = int(input())
hn = list(map(int,input().split() ) )
# カエルがi+2番目に到着するには
# dp[i+2] = min(dp[i+1]+abs(hn[i+2] - hn[i+1]) + , dp[i] + abs(hn[i+2] - hn[i])
dp = [0] * (N)
dp[0] = 0
dp[1] = abs(hn[0]-hn[1])
for i in range(N-2):
    dp[i+2] = min(dp[i+1] + abs(hn[i+2] - hn[i+1])  , dp[i] + abs(hn[i+2] - hn[i]))

print(dp[N-1])


Measured memory_bytes: 13928
NUM=10**9+7
H,W=list(map(int,input().split()))
matrix=[]
for i in range(H):
    matrix.append(list(input()))
dp=[[0]*W for i in range(H)]
dp[0][0]=1
for i in range(1,W):
    if(matrix[0][i]=='#'):
        dp[0][i]=0
    else:
        dp[0][i]=dp[0][i-1]
for j in range(1,H):
    if(matrix[j][0]=='#'):
        dp[j][0]=0
    else:
        dp[j][0]=dp[j-1][0]
for i in range(1,H):
    for j in range(1,W):
        if(matrix[i][j]=='#'):
            dp[i][j]=0
        else:
            dp[i][j]=(dp[i-1][j] + dp[i][j-1])%NUM 
print(dp[H-1][W-1]%NUM)

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------
int V, E ;
vector<vector<int>> graph ;
vector<int> seen ;
vector<int> cnt ;

void dfs_graph(int x){
    seen[x] = 1 ;
    for(int i=0;i<graph[x].size();i++){
        if(seen[graph[x][i]]==0){
            cnt[graph[x][i]] += cnt[x] ;
            dfs_graph(graph[x][i]) ;
        }
    }
    return ;
}




//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> V  ;
    E = V - 1 ;
    int q ;
    cin >> q ;

    vector<int> zero(V,0) ;
    seen = zero ;
    cnt = zero ;
    
    for(int i=0;i<V;i++){
        graph.push_back(vector<int>()) ;
    }

    for(int i=0;i<E;i++){
        int a, b ;
        cin >> a >> b ;
        graph[a-1].push_back(b-1) ;
        graph[b-1].push_back(a-1) ;
    }

    
    REP(i,q){
        int c, d ;
        cin >> c >> d ;
        cnt[c-1] += d  ;
    }

    dfs_graph(0) ;

    REP(i,V){
        cout << cnt[i] <<" " ;  
    }
    cout << endl ;


    

    return 0;
}


Measured memory_bytes: 23148
#include<bits/stdc++.h>
#define int long long int
#define f(i,s,e) for(i=s;i<e;++i)
#define fr(i,s,e) for(i=s;i>=e;i--)
#define ff(i,s,e,f) for(i=s;i<e && f;++i)
#define mem(arr,val) memset(arr, val, sizeof(arr))
#define mems(arr, val, n) memset(arr, val, n)
#define vec vector<int>
#define pr pair<int,int>
#define vp vector<trip>
#define _in(v) for(auto &x:v) cin>>x;
#define _out(v) for(auto x:v) cout<<x<<" "; cout<<endl;
#define lim 1000000
#define mod 1000000007
#define Arena ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define flush this_thread::sleep_for(chrono::seconds(0));
using namespace std;


signed main(void)
{
    Arena
    register int i,j,num,z,t=1;
    //cin>>t;
    f(z,1,t+1)
    {
        string s;cin>>s;
        if(s[2]==s[3] && s[4]==s[5])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
a.sort(key = lambda x:x[0])
ans = 0
b = 0
flag = 0
for i in range(n):
    while a[i][1]:
        a[i][1]-=1
        b+=1
        ans += a[i][0]
        if b ==m:
            flag=1
            break
    if flag==1:
        break
print(ans)

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}

ll const N=(ll)2e6+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;

        
        n=4;
        vll a(n);
        for(i=0;i<n;i++){
                cin>>a[i];
        }
        ll ans=-1e18;
        for(i=0;i<2;i++){
                for(j=2;j<n;j++){
                        ans=max(ans,a[i]*a[j]);
                }
        }
        if(a[0]<=0 && a[1]>=0 )
        ans=max(ans,0ll);
        else if(a[2]<=0 && a[3]>=0)
        ans=max(ans,0ll);
        cout<<ans<<endl;
        
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
            
            return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(a<b){
    rep(i,b)cout << a;
  }else{
    rep(i,a)cout << b;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3524
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,a[300010],g;
    bool can=false;
    cin>>n>>k;
    rep(i,n){
        cin>>a[i];
    }
    sort(a,a+n);
    g=gcd(a[0],a[1]);
    rep(i,n){
        g=gcd(g,a[i]);
    }
    if(a[n-1]==k) can=true;
    if(a[n-1]>k && k%g==0) can=true;
    if(can)  cout<<"POSSIBLE"<<endl;
    else  cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B,C;
    cin >> A >> B >> C;
    ll ans = 0;
    if(A == B && B == C){
        if(A % 2 == 1){
            print(0);
            return 0;
        }
        print(-1);
        return 0;
    }
    while(1){
        ll a,b,c;
        a = A; b = B; c = C;
        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1) break;
        A = (b+c)/2; B = (a+c)/2; C = (a+b)/2;
        ans++;
    }
    print(ans);
 }

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)

const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int n;
	
	while(cin >> n, n) {
		vvi field(n+1, vi(n+1, 0));

		REP(i, n) {
			REP(j, n) {
				cin >> field[i][j];		
			}
		}

		REP(i, n) {
			REP(j, n) {
				field[i][n] += field[i][j];
				field[n][j] += field[i][j];
				field[n][n] += field[i][j];
				printf("%5d", field[i][j]);
			}
			printf("%5d\n", field[i][n]);
		}

		REP(i, n+1) {
			printf("%5d", field[n][i]);
		}

		printf("\n");
	}

	
	return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>
int main(void)
{
	int data[3];
	int i,j,temp;
	for(i=0;i<3;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<2;i++){
		for(j=i+1;j<3;j++){
			if(data[i]>data[j]){
				temp=data[i];
				data[i]=data[j];
				data[j]=temp;
			}
		}
	}
	for(i=0;i<2;i++){
		printf("%d ",data[i]);
	}
	printf("%d\n",data[2]);
	return 0;
}

Measured memory_bytes: 596
#define UNDERSTAND 1000000007

#include <stdio.h>

int main(void)
{
    
    long int n,m;
    long int temp=1;
    long int change;
    
    scanf("%ld %ld",&n,&m);
    
    if(n < m){
        change = m;
        m = n;
        n = change;
    }
    if((n-m==1)||(m-n==1)||(m==n)){
        
        int count = m;
        
        while(count>1){
            temp = temp * count--;
            temp = temp % UNDERSTAND;
        }
        
        temp = temp * temp;
        temp = temp % UNDERSTAND;
        
        if(n > m){
            temp = temp * n;
            temp = temp% UNDERSTAND;
        }
        
        if(n == m)printf("%ld\n",(temp*2) % UNDERSTAND);
        else printf("%ld\n",temp % UNDERSTAND);
    }
    else printf("0\n");
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int n;
    cin>>n;
    long long int a[n];
    
    long long int b[2000009]={0};
    long long int count=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    for(int i=0;i<2000009;i++){
     // cout<<b[a[i]]<<endl;
        if(b[i]>1){
         
            count=count+(b[i]*(b[i]-1))/2;
        }
    }
    for(int i=0;i<n;i++){
        if(b[a[i]]>1){
            cout<<count -((b[a[i]]*(b[a[i]]-1))/2 -(((b[a[i]]-2)*(b[a[i]]-1))/2))<<endl;
         //cout<<"b "<<b[a[i]];
        }
        else{
            // cout<<b[a[i]];
             cout<<count<<endl;
    }
    }

}

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

int main(int argc, const char * argv[]) {
    int a,b,c,i=0,j=0;
    
    cin>>a>>b>>c;
    if(a==5)i++;
    else if(a==7)j++;
    if(b==5)i++;
    else if(b==7)j++;
    if(c==5)i++;
    else if(c==7)j++;
    
    if(i==2 && j==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
int main()
{
    ft
    ll t,i,j,n,m,c;
    cin>>n;
    if(n%2==1)
    {
        m=ceil(n*1.0/2);
        cout<<fixed<<setprecision(10)<<(m*1.0/n)<<"\n";
    }
    else
    {
        m=n/2;
        cout<<fixed<<setprecision(10)<<(m*1.0/n)<<"\n";
    }
    return 0;
}

Measured memory_bytes: 256
from math import pi
from bisect import bisect_left as bl

def LIS(p) :
    route = []
    for y in p :
        pos = bl(route, y)
        if len(route) <= pos : route.append(y)
        else : route[pos] = y
    return len(route)


def main() :
    x1, y1, x2, y2 = map(int, input().split())
    xfilp = 1
    yflip = 1
    if x1 > x2 :
        xfilp = -1
        x1, x2 = x2, x1
    if y1 > y2 :
        yflip = -1
        y1, y2 = y2, y1
    n = int(input())
    p = []
    for i in range(n) :
        x, y = map(int, input().split())
        if x1 <= x <= x2 and y1 <= y <= y2 :
            p.append((x * xfilp, y * yflip))
    p = [y for x, y in sorted(p, key=lambda t:t[0])]
    foun = LIS(p)
    ans = 100*(x2-x1 + y2-y1) - (20 - pi*5)*foun
    if foun == min(x2-x1+1, y2-y1+1) :
        ans += pi*5
    print(ans)

main()

Measured memory_bytes: 89148
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
// clang-format on

int N, M;
int A[MAX_N], B[MAX_N];

priority_queue<Pl, vector<Pl>, greater<Pl>> que;

void solve()
{
  ll price = 0;
  int n = 0;
  while (!que.empty() && n <= M) {
    Pl p = que.top();
    que.pop();
    int ad = min(M - n, p.second);
    price += p.first * ad;
    n += ad;
  }
  cout << price << endl;
}

int main(void)
{
  cin >> N >> M;
  REP(i, N)
  {
    ll a;
    int b;
    cin >> a >> b;
    que.push(Pl(a, b));
  }
  solve();
  return 0;
}


Measured memory_bytes: 2420
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end
require 'bigdecimal'
N = get_int
A = get_ints

sum = 0
A.each do |a|
  sum += 1 / BigDecimal(a)
end

puts (1 / sum).to_f


Measured memory_bytes: 14612
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

struct mint {
	ll x;
	mint() :x(0) {}
	mint(ll x) :x((x% mod + mod) % mod) {}
	// mint(ll x):x(x){}
	mint& fix() { x = (x % mod + mod) % mod; return *this; }
	mint operator-() const { return mint(0) - *this; }
	mint operator~() const { return mint(1) / *this; }
	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) { (x *= a.pow(mod - 2).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 operator/(const mint& a)const { return mint(*this) /= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint res = pow(t / 2);
		res *= res;
		return (t & 1) ? res * x : res;
	}
	bool operator<(const mint& a)const { return x < a.x; }
	bool operator==(const mint& a)const { return x == a.x; }
};

template<typename T>
map<T, ll> factorize(T x) {
	map<T, ll> res;
	for (int i = 2; i * i <= x; i++) {
		while (x % i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1) res[x]++;
	return res;
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	map<ll, int> LCM;
	vector<int> d(n);
	rep(i, n) {
		int a;
		cin >> a;
		d[i] = a;
		for (auto& c : factorize(a)) {
			if (LCM[c.first] < c.second) LCM[c.first] = c.second;
		}
	}
	mint lcm = 1;
	for (auto& c : LCM) {
		rep(i, c.second) lcm *= c.first;
	}
	mint ans = 0;
	rep(i, n) {
		ans += lcm / d[i];
	}
	cout << ans.x << endl;
	return 0;
}


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

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

    int amax=-1e7, amin=1e7;
    long long int asum=0;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        amax = max(amax, tmp);
        amin = min(amin, tmp);
        asum += tmp;
    }
    cout << amin << " " << amax << " " << asum <<endl;
    return 0;
}

Measured memory_bytes: 3128
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n) { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int night;
	double r, l, p, e, t;
	cin >> night >> l >> r >> p >> e >> t;
	double ans = 0.0;
	queue<pair<pair<double, double>, double>> Q;
	Q.push({ {l,r},1.0 });
	REP(i, night) {
		int cnt = Q.size();
		REP(j, cnt) {
			pair<pair<double, double>, double> q = Q.front();Q.pop();
			if (t + e < q.first.first)
				continue;
			if (t - e > q.first.second)
				continue;
			if (t - e < q.first.first&&q.first.second < t + e) {
				Q.push(q);
				continue;
			}
			if ((q.first.first + q.first.second) / 2 >= t) {
				Q.push({ { (q.first.first + q.first.second) / 2.0,q.first.second },q.second*p });
				Q.push({ { q.first.first,(q.first.first + q.first.second) / 2.0 },q.second*(1.0 - p) });
			}
			else {
				Q.push({ { (q.first.first + q.first.second) / 2.0,q.first.second },q.second*(1.0 - p) });
				Q.push({ { q.first.first,(q.first.first + q.first.second) / 2.0 },q.second*p });
				
			}
		}
	}
	while (!Q.empty()) {
		pair<pair<double, double>, double> q = Q.front();Q.pop();
		if (abs((q.first.first + q.first.second) / 2 - t) <= e + 1e-10) {
			ans += q.second;
		}
	}
	printf("%.6lf\n", ans);
}

Measured memory_bytes: 3344
#include<iostream>
#include<string>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string str;
		set<string> ss;
		cin >> str;
		for (int j = 0; j < str.length() - 1; j++)
		{
			string s1 = str.substr(0, j + 1);
			string s2 = str.substr(j + 1, str.length());
			string sr1 = s1;
			string sr2 = s2;
			reverse(sr1.begin(), sr1.end());
			reverse(sr2.begin(), sr2.end());
			string S[] = { s1,sr1,s2,sr2 };
			for(int i=0;i<=1;i++)
				for (int j =2; j <= 3; j++)
				{
					ss.insert(S[i] + S[j]);
					ss.insert(S[j] + S[i]);
				}
		}
		cout << ss.size() << endl;
	}
}


Measured memory_bytes: 3260
#include <cstdio>
#include <utility>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <tuple>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int ll;
using namespace std;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;



int main()
{
    int h,w;
    cin >> h >> w;
    int count =0;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char tmp;
            cin >> tmp;
            if(tmp == '#')
            {
                count++;
            }
        }
    }

    if(count == h+w-1)
    {
        cout <<"Possible"<<endl;
    }
    else
    {
        cout << "Impossible" << endl;
    }

   return 0 ;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int K,X;

    cin>>K>>X;
    if (X-K+1 >= -1000000) {
        for(int i = X-K+1;i <= X+K-1;i++) {
            cout<<i<<" ";
        }
        cout<<endl;
    } else if(X-K+1 < -1000000) {
        for(int i = 0;i < K;i++) {
            cout<<-1000000+i<<" ";
        }
        cout<<endl;
    } else if(X+K-1 >= 1000000) {
        for(int i = K-1;i >= 0;i--) {
            cout<<1000000-i<<" ";
        }
        cout<<endl;
    } else {
        for(int i = -K+1;i < K;i++) {
            cout<<X+i<<" ";
        }
        cout<<endl;
    }
    return 0;
}



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

bool CheckRotations(char *str1, char *str2)
{
  int size   = strlen(str1);
  char temp[1000];
 
  strcat(temp, str1);
  strcat(temp, str1);
 
  if (NULL!=strstr(temp, str2))
    return true;
  else
    return false;
}
 
int main()
{
    char str1[1000], str2[1000];
    
    scanf("%s %s", str1, str2);
    if (CheckRotations(str1, str2)){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}

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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    int n, t;
    cin >> n >> t;
    int res = INF;
    for(int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        if(b <= t && res >= a) res = a;
    }
    if(res == INF) cout << "TLE" << endl;
    else cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		blood_groups();
	}

	private static void blood_groups() {
		int[] bg = new int[4];

		while (sc.hasNext()) {
			String[] datas = sc.nextLine().split(",");

			switch( datas[1] ) {
			case "A":
				bg[0]++;
				break;
			case "B":
				bg[1]++;
				break;
			case "AB":
				bg[2]++;
				break;
			case "O":
				bg[3]++;
				break;
			default:
				break;
			}
		}

		System.out.println(bg[0]);
		System.out.println(bg[1]);
		System.out.println(bg[2]);
		System.out.println(bg[3]);

	}

}



Measured memory_bytes: 26024
a = input().split()
N, X = [int(num) for num in a]
L = input().split()
L = [int(num) for num in L]
D = []
d = 0
for i in range(N):
  d += L[i]
  if d <= X:
    D.append(d)  
print(len(D)+1)

Measured memory_bytes: 3064
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1<<18;
using ll = long long;
using pll = pair<ll, ll>;
int h[200001];
struct LiChao{
	struct Node{
		int l=0,r=0;
		pll line = pll(0, (ll)1e18);
	} node[2*SIZE];
	int cnt;
	inline ll f(pll line, int x){
		return line.first*x + line.second;
	}
	void update(int nn, int ns, int ne, pll newLine){
		auto &cur = node[nn];
		pll l1 = cur.line, l2 = newLine;
		if(f(l1, ns) > f(l2, ns)) swap(l1, l2);
		if(f(l1, ne) <= f(l2, ne)){
			cur.line = l1;
			return;
		}
		int m = ns+ne>>1;
		if(f(l1, m) <= f(l2, m)){
			cur.line = l1;
			if(!cur.r) cur.r = ++cnt, node[cnt].line = l1;
			update(cur.r, m+1, ne, l2);
		}
		else{
			cur.line = l2;
			if(!cur.l) cur.l = ++cnt, node[cnt].line = l2;
			update(cur.l, ns, m, l1);
		}
	}
	ll query(int nn, int ns, int ne, int x){
		auto &cur = node[nn];
		if(ns==ne) return f(cur.line, x);
		int m = ns+ne>>1;
		if(m<x) return min(f(cur.line, x), cur.r?query(cur.r, m+1, ne, x):(ll)1e18);
		return min(f(cur.line, x), cur.l?query(cur.l, ns, m ,x):(ll)1e18);
	}
} L;
int N;
ll dp[200001], C;
int main(){
	scanf("%d%lld",&N,&C);
	for(int i=1; i<=N; ++i) scanf("%d",h+i);
	L.update(0, 0, 1e6, pll(-2ll*h[1], 1ll*h[1]*h[1]));
	for(int i=2; i<=N; ++i){
		dp[i] = 1ll*h[i]*h[i]+C+L.query(0, 0, 1e6, h[i]);
		L.update(0, 0, 1e6, pll(-2ll*h[i], 1ll*h[i]*h[i]+dp[i]));
	}
	printf("%lld",dp[N]);
	return 0;
}

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

pair<int, int> a[100000];

int main(){
  int N;
  cin >> N;
  rep(i, N){
    int tmp;
    cin >> tmp;
    a[i] = make_pair(tmp, i + 1);
  }
  sort(a, a + N);
  rep(i, N){
    cout << a[i].second << " ";
  }
  cout <<endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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 ll MOD = 1e9+7;

vector<ll> A;

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

int main(){
    ll N, K;
    cin >> N >> K;
    ll high = -1;
    REP(i,N){
        ll a;
        cin >> a;
        A.push_back(a);
        chmax(high, a);
    }

    if(K > high){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    ll G = A[0];
    for(int i = 1; i < N; i++){
        ll a = A[i];
        G = gcd(G, a);
    }

    if(K % G == 0){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 1400
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	t := getNextInt(scanner)

	dp := make([]int, 6000)

	cooks := make(Cooks, n)
	for i := 0; i < n; i++ {
		cooks[i].a = getNextInt(scanner)
		cooks[i].b = getNextInt(scanner)
	}

	sort.Sort(cooks)

	for i := 0; i < n; i++ {
		for j := t - 1; j >= 0; j-- {
			if dp[j+cooks[i].a] < dp[j]+cooks[i].b {
				dp[j+cooks[i].a] = dp[j] + cooks[i].b
			}
		}
	}
	ans := 0
	for i := 0; i < 6000; i++ {
		if ans < dp[i] {
			ans = dp[i]
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}

type Cook struct {
	a, b int
}

type Cooks []Cook

func (a Cooks) Len() int           { return len(a) }
func (a Cooks) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Cooks) Less(i, j int) bool { return a[i].a < a[j].a }


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

class unionFind{
    template<typename T>
    using vector = std::vector<T>;

    vector<int> par;
    vector<long long> wei;
    int groupCount;

public:
    void init(int n = 0){
        par.resize(n);
        fill(par.begin(), par.end(), -1);

        wei.resize(n);
        fill(wei.begin(), wei.end(), 0LL);

        groupCount = n;

        return;
    }

    unionFind(int n = 0){
        init(n);
    }

    int root(int x){
        if(par[x] < 0){
            return x;
        }
        int r = root(par[x]);
        wei[x] += wei[par[x]];
        return par[x] = r;
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }

    int size(int x){
        return -par[root(x)];
    }

    long long weight(int x){
        root(x);
        return wei[x];
    }

    long long diff(int x, int y){
        if(!same(x, y)){
            return LLONG_MIN;
        }
        return weight(y) - weight(x);
    }

    bool unite(int x, int y, long long w = 0){
        w += weight(x) - weight(y);

        x = root(x);
        y = root(y);

        if(x == y){
            return false;
        }

        if(size(x) < size(y)){
            std::swap(x, y);
            w = -w;
        }

        par[x] += par[y];
        par[y] = x;
        wei[y] = w;
        --groupCount;

        return true;
    }

    int number_of_group(void){
        return groupCount;
    }
};

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

    int n, m;
    cin >> n >> m;

    unionFind uf(n);
    rep(i, m){
        int x, y, z;
        cin >> x >> y >> z;
        uf.unite(x - 1, y - 1);
    }

    cout << uf.number_of_group() << endl;

    return 0;
}

Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var s = br.readLine().split(" ");
      final var n = Integer.parseInt(s[0]);
      final var m = Integer.parseInt(s[1]);

      var sum = 0;
      if (n >= 2) {
        sum += (n * (n - 1)) / 2;
      }
      if (m >= 2) {
        sum += (m * (m - 1)) / 2;
      }
      System.out.println(sum);
    }
  }
}


Measured memory_bytes: 32540
import fractions

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

gcd_left_list = [0]*N
gcd = alist[0]
for i in range(1,N):
  gcd = fractions.gcd(gcd,alist[i-1])
  gcd_left_list[i] = gcd

gcd_right_list = [0]*N
gcd = alist[N-1]
for i in reversed(range(0,N-1)):
  gcd = fractions.gcd(gcd,alist[i+1])
  gcd_right_list[i] = gcd

#print(alist)
#print(gcd_left_list)
#print(gcd_right_list)
    
max_gcd = max(gcd_right_list[0], gcd_left_list[N-1])
for i in range(1,N-1):
  gcd = fractions.gcd(gcd_left_list[i],gcd_right_list[i])
  if gcd > max_gcd:
    max_gcd = gcd

print(max_gcd)

Measured memory_bytes: 16124
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

can_use = [False for i in range(10)]
for a in A:
    can_use[a] = True

match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1 for i in range(10 ** 4 + 1)]
dp[0] = 0

for i in range(N):
    if dp[i] < 0:
        continue
    for d in range(1, 10):
        if can_use[d] and i + match[d] <= N:
            dp[i + match[d]] = max(dp[i + match[d]], dp[i] * 10 + d)

print(dp[N])


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

typedef long long int LL;
typedef unsigned long long uLL;
typedef pair < int , int > ii;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;
const int mod = 1000000007;
const double eps = 1e-8;
const double pi = acos( -1.0 );

int main( int argc , char const *argv[] ) {
        ios_base :: sync_with_stdio(false); cin.tie(NULL);
        int n , x;
        cin >> n >> x;
        for( int i = n , j = 1; i >= 1; i-- , j++ ) {
                if( i == x ) return cout << j << endl,0;
        }
        return 0;
}








Measured memory_bytes: 256
n,m=map(int,input().split())
ab=[];ans=0
for i in range(n):
	ab.append(list(map(int,input().split())))
ab=sorted(ab, key=lambda x:x[0])
for i in ab:
	if i[1]<m:
		m-=i[1]
		ans+=i[0]*i[1]
	else:
		ans+=i[0]*m
		print(ans);exit()

Measured memory_bytes: 29792
#include <stdio.h> 
 
int main() {
  int n,x;
  int b,i,j,k,a;
 
  while(1) {
    scanf("%d %d",&n,&x);   
    b = 0;
    if( n == 0 && x == 0){
      break;
    }
    for(k = 1; k <= n ; k++) {
 
 
      for(j = 1; j <= n ; j++) {
 
    for(i = 1; i <= n; i++) {
       
      if(i == j || j == k || i ==k) {
         
      }else{
        a = i + j + k;
        if(a == x) {
          
          b += 1;
  
        }
      }
       
    }//i
     
      }//j
 
    }//k
    printf("%d\n",b/6);
  }
 
 
  return 0;
}  


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int a[100005],front[100005],back[100005],n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	front[1]=a[1];
	for(int i=2;i<=n;i++)
	{
		front[i]=__gcd(front[i-1],a[i]);
	}
	back[n]=a[n];
	for(int i=n-1;i>0;i--)
	{
		back[i]=__gcd(back[i+1],a[i]);
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ans=max(ans,__gcd(front[i-1],back[i+1]));
	}
	cout<<ans;
}

Measured memory_bytes: 1408
def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret

def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 14480
program takoyaki
  implicit none
  integer,allocatable :: d(:)
  integer ::n,i,j
  integer ::sum
  
  read (*,*)n
  allocate(d(n))
  read(*,*) (d(i),i=1,n)
  sum = 0
  do i = 1,n-1
     do j = i+1,n
       sum = sum + d(i)*d(j)
     end do
   end do
  write(*,*) sum
        
end program takoyaki


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i ++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i --)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return 1;}return 0;}

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 1000000007ll;

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

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

ll solve(ll a, ll b, ll x){
    return (a * x / b) - (x / b) * a;
}

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

    ll ans = solve(a, b, 1);
    // cout << "a = " << a << ", b = " << b << endl << endl;
    for (ll x = 1; x <= n; x ++){
        // printf("x = %lld, ans = %lld\n", x, solve(a, b, x));
        chmax(ans, solve(a, b, x));
    }

    ll t_ans = 0;
    if(n < b){
        t_ans = solve(a, b, n);
    }else{
        t_ans = solve(a, b, b - 1);
    }
    cout << t_ans << endl;


    
    return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');
            int[] v = new int[N];

            for (int i = 0; i < N; i++)
            {
                v[i] = int.Parse(s[i]);
            }

            long ans = 0;
            for (int i = 0; i < N; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    ans += Math.BigMul(v[i], v[j]);
                }
            }

            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 11092
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MO 998244353
#define MAXN 300000
using namespace std;
typedef long long LL;
LL N,A,B,K;
LL fact[MAXN+5],inv[MAXN+5];
LL PowMod(LL a,LL b)
{
	a%=MO;
	LL ret=1LL;
	while(b)
	{
		if(b&1)
			ret=ret*a%MO;
		a=a*a%MO;
		b>>=1;
	}
	return ret;
}
void prepare()
{
	fact[0]=1LL;
	for(int i=1;i<=MAXN;i++)
		fact[i]=fact[i-1]*i%MO;
	inv[MAXN]=PowMod(fact[MAXN],MO-2);
	for(int i=MAXN-1;i>=0;i--)
		inv[i]=inv[i+1]*(i+1)%MO;
}
LL C(LL n,LL m)
{
	if(m>n)
		return 0;
	return fact[n]*inv[m]%MO*inv[n-m]%MO;
}
int main()
{
	prepare();
	scanf("%lld %lld %lld %lld",&N,&A,&B,&K);
	LL x,y;
	LL ans=0;
	for(LL x=0;x<=N;x++)
	{
		if(K-x*A<0)
			break;
		if((K-x*A)%B!=0)
			continue;
		y=(K-x*A)/B;
		ans=(ans+C(N,x)*C(N,y)%MO)%MO;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4864
#include<iostream>
using namespace std;
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#include<stdio.h>
#include<sstream>

int main(){
   string X;
   cin >> X;
    int a[6];
    for(int i=0;i<6;++i){
        a[i]=100+i;
    }
    string K;
    int L=X.length();
    for(int i=0;i<L-2;++i){
        K+=X[i];
    }
    string J;
    for(int i=L-2;i<L;++i){
        J+=X[i];
    }
    int R=atoi(K.c_str());
    int H=atoi(J.c_str());
    if(R>=1){
    if(H<=R*5){
        cout << 1;
    }
    else{
        cout << 0;
    }
    }
    else{
        cout << 0;
    }
}

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


n = int(input())

while True:
    if isPrime(n):
        print(n)
        break
    else:
        n += 1

Measured memory_bytes: 2940