akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2505;
vector<int>G[maxn],C[maxn];
ll dist[maxn];
int in[maxn];
bool vis[maxn],is[maxn][maxn];
void bfs(int s)
{
    queue<int>P;
    P.push(s);
    is[s][s]=1;
    while(!P.empty())
    {
        int v=P.front();P.pop();
        for(int i=G[v].size()-1;i>=0;i--)
        {
            int to=G[v][i];
            if(!is[s][to])
            {
                is[s][to]=1;
                P.push(to);
            }
        }
    }
}
ll spfa(int s,int t)
{
    for(int i=0;i<maxn;i++)
        dist[i]=-1e18;
    dist[s]=0;
    vis[s]=1;
    queue<int>P;
    P.push(s);
    while(!P.empty())
    {
        int v=P.front();
        P.pop();
        vis[v]=0;
        for(int i=G[v].size()-1;i>=0;i--)
        {
            int to=G[v][i],cost=C[v][i];
            if(is[to][t]==0)
                continue;
            if(dist[to]<dist[v]+cost)
            {
                dist[to]=dist[v]+cost;
                in[to]++;
                if(in[to]>maxn)
                    return -1;
                if(!vis[to])
                {
                    vis[to]=1;
                    P.push(to);
                }
            }
        }
    }
    if(dist[t]<-1e17)
        return -1;
    return max(1LL*0,dist[t]);
}
int main()
{
    int n,m,p;
    scanf("%d%d%d",&n,&m,&p);
    for(int i=1;i<=m;i++)
    {
        int x,y,z;scanf("%d%d%d",&x,&y,&z);
        G[x].push_back(y);
        C[x].push_back(z-p);
    }
    for(int i=1;i<=n;i++)
        bfs(i);
    printf("%lld\n",spfa(1,n));
    return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;

void solve() {
	cin >> N;
	int res = 0;
	rep(i, 1, N + 1) {
		int n = i;
		int cnt = 0;
		while(n != 0) {
			n /= 10;
			cnt++;
		}
		res += cnt % 2;
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}

bool x[4];

signed main() {
	int a, b;
	cin >> a >> b;
	x[a] = true, x[b] = true;
	if (x[1] && x[2]) {
		cout << 3 << endl;
	}
	else if (x[1] && x[3]) {
		cout << 2 << endl;
	}
	else {
		cout << 1 << endl;
	}

	return 0;
}


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

int N, A[100005], ans;
int B[200005];

void cal(){
  
  int sum = 0;
  
  for(int i=1;i<=200000;i++){
    if( B[i] && B[i-1] ) sum += abs( B[i] - B[i-1] );
  }
  
  ans = max( ans, sum );
  
}

void check(int flag){
  
  int L = 100000 - 1, R = 100000 + 1;
  int l = 0, r = N - 1;
  
  if( flag == 0 ) B[100000] = A[l++];
  else B[100000] = A[r--];
  
  flag = !flag;
  
  while(1){
    
    if( l > r ) break;
    
    if( flag == 0 ){
      
      if( l == r ){
	
	if( B[L+1] > B[R-1] ) B[L--] = A[l++];
	else B[R--] = A[l++];
	
      }
      else{
	
	B[L--] = A[l++];
	
	B[R++] = A[l++];
	
      }
      
    }
    else{
      
      if( l == r ){
	
	if( B[L+1] < B[R-1] ) B[L--] = A[r--];
	else B[R--] = A[r--];
	
      }
      else{

	B[L--] = A[r--];
	
	B[R++] = A[r--];
	
      }
      
    }
    
    flag = !flag;
    
  }
  
  cal();
  
}

signed main(){
  
  cin>>N;
  
  for(int i=0;i<N;i++) cin>>A[i];
  
  sort( A, A + N );
  
  check(0);
  
  check(1);
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> xy_t;

xy_t P[110];
int main(){
  int N = 0;
  double x,y;
  while(~scanf("%lf,%lf", &x, &y)) {
      P[N++] = xy_t(x,y);
  }

  double sum = 0.0;
  for(int i = 0; i+2<N; ++i) {
    xy_t a=P[0], b=P[i+1], c=P[i+2];
    sum +=abs( ((conj(b-a)*(c-a)).imag())/2.0);
  }
  printf("%.6f\n",abs(sum));



  return 0;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
     
using namespace std;
     
int n;
vector<double> p;
vector<vector<double>> memo;

double probability_of_having_more_heads_than_tails(int coin_idx, int flipped_head) {
    if(coin_idx >= n)
        return (flipped_head > n / 2) ? 1 : 0;

    if(memo[coin_idx][flipped_head] != -1)
        return memo[coin_idx][flipped_head];

    memo[coin_idx][flipped_head] = probability_of_having_more_heads_than_tails( coin_idx + 1 , flipped_head + 1) * p[coin_idx] + probability_of_having_more_heads_than_tails(coin_idx + 1, flipped_head) * (1 - p[coin_idx]);
    return memo[coin_idx][flipped_head];
}
     
int main() {
    cin >> n;
    cout.precision(10);
    p = vector<double>(n);
    memo = vector<vector<double>>(n, vector<double>(n, -1));
    for(int i = 0; i < n; i++)
        cin >> p[i];
     
    double result = probability_of_having_more_heads_than_tails( 0, 0);
     
    cout << result << endl;
     
    return 0;
}

Measured memory_bytes: 70912
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		String str;
		str = sc.next();
			StringBuilder strBul = new StringBuilder(str).reverse();
			System.out.println(strBul);
		}
}

Measured memory_bytes: 25584
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n;
	int sco=0;
	vector<int> a;

	cin>> n;
	a.resize(n);

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

	sort(a.begin(), a.end());

	for(int i=0;i<n;i++){
		if(i%2==(n+1)%2){
			sco+=a[i];
		}else{
			sco-=a[i];
		}
	}

	cout<< sco << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll cnt=0;
    rep(i,n){
        if(a[i]<0) cnt++;
    }
    if(cnt%2==0){
        ll res=0;
        rep(i,n) res+=abs(a[i]);
        cout<<res<<endl;
    }else{
        ll res=0;
        rep(i,n) res+=abs(a[i]);
        ll nin=1e10;
        rep(i,n) chmin(nin, abs(a[i]));
        cout<<res - 2*nin<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		double x,h,S;
		cin >> x;
		cin >> h;
		if(!x&&!h)	break;
		S = x*x;
		S += (sqrt(x*x/4+h*h)*x*2);
		printf("%.7lf\n",S);
	}
	return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
string t;
char ch;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>t;
sort(t.begin(),t.end());
if(t.size()==1&&t[0]=='a') {
        cout << "None";
        return 0;
    }
set <char> s;
for(long long  i=0;i<t.size();i++){
    s.insert(t[i]);
}

for(char i='a';i<='z';i++){
    if(s.count(i)==true)continue;
    else{
        cout<<i;
        return 0;
    }}
cout<<"None";
return 0;}



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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

vector<int> a, dp;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, k;
    cin >> n >> k;
    a = vector<int>(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    vector<int> dp(k+1, 0);
    for(int i = 1; i <= k; ++i){
        for(int j = 0; a[j] <= i && j < n; ++j){
            dp[i] |= !dp[i-a[j]];
        }
    }

    cout << (dp[k] ? "First" : "Second") << "\n";
    return 0;
}

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

int main() {
  
  int A, B, C, D;
  
  cin >> A >> B >> C >> D;
  
  if(A+B>C+D)
    cout << "Left" <<endl;
  else if(A+B==C+D)
    cout << "Balanced" <<endl;
  else if(A+B<C+D)
    cout << "Right" << endl;
}

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

const int N = 1010;
const int mod = 1e9 + 7;

int h, w, f[N][N];
char a[N][N];

int main() {
	scanf("%d%d", &h, &w);
	f[1][1] = 1;
	for(int i = 1; i <= h; ++i) scanf("%s", a[i] + 1);
	for(int i = 1; i <= h; ++i) {
		for(int j = 1; j <= w; ++j) {
			if(i == 1 && j == 1) continue;
			if(a[i][j] == '.' && a[i - 1][j] == '.') 
				(f[i][j] += f[i - 1][j]) %= mod;
			if(a[i][j] == '.' && a[i][j - 1] == '.')
				(f[i][j] += f[i][j - 1]) %= mod;
		}
	}
	printf("%d\n", f[h][w]);
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return (rand()<<16|rand())%x;
}
int n,ans=1e9;
inline int sum(int x){
	if(x==0)return 0;
	else return sum(x/10)+x%10;
}
int main(){
	n=read();
	for(int i=1;i<n;i++){
		ans=min(ans,sum(i)+sum(n-i));
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main(){
  int n, x;
  std::cin >> n >> x;
  std::vector<int> l;
  int temp;
  while(std::cin >> temp)
    l.push_back(temp);
  int cnt = 0;
  long bound = 0;
  for(int i = 0; bound <= x && cnt < n+1; ++i, ++cnt)
    bound = bound + l[i];
  std::cout << cnt << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define mod 1000000000+7
#define rep(i,n) for(int i=0;i<(int) (n);i++)
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;}
using namespace std;
int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;

  if(u==s)cout<<a-1<<" "<<b;
  else cout<<a<<" "<<b-1;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int

int main()
{
 	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  	//ll tt;	cin>>tt;	while(tt--)
  	{
  		ll n,i,j;
  		string str;

  		cin>>str;//cout<<str<<endl;
		n=str.size();
  		str=" "+str;
  		
  		
  		bool flag=true;

  		for(i=1,j=n;i<=j;i++,j--)	if(str[i]==str[j])	;
 										else flag=false;

  		for(i=1,j=(n-1)/2;i<=j;i++,j--)	if(str[i]==str[j])	;
 										else flag=false;

 		for(i=(n+3)/2,j=n;i<=j;i++,j--)	if(str[i]==str[j])	;
 		else flag=false;
 
 		cout<<(flag?"Yes":"No")<<endl;
  	}
 	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
    return 0;
  		
}

Measured memory_bytes: 256
#include <iostream>
typedef long long int llint;

llint step = 0;
llint getgcd(llint a, llint b){
  if(b==0)return a;
  step++;
  return getgcd(b, a%b);
}

int main(){
  llint a, b;
  while(std::cin >> a >> b, a && b){
    llint gcd = 0;
    step = 0;
    if(a > b)gcd = getgcd(a, b);
    else gcd = getgcd(b, a);
    std::cout << gcd << " " << step << std::endl;
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,res=0;
    scanf("%d",&n);
    while(1)
    {
    res=n%10;
    if(res-7==0){
        cout << "Yes" << "\n";
        break;
    }
    n=n/10;
    res=n%10;
    if(res-7==0){
        cout << "Yes" << "\n";
        break;
    }
    n=n/10;
    res=n%10;
    if(res-7==0){
        cout << "Yes" << "\n";
        break;
    }
        else{
        cout << "No" << "\n";
        return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        vector<int> a(n);
        REP(i, n) cin >> a[i];

        map<int, ll> mp;
        REP(i, n) mp[a[i]]++;

        ll p = 0;
        for (auto itr : mp) {
                if (itr.second >= 2) {
                        p += itr.second * (itr.second - 1) / 2;
                } 
        }

        REP(i, n) {
                if (mp[a[i]] >= 2) {
                        cout << p - mp[a[i]] + 1 << endl;
                } else {
                        cout << p << endl;
                }
        }

        return 0;
}


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

int main(){
    ll n;
    cin >> n;
    vector<pll> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(),a.end());
    ll ans = 0;
    set<ll> st;
    st.insert(-1);
    st.insert(n);
    rep(i,n){
        auto it = st.lower_bound(a[i].second);
        ll res = a[i].first * ((*it) - a[i].second);
        --it;
        res *= (a[i].second - (*it));
        ans += res;
        st.insert(a[i].second);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    int a = 0, b = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') ++a;
    }
    int ans = max(a, b);
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') --a;
        else ++b;
        int now = max(a, b);
        ans = min(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3728
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll; 
const int Max = 2e5 + 5;
int n, k;
int a[Max];

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout <<c <<" "<< a <<" "<< b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) < (b) ? (b) : (a))

int main() {
  int n, x, answer = 0, an;
  while(1) {
    scanf("%d%d", &n, &x);
    answer = 0;
    if(!n && !x) break;
    for(an = n; x + 3 <= an * 3; --an) {
      answer += max(((min(x - an, an) - 1) - (x - an - min(x - an, an) + 1) + 1) / 2, 0);
    }
    printf("%d\n", answer);
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, m; cin >> n >> m;
  for (int x; cin >> x; n -= x);
  cout << max(n, -1) << endl;

  return 0;
}


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

int main() {
    int N, L;
    string s[110], ans="";
    cin >> N >> L;
    for (int i = 0; i < N; ++i) cin >> s[i];

    sort(s, s + N);
    for (int i = 0; i < N; ++i) ans += s[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
tbl=[list(map(int, input().split())) for _ in range(3)]
N=int(input())
lst=list(int(input()) for _ in range(N))
for i in range(3):
  for j in range(3):
    for x in lst:
      if tbl[i][j] == x:
        tbl[i][j] = 0
        break
if max(tbl[0][0],tbl[0][1],tbl[0][2]) == 0:
  print("Yes")
elif max(tbl[1][0],tbl[1][1],tbl[1][2]) == 0:
  print("Yes")
elif max(tbl[2][0],tbl[2][1],tbl[2][2]) == 0:
  print("Yes")
elif max(tbl[0][0],tbl[1][0],tbl[2][0]) == 0:
  print("Yes")
elif max(tbl[0][1],tbl[1][1],tbl[2][1]) == 0:
  print("Yes")
elif max(tbl[0][2],tbl[1][2],tbl[2][2]) == 0:
  print("Yes")
elif max(tbl[0][0],tbl[1][1],tbl[2][2]) == 0:
  print("Yes")
elif max(tbl[2][0],tbl[1][1],tbl[0][2]) == 0:
  print("Yes")
else:
  print("No")

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

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    vector<string> s(3);
    cin >> s.at(0) >> s.at(1) >> s.at(2);
    char cur = 0;
    vector<ll> pos(3, 0);
    while(1){
        if(pos.at(cur) >= s.at(cur).size()){
            cout << (char)('A' + cur) << endl;
            return 0;
        }
        ll nxt = s.at(cur).at(pos.at(cur)) - 'a';
        pos.at(cur)++;
        cur = nxt;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n, m;
  cin >> n >> m;
  map<int,int> mp;
  for(int i = 0; i < n; ++i){
    int k;
    cin >> k;
    for(int j = 0; j < k; ++j){
      int a;
      cin >> a;
      mp[a]++;
    }
  }

  int ans = 0;
  for(auto itr : mp){
    if(itr.second == n){
      ans++;
    }
  }

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



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
n4 = 0
n2 = 0
for i in a:
    if i % 4 == 0:
        n4 += 1
    elif i % 2 == 0:
        n2 += 1
if n%2==0:
    n -= 2*n4
    n -= n2
    if n <= 0:
        print('Yes')
    else:
        print('No')
else:
    n-=2*n4
    if n<=1:
        print('Yes')
    else :
        n -= n2
        if n <= 0:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 14224
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#define Z(z)m[a+b]=1;m[b+a]=1;reverse(z.begin(),z.end());
using namespace std;main(){
	int i,n;
	for(cin>>n;n;n--){
		string s,a,b;cin>>s;map<string,int> m;
		for(i=0;++i<s.length();){a=s.substr(0,i),b=s.substr(i);Z(a)Z(b)Z(a)Z(b)}
		cout<<m.size()<<endl;
	}
}

Measured memory_bytes: 1300
def main():
    N = int(input())
    A = [int(val)-(i+1) for i,val in enumerate(input().split())]
    A.sort()
    if N&1:
        b = A[N//2]
        ans = sum([abs(a-b) for a in A])
    else:
        b1 = A[N//2]
        b2 = A[N//2 - 1]
        ans1 = [abs(a-b1) for a in A]
        ans2 = [abs(a-b2) for a in A]
        ans = min(sum(ans1),sum(ans2))
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 99396
h,w=[int(i) for i in input().split()]
a=[]
row=[]
col=[]
for i in range(h):
    a.append(input())
for i in range(h):
    row.append(False)
for i in range(w):
    col.append(False)

for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            row[i]=True
            col[j]=True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j],end="")
        print("\n")


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    int check;

    REP(i, s.length()){
        s.pb(s[0]);
        s.erase(0, 1);
        if(s == t) check++;
    }
    if(check == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <iostream>
using namespace std;
int main() {
  string s;
  while (cin >> s,s != "0") {

    int l = s.length();
    int t[l+1][11], ans = 0, u = 0;
    for(int i = 0; i <= l; ++i) fill(t[i],t[i]+11,0);
    t[l][0] = 1;
    for(int i = l-1; i >= 0; --i){
      for(int j = 0; j < 11; ++j) t[i][j] = t[i+1][j];
      int k = s[i] - '0';

      if((l-i)%2 == 0) k = 11-k;
      u += k;
      u %= 11;
      if(s[i] != '0') ans += t[i][u];
      ++t[i][u];
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 6608
N = int(input())
a = [int(x) for x in input().split()]
result = 0
prev = a[0]
change = False
for i in range(1, N):
	if prev == a[i] and not change:
		result += 1
		change = True
	else:
		change = False
	prev = a[i]
print(result)

Measured memory_bytes: 3064
# import bisect
# from collections import Counter, defaultdict, deque, namedtuple
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    p = list(map(int,ipti().split()))

    ans = 0
    for i in range(1, n-1):
        if p[i - 1] < p[i] < p[i + 1]:
            ans += 1
        elif p[i + 1] < p[i] < p[i - 1]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
//#include "stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = max(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int dy = y2 - y1;
	int dx = x2 - x1;
	
	printf("%d %d %d %d\n", x2 - dy, y2 + dx, x1 - dy, y1 + dx);
}


Measured memory_bytes: 256
#include <stdio.h>
int stack[100];
int it=0;
int pop(){
	return stack[it--];
}

void push(int x){
	stack[++it]=x;
}

int main(void){
	int i=0,x,y;
	char str[64];
	while(scanf("%s",str)!=EOF){
		switch(str[0]){
			case '+':
			x = pop();
			y = pop();
			push(y+x);
			break;
			case '-':
			x = pop();
			y = pop();
			push(y-x);
			break;
			case '*':
			x = pop();
			y = pop();
			push(y*x);
			break;
			case '/':
			x = pop();
			y = pop();
			push(y/x);
			break;
			default:
			push(atoi(str));
			break;
		}
	}
	printf("%d\n",pop());
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n],b[n]={};
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++){
        b[a[i]-1] = i+1;
    }
    for(int i = 0; i < n; i++){
        cout << b[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>
 
using namespace std;

typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000007

#define N_MAX (1<<18)
#define INF 1000000000000000000LL

struct segmx{
  long long nn;
  long long dat[(2 * N_MAX) - 1];

  void init(long long n1){
    nn = 1;

    while(nn < n1)nn *= 2;

    for(long long i = 0; i < 2 * nn - 1; i++){
      dat[i] = -INF;
    }
  }

  void update(long long k, long long a){
    k += nn - 1;
    dat[k] = a;
    while(k > 0){
      k = (k - 1) / 2;
      dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }

  long long query(long long a, long long b, long long k, long long l, long long r){
    if(r <= a || b <= l)return -INF;

    if(a <= l && r <= b){
      return dat[k];
    }
    else{
      long long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
      long long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return max(vl, vr);
    }
  }

  long long query(long long a, long long b){
    return query(a,b,0,0,nn);
  }
}segmx1;

int main(){
  segmx1.init(200100);
  ll n;
  cin>>n;
  vector<pair<ll,ll> > v;
  ll mx = 0;

// 1

  rep(i,0,n){
    ll a,b;
    cin>>a>>b;
    v.pb(mp(a,b));
  }
  sort(all(v));
  ll index = 5;
  rep(i,0,v.sz){
    segmx1.update(index,v[i].fi+v[i].se);
    index++;
  }

  index = 5;
  rep(i,0,v.sz-1){
    ll a = segmx1.query(index+1,n+5);
    mx = max(mx,a-v[i].fi-v[i].se);
    index++;
  }

// 2

  vector<pair<ll,ll> > v1;
  segmx1.init(200100);

  rep(i,0,v.sz){
    ll a = v[i].fi;
    ll b = v[i].se;
    v1.pb(mp(a,1000000000-b));
  }
  v = v1;
  sort(all(v));
  index = 5;
  rep(i,0,v.sz){
    segmx1.update(index,v[i].fi+v[i].se);
    index++;
  }
  index = 5;
  rep(i,0,v.sz-1){
    ll a = segmx1.query(index+1,n+5);
    mx = max(mx,a-v[i].fi-v[i].se);
    index++;
  }
  cout << mx << endl;
  return 0;
}

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

int top, S[1000];
int pop();
void push(int);

int main()
{
  int a,b;
  top = 0;
  char s[100];
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a-b);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else
      push(atoi(s));
  }

  printf("%d\n",pop());
  return 0;
}

void push(int x){
  S[++top] = x;
}

int pop(){
  top--;
  return S[top+1];
}




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

int main(){
    
    int i,x;
    
    for ( i = 1; i < 100000; i++ ){
        
        cin >> x;
        
        if ( x == 0 ) break;
        
        cout << "Case " << i << ": " << x << endl;
        
    } 
    return 0;
}


Measured memory_bytes: 3000
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
 
long long ai[100000];
int main(){
  long long n;
  long long res=0;
  cin >> n;

  for(long long i=0;i<n;i++){
    cin >> ai[i];
    ai[i]--;
  }
  for(long long i=0;i<n;i++){
    if(ai[ai[i]]==i){
      res++;
    }
  }
  cout <<res/2<<endl;

}


Measured memory_bytes: 1024
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import sys, os
def ac_input(*args):
    return map(int, input().split())

def main():
    ans = []
    N = int(input())
    A = input().split()
    for i in range(N):
        ans.append(0)
    for i in range(N):
        ans[int(A[i])-1] = i+1
    for i in range(N):
        print(str(ans[i]) + " ",end="")
    print("")
if __name__ == "__main__" :
    main()



Measured memory_bytes: 14544
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == [] and n != 1:
        arr.append([n, 1])

    return arr

N = int(input())

d = dict()
for i in range(1, N + 1):
    a = factorization(i)
    for aa in a:
        if aa[0] in d:
            d[aa[0]] += aa[1]
        else:
            d[aa[0]] = aa[1]

res = 1
for dd in d.values():
    res *= dd + 1
    res %= 10 ** 9 + 7

print(res)


Measured memory_bytes: 9320
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N,x;
	cin>>N>>x;
	if(x==1 || x==N*2-1){
		puts("No");
		return 0;
	}
	int ans[300000];
	bool flip=0;
	if(x>N) flip=1,x=2*N-x;
	int M=2*N-1;
	rep(i,M) ans[i]=i+1;
	rotate(ans+x-2,ans+x,ans+N);
	if(flip) rep(i,M) ans[i]=N*2-ans[i];
	puts("Yes");
	rep(i,M) cout<<ans[i]<<endl;

}


Measured memory_bytes: 2304
def aaa(n, lst):
    lst = [x % n for x in lst if x % n != 0]
    lst.append(n)
    return sorted(lst)

N = int(input())
lst = sorted(map(int, input().split()))
while len(lst) > 1:
    lst = aaa(lst[0], lst[1:])

print(lst[0])

Measured memory_bytes: 14480
#include<bits/stdc++.h>
#define r(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main(){
	int d[60],x;
	r(i,0,60)d[i]=9999;
	r(i,0,30)d[i*2]=380*i-380*(i/5);
	r(i,0,55)r(j,0,(55-i)/3)d[j*3+i]=min(d[j*3+i],d[i]+j*550-330*(j/4));
	r(i,0,55)r(j,0,(55-i)/5)d[j*5+i]=min(d[j*5+i],d[i]+j*850-306*(j/3));
	while(cin>>x&&x)cout<<d[x/100]<<endl;
	return 0;
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
	int n;
	cin >> n;
	if (n >= 195) cout << 5 << endl;
	else if (n >= 189) cout << 4 << endl;
	else if (n >= 165) cout << 3 << endl;
	else if (n >= 135) cout << 2 << endl;
	else if (n >= 105) cout << 1 << endl;
	else cout << 0 << endl;

}

Measured memory_bytes: 256
import math


def main():
    N = int(input())
    sqrt = math.ceil(math.sqrt(N))
    ans = 0
    for x in range(1, sqrt):
        if N % x == 0:
            y = N // x - 1
            if N // y == N % y:
                ans += y
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38768
import java.util.*;
//import java.io.*;
import java.util.stream.IntStream;

public class Main{
    static int sum=0;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
        Vector p1 = new Vector(sc.nextInt(), sc.nextInt());
        Vector p2 = new Vector(sc.nextInt(), sc.nextInt());
        int n = sc.nextInt();
        for(int i=0; i<n; i++){
            Vector p = new Vector(sc.nextInt(), sc.nextInt());

            Vector s1 = p.minus(p1);
            // target segment
            Vector s2 = p2.minus(p1);

            Vector ans = p1.plus(s2.project(s1));
            System.out.println(ans.x + " " + ans.y);

        }

    }
}

class Vector{
    public static double EPS = 1e-10;
    public double x,y;

    public Vector(){}
    public Vector(double x, double y){this.x=x;this.y=y;}

    public Vector plus(Vector p){return new Vector(this.x+p.x, this.y+p.y);}
    public Vector minus(Vector p){return new Vector(this.x-p.x, this.y-p.y);}
    public Vector multiple(double a){return new Vector(this.x*a, this.y*a);}
    public Vector divide(double a){return new Vector(this.x/a, this.y/a);}

    public double abs(){return Math.sqrt(this.norm());}
    public double norm(){return x*x+y*y;}

    
    public static double dot(Vector a, Vector b){
        return a.x*b.x+a.y*b.y;
    }

    public static double cross(Vector a, Vector b){
        return a.x*b.y-a.y*b.x;
    }

    public Vector project(Vector point){
        double t = dot(this, point)/this.norm();
        return this.multiple(t);
    }
    
}


Measured memory_bytes: 35196
#include <stdio.h>
#include <stdlib.h>

int up(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(){
  int n;
  scanf("%d", &n);
  int d[n];
  for(int i = 0; i < n; i++){
    scanf("%d", &d[i]);
  }
  qsort(d, n, sizeof(int), up);
  printf("%d\n", d[n / 2] - d[n / 2 - 1]);
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
using namespace std;
 
int main() {
    for(;;){
    int m,f,r;
    cin >> m >>f >>r;
     
    if(m==-1 && f==-1 && r==-1){break;}
    if(m==-1||f==-1){
			cout<<"F"<<endl;
			continue;
		}
    if(m+f>=80){cout<<"A"<<endl;}
    else if(m+f>=65){cout<<"B"<<endl;}
    else if(m+f>=50||r>=50 ){cout<<"C"<<endl;}
    else if(m+f>=30) {cout<<"D"<<endl;}
    else{cout<<"F"<<endl;}
     
    }
    return 0;
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;

  if(d<=a || b<=c) puts("0\n");
	else printf("%d\n",min(b,d)-max(a,c));

	return 0;
}

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

def main(N, lst_X):
    
    min_P1 = sum(lst_X) // N
    sum_sutamina1 = 0
    for X in lst_X:
        sum_sutamina1 += (X - min_P1) ** 2

    min_P2 = min_P1 + 1
    sum_sutamina2 = 0
    for X in lst_X:
        sum_sutamina2 += (X - min_P2) ** 2

    return min(sum_sutamina1, sum_sutamina2)
        
if __name__ == "__main__":

    answer = main(N, lst_X)
    print(answer)


Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

typedef struct point{
  double x;
  double y;
}point;

void kock(int, point, point);

int main()
{
  int n;
  point p1, p2;

  p1.x=0.0;
  p1.y=0.0;
  p2.x=100.0;
  p2.y=0.0;

  scanf("%d", &n);
  printf("%.8f %.8f\n", p1.x, p1.y);
  kock(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y);
  
  return 0;
}

void kock(int n, point p1, point p2)
{
  point s, t, u;
  
  if(n==0) return;
  else
    {
      s.x=(2.0*p1.x+1*p2.x)/3.0;
      s.y=(2.0*p1.y+1*p2.y)/3.0;
      t.x=(1.0*p1.x+2*p2.x)/3.0;
      t.y=(1.0*p1.y+2*p2.y)/3.0;
      u.x=(t.x-s.x)*(1.0/2.0)-(t.y-s.y)*(sqrt(3.0)/2.0)+s.x;
      u.y=(t.x-s.x)*(sqrt(3.0)/2.0)+(t.y-s.y)*(1.0/2.0)+s.y;
      
      kock(n-1, p1, s);
      printf("%.8f %.8f\n", s.x, s.y);
      kock(n-1, s, u);
      printf("%.8f %.8f\n", u.x, u.y);
      kock(n-1, u, t);
      printf("%.8f %.8f\n", t.x, t.y);
      kock(n-1, t, p2);
    }
}

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

int main()
{
    list <int> a;
    int num,tmp;string op;
    cin>>num;
    for(int i=0;i<num;i++) {
        cin >> op;
        if(op=="insert") {cin>>tmp;a.push_front(tmp);}
        if(op=="delete") {cin>>tmp; list<int>::iterator it=find(a.begin(),a.end(),tmp);if(it!=a.end()) a.erase(it);}
        if(op=="deleteFirst")  a.pop_front();
        if(op=="deleteLast") a.pop_back();
    }
    list<int>::iterator i;
    cout<<*a.begin();
    for( i = ++a.begin(); i != a.end(); ++i)
        cout <<" "<< *i ;
    cout <<	endl;
    return 0;
}


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


/********************************************************************/
#define M1 1000000007	//Standard primes used in modulo operations
#define M2 998244353
#define PI 3.1415926536
const int INF = INT_MAX;
#define ll long long
#define pll pair<ll,ll>
#define REP(i, a, b) for(ll i=a;i<b;i++)
#define REPR(i, a, b) for(ll i=b-1;i>=a;i--)
#define forr(i, n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define space ' '
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl

void FAST() {	//FAST Input Output, DONT use both scnaf,printf / cin,cout , Use any ONE system
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll gcd(ll x, ll y) {	//returns gcd of two long long ints
	if (x == 0) return y;
	return gcd(y % x, x);
}

ll powM(ll x, ll y, ll m) {	//returns (a^b)%m ( ^ is exponent )
	ll ans = 1, r = 1;
	x %= m;
	while (r > 0 && r <= y)
	{
		if (r & y)
		{
			ans *= x;
			ans %= m;
		}
		r <<= 1;
		x *= x;
		x %= m;
	}
	return ans;
}

map<long long, long long> factorize(long long n) {	//returns map containing factor and multiplicity, Eg: 60 = {{2,2},{3,1},{5,1}}
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}
/* **********END OF TEMPLATE*********** */

int main() {
	FAST();
	string s;
	cin>>s;
	int l = s.length();
	string s1,s2;
	s1 = "s";
	s2 = "es";
	if(s[l-1]=='s'){
		s.append(s2);
	}
	else{
		s.append(s1);
	}
	cout<<s<<endl;
	}


		


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



int main(){
    int N;
    cin>>N;
    vector<int> data(N);
    int saidai=0;
    for(int i=0;i<N;i++){
        cin>>data[i];
}
    vector<int> num(100000);
    for(int i=0;i<N;i++){
        num[data[i]]++;
    }
 int x=0;
    int count=0;
    if(N==1){
        cout<<1<<endl;
        return 0;
    }
    if(N==2){
        x=data[0];
        if(x==data[1]||x+1==data[1]||x-1==data[1])cout<<2<<endl;
        else cout<<1<<endl;
        return 0;
    }

    for(int i=0;i<N-2;i++){
        count=max(num[i]+num[i+1]+num[i+2],count);
    }

    cout<<count<<endl;

   
    
        
        
    }

    



Measured memory_bytes: 1024
#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
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+2;
string s;
map<string,int>mp;
vector<string>v;
int main()
{
    ft
    int i,j,n,m,l,r,ans=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>s;
        mp[s]++;
        ans=max(ans,mp[s]);
    }
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        int x=it->second;
        if(x==ans)
        {
            v.pb(it->first);
        }
    }
    sort(v.begin(),v.end());
    n=v.size();
    for(i=0;i<n;i++)
    {
        cout<<v[i]<<"\n";
    }
    return 0;
}



Measured memory_bytes: 25584
s = int(input())

A = [s]
m = 2
while True:
  n = A[-1]
  if n % 2 == 0:
    f = n // 2
  else:
    f = n * 3 + 1
  if f in A:
    break
  else:
    A.append(f)
  m += 1

#print(A)
print(m)

Measured memory_bytes: 3060
import sys
from collections import deque


def min_cost_flow(links, links_from, s, t, flow, n2):
    remain = flow
    result = 0
    INF = 10 ** 12
    predecessors = [0] * n2  # link_id

    while remain:
        # print(remain)
        distances = [INF] * n2
        updated = [False] * n2
        distances[s] = 0
        updated[s] = True
        q = deque([s])
        while q:
            v = q.popleft()
            vc = distances[v]
            updated[v] = False

            for li in links_from[v]:
                _, u, cap, cost = links[li]
                if cap == 0:
                    continue
                new_cost = vc + cost
                if new_cost >= distances[u]:
                    continue
                distances[u] = new_cost
                predecessors[u] = li
                if not updated[u]:
                    updated[u] = True
                    q.append(u)

        min_cap = remain
        v = t
        while v != s:
            li = predecessors[v]
            l = links[li]
            min_cap = min(min_cap, l[2])
            v = l[0]
        v = t
        while v != s:
            li = predecessors[v]
            l = links[li]
            l[2] -= min_cap
            links[li ^ 1][2] += min_cap
            v = l[0]
        remain -= min_cap
        result -= min_cap * distances[t]
    return result


n = int(input())
lines = sys.stdin.readlines()
n2 = 2 * n + 6
s, t = 0, 2 * n + 1
k1, k2, k3, k4 = range(n2 - 4, n2)
balls = 0
links_from = [[] for _ in range(n2)]
links = []  # [[src, tgt, capacity, unit_cost], ]


def add_link(s, t, cap, cost):
    i = len(links)
    links.append([s, t, cap, cost])
    links.append([t, s, 0, -cost])
    links_from[s].append(i)
    links_from[t].append(i + 1)


for i in range(n):
    ri = i + 1
    rx, ry, rc = map(int, lines[i].split())
    balls += rc
    add_link(s, ri, rc, 0)
    add_link(ri, k1, rc, rx + ry)
    add_link(ri, k2, rc, -rx + ry)
    add_link(ri, k3, rc, rx - ry)
    add_link(ri, k4, rc, -rx - ry)

for i in range(n, 2 * n):
    bi = i + 1
    bx, by, bc = map(int, lines[i].split())
    add_link(bi, t, bc, 0)
    add_link(k1, bi, bc, -bx - by)
    add_link(k2, bi, bc, bx - by)
    add_link(k3, bi, bc, -bx + by)
    add_link(k4, bi, bc, bx + by)

print(min_cost_flow(links, links_from, s, t, balls, n2))


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

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
}

Measured memory_bytes: 22100
package main
 
import (
	"fmt"
)
 
func main() {
	var D, T, S int
	fmt.Scanf("%d %d %d", &D, &T, &S)
	var time float64
	time = float64(D) / float64(S)
	var c string
	Time := float64(T)
	if time <= Time{
		c = "Yes"
	} else {
		c = "No"
	}
	fmt.Printf("%s\n", c)
}

Measured memory_bytes: 1836
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twol pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int in(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
int r,g,b,n,ans;
int main(){FAST;xRand;
cin>>r>>g>>b>>n;
for(int R=0;R<=3000;R++){
	for(int G=0;G<=3000;G++){
			int B=n-R*r-G*g;
			if(B<0) continue;
			if(B%b==0) ans++;
	}
}
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/






Measured memory_bytes: 256
def Convert(string): 
    li = list(map(int, string.split(" "))) 
    return li 

N = input().split()
L = Convert(input())
Min = L[0]
Sum = 0

for i in L:
    if i <= Min:
        Sum += 1
        Min = i
        

print(Sum)

    
        
        
    


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

int main(){
  int N;
  cin >> N;
  int P[N];
  for (int i = 0; i < N; i++){
    cin >> P[i];
  }
  int m = P[0], cnt = 1;
  for (int i = 1; i < N; i++){
    if (m > P[i]){
      cnt++;
      m = P[i];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 4380