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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N;
	vector<llong> A(5);

	cin >> N;
	llong mini = inf;
	for (int i = 0; i < 5; ++i) {
		cin >> A[i];
		mini = min(mini, A[i]);
	}

	cout << N/mini + (N%mini > 0) + 4 << endl;

	return 0;
}

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

#define ll long long
#define vi vector<int>
#define REP(i, n) for (int i = 0; i < n; i++)
#define check cout << "OK" << endl

int main() {
  int x, y;
  cin >> x >> y;
  if (x * 4 >= y && x * 2 <= y && y % 2 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
using namespace std;
map <int ,int> mpa,mpb;

int A[100002], n;

int search(int z){
  int co=0;
  int left=0;
  int right=n;
    while(left<right){
      int mid=(left+right)/2;
      if(A[mid]==z) return 1;
      if(A[mid]>z) right=mid;
      else if(A[mid]<z) left=mid+1;
    }
  return 0;
}

int main (){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> A[i];
  }
  int q,t;
  cin >> q;
  int ans=0;
  for(int i=0;i<q;i++){
    cin >> t;
    if (search(t)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3444
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String data = sc.nextLine();
        
        String[] array = data.split(" ");
        long n = Long.parseLong(array[0]);
        long k = Long.parseLong(array[1]);
        
        long count = 0;
        
        while(n > 0)
        {
            n = n / k;
            count++;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        200001
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--) 
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define MAXN		200001
#define ordered_set tree<ll int, null_type,less<ll int>, rb_tree_tag,tree1_order_statistics_node_update> 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll int n;
	cin >> n;
	ll int mat[n+1][n+1];
	memset(mat,0,sizeof(mat));
	ll int pointers[n+1];
	memset(pointers,0,sizeof(pointers));
	rep(i,1,n+1)
	{
		rep(j,0,n-1)
		{
			cin >> mat[i][j];
		}
	}
	ll int days=0;
	while(days<=(n*n))
	{
		ll int f=1;
		ll int vis[n+1];
		memset(vis,0,sizeof(vis));
		rep(i,1,n+1)
		{
			ll int v=mat[i][pointers[i]];
			if (mat[v][pointers[v]]==i and vis[i]==0 and vis[v]==0)
			{
				pointers[i]++;
				pointers[v]++;
				vis[i]=1;
				vis[v]=1;
				f=0;
			}
		}
		if (f)
		{
			ll int f2=0;
			rep(i,1,n+1) if (pointers[i]!=n-1) {f2=1;break;}
			if (f2)	days=(n*n)+1;
			break;
		}
		days++;
	}
	if (days>(n*n)) cout << -1 << endl;
	else cout << days << endl;
}

Measured memory_bytes: 8064
#include <iostream>

using namespace std;

int main() {
	int N;
	int a[100100] = {};

	cin >> N;

	int count = 0;
	for (int i = 0; i < N; i++) {
		int s;
		cin >> s;
		s--;
		a[i] = s;
		if (s < i) {
			if (a[s] == i) {
				count++;
				continue;
			}
		}
	}
	cout << count << endl;
	
	return 0;
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cmath>
#include <regex>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ba back
#define ppb pop_back
#define eb emplace_back
#define eps 1e-6
#define vll vector<long long int>
#define sz(x) (int((x.size())))
#define all(x) (x).begin(),(x).end()
#define FAST ios_base :: sync_with_stdio (false); cin.tie (NULL)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,n) for(int i=1;i<n;i++)
using namespace std;
typedef long long int ll;
void solve() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(max(a*c,a*d),max(b*d,b*c));
   cout<<ans;
}
int main(){
    FAST;

solve();


}

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    rep(_,n){
        int h;
        cin>>h;
        ans+=h>=k;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5,mod=1e9+7,inv2=(mod+1)/2;
inline int pls(int x,int y){
	x+=y;return x>=mod?x-mod:x;
} 
inline int dec(int x,int y){
	x-=y;return x<0?x+mod:x;
}
inline int mul(int x,int y){return 1ll*x*y%mod;}
inline int qpow(int a,int b){
	int res=1;
	for(;b;b>>=1,a=mul(a,a)) if(b&1) res=mul(res,a);
	return res;
}
inline int read(){
	int s=0;char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)) s=s*10+ch-'0',ch=getchar();
	return s;
}
int n;
int a[N],cnt[N],d[N],zero[N],p[N];
int tot=1;
int c1[N],c2[N];
inline void add(int x,int y){
	for(;x<=n;x+=x&-x) c1[x]=pls(c1[x],y),c2[x]++; 
}
inline int qry(int *c,int x){
	int s=0;
	for(;x;x-=x&-x) s=pls(s,c[x]);
	return s;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++) a[i]=read(),cnt[a[i]]++;
	for(int i=n-1;i>=1;i--) cnt[i]+=cnt[i+1];
	for(int i=1;i<=n;i++){
		cnt[i]-=(n-i);
		if(cnt[i]<=0) {puts("0");return 0;}
		tot=mul(tot,cnt[i]);
	}
	p[0]=d[0]=1;
	for(int i=1;i<=n;i++){
		int u=mul(cnt[i]-1,qpow(cnt[i],mod-2));
		d[i]=d[i-1],zero[i]=zero[i-1];
		if(!u) zero[i]++,p[zero[i]]=i;
		else d[i]=mul(d[i],u);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=pls(ans,mul(dec(qry(c1,a[i]),qry(c1,p[zero[a[i]]]-1)),mul(d[a[i]],mul(tot,inv2))));
		add(a[i],qpow(d[a[i]],mod-2));
	}
	memset(c1,0,sizeof(c1));memset(c2,0,sizeof(c2));
	for(int i=n;i>=1;i--){
		ans=dec(ans,mul(dec(qry(c1,a[i]-1),qry(c1,p[zero[a[i]]]-1)),mul(d[a[i]],mul(tot,inv2))));
		ans=pls(ans,mul(qry(c2,a[i]-1),tot));
		add(a[i],qpow(d[a[i]],mod-2));
	}
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 9204
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



double dp[600];
int n, m;
vector<int> edge[600];


double calc(int ngs, int ngt) {
	dp[n - 1] = 0;
	for (int s = n - 2; s >= 0; s--) {
		int e = 0;
		double sum = 0;
		for (int t : edge[s]) {
			if (s == ngs && t == ngt)continue;
			e++;
			sum += dp[t];
		}

		dp[s] = sum / e + 1;
	}
	return dp[0];
}


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

	cin >> n >> m;
	rep(i,m) {
		int s, t;
		cin >> s >> t;
		s--; t--;
		edge[s].push_back(t);
	}
	double ans = calc(-1, -1);
	vector<int> ng(n, -1);
	rep(i, n){
		if (edge[i].size() > 1) {
			double ma = 0;
			int tma = -1;
			for (int t: edge[i]) {
				if (ma < dp[t]) {
					ma = dp[t];
					tma = t;
				}
			}
			ng[i] = tma;
		}
	}


	rep(s, n) {
		if (ng[s] != -1) {
			ans = min(ans, calc(s, ng[s]));
		}
	}

	printf("%.10f\n", ans);


	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int n,l,cnt1,cnt2,A[10001],res;
bool cmp(int A,int B){
	return abs(A)<abs(B);
}
int main(){
	scanf("%d %d",&n,&l);
	for(int i=1;i<=n;i++)A[i]=l+i-1;
	sort(A+1,A+1+n,cmp);
	for(int i=2;i<=n;i++)cnt1+=A[i];
	cout<<cnt1;
	return 0;
}

Measured memory_bytes: 256
package main
import . "fmt"
func main() {
  var x1,y1,x2,y2 int
  var dx,dy int
  Scan(&x1,&y1,&x2,&y2)
  dx = x2-x1
  dy = y2-y1
  Printf("%d %d %d %d\n",x2-dy,y2+dx,x1-dy,y1+dx)
}

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

using namespace std;

int main()
{
    int t,tam;
    string s;
    cin>>t>>s;
    tam=s.size();

     if(tam<t){
        cout<<s;
        return 0;
     }
    for(int i=0; i<t;i++)
        cout<<s[i];
       if(tam>t)
        cout<<"...";

    return 0;
}


Measured memory_bytes: 3540
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

int main()
{
    int num,time;
    cin >> num >> time;
    string str;
    cin >> str;
    int ans = 0;
    string str_left = "L";
    string str_right = "R";
    int current=0;
    int change_point = 0;
    for(int i=1;i<num;i++){
        if(str.compare(i,1,str,i-1,1)==0){
            current ++;
        }else{
            ans += current;
            current = 0;
            change_point ++;
        }
    }
    ans += current;
    ans += min(change_point,time*2);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b, t;
    cin >> a >> b >> t;
    int res = t / a * b;
    cout << res << "\n";

    return 0;
}

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

int main() {
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  double x3 = x2 - x1;
  double y3 = y2 - y1;
  cout << fixed << setprecision(8);
  cout << sqrt(x3 * x3 + y3 * y3) << endl;
}



Measured memory_bytes: 3292
// abc061_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll N, K;
    cin >> N >> K;
    vector<P> AB(N);
    REP(i, N){
        cin >> AB[i].first >> AB[i].second;
    }
    sort(ALL(AB));

    ll sm = 0;
    ll ans = 0;
    REP(i, N){
        sm += AB[i].second;
        if (sm >= K){
            ans = AB[i].first;
            break;
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		int num = 0;
		scan.close();
		
		if(str.equals("SUN")) {num = 7;}
		else if (str.equals("MON")) {num = 6;}
		else if (str.equals("TUE")) {num = 5;}
		else if (str.equals("WED")) {num = 4;}
		else if (str.equals("THU")) {num = 3;}
		else if (str.equals("FRI")) {num = 2;}
		else if (str.equals("SAT")) {num = 1;}
		
		System.out.println(num);
	}
}




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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;

struct Edge{ int to; int d; };
vector<Edge> g[MAX_N];

bool mark[MAX_N];
ll memo[MAX_N];

bool consistent;
void dfs(int v, ll d) {
  if (mark[v]) {
    if (memo[v] != d) consistent = false;
    return;
  } else {
    mark[v] = true;
    memo[v] = d;
    for (const Edge& e : g[v]) {
      dfs(e.to, d + e.d);
    }
  }
}

bool solve() {
  REP(i, MAX_N) g[i].clear();
  CLR(mark, 0);
  CLR(memo, 0);

  int N = nextInt();
  int M  = nextInt();
  REP(i, M) {
    int L = nextInt() - 1;
    int R = nextInt() - 1;
    int D = nextInt();
    g[L].push_back({R, D});
    g[R].push_back({L,-D});
  }

  consistent = true;
  REP(i, N) if (!mark[i]) {
    dfs(i, 0);
  }
  return consistent;
}

int main2() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 11904
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	long long int n;
	cin >> n;
	long long int ans = 0;
	for (long long int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			ans = i;
		}
	}
	cout << (ans - 1) + (n / ans - 1);
}

Measured memory_bytes: 256
//
//  main.cpp
//  ABC144F2

#include <iostream>
#include <vector>
#include <numeric> // accumulate
#include <algorithm> // max_element
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main(int argc, const char * argv[])
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> to(n + 1);
    rep(i, m) {
        int s, t;
        cin >> s >> t;
        to.at(s).push_back(t); // 部屋Sから別の部屋への通路、複数本の時もある
    }
    vector<double>dp(n + 1);
    vector<int>mx2(n+1);
    dp.at(n) = 0.0;
    dp.at(n - 1) = 1.0;
    for (int i = n - 1; i >= 1; i--)
    {
        int num = (int)to.at(i).size();
        vector<double>sv(num);
        for (int j = 0; j < num; j++)
        {
            sv.at(j) = dp.at(to.at(i).at(j)) / num;
        }
        dp.at(i) = accumulate(sv.begin(), sv.end(),0.0)+1;
    }
    double ans=dp.at(1);
    vector<double>dp2(n+1);
    for (int k=n-1; k>=1; k--) { // kは試す通路のある洞窟番号
        dp2=dp; // vectorをコピーしておく
        for (int i=n-1;i>=1; i--) {
            int mx=n;
            int num=(int)to.at(i).size();
            vector<double>sv2(num);
            if(i==k){ // ひとつひとつの洞窟に対して、試してみる。
                for (int m=0; m<num; m++) {
                    if (dp2.at(to.at(i).at(m))>dp2.at(mx)) {
                        mx=to.at(i).at(m);
                    }
                }
                for (int j=0; j<num; j++) {
                    if(num==1){
                        sv2.at(j)=dp2.at(to.at(i).at(j));
                    } else{ // dpが最大の行き先への通路を塞ぎ、それ以外を計算する
                        if (to.at(i).at(j)!=mx) {
                            sv2.at(j)=dp2.at(to.at(i).at(j))/(double)(num-1);
                        }
                    }
                }
            }else{
                for (int j=0; j<num; j++) {
                    sv2.at(j)=dp2.at(to.at(i).at(j))/(double)num;
                }
            }
            dp2.at(i)=accumulate(sv2.begin(), sv2.end(), 0.0)+1.0;
        }
        ans=min(ans,dp2.at(1));
    }
    printf("%10.10f\n",ans);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  vector<vi32> A(3, vi32(3));
  vector<vi32> f(3, vi32(3));
  cin >> A;
  int n;
  cin >> n;
  rep(i, n) {
    int x;
    cin >> x;
    rep(j, 3) rep(k, 3) if (A[j][k] == x) {
      f[j][k] = 1;
    }
  }
  rep(i, 3) {
    bool b = true;
    rep(j, 3) {
      if (!f[i][j]) b = false;
    }
    if (b) yes();
  }
  rep(j, 3) {
    bool b = true;
    rep(i, 3) {
      if (!f[i][j]) b = false;
    }
    if (b) yes();
  }
  if (f[0][0] && f[1][1] && f[2][2]) yes();
  if (f[0][2] && f[1][1] && f[0][2]) yes();
  no();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<string> w(n);
    rep(i, n) cin >> w[i];
    string ans = "Yes";
    rep(i, n-1) {
        if (w[i].back()!=w[i+1][0]) ans = "No";
    }
    sort(whole(w));
    rep(i, n-1) {
        if (w[i]==w[i+1]) ans = "No";
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b){
        if(a<c && c<b){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else if(a>b){
        if(a>c && c>b){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
}

Measured memory_bytes: 256
M=10**9+7
def extended_gcd(a, b)
  last_remainder, remainder = a.abs, b.abs
  x, last_x, y, last_y = 0, 1, 1, 0
  while remainder != 0
    last_remainder, (quotient, remainder) = remainder, last_remainder.divmod(remainder)
    x, last_x = last_x - quotient*x, x
    y, last_y = last_y - quotient*y, y
  end
  return last_remainder, last_x * (a < 0 ? -1 : 1)
end

def invmod(e)
  g, x = extended_gcd(e, M)
  x % M
end

n,k=gets.split.map &:to_i
ans=(k..n+1).reduce(0){|s,i| (s+i*(n+1-i)+1)%M }
puts ans

Measured memory_bytes: 14404
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef gp_hash_table < int, int > fast;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 5, M = 1e3 + 5, LG = 20;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

void test();

int main() {
    fast_io();
    cout << fixed << setprecision(15);
    test();
    return 0;
}

void test() {
    int n;
    cin >> n;
    db ans = 0;
    for (int i = 0, a; i < n; ++i) {
        cin >> a;
        ans += 1 / db(a);
    }
    ans = 1 / ans;
    cout << ans << "\n";
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))
As.sort()

s = 0
ans = 0
for i in range(len(As)-1):
	s += As[i]
	if s * 2 >= As[i+1]:
		ans += 1
	else:
		ans = 0
ans += 1
print(ans)


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

int main() {
  int N, A, leftover;
  cin >> N ;
  cin >> A ;
  leftover = N % 500;
  
  if (leftover <= A) {
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

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


def main():
    As = map(int, readline().split())
    if sum(As) >= 22:
        print('bust')
    else:
        print('win')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[60][60];
	int n,m,i,j;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m+1;j++)
		{
			scanf("%c",&a[i][j]);
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
		    if(a[i][j]=='#')
		    {
		    	if(a[i+1][j]!='#'&&a[i-1][j]!='#'&&a[i][j+1]!='#'&&a[i][j-1]!='#')
		    	{
		    		printf("No");
		    		return 0;
				}
			}
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

// flagを用いたバブルソート
int bubbleSort(int A[],int N) {
    int i,j;
    int sw = 0;
    unsigned short flag = 1;
    for(i=0;flag;i++) {
        flag = 0;
        for(j=N-1;j>=i+1;j--) {
            if(A[j]<A[j-1]) {
                swap(&A[j],&A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main(void) {
    int i, A[100], N, sw;
    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = bubbleSort(A,N);

    for(i=0;i<N;i++) {
        if (i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",sw);

    return 0;
}


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

int A, B, C;
int X, Y;

int main(int argc, char* argv[]){
  cin  >> A >> B >> C >> X >> Y;
  int ans = 1001000100;
  if(X<Y){
	swap(A,B);
	swap(X,Y);
  }
  for(int i = 0; i <= X; i++){
	int c = (X-i)*2;
	int b;
	if(c/2>=Y) b = 0;
	else b = Y-c/2;
	int K = A*i+B*b+C*c;
	if(K<ans) ans = K;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import math

# 高速冪乗計算

def fast_modexp(x, e, n=(10**9+7)):
    y = 1
    for k in range(e.bit_length()):
        if e & (1<<(e.bit_length()-k-1)):
            y = y * y * x % n
        else:
            y = y * y % n

    return y

n, a, b = map(int, input().split())
numer_a = 1
numer_b = 1
for i in range(a):
    numer_a = (numer_a * (n-i)) % (10**9+7)

for i in range(b):
    numer_b = (numer_b * (n-i)) % (10**9+7)

denom_a = 1
denom_b = 1

for i in range(1, a+1):
    denom_a = (denom_a * i) % (10**9+7)

for i in range(1, b+1):
    denom_b = (denom_b * i) % (10**9+7)

ans = fast_modexp(2, n)
ans = (ans - 1) % (10**9+7)
ans = (ans - numer_a * fast_modexp(denom_a, 10**9+5)) % (10**9+7)
ans = (ans - numer_b * fast_modexp(denom_b, 10**9+5)) % (10**9+7)


print(ans)

Measured memory_bytes: 3064
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int fun(int n){
	return (n*n*n*n*n);
}

inline void solve(){
    int x;cin>>x;
    for (int i=0;i<500;i++){
    	for (int j=0;j<500;j++){
    		if (fun(i)-fun(j)==x) {
    			cout << i << " "<<j<<endl;
    			return;
    		}
    		if (fun(i)-fun(-j)==x) {
    			cout << i << " "<<-j<<endl;
    			return;
    		}if (fun(-i)-fun(j)==x) {
    			cout << -i << " "<<j<<endl;
    			return;
    		}
    		if (fun(-i)-fun(-j)==x) {
    			cout << -i << " "<<-j<<endl;
    			return;
    		}
    	}
    }
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}
/*

*/


Measured memory_bytes: 3616
X = int(input())
d = {}
for i in range(0, 26):
    d[i+1] = chr(97+i)
a = []
while X > 0:
    if X%26 != 0:
        a.append(d[(X % 26)])
        X -= X % 26
    else:
        a.append(d[26])
        X -= 26
    X //= 26
for i in a[::-1]:
    print(i, end='')
print()

Measured memory_bytes: 61788
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Numerics;

namespace competitive
{
    class Program
    {
        static void Main(string[] args)
        {
            var scanner = new Scanner();
            var x = scanner.NextLong();
            var rem = x % 11;
            var sub = x / 11;
            var ans = sub * 2;
            if (rem == 0)
            {

            }
            else if (rem <= 6)
            {
                ans++;
            }
            else
            {
                ans += 2;
            }
            Console.WriteLine(ans);
        }
    }

    public static class Extensions
    {
        public static int ToInt(this string str) => int.Parse(str);
        public static double ToDouble(this string str) => double.Parse(str);
        public static long ToLong(this string str) => long.Parse(str);
        public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    }

    public class Scanner
    {
        private TextReader reader;
        public Scanner()
        {
            reader = Console.In;
        }
        public Scanner(TextReader reader)
        {
            this.reader = reader;
        }
        private string NextWord()
        {
            var sb = new StringBuilder();
            while (true)
            {
                var c = reader.Read();
                if (c == -1 || c == 13 || c == 10)
                {
                    break;
                }
                sb.Append((char)c);
            }
            return sb.ToString();
        }
        public int NextInt()
        {
            return NextWord().ToInt();
        }
        public string Next()
        {
            return NextWord();
        }
        public double NextDouble()
        {
            return NextWord().ToDouble();
        }
        public long NextLong()
        {
            return NextWord().ToLong();
        }
        public BigInteger NextBigInteger()
        {
            return NextWord().ToBigInteger();
        }
        public string NextLine()
        {
            return reader.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
#define mod 1000000007
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x
  
using namespace std;
signed main()
{

  std::ios::sync_with_stdio(false);
  cin.tie(); cout.tie();
  int t;
  cin>>t;
  int ctr = 0;
  bool ok = false;
  while(t--){
   int a,b;
   cin>>a>>b;
    if(a==b)ctr++;
    else ctr = 0;
    if(ctr>=3)ok = true;
  }
  if(ok){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 3644
n = int(input())
s = list(map(int,input().split()))

odd = []
even = []
for i in range(n):
    if i%2 == 0:
        odd.append(s[i])
    else:
        even.append(s[i])
    
ans = odd[::-1] + even
ans_str=[str(a) for a in ans]

if n%2 == 1:
    print(" ".join(ans_str))
else:
     print(" ".join(ans_str[::-1]))



Measured memory_bytes: 37752
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

ll A,B;

vector<ll> factorize(ll X){
  vector<ll> res;
  for(ll i=2;i*i<=X;i++){
    if(X%i==0){
      res.push_back(i);
      while(X%i==0) X/=i;
    }
  }
  if(X>1) res.push_back(X);
  return res;
}

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

  vector<ll> pri=factorize(A);
  ll ans=1;
  for(int i=0;i<pri.size();i++){
    if(B%pri[i]==0) ans++;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
ARR = list(map(int, input().split()))

def calculate(n, arr):
    mod = 1000000000 + 7
    result = 0

    rightTotal = sum(arr)
    for i in range(n-1):
        rightTotal -= arr[i]
        result += (arr[i] * rightTotal) % mod

    print(result % mod)




calculate(N, ARR)

Measured memory_bytes: 31368
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define pb(a) push_back(a)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
  int n,l;
  cin >> n >> l;
  int aji[n];
  int sum = 0;
  REP(i,n){
    aji[i] = l+i;
    sum += aji[i];
  }
  int res;
  if(l>=0){
    res = sum-aji[0];
  }else if(n>-l){
    res = sum;
  }else{
    res = sum-aji[n-1];
  }

  cout << res << endl;
  return 0;

}


Measured memory_bytes: 256
N = int(input())
v = list(map(int, input().split()))
for i in range(N-1):
  v.sort()
  a = 0
  a += v[0]
  v.remove(v[0])
  a += v[0]
  v.remove(v[0])
  v.append(a/2)
print(v[0])

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		int i,j;
		Scanner sc = new Scanner(System.in);
		int a[] = new int[3];
		for(i = 0; i < 3; i++){
			a[i] = sc.nextInt();
		}
		
		for(i = 0; i < 3; i++){
			for(j = i + 1; j < 3; j++){
				if(a[i] > a[j]){
					int tmp = a[i];
					a[i] = a[j];
					a[j] = tmp;
				}
			}
		}
		for(i = 0; i < 3; i++){
			System.out.print(a[i]);
			if(i == 2){
				System.out.println("");
			}else{
				System.out.print(" ");
			}
		}
	}
}
			

Measured memory_bytes: 26140
import scala.collection.mutable
object Main extends App {
  import scala.io.StdIn._
  val s1 = readLine.trim
  val s2 = readLine.trim
  val countS1 = Array.fill(s1.length + 1){Array.fill(26){0}}
  val countS2 = Array.fill(s2.length + 1){Array.fill(26){0}}
  for (i ← s1.indices; j ← 0 until 26) {countS1(i + 1)(j) = countS1(i)(j) + (if (s1(i) - 'a' == j) 1 else 0)}
  for (i ← s2.indices; j ← 0 until 26) {countS2(i + 1)(j) = countS2(i)(j) + (if (s2(i) - 'a' == j) 1 else 0)}
  println((1 to Math.min(s1.length, s2.length)).reverse.find(len ⇒ canMakeHiddenAnagram(countS1, countS2, len)).getOrElse(0))
  def canMakeHiddenAnagram(str1: Array[Array[Int]], str2: Array[Array[Int]], length: Int): Boolean = {
    val set = mutable.Set[List[Int]]()
    for (from ← 0 until str1.length - length) {
      set += str1(from + length).zip(str1(from)).map{case (a, b) ⇒ a - b}.toList
    }
    (0 until  str2.length - length).exists(from ⇒ set.contains(str2(from + length).zip(str2(from)).map{case (a, b) ⇒ a - b}.toList))
  }
}


Measured memory_bytes: 584700
def main(n):
  s=0
  if n%10==2:
    s+=1
  if (n%100)//10==2:
    s+=1
  if (n%1000)//100==2:
    s+=1
  if n>=2000 and n<=2999:
    s+=1
  return s
n=int(input())
print(main(n))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,a[200010];
    cin>>n;
    rep(i,n)cin>>a[i];
    int ans=0;
    rep(i,n-1){
        if(a[i]>a[i+1]){
            ans+=a[i]-a[i+1];
            a[i+1]=a[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5200
N = int(input())
arr = [0] + list(map(int,input().split()))
cnt_arr = [0]*(N+1)
for i in arr:
  cnt_arr[i] += 1
def cmb2(n):
  if n<2:
    return 0
  else:
    return n*(n-1)//2
cmb_arr = [0]*(N+1)

_sum = 0
for idx,cnt in enumerate(cnt_arr):
  cmb_arr[idx] = cmb2(cnt)
  _sum += cmb_arr[idx]

for k in range(1,N+1):
  print(_sum - cmb2(cnt_arr[arr[k]]) + cmb2(cnt_arr[arr[k]]-1))
  

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

int fitSquareSize( int n, int y, int x, char* table, bool* checked ){
	int size;
	bool end = false;
	for( size = 1; ; ++size ){
		for( int i = 0; i < size; ++i ){
			if( table[ ( y + (size-1) ) * (n+1) + ( x + i ) ] == '*' ||
				table[ ( y + i ) * (n+1) + x + (size-1) ] == '*' ){
				end = true;
				break;
			}
		}
		if( end ){
			break;
		}
		checked[ y * (n+1) + x + (size-1) ] = true;
	}
	return size-1;
}

int main(){
	int n;
	while( cin >> n && n ){
		char* table = new char[ (n+1) * (n+1) ];
		bool* checked = new bool[ (n+1) * (n+1) ]();
		int sizeMax = 0;
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				char c;
				cin >> c;
				int index = i * (n+1) + j;
				table[ index ] = c;
				if( c =='*' ){
					checked[ index ] = true;
				}
			}
			table[ i * (n+1) + n ] = '*';
			checked[ i * (n+1) + n ] = true;
		}
		for( int i = 0; i < n+1; ++i ){
			int index = n * (n+1) + i;
			table[ index ] = '*';
			checked[ index ] = true;
		}
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				if( checked[ i * (n+1) + j ] ) continue;
				sizeMax = max( fitSquareSize( n, i, j, table, checked ), sizeMax );
			}
		}

		cout << sizeMax << endl;

		delete[] table;
		delete[] checked;
	}
}

Measured memory_bytes: 2104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			int n = Integer.parseInt(br.readLine());

			if(n == 0){
				break;
			}

			writeNumbers("", n, n);
		}
	}

//	static ArrayList<Integer> makeList(int num){
//		if(num == 1){
//			ArrayList<Integer> list = new ArrayList<Integer>();
//			list.add(1);
//			return list;
//		}
//
//		else {
//			for(int i = num ; i >= 1 ; i++){
//				ArrayList<Integer> subList = makeList(num - 1);
//			}
//		}
//	}

	static void writeNumbers(String str, int n, int prev){
		//System.out.println("n = "+n);
		
		for(int i = n; i >= 1 ; i--){
			String[] tmpArray = str.split(" ");
			if(i == n && i <= prev){
				System.out.println(str + n);
			}
			else if(i <= prev){
				//System.out.print(str + " " + i + " ");
				if(str.equals("")){
					writeNumbers(i+" ", n - i, i);
				}
				else {
					writeNumbers(str + i+ " ",  n - i, i);
				}
			}
		}
	}

}

Measured memory_bytes: 81252
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int a[] = new int[n + 2];
        a[0] = 0;
        a[n + 1] = 0;

        int sum = 0;
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
            sum += Math.abs(a[i - 1] - a[i]);
        }
        sum += Math.abs(a[n] - a[n + 1]);

        for (int i = 1; i <= n; i++) {
            System.out.println(sum - calc(a[i - 1], a[i], a[i + 1]));
        }
    }

    private int calc(int a, int b, int c) {
        if ((a <= c && c <= b) || (b <= c && c <= a)) {
            return 2 * Math.abs(b - c);
        }

        if ((b <= a && a <= c) || (c <= a && a <= b)) {
            return 2 * Math.abs(a - b);
        }

        return 0;
    }

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


Measured memory_bytes: 71500
Ss=[i for i in input()]
anss = []
counter = 0
for i in range(len(Ss)):
    if Ss[i]!="A" and Ss[i]!="C" and Ss[i]!="G" and Ss[i]!="T":
        anss.append(counter)
        counter=0
    else:
        counter+=1
        anss.append(counter)
if len(anss)!=0:
    print(max(anss))
else:
    print(0)

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

int main() {
  int n; cin >> n;
  vector<int> l(n);
  ll ans = 0;
  rep(i,n) cin >> l[i];
  rep(i,n) {
    for (int j = i+1; j < n; j++) {
      if (l[i] == l[j]) continue;
      for (int k = j+1; k < n; k++) {
        if (l[i] == l[k] || l[j] == l[k]) continue;
        if (abs(l[j]-l[k]) < l[i] && l[i] < l[j] + l[k]) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
N = int(input())
a_list = list(map(int,input().split()))

cnt = 0
for a in a_list:
    tmp_cnt = 0
    while True:
        if a % 2 == 0:
            tmp_cnt += 1
            a = int(a / 2)
        else:
            break
    cnt += tmp_cnt
        
print(cnt)

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

using namespace std;
typedef pair<int, int> P;

int park[200001];
int parl[200001];
int rankk[200001];
int rankl[200001];

int findk(int x){
		if(park[x] == x)return x;
		else return park[x] = findk(park[x]);
}

int findl(int x){
		if(parl[x] == x)return x;
		else return parl[x] = findl(parl[x]);
}

bool connk(int x, int y){
		return findk(x) == findk(y);
}

bool connl(int x, int y){
		return findl(x) == findl(y);
}

void mergek(int x, int y){
		int xp = findk(x);
		int yp = findk(y);
		if(xp == yp)return;
		if(rankk[xp] > rankk[yp]){
				park[yp] = xp;
		}else{
				park[xp] = yp;
				if(rankk[xp] == rankk[yp])rankk[yp]++;
		}
}

void mergel(int x, int y){
		int xp = findl(x);
		int yp = findl(y);
		if(xp == yp)return;
		if(rankl[xp] > rankl[yp]){
				parl[yp] = xp;
		}else{
				parl[xp] = yp;
				if(rankl[xp] == rankl[yp])rankl[yp]++;
		}
}

int main(int argc, char const* argv[])
{
	int n, k, l;
	cin >> n >> k >> l;
	for(int i = 0; i < n; i++){
			park[i] = i;
			parl[i] = i;
	}
	for(int i = 0; i < k; i++){
			int p, q;
			cin >> p >> q;
			p--;
			q--;
			mergek(p, q);
	}
	for(int i = 0; i < l; i++){
			int p, q;
			cin >> p >> q;
			p--;
			q--;
			mergel(p, q);
	}
	map<P, int> mp;
	for(int i = 0; i < n; i++){
			P tmp = make_pair(findk(i), findl(i));
			if(mp.find(tmp) == mp.end())mp[tmp] = 0;
			mp[tmp]++;
	}
	for(int i = 0; i < n; i++){
			cout << mp[make_pair(findk(i), findl(i))];
			if(i == n - 1)cout << endl;
			else cout << " ";
	}
	return 0;
}


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

int main(){
  vector<int> a(4) ; //4は要素数
  for (int i=0; i<4; i++){
    cin >> a.at(i) ;
  }
  sort(a.begin(),a.end());
  if (a.at(0)==1 && a.at(1)==4 && a.at(2)==7 && a.at(3)==9){
  cout << "YES" << endl ;  
  }
  else{
    cout << "NO" << endl ;  
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  string s;
  cin>>s;
  int n=s.length();
  int ans=10000;
  rep(i,0,n-2){
    string s1=s.substr(i,3);
    ans=min(ans,abs(753-stoi(s1)));
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

int main(){
  int N;
  cin >> N;
  vector<long> H(N);
  for(int i = 0; i < N; i++) cin >> H.at(i);
  long pre, now, next;
  bool check = false;
  bool down = false;
  if(N == 1){
//    cout << 1;
    cout << "Yes" << endl;
  }
  else if(N == 2){
    if(H.at(1) - H.at(0) > -2){
//      cout << 2;
      cout << "Yes" << endl;
    }
    else{
//      cout << 3;
      cout << "No" << endl;
    }
  }else{
    now = H.at(0);
    next = H.at(1);
    if(next - now < -1) check = true;
    else if(now > next){
      down = true;
      now--;
    }
    for(int i = 1; i < N - 1; i++){
      if(check) break;
      pre = now;
      now = next;
      next = H.at(i + 1);
      if(now - pre < -1){
        check = true;
        break;
      }else if(next - now < -1){
        check = true;
        break;
      }
      if(now > next){
        if(down){
          check = true;
          break;
        }
        down = true;
        now--;
      }
      if(now < next){
        down = false;
      }
    }//i
    if(check){
//      cout << 4;
      cout << "No" << endl;
    }else cout << "Yes" << endl;
  }
//  cout << down << endl;
//  cout << "false = " << false;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(i,a,n) for(int i = a;i < (int)(n);i++)
using namespace std;
typedef long long ll;

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

    cout << max(A+B,max(A-B,A*B));

}

Measured memory_bytes: 764
from collections import defaultdict

n, t = map(int, input().split())
menu = []

for _ in range(n):
    a, b = map(int, input().split())
    menu.append((a, b))

menu = sorted(menu)

dp = defaultdict(int)
dp[0] = 0

score = 0

for a, b in menu:
    for time, utility in list(dp.items()):
        if time + a >= t:
            score = max(score, utility + b)
        else:
            dp[time + a] = max(dp[time + a], utility + b)

print(max(score, max(dp.values())))


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

int main() {
  string S,T;
  cin >> S >> T;
  
  //cout << S << endl << T << endl;
  //cout << T.size() << endl;
  
  //T.at(T.size() - 1) = '';
  T.pop_back();
  //cout << T << endl;
  
  if(S==T){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


}


Measured memory_bytes: 3600