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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
   ll N; cin >> N;
   REP(i, 3500){
      REP(j, 3500){
         ll numer, denom;
         denom = N * (i + 1) * (j + 1);
         numer = 4 * (i + 1) * (j + 1) - (i + 1 + j + 1) * N;
         if(numer > 0 && denom % numer == 0){
            printf("%lld %lld %lld\n", i + 1, j + 1, denom / numer);
            return 0;
         }
      }
   }
}


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

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(c>=a && c<=b)cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main()
{
    ll n;
    cin>>n;
    ll ar[n][3],dp[n][3];
    for(ll i=0;i<n;i++)
        for(ll j=0;j<3;j++)
            cin>>ar[i][j];
    
    dp[0][0]=ar[0][0];dp[0][1]=ar[0][1];dp[0][2]=ar[0][2];
    for(ll i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+ar[i][0];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+ar[i][1];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+ar[i][2];
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
}

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

int main() {
  int n,d;
  cin >> n >> d;
  int num[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin >> num[i][j];
    }
  }
  
  int count = 0;

  for(int i=0;i<n-1;i++){
    double ans=0;
    for(int j=i+1;j<n;j++){
      int test=0;
      for(int k=0;k<d;k++){
        test += pow((num[i][k]-num[j][k]),2);
      }
      ans = sqrt(test);
      int ans1 = (int)ans;
      if(ans1 == ans){
        count++;
      }
    }
  }
  cout << count << endl;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if (a + b & 1)
        cout << "IMPOSSIBLE";
    else
        cout << (a + b) / 2;
    return 0;
}
    

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

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

    int a, b;
    cin >> a >> b;

    if (a > b) {
        cout << "a > b" << endl;
    } else if (a < b) {
        cout << "a < b" << endl;
    } else {
        cout << "a == b" << endl;
    }

    return 0;
}


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

typedef long long lint;

int main(){
    int N;
    cin >> N;
    lint A[1000];
    lint sum[2]={0,0};
    bool get[2][1000];
    lint max=-10000000001;
    int mi;
    for(int i=0;i<N;i++){
        cin >> A[i];
        get[0][i]=get[1][i]=false;
        if(A[i]>=0){ sum[i%2]+=A[i]; get[i%2][i]=true; }
        if(A[i]>max){ max=A[i]; mi=i; }
    }
    int g=(sum[0]>sum[1]?0:1);
    if(max<0){
        g=mi%2;
        sum[g]=max;
        get[g][mi]=true;
    }

    int ocnt=0, at=0;
    int cnt=0;
    string r="";

    while(at<N){
        if(get[g][at]){
            ocnt++;
            at++;
        }else{
            if(ocnt==0){
                r=r+"1\n";
                cnt++;
                at++;
            }else{
                int xcnt;
                for(xcnt=0;at+xcnt<N && !get[g][at+xcnt];xcnt++);
                if(at+xcnt==N){
                    for(int i=xcnt;i>=1;i--) r=r+to_string(ocnt+i)+"\n";
                    at=N;
                    cnt+=xcnt;
                }else{
                    for(int i=xcnt/2+1;i>=1;i--) r=r+to_string(ocnt+i)+"\n";
                    at+=xcnt;
                    ocnt--;
                    cnt+=xcnt/2+1;
                }
            }
        }
    }

    cout << sum[g] << endl << cnt << endl << r;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
long long int saiki(long long int);
int main(){
  long long int n;
  scanf( "%lld" ,&n );
  printf( "%lld\n" ,saiki(n) );
  return 0;
}


long long int saiki( long long int n ){
  if( n == 1 ){
    return 1;
  }
  return n * saiki( n - 1 );
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
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() {
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b;
}

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

int main()
{
	int X, A;
	scanf("%d", &X);
	scanf("%d", &A);
	if (X < A) 
	{
		printf("0");
	}
	else 
	{
		printf("10");
	}

	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <random>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <complex>
#include <functional>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < int(b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> int(a);)
#define all(v) v.begin(),v.end()
#define trav(x, v) for(auto &x : v)
#define sz(v) int((v).size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long double ld;

const ll inf = 1e18;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, e, t;
	cin >> n >> e >> t;
	vector<ll> dp(n+1,inf), x(n+1);
	rep(i,0,n) cin >> x[i];
	x[n] = e;
	dp[n] = 0;
	int r = n;
	ll mn = inf;
	multiset<ll> ko;
	ko.insert(x[n]);
	rrep(i,0,n){
		while(2*(x[r-1]-x[i])>t){
			mn = min(mn, 2*x[r-1]+dp[r]+x[r]);
			ko.erase(ko.find(dp[r]+x[r]));
			--r;
		}
		dp[i] = min(dp[i], mn-3*x[i]);
		//cerr << dp[i] << ' ';
		dp[i] = min(dp[i], t-x[i]+*ko.begin());
		//cerr << dp[i] << endl;
		ko.insert(x[i]+dp[i]);
	}
	//trav(x, dp) cout << x << endl;
	cout << dp[0]+x[0] << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    int N,a,b,r,x,ans;

    cin >> N;

    if(N>=2){
        a=2;
        b=N;
    }else{
        a=N;
        b=2;
    }
    x=a*b;
    r=a%b;

    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }

    ans=x/b;


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int r, g, b;
	int n;
	scanf("%d %d %d", &r, &g, &b);
	n = r * 100 + g * 10 + b;
	if (n % 4 == 0)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
	long long int n = 0, cw = 0, cr = 0, Cr = 0, ans;
	char c[200010];
	scanf("%lld%s", &n, c);
	for (int i = 0; i < n; i++) if (c[i] == 'R')Cr++;
	if (Cr == n || Cr == 0)ans = 0;
	else {
		for (long long int i = 0; i < Cr; i++)if (c[i] == 'W') cw++;
		for (long long int i = Cr - 1; i < n; i++)if (c[i] == 'R') cr++;
		if (cw < cr)ans = cw;
		else ans = cr;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 1912
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>//cout << fixed << setprecision() <<
#include <set>
#include <map>
using ll = long long;
using namespace std;
vector<vector<int>> v;
vector<int> v2;
queue<int> q;

void monmo(int n){
    int momo;
    for(int i=0;i<v[n].size();i++){
        if(v2[v[n][i]]==0){
            v2[v[n][i]]=n;
            q.push(v[n][i]);
        }
    }
    if(!q.empty()){
        momo=q.front();q.pop();
        monmo(momo);
    }
}

int main(void){
    int n,m;
    int a,b;
    cin>>n>>m;
    v.emplace_back(); //v[0]は無視
    v2.push_back(0);//v2[0]は無視
    for(int i=0;i<n;i++){
        v.emplace_back();
        v2.push_back(0);
    }
    for(int i=0;i<m;i++){
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    
    monmo(1);
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++){
        cout<<v2[i]<<endl;
    }
    
}


Measured memory_bytes: 10104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  string S, T;
  int res=0;
  cin >> S>>T;

  cout << T<<S << endl;
}


Measured memory_bytes: 256
import fractions
import sys

n1 = int(input())
nl1 = [int(i1) for i1 in input().split()]

if n1 == 2:
    print(max(nl1))
    sys.exit()

r1 = 0

nl1.sort()

if n1 >= 3:
    n2 = fractions.gcd(nl1[0], nl1[1]) 
    n2 = max(n2, fractions.gcd(nl1[1], nl1[2]))
    n2 = max(n2, fractions.gcd(nl1[0], nl1[2]))

c1 = 0
for i2 in range(n1):
    if nl1[i2] % n2 != 0:
        c1 += 1
    if c1 >= 2:
        break
    if i2 == (n1 - 1):
        r1 = n2

i3 = n2

while r1 == 0:
    c1 = 0
    for i4 in range(n1):
        if nl1[i4] % i3 != 0:
            c1 += 1
        if c1 >= 2:
            break
        if i4 == (n1 - 1):
            r1 = i3
    i3 -= 1

print(str(r1))

Measured memory_bytes: 16148
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
int n;
int a[55][55];
ll ans;
int main(){
	scanf("%d",&n);
	For(i,1,n){
		long double x;
		scanf("%Lf",&x);
		ll y=(ll)(x*1e9+1e-3);
		int s1=0,s2=0;
		for (;y%2==0;y/=2,++s1);
		for (;y%5==0;y/=5,++s2);
		++a[s1][s2];
	}
	For(i,0,50) For(j,0,30)
		For(k,0,50) For(l,0,30)
			if (i+k>=18&&j+l>=18&&pii(i,j)<=pii(k,l))
				if (i!=k||j!=l) ans+=1ll*a[i][j]*a[k][l];
				else ans+=1ll*a[i][j]*(a[i][j]-1)/2;
	cout<<ans<<endl;
}

Measured memory_bytes: 3820
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

        sc.nextLine();

        String S = sc.nextLine();

        for(int i = 0; i < S.length()-1; i++) {
            if(a == 1)
              break;
            char currentChar = S.charAt(i);
            char nextChar = S.charAt(i+1);
            boolean same = (currentChar == nextChar);
            if(same) {
              a--;
            }
        }

        System.out.println(a);
    }
}

Measured memory_bytes: 28104
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"

  val input: Array[Array[Int]] = Array.ofDim(6, 6000000)
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val a, b, k = sc.nextInt
//  val b = sc.nextInt
//  val a = List.fill(n)(sc.nextInt)
//  val b = List.fill(m)(sc.nextInt)
//  val c = List.fill(n - 1)(sc.nextInt)
//  val list = List.fill(n, m)(sc.nextInt)

  val ans = (1 to 100).filter(i => a % i == 0 && b % i == 0).reverse(k - 1)

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 169028
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ns = sc.next();
    String nt = sc.next();
    char[] sChar = ns.toCharArray();
    char[] tChar = nt.toCharArray();
    Arrays.sort(sChar);
    Arrays.sort(tChar);
    String s = new String(sChar);
    String t_asc = new String(tChar);
    String t = new StringBuilder(t_asc).reverse().toString();
    if (s.compareTo(t) < 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35632
#include<iostream>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	int sum=0;
	int a;
	for (int i = 0; i <= m - 1; i++) {
		cin >> a;
		sum += a;
	}
	if (sum > n) {
		cout << -1 << endl;
	}
	else {
		cout << (n - sum) << endl;
	}
}

Measured memory_bytes: 3636
#include <stdio.h>


int main(){
	char  c[8][8];
	int i,j;
	int b,b2;
	char ans,p;
	while(1){
		for(i=0; i<8; i++){
			for(j=0; j<8; j++){
				b=scanf("%c",&c[j][i]);
			}
			if(b==EOF)break;
			scanf("%c",&p);
		}
		scanf("%c",&p);
		for(i=0; i<8; i++){
			for(j=0; j<8; j++){
				if(c[i][j]=='1')c[i][j]=1;
				else c[i][j]=0;
			}
		}
		if(b==EOF)break;
		b2=1;
		for(i=0; i<8; i++){
			for(j=0; j<8; j++){
				if(c[j][i]&&i<7&&j<7){
					if(c[j+1][i]&&c[j][i+1]&&c[j+1][i+1]){
						ans='A';
						b2=0;
						break;
					}
				}
				if(c[j][i]&&i<5){
					if(c[j][i+1]&&c[j][i+2]&&c[j][i+3]){
						ans='B';
						b2=0;
						break;
					}
				}
				if(c[j][i]&&j<5){
					if(c[j+1][i]&&c[j+2][i]&&c[j+3][i]){
						ans='C';
						b2=0;
						break;
					}
				}
				if(c[j][i]&&j>0&&i<6){
					if(c[j-1][i+1]&&c[j][i+1]&&c[j-1][i+2]){
						ans='D';
						b2=0;
						break;
					}
				}
				if(c[j][i]&&j<6&&i<7){
					if(c[j+1][i]&&c[j+1][i+1]&&c[j+2][i+1]){
						ans='E';
						b2=0;
						break;
					}
				}
				if(c[j][i]&&j<7&&i<6){
					if(c[j][i+1]&&c[j+1][i+1]&&c[j+1][i+2]){
						ans='F';
						b2=0;
						break;
					}
				}
			}
			if(!b2)break;
		}
		if(b2)ans='G';
		printf("%c\n",ans);
	}


	return 0;
}

Measured memory_bytes: 540
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    int n, k;
    std::cin >> n >> k;

    std::vector<int> p(n);
    for (auto &pp : p) {
        std::cin >> pp;
    }

    std::sort(std::begin(p), std::end(p));

    int price = 0;
    for (std::size_t i = 0; i < k; ++i) {
        price += p[i];
    }
    std::cout << price << std::endl;
}

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

int	digit(int n)
{
	int	d = 1;
	while (n /= 10) 
		++d;
	return d;
}

int	power10(int	d)
{
	int	p = 1;
	for (int i = 0; i < d; ++i)
		p *= 10;
	return p;
}

int	main()
{
	int	N;
	cin >> N;
	int	d = digit(N);
	int	cnt = 0;
	for (int i = 0; i < d - 1; i += 2)
		cnt += power10(i + 1) - power10(i);
	if (d % 2)
		cnt += N - power10(d - 1) + 1;
	cout << cnt << endl;
}


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

#define ll long long
#define ull unsigned long long
#define prINT pair<int, int>

//const int N = 1e3 +5;

void Mo35(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

int main(){
Mo35();

    string s ,t; cin>> s>> t;
    int c = 0, sz = s.size();
    for(int i=0; i<sz; ++i) if(s[i] != t[i]) c++;
    cout<< c;

return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define int long long
constexpr int MOD = 1000000000 + 7;
constexpr int MAX_RC = 1000000 + 10;
constexpr int modpow(int a, int n)
{
    int rtn = 1;
    while (n > 0)
    {
        if (n & 1)
            rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}
vector<int> fact, rev_fact;
void setFact(int n)
{
    fact.resize(n);
    rev_fact.resize(n);
    fact[0] = 1;
    for (int i = 1; i < n; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= MOD;
    }
    rev_fact[n - 1] = modpow(fact[n - 1], MOD - 2);
    for (int i = n - 2; i >= 0; i--)
    {
        rev_fact[i] = rev_fact[i + 1] * (i + 1);
        rev_fact[i] %= MOD;
    }
}
int getCombination(int a, int b)
{
    return (((fact[a] * rev_fact[b]) % MOD) * rev_fact[a - b]) % MOD;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    setFact(MAX_RC * 2);

    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    // 解説AC
    // パスカルの三角形
    int c22 = getCombination(r2 + c2 + 2, c2 + 1) - 1;
    int c21 = getCombination(r2 + c1 - 1 + 2, c1 - 1 + 1) - 1;
    int c12 = getCombination(r1 - 1 + c2 + 2, c2 + 1) - 1;
    int c11 = getCombination(r1 - 1 + c1 - 1 + 2, c1 - 1 + 1) - 1;

    int ans = c22 + c11 - c12 - c21;
    cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 31488
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    T.pop_back();
    if (S == T) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  if ( n <= 81 && n % 9 == 0){
    cout << "Yes" << endl;
  }
  else if ( n <= 64 && n % 8 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 49 && n % 7 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 36 && n % 6 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 25 && n % 5 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 16 && n % 4 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 9 && n % 3 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 4 && n % 2 == 0){
    cout << "Yes" << endl;
    return 0;
  } else if ( n <= 1 && n % 1 == 0){
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
    return 0;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

const int mx = 305;
double dp[mx][mx][mx];
double p[mx][mx][mx];

int main() {
	int n; scanf ("%d", &n);
	vector < int > A (n);
	for (int & x : A) scanf ("%d", & x);
	vector < int > count (4);
	for (int x : A) {
		count[x]++;
	}
	// cout << count[1] << " " << count[2] << " " << count[3] << endl;
	p[count[1]][count[2]][count[3]] = 1.0;
	for (int c = n; c >= 0; c--) {
		for (int b = n; b >= 0; b--) {
			for (int a = n; a >= 0; a--) {
				if (a == 0 && b == 0 && c == 0) continue;
				if (a + b + c > n) continue;
				
				double p_waste = (double) (n - (a + b + c)) / n;
				double expected_waste = p_waste / (1.0 - p_waste);
				dp[a][b][c] += p[a][b][c] * expected_waste;
				
				if (a != 0) {
					double pa = (double) a / (a + b + c);
					p[a - 1][b][c] += pa * p[a][b][c];
					dp[a - 1][b][c] += pa * (p[a][b][c] + dp[a][b][c]);
				}
				if (b != 0) {
					double pb = (double) b / (a + b + c);
					p[a + 1][b - 1][c] += pb * p[a][b][c];
					dp[a + 1][b - 1][c] += pb * (p[a][b][c] + dp[a][b][c]);
				}
				if (c != 0) {
					double pc = (double) c / (a + b + c);
					p[a][b + 1][c - 1] += pc * p[a][b][c];
					dp[a][b + 1][c - 1] += pc * (p[a][b][c] + dp[a][b][c]);
				}
			}
		}
	}
	// cout << p[0][0][0] << endl;
	printf ("%.10lf\n", dp[0][0][0]);
	return 0;
}



Measured memory_bytes: 438528
#include<iostream>

using namespace std;
int main()
{
   int n=0,a=0,b=0;
   cin>>n>>a>>b;
   if(n*a<b)
   cout<<n*a<<endl;
   else if(n*a>b)
   cout<<b<<endl;
   else
   {
       cout<<n*a<<endl;
   }
   return 0;
   
}

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

using namespace std;
#ifdef LOCAL
#include "../debug_prettyprint.hpp"
#else
#define debug(...) 42
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#endif
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<<fixed<<setprecision(12);
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
//endregion


const int MAXN=2e5+5;
const int INF = 1<<30;

struct seg {
    int from, to;
    int dist;

    friend ostream &operator<<(ostream &os, const seg &seg) {
        os<<"["<<seg.from<<", "<<seg.to<<", "<<seg.dist<<"]";
        return os;
    }
};

int main() {
    FASTIO

    int H,W; cin>>H>>W;

    map<int,seg> mp;
    multiset<int> dist;

    RNG(i,1,W) {
        mp[i] = {i, i, 0};
        dist.insert(0);
    }
    mp[INF] = {W+1, W+1, INF};
    dist.insert(INF);

    FOR(i,H) {
        int l,r; cin>>l>>r;

        auto lb = mp.lower_bound(l);
        int fx = lb->second.from;
        int tx = -1;
        for(auto it = lb; it != mp.upper_bound(r+1); ) {
            tx = it->second.to;
            dist.erase(dist.find(it->second.dist));
            debug("erase", it->second.from, it->second.to);
            it = mp.erase(it);
        }
        if(r+1<=W && tx>=0) {
            mp[r+1].from = fx;
            mp[r+1].to = tx;
            mp[r+1].dist = r+1-tx;
            dist.insert(r+1-tx);
            debug("update", fx, tx, r+1-tx, mp[r+1]);
        }

        debug("update", mp);
        debug("");

        int ans = *dist.begin()+i+1;
        cout<<(ans>=INF ? -1 : ans)<<endl;
    }
}

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

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n;
    cin >> n;
    vector<i64> a(n);
    for (auto& e : a) cin >> e;
    sort(begin(a), end(a));
    vector<p64> ans;
    i64 b = lower_bound(begin(a), end(a), 0l) - begin(a);
    if (b == 0) b++;
    if (b == n) b--;
    for (i64 i = b; i < n - 1; i++) {
        ans.emplace_back(a[0], a[i]);
        a[0] -= a[i];
    }
    for (i64 i = 0; i < b; i++) {
        ans.emplace_back(a[n - 1], a[i]);
        a[n - 1] -= a[i];
    }
    cout << a[n - 1] << endl;
    for (auto& e : ans) cout << e.first << " " << e.second << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 4336
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();

        String[] formula = line.split(" ");
        if (formula[1].equals("+")) {
            System.out.println(new BigDecimal(formula[0]).add(new BigDecimal(formula[2])));
        }

        if (formula[1].equals("-")) {
            System.out.println(new BigDecimal(formula[0]).subtract(new BigDecimal(formula[2])));
        }


    }
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k;
	cin >> k;
	int even = 0, odd = 0;
	for(int i = 1; i <= k; ++i){
		if(i%2 == 0) ++even;
		else ++odd;
	}
	int ans = even * odd;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
  ll N;
  cin>>N;
  ll X=0;
  ll digit = 0;
  for(ll i=1; i<=sqrt(N); ++i){
  if(N%i==0)
   X=N/i;}
    while(X!=0){
    X=X/10;
    ++digit;}
    cout<<digit<<endl;
}
  


Measured memory_bytes: 256
n,a,b,c,d = gets.split(" ").map { |v|
	v.to_i
}

n = n - 1
dif = b-a

for p in 0 .. n do
	difmax= d * p - c * (n-p)
	difmin= c * p - d * (n-p)
	if difmin <= dif and dif <= difmax then
		puts "YES"
		exit
	end
end

puts "NO"

Measured memory_bytes: 1788
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

struct UnionFind {
  vector<int> data;  // size defined only for root node
  int count;

  UnionFind(int size) : data(size, -1), count(size){ }

  bool merge(int x, int y) {
    x=root(x); y=root(y);
    if (x!=y) {
      if (data[y]<data[x]) swap(x, y);
      data[x]+=data[y]; data[y]=x;
      count--;
    }
    return x != y;
  }
  int root(int x) {
    return (data[x]<0 ? x : data[x]=root(data[x]));
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int solve(){
  int h,w;cin>>h>>w;
  vector<vector<int>> B(h, vector<int>(w, 0));
  rep(i, h){
    string s;cin>>s;
    rep(j,w){
      if (s[j]=='#') B[i][j] = 1;
    }
  }
  vector<UnionFind> X(h, UnionFind(w));
  vector<UnionFind> Y(w, UnionFind(h));

  rep(i, h){
    rep(j, 1, w){
      if (B[i][j-1]==0 and B[i][j]==0) X[i].merge(j-1, j);
    }
  }
  rep(j, w){
    rep(i, 1, h){
      if (B[i-1][j]==0 and B[i][j]==0) Y[j].merge(i-1, i);
    }
  }
  // dump(X[0].size(1));
  // dump(X[0].size(2));
  // dump(X[0].size(4));
  // dump(X[1].size(0));
  // dump(X[1].size(1));
  // dump(Y[1].size(1));

  int ans = 0;
  rep(i, h)rep(j, w){
    if (B[i][j]==1) continue;
    int s = 0;
    s += X[i].size(j);
    s += Y[j].size(i);
    s--;
    chmax(ans, s);
  }
  cout << ans << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 94336
#include <stdio.h>
#include <string.h>
 
int main(void){
    
    long long a,b,x,y;
    scanf("%lld%lld",&a,&b);
    
    for (long long i=1;i<=100100;i++){
        x = i*0.08;
        y = i*0.1;
        if (x == a && y == b){
            printf("%lld",i);
            return 0;
        }
    }
    printf("-1");
}

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

#define int long long int
#define mp make_pair
#define mod 1000000007
using namespace std;

const int N = 22;
int n;
vector <int> v[23];
int dp[23][1 << N];

int fun(int pos , int mask)
{
    if(pos == n){
        return ((mask + 1) == (1 << n));
    }
    int &ans = dp[pos][mask];
    if(ans != -1){
        return ans;
    }
    ans = 0;
    for (int i = 0; i < n; ++i) {
        if((mask >> i)&1){
            continue;
        }
        if(v[pos][i] != 0){
            ans += fun(pos + 1 , mask|(1<<i));
        }
    }
    ans %= mod;
    return ans;
}

int32_t main() {
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int x;
            scanf("%lld", &x);
            v[i].push_back(x);
        }
    }
    for (int i = 0; i < 23; ++i) {
        for (int j = 0; j < (1 << N); ++j) {
            dp[i][j] = -1;
        }
    }
    int ans = fun(0 , 0);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 753920
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    //  cout << x << " ";
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
        int a, b;
        cin >> a >> b;
        for (int i = 1; i <= 3;i++){
            if(i!=a&&i!=b){
                cout << i << endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define INF (int)1e9+1
#define INFLL (int)1e18+1
#define sz(bb) (int)bb.size()
#define all(qq) qq.begin(), qq.end() 
#define Max(a, b, c) max(a, max(b, c))
#define Min(a, b, c) min(a, min(b, c))
const double PI=acos(-1);
// #define int unsigned long long int//used when x<=2^64-1 && x>0
#define int long long//used when x<=2^63-1
//bool cmp if returns true it keeps 1st as first else swaps
typedef long long  ll;


void solve()
{
    int n, m, k;
    cin>>n>>m>>k;
    int arr[n+1], brr[m+1];
    arr[0]=0;
    brr[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        arr[i]+=arr[i-1];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>brr[i];
        brr[i]+=brr[i-1];
    }
    int ans=0;
    for(int i=0;i<=n;i++)
    {
        if(arr[i]>k)
            break;
        int cur=i;
        int l=0, r=m, mid;
        int left=k-arr[i];
        int lol=0;
        while(l<=r)
        {
            mid=(l+r)/2;
            if(brr[mid]<=left)
            {
                lol=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        cur+=lol;
        ans=max(ans, cur);
    }
    cout<<ans<<"\n";
}
int32_t main()
{
    IOS;
    int t;
    // cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6704
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

typedef long long i64;

vector<int> onLeft, onRight;
vector<bool> onReverse;

int current = 0;

void build(int64_t n) {
    if (n == 1) {
        onRight.push_back(++current);
        onReverse.push_back(false);
        onLeft.push_back(current);
    } else if (n & 1) {
        build(n / 2);
        onLeft.push_back(++current);
        onRight.push_back(current);
        onReverse.push_back(false);
    } else {
        build(n - 1);
        onRight.push_back(++current);
        onReverse.push_back(true);
    }
}

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int64_t n;
    cin >> n;
    build(n);
    vector<int> fans = onLeft;
    fans.insert(fans.end(), onRight.begin(), onRight.end());
    for (int i = SZ(onRight) - 1; i >= 0; --i) {
        if (onReverse[i]) {
            fans.push_back(onRight[i]);
        }
    }
    cout << SZ(fans) << '\n';
    for (int x: fans) {
        cout << x << ' ';
    }
    cout << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1e9+7;
int main(){

ll n;
cin>>n;

ll a,b,c,x=0,y=0,z=0,p=0,q=0,r=0;

for(int i=0;i<n;i++){
	cin>>a>>b>>c;
	
	
	////////////////////////
		p=a+max(z,y);
		q=b+max(x,z);
		r=c+max(x,y);
	///////////////////////	
		x=p;
		y=q;
		z=r;
	//////////////////////
	
}
cout<<max({p,q,r});

return 0;



}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline().strip

def num753(num, keta):
    if len(num) >= keta:
        yield num
    else:
        for n in ('3', '5', '7'):
            tmp = num + n
            # gen = num753(tmp, keta)
            for nu in num753(tmp, keta):
                yield nu

N = input()
ans = 0
for i in range(3, len(N)+1):
    for num in num753('', i):
        if '3' in num and '5' in num and '7' in num:
            if int(num) <= int(N):
                ans += 1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){

	int L,N,x[30],w[30];
	scanf("%d %d",&L,&N);

	int i,weight=0;
	for(i=0;i<N;i++){
		scanf("%d %d",&x[i],&w[i]);
		weight+=x[i]*w[i];
	}

	if(weight>0){
		printf("1\n");
		printf("-1 %d",weight);
	}
	if(weight==0){
		printf("1\n");
		printf("0 1");
	}
	if(weight<0){
		printf("1\n");
		printf("1 %d",weight*-1);
	}
}

Measured memory_bytes: 2672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e3 + 10;

int N;
char s[MAX], t[MAX];

int main() {
#ifdef ACM_LOCAL
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif
    scanf("%d%s", &N, s + 1);
    int len = strlen(s + 1);
    if (len <= N) printf("%s\n", s + 1);
    else {
        strncpy(t + 1, s + 1, N);
        printf("%s%s\n", t + 1, "...");
    }



    return 0;
}


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

#define ll long long
#define pll pair<ll,ll> 

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


	ll n;
	cin>>n;
	ll A[n];
	ll ans=0;
	for(ll i=0;i<n;i++){
		cin>>A[i];
	}
	
	sort(A,A+n);
	ans+=A[n-1];
	ll x=n-2;
	for(ll i=n-3;i>=0;i--){
		ans+=A[x];
		i--;
		if(i>=0)
			ans+=A[x];
		x--;
	}

	cout<<ans<<endl;
}



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

typedef long long ll;
#define maxi 9999999
void go();



int main() {
    //freopen("input.txt","r",stdin);
    go();
    string s,t;
    cin >> s >> t;
    //cout << s << endl;
    //cout << t << endl;
    int i,j,ans=100000;
    for(i=0; i<=s.size()-t.size(); i++) {
        int dif=0;
        for(j=0; j<t.size(); j++) {
            if(t[j]!=s[j+i]) dif++;
        }
        ans=min(ans,dif);
    }
    cout << ans << endl;
}



void go() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

Measured memory_bytes: 3636
const main = stdin => {
  const S = stdin.trim()

  let max = ''
  let tmp = ''
  for (let i = 0; i < S.length; i++) {
    if (!(S[i] === 'A' || S[i] === 'C' || S[i] === 'G' || S[i] === 'T')) {
      if (tmp.length > max.length) {
        max = tmp
      }
      tmp = ''
      continue
    }
    tmp += S[i]
  }
  if (tmp.length > max.length) {
    max = tmp
  }

  console.log(max.length);
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


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

typedef long long LL;
#define int LL
const int N = 128,BAIS = 64;
vector<int> num[N],ask[N];
int bit[N];

void mdf(int pos) {pos += BAIS;for(int i = pos ; i < N ; i += i&-i) bit[i] += 1;}
int qry(int pos) {pos += BAIS;int ans = 0;for(int i = pos ; i ; i -= i&-i) ans += bit[i];return ans;}

void work(string &s) {
    int x = 0,y = 0,flag = 0;
    for(auto v : s) {
        if(v != '.') x = x*10+v-'0';
        else flag = 1;
        if(flag && v != '.') ++y;
    }
//cerr<<x<<' '<<y<<endl;
    int a = y , b = y;
    while(x % 2 == 0) {
        x /= 2;
        --a;
    }
    while(x % 5 == 0) {
        x /= 5;
        --b;
    }
    if(a <= 0) ask[-a].push_back(-b);
    else num[a].push_back(-b);
}

void solve() {
    string s;
    int n;
    cin >> n;
    for(int i = 1 ; i <= n ; ++i) {
        cin >> s;
        work(s);
    }
    LL tot = 0;
    int sum = 0;
    for(int i = 0 ; i < 32 ; ++i) {
        for(auto v : num[i]) {
            mdf(v);
            ++sum;
        }
        for(auto v : ask[i]) {
            tot += sum - qry(-v-1);
            mdf(v);
            ++sum;
        }
    }
    cout << tot << endl;
}

signed main() {
    ios::sync_with_stdio(0);
    int t = 1;
    //cin >> t;
    while(t--) solve();
    return 0;
}

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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>
#define endl "\n"

const ll INF = 1e18L+5;

/*
const int max_size = 100001;
int parent[max_size];
int Size[max_size];

int root(int x){
	while(x!=parent[x]){
		parent[x] = parent[parent[x]];
		x = parent[x];
	}
	return x;
}

void sunion(int x,int y){
	int rx = root(x);
	int ry = root(y);
	if(rx != ry){
		if(Size[rx] > Size[ry]){
			parent[ry] = parent[rx];
			Size[rx] += Size[ry];
		}
		else{
			parent[rx] = parent[ry];
			Size[ry] += Size[rx];
		}
	}
}
*/

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--){
		int n,W;
		cin >> n >> W;
		int w[n];
		ll v[n];
		int sum_value=0;
		for(int i=0;i<n;i++){
			cin >> w[i] >> v[i];
			sum_value += v[i];
		}
		vll dp(sum_value+1,INF);
		dp[0] = 0ll;
		for(int i=0;i<n;i++){
			for(int j=sum_value-v[i];j>=0;j--){
				dp[j+v[i]] = min(dp[j+v[i]],dp[j]+w[i]);
			}
		}
		int ans=0;
		for(int i=0;i<=sum_value;i++){
			if(dp[i] <= W) ans = max(ans,i);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
// Crt. 2019-11-04  19:01:50
#include <algorithm>
#include <iostream>
#include <cstdio>
#define N 3100
using namespace std;
const int Mod = 1e9 + 7;

inline void inc(int &x, int y) {
    x += y, x -= x >= Mod ? Mod : 0;
}

int n, m, r[N], sum[N], f[N][N];
char s[N];

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n >> m;
    scanf("%s", s + 1);
    for (int i = 1; i <= n + 1; ++i)
        sum[i] = sum[i - 1] + (s[i] == '1'), r[i] = i;

    for (int i = 1, l, x; i <= m; ++i) {
        scanf("%d%d", &l, &x);
        r[l] = max(r[l], x);
    }

    for (int i = 1; i <= n + 1; ++i)
        r[i] = max(r[i], r[i - 1]);

    f[0][0] = 1;
    for (int i = 0; i <= n; ++i)
        for (int j = 0; j <= n; ++j) {
            if (!f[i][j]) continue;
            int r1 = r[i], r2 = r[i + 1];
            if (j) inc(f[i + 1][sum[r2] - sum[r1] + j - 1], f[i][j]);
            if (r[i] - (i - 1) - j) inc(f[i + 1][sum[r2] - sum[r1] + j], f[i][j]);
        }

    cout << f[n + 1][0] << endl;

    return 0;
}


Measured memory_bytes: 35712
#include<stdio.h>
#include<string.h>

char n[102];
int k,l,dp[101][4],bd[101][4];

int max(int a,int b){return a>b?a:b;}

int main(){
  scanf("%s%d",n+1,&k);
  l=strlen(n+1);
  dp[1][1]=n[1]-'1';
  bd[1][1]=1;
  for(int i=2;i<=l;i++){
    if(n[i]=='0'){
      bd[i][1]=bd[i-1][1];
      bd[i][2]=bd[i-1][2];
      bd[i][3]=bd[i-1][3];
    }
    else{
      bd[i][2]=bd[i-1][1];
      bd[i][3]=bd[i-1][2];
      dp[i][1]=bd[i-1][1];
      dp[i][2]=bd[i-1][2];
      dp[i][3]=bd[i-1][3];
    }
    dp[i][1]+=dp[i-1][1]+9;
    dp[i][2]+=dp[i-1][2]+dp[i-1][1]*9+bd[i-1][1]*max(n[i]-'1',0);
    dp[i][3]+=dp[i-1][3]+dp[i-1][2]*9+bd[i-1][2]*max(n[i]-'1',0);
  }
  printf("%d",dp[l][k]+bd[l][k]);
  return 0;
}

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

#define x first
#define y second
#define pb push_back
#define Set(i, v) memset(i, v, sizeof i)
#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

typedef long long LL;

using namespace std;

const int N = 110;

int A[N], B[N], n;

int main(){

	scanf("%d", &n);
	For(i, 1, n) scanf("%d", &A[i]), A[i] += A[i - 1];
	For(i, 1, n) scanf("%d", &B[i]);
	Forr(i, n, 1) B[i] += B[i + 1];

	int ans = 0;
	For(i, 1, n) ans = max(ans, A[i] + B[i]);
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,m;cin>>n>>m;
    ll cnt,ans=0;
    for(ll i=1;i*i<=m;i++){
        if(m%i)continue;
        cnt = m/i;
        if(cnt>=n)ans=max(ans,i);
        cnt = i;
        if(cnt>=n)ans=max(ans,m/i);
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	int N, M;
	cin >> N >> M;
	vector<long long> H(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i];
	}

	vector<vector<int>> vec;
	vec.resize(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		vec[a - 1].push_back(b - 1);
		vec[b - 1].push_back(a - 1);
	}

	int bestPeaks = 0;

	for (int i = 0; i < vec.size(); ++i) {
		int count = 0;
		for (int j = 0; j < vec[i].size(); ++j) {
			if (H[i] <= H[vec[i][j]]) {
				++count;
				break;
			}
		}
		if (count == 0) {
			bestPeaks++;
		}
	}

	cout << bestPeaks << endl;
	return 0;
}




Measured memory_bytes: 9052
ABC = list(map(int, input().split()))
count_5 = 0
count_7 = 0

for i in range(3):
	if ABC[i] == 5:
		count_5 += 1
	elif ABC[i] == 7:
		count_7 += 1

if (count_5 == 2) & (count_7 == 1):
	print("YES")
else:
	print("NO")

Measured memory_bytes: 38256
from collections import deque
import sys

INFTY=sys.maxsize
WHITE=0
GRAY=1
BLACK=2

color=[]
d=[]
Q=deque([])
n=0
L=[]

def readinput():
    global n
    global L

    n=int(input())
    for i in range(n+1):
        L.append([])

    for i in range(n):
        inp=list(map(int,input().split()))
        L[inp[0]]=inp[2:]


def bfs(s):
    global color
    global d
    global Q

    for i in range(n+1):
        color=[WHITE]*(n+1)
        d=[-1]*(n+1)

    color[s]=GRAY
    d[s]=0
    Q.append(s)

    while(len(Q)>0):
        u = Q.popleft()
        for l in L[u]:
            if(color[l]==WHITE):
                color[l]=GRAY
                d[l]=d[u]+1
                Q.append(l)
        color[u]=BLACK

if __name__=='__main__':
    readinput()
    bfs(1)
    for i in range(1,n+1):
        print('{} {}'.format(i, d[i]))



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

using namespace std;

void a()
{
   int X, t;
    cin >> X >> t;
    if(X <= t)
    {
        cout << 0 << endl;
    }else{

        cout << X - t << endl;
    }
}

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

int main() {
    b();
    return 0;
}


Measured memory_bytes: 512