akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

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

    final var K = scanner.nextInt();
    final var S = scanner.next();

    if (S.length() > K) {
      final var sub = S.substring(0, K);
      System.out.println(sub + "...");
    } else {
      System.out.println(S);
    }
  }
}


Measured memory_bytes: 38616
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map> 
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int maxn=1e5+6;
const int mod=1e9+7;
int read(){        
    int s = 0, f = 1;        
    char ch = getchar();        
    while(!isdigit(ch)) {        
        if(ch == '-') f = -1;        
        ch = getchar();        
    }        
    while(isdigit(ch)) {        
        s = s * 10 + ch - '0';        
        ch = getchar();        
    }        
    return s * f;        
}     
int main(){
	int n;
	cin>>n;
	while(n){
		int cnt=n%10;
		if(cnt==7){
			cout<<"Yes"<<endl;
			return 0;
		}
		n/=10;
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 500000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int n;
    cin>>n;
	vector<int>a(n),c(n-1);
	REP(i,n){
		cin>>a[i];
		a[i]--;
	}
	ll sum=0;
	REP(i,n){
		int b;
		IN(b);
		sum+=b;
	}
	REP(i,n-1){
		IN(c[i]);
	}
	REP(i,n-1){
		if(a[i]+1==a[i+1])sum+=c[a[i]];
	}
	OUT(sum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;
 
  int sz;
  vector< Monoid > seg;
 
  const F f;
  const Monoid M1;
 
  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }
 
  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }
 
  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }
 
  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }
 
  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }
};


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin >> n >> k;
  int p[n];
  SegmentTree< int > seg(n, [](int a, int b) { return max(a, b); }, -1);
  SegmentTree< int > seg_min(n, [](int a, int b) { return min(a, b); }, INT_MAX);
  rep(i,n){
    cin >> p[i];
    seg.update(i,p[i]);
    seg_min.update(i,p[i]);
  }
  int st[n];
  rep(i,n) st[i]=0;
  int c=1;
  rep(i,n-1){
    if(p[i]<p[i+1])c++;
    else c=1;
    if(c>=k) st[i-k+2]=1;
    else st[i]=0;
  }
  //  rep(i,n)cout << st[i] << " ";
  //  cout << ""<<endl;
  int ans=1;
  int cc=0;
  rep1(i,n-1) if(st[i]) cc++;
  if(cc>0 && st[0]==0) ans+=1;
  for(int i=0; i+k<n;i++){
    //    cout <<p[i] << " sta " <<   ans << endl;
    if(st[i+1]==1) continue;
    int pmin=seg_min.query(i,i+k);
    //    cout << i << " notoki " << pmin << " " << p[i] << endl;
    if(pmin!=p[i]){
      ans++;
      continue;
    }
    int pre=seg.query(i,i+k);
    //    cout << "when i " << i << "max " << pre << endl;
    if(pre<p[i+k]) continue;
    //    cout <<
    ans++;
  }

  cout << ans << endl;

  
  return 0;
    

}


Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>
#include <deque>

using namespace std;
using PII = pair<int, int>;

vector<int> a, b, d;
deque<int> c;
vector<vector<int>> connect;


void dfs(int node) {
	if (d[node] == -1) {
		d[node] = c.front();
		c.pop_front();

		for (auto x: connect[node]) {
			dfs(x);
		}
	}
}

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

	connect.assign(n, {});
	a.assign(n - 1, -1);
	b.assign(n - 1, -1);
	c.assign(n, -1);
	d.assign(n, -1);

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

		connect[a[i]].emplace_back(b[i]);
		connect[b[i]].emplace_back(a[i]);
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end(), greater<int>());

	dfs(0);

	int score = 0;
	for (int i = 0; i < n - 1; i++) {
		score += min(d[a[i]], d[b[i]]);
	}

	cout << score << endl;
	for (int i = 0; i < n; i++) {
		if (i != 0) {
			cout << " ";
		}
		cout << d[i];
	}
	cout << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int K, X;
  cin >> K >> X;

  int mn = X - (K - 1);
  int mx = X + (K - 1);

  for (int i = mn; i < mx; i++)
  {
    cout << i << " ";
  }
  cout << mx << endl;

  return 0;
}


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

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    string str;
    cin >> str;
    if (str.length()<=n){
        cout << str << "\n";
    } else {
        for (int i=0; i<n; i++){
            cout << str.at(i);
        }
        cout << "...\n";
    }
    return 0;
}


Measured memory_bytes: 3684
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int N;
int a[100];
int dp[100001];
int main() {
	int K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> a[i];
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < N; j++) {
			if (i >= a[j] && !dp[i - a[j]]) dp[i] = 1;
		}
	}
	if (dp[K]) cout << "First" << endl;
	else cout << "Second" << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    Rep (i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N+1, vector<ll>(W+1, 0));
    Rep (i, N) {
        Rep (j, W+1) {
            chmax(dp[i+1][j], dp[i][j]);
            if (j-w[i] >= 0) chmax(dp[i+1][j], dp[i][j-w[i]] + v[i]);
        }
    }

    cout << dp[N][W] << "\n";
}

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

int group( int x )
{
	int g = 0;
	if( x == 4 || x == 6 || x == 9 || x == 11 ) {
		g = 1;
	}
	else if( x == 2 ) {
		g = 2;
	}
	return g;
}

int main()
{
	int x, y;

	cin >> x >> y;

	if( group( x ) == group( y ) ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<n;i++)
using namespace std;
int main() {
    int n; cin >> n;
    rep(q, n) {
        vector<int> a(10);
        rep(j, 10) cin >> a[j];
        bool ok = 1;
        rep(j, a.size() - 1) {
            if (a[j] > a[j + 1]) {
                ok = 0;
                break;
            }
        }
        if (ok) {
            cout << "YES" << endl;
            continue;
        }
        req(bit, 1 << 10) {
            if (bit == 1023) {
                cout << "NO" << endl;
                break;
            }
            vector<int> b, c;int cnt = 0;
            rep(j, 10) {
                if (bit & (1 << j)) {
                    cnt++;
                    b.push_back(a[j]);
                }
                else c.push_back(a[j]);
            }
            bool ch = 1,ok=1;
            rep(j, b.size() - 1) {
                if (b[j] > b[j + 1]) {
                    ch = 0;
                    break;
                }
            }rep(j, c.size() - 1) {
                if (c[j] > c[j + 1]) {
                    ok = 0;
                    break;
                }
            }
            if (ok && ch) {
                cout << "YES"  << endl;
                break;
            }
        }
    }
}


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

const bool DEBUG = false;

int N, D;
vector<vector<double>> X;

void input() {
  cin >> N >> D;
  X = vector<vector<double>>(N, vector<double>(D));
  for (size_t i = 0; i < N; i++)
    for (size_t j = 0; j < D; j++) cin >> X[i][j];
}

int main(int argc, char const *argv[]) {
  input();
  int total = 0;
  for (size_t i = 0; i < N - 1; i++) {
    for (size_t j = i + 1; j < N; j++) {
      double sqdist = 0, dist = 0;
      for (size_t k = 0; k < D; k++) sqdist += pow(X[i][k] - X[j][k], 2);
      dist = sqrt(sqdist);
      if (dist - (int)dist == 0.0) total++;
    }
  }

  cout << total << endl;

  return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  string mae = S.substr(0, N), ushi = S.substr(N, N);

  // 後ろ文字列たちから得られる反転ペアたちを作っておく
  map<pair<string,string>, long long > ma;
  for (int bit = 0; bit < (1<<N); ++bit) {
	string a = "", b = "";
	for (int i = 0; i < N; ++i) {
	  if (bit & (1<<i)) a += ushi[i];
	  else b += ushi[i];
	}
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	auto p = make_pair(a, b);
	++ma[p];
  }

  // 前半文字列から作られるペアが後ろにもあるかどうかを判定する
  long long res = 0;
  for (int bit = 0; bit < (1<<N); ++bit) {
	string a = "", b = "";
	for (int i = 0; i < N; ++i) {
	  if (bit & (1<<i)) a += mae[i];
	  else b += mae[i];
	}
	auto p = make_pair(a, b);
    res += ma[p];
  }

  cout << res << endl;
}


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

using namespace std;

#define MAX_N 50000

int n, m;
int dp[MAX_N + 1];

inline bool isRange(const int k)
{
    return 0 <= k && k <= n;
}

int main()
{
    scanf("%d %d", &n, &m);
    vector<int> c(m);
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &c[i]);
    }

    for (int i = 1; i <= n; i++)
    {
        dp[i] = INT_MAX;
    }

    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (isRange(i + c[j]))
                dp[i + c[j]] = min(dp[i] + 1, dp[i + c[j]]);
        }
    }

    printf("%d\n", dp[n]);

    return 0;
}



Measured memory_bytes: 3396
#include<stdio.h>



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


int lcm( int a ,int b )
{
	return ( a / gcm( a ,b ) ) * b ;
}


int in( int a )
{
	scanf( "%d" ,&a ) ;

	return a ;
}


int main()
{
	int n ;
	scanf( "%d" ,&n ) ;


	int num ;
	scanf( "%d" ,&num ) ;


	while( --n )
	{
		num = lcm( num ,in( 0 ) ) ;
	}


	printf( "%d\n" ,num ) ;


	return 0 ;
}

Measured memory_bytes: 596
<?php
    fscanf(STDIN,"%d %d %d",$a,$b,$c);
    if($a<$b){
        if($b<$c){
            echo $a." ".$b." ".$c;
        }
        else if($c<$b){
            echo $a." ".$c." ".$b;
        }
    }
    else if($b<$c){
        if($a<$c){
            echo $b." ".$a." ".$c;
        }
        else if($c<$a){
                echo $b." ".$c." ".$a;
        }
    }
    else if($c<$a){
        if($a<$b){
            echo $c." ".$a." ".$b;
        }
        else if($b<$a){
            echo $c." ".$b." ".$a;
        }
    }    
?>

Measured memory_bytes: 15204
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,y,ans;
  cin>>n>>m;
  long int a[n],b[n],c[m],d[m];
  for(i=0;i<n;++i){
    cin>>a[i]>>b[i];
  }
  for(i=0;i<m;++i){
    cin>>c[i]>>d[i];
  }
  for(i=0;i<n;++i){
    long min = 400000001;
    for(int j=0;j<m;++j){
      y = (abs(a[i]-c[j])+abs(b[i]-d[j]));
      if(min>y){
        min = y;
        ans = j+1;
      }
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
n=int(input())
now=1
A=[]
while n!=0:
    if n%(now*2)==0:
        A.append(0)
    else:
        A.append(1)
        n-=now
    now*=-2
A=list(reversed(A))
S=""
for a in A:
    S+=str(a)
if len(S)==0:
    print(0)
else:
    print(S)

Measured memory_bytes: 3064
int main() {
	int n,i,j;
	char w[101][11];
	scanf("%d",  &n);
	for (i = 0; i < n; i++) scanf("%s", w[i],11);
	for (i = 0; i < n;i++){		
		if (i >= 1 && w[i][0] != w[i - 1][strlen(w[i - 1]) - 1])
		{
			printf("No");
			return 0;
		}
	}
	for (i = 0; i < n; i++)
		for (j = i + 1; j < n; j++) {
			{
				if (strcmp(w[i], w[j]) == 0) {
					printf("No");
					return 0;
				}
			}
	}
	printf("Yes");
	return 0;
}

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

struct Card {char suit, value; };

void bubble(struct Card A[], int N) {
        for (int i=0; i<N; i++){
        for (int j=N-1; j > i; j--){
        if (A[j-1].value > A[j].value){
        swap(A[j-1],A[j]);
        //?§?????????????????????¨swap ??§????????????????????§
        }
        }}}

void select(struct Card A[], int N) {
        int minj = 0;
        for (int i=0;i<N;i++) {
        minj = i;
        for (int j=i+1; j<N; j++) {
        if (A[j].value < A[minj].value) minj = j;
        }
        swap(A[minj],A[i]);
        }
}

void print(struct Card A[], int N) {
        for (int i=0;i<N;i++) {
        if (i) cout << " ";
        cout << A[i].suit << A[i].value;
        }
        cout << endl;
}

bool isStable(struct Card in[], struct Card out[], int N) {
        for (int i=0;i<N;i++) {
        for (int j=i+1;j<N;j++) {
        for (int a=0;a<N;a++) {
        for (int b=a+1;b<N;b++) {
        if (in[i].value == in[j].value && in[i].value==out[b].value && in[i].suit == out[b].suit &&  in[j].suit==out[a].suit && in[j].value==out[a].value)
        return false;
        }}}}
        return true;
}

int main() {
        struct Card in[37],C1[37],C2[37];
        int N;
        cin >> N;

        for (int i=0;i<N;i++) {
        cin >> in[i].suit >> in[i].value;
        }

        for (int i=0;i<N;i++) {
        C1[i] = in[i];
        C2[i] = in[i];
        }       //copy

        bubble(C1,N);
        select(C2,N);

        print(C1,N);

        if (isStable(in,C1,N)) cout << "Stable" << endl;
        else cout << "Not stable" << endl;

        print(C2,N);


        if (isStable(in,C2,N)) cout << "Stable" << endl;
        else cout << "Not stable" << endl;

        return 0;}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    //IOS;
    //ll t;cin>>t;while(t--)
    {
        ll x,a,b,c,d,i,j,k,l,m,n,sum=0,temp=0,f=0,cnt=0,t;
        cin>>n>>x>>t;
        cout<<((n+x-1)/x)*t<<endl;

    }
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long t = 0;
        long ans = 0;
        if (k % 2 == 0) {
            t = n / k;
            ans += (t * t * t);
            t = ((n*2) / k +1)/2;
            ans += (t * t * t);
        } else {
            t = n / k;
            ans += (t * t * t);
        }

        System.out.println(ans);

    }
}

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

int main()
{
    int r=3,i,j,x,a[10][10];
    for(int i=0; i<r; i++)
    {
        for(int j=0; j<r; j++)
            cin>>a[i][j];
    }
    cin>>r;
    for(i=0; i<r; i++)
    {
        cin>>x;
        for(int i=0; i<r; i++)
        {
            for(int j=0; j<r; j++)
            {
                if(x==a[i][j])
                    a[i][j]=-2;
            }
        }
    }
    if(a[0][1]==-2 && a[0][0]==-2 && a[0][2]==-2)
        cout<<"Yes"<<endl;
    else if(a[1][1]==-2 && a[1][0]==-2 && a[1][2]==-2)
        cout<<"Yes"<<endl;
    else if(a[2][1]==-2 && a[2][0]==-2 && a[2][2]==-2)
        cout<<"Yes"<<endl;

    else if(a[1][0]==-2 && a[0][0]==-2 && a[2][0]==-2)
        cout<<"Yes"<<endl;
    else if(a[1][1]==-2 && a[0][1]==-2 && a[2][1]==-2)
        cout<<"Yes"<<endl;
    else if(a[1][2]==-2 && a[0][2]==-2 && a[2][2]==-2)
        cout<<"Yes"<<endl;
    else if(a[1][1]==-2 && a[0][0]==-2 && a[2][2]==-2)
    {
        cout<<"Yes"<<endl;
    }
    else if(a[1][1]==-2 && a[0][2]==-2 && a[2][0]==-2)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;
string s;

int main(){
    //cin >> ;
    //cout << ans << endl;

    //cin >> ;
    ll X;
    scanf("%lld", &X);
    
    ll money = 100;
    while(1){
        ans++;
        money *= 1.01;
        if(money >= X){
            break;
        }

    }



    //cout << ans << endl;
    std::cout << ans << endl;
    return 0;
}

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

int main()
{
	int n; cin >> n;
	vector<string> c;
	for (int i = 0; i < n; i++) {
		string tmp_s; cin >> tmp_s;
		sort(tmp_s.begin(), tmp_s.end());
		c.push_back(tmp_s);
	}
	sort(c.begin(), c.end());
	
	ll ans = 0;
	for (int i = 0; i < n - 1; ) {
		ll cnt = 1;
		for (int j = i; j < n - 1; j++) {
			if (c[j] == c[j + 1]) cnt++;
			else break;
		}
		ans += cnt * (cnt - 1) / 2;
		i += cnt;
	}

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

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

long long a,b,x;

int main()
{
	scanf("%lld%lld",&a,&b);
	x=__gcd(a,b);
	int ans=1;
	long long bound=sqrt(x);
	for(long long i=2;i<=bound;++i)
	{
		if(x%i==0)++ans;
		while(x%i==0)x/=i;
	}
	if(x!=1)++ans;
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<map>
#include<vector>
#include<stack>
#include <string>
#include<fstream>
#include<ctime>
#include<queue>

using namespace std;
#define LL long long
#define mxn 100010
#define mxe 1000010
#define eps 1e-4
#define inf 0x7fffffff

#include<iostream>
#include<cstdio>
#define INF 999999999;
#include<iostream>
using namespace std;

#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#define MAX 1000000
using namespace std;
int amount[MAX];
int vis[MAX];
int prime[MAX];
int main(){
	memset(vis, 0, sizeof(vis));
	memset(prime, 0, sizeof(prime));
	prime[0] = prime[1] = 0;
	for (int i = 2; i<= MAX; i++){
		if (!vis[i]){
			prime[i] = 1;
			for (int j = i + i; j <= MAX; j += i){
				vis[j] = 1;
				prime[j] = 0;
			}
		}
	}
	int sum = 0;
	for (int i = 0; i <= MAX; i++){
		if (prime[i]){
			sum++;
		}
		amount[i] = sum;
	}
	int n;
	while (cin >> n){
		cout << amount[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 12884
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
ll P[60],C[60];
ll solve(ll lv,ll rem){
   // cout<<lv<<" "<<rem<<endl;
   if(rem<=0) return 0;
    if(lv==1){
        if(rem==1) return 0;
        else if(rem<5) return rem-1;
        else
            return rem-2;
    }
    if(rem==P[lv]){
        return C[lv];
    }
    if(rem==1){
        return 0;
    }
    ll ans=0;
    if(P[lv-1]+1>=rem){
        ans+=solve(lv-1,rem-1);
    }
    else if(P[lv-1]+2>=rem){
        ans+=1+solve(lv-1,rem-2);
    }
    else{
        ans+=C[lv-1]+1+solve(lv-1,rem-(P[lv-1]+2));
    }
   return ans;
}
ll test(int l,int x){
   ll cnt=0;
   string st="BpppB";
   for(int i=0;i<l-1;i++){
    st=("B"+st+"p"+st+"B");
   }
   for(int i=0;i<x;i++){
    if(st[i]=='p') cnt++;
   }
   return cnt;
}
int main(){
    GO();
    P[1]=5;
    C[1]=3;
    for(int i=2;i<=50;i++){
        P[i]=(P[i-1]*2+3);
        C[i]=(C[i-1]*2+1);
    }

    //cout<<C[2]<<" "<<P[2]<<endl;
    ll l,x;
    cin>>l>>x;
    if(l==1){
        if(x==1) cout<<"0\n";
        else if(x<5) cout<<x-1<<endl;
        else
            cout<<x-2<<endl;
        return 0;
    }
   cout<< solve(l,x) <<endl;

   //cout<<test(l,x)<<endl;
}








Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
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<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int T;
int a[1010101];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n;
  cin >> n;
  ld ans = 0;
  for(int i=1;i<=n;i++){
    string s;
    ld u;
    cin >> u >> s;
    if(s=="JPY"){
      ans+=u;
    }
    else {
      ans+=380000.0*u;
    }
  }
  cout << fixed << setprecision(10) << ans << endl;


return 0;
}
///....


Measured memory_bytes: 256
N, K = map(int, input().split())
min_val = 0
max_val = 0
for i in range(K):
    max_val += N - i
    min_val += i
# print(min_val)
# print(max_val)

ans = 0
mod = 10 ** 9 + 7
for i in range(K, N + 2):
    ans += max_val - min_val + 1
    ans %= mod
    min_val += i
    max_val += N - i
print(ans)

Measured memory_bytes: 9192
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int[] cnt = new int[26];
			boolean[] any = new boolean[26];
			Arrays.fill(cnt, Integer.MAX_VALUE);
			for (int i = 0; i < n; i++) {
				char[] s = in.next().toCharArray();
				int[] cur = new int[26];
				for (char ch : s) {
					int c = ch - 'a';
					any[c] = true;
					++cur[c];
				}
				for (int j = 0; j < 26; j++) {
					cnt[j] = Math.min(cnt[j], cur[j]);
				}
			}
			StringBuilder ans = new StringBuilder();
			for (int i = 0; i < 26; i++) {
				if (!any[i]) {
					continue;
				}
				for (int j = 0; j < cnt[i]; j++) {
					ans.append((char) ('a' + i));
				}
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 21460
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        
        int min = 2 * k;
        for (int i = 0; i < n; i++) {
            int tmp = 0;

            // cw
            int l = i - 1;
            if (l < 0) {
                l = n - 1;
                tmp = a[l] - a[i];
            } else {
                tmp = k - a[i] + a[l];
            }
            min = Math.min(min, tmp);

            // ccw
            int r = i + 1;
            if (r >= n) {
                r = 0;
                tmp = a[i] - a[r];
            } else {
                tmp = a[i] + k - a[r];
            }
            min = Math.min(min, tmp);
        }
        
        System.out.println(min);
    }
}

Measured memory_bytes: 67444
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))


int ans = 10000;

void func(int n,int g,int mx,int num,ll sump,int sumn,vector<pair<int,int>>& v,int d) {
    if (n==d) {
        if (sump>=g) {
            ans=min(ans,sumn);
            return;
        }
        if ((g-sump)/(mx+1) +1 < num) {
            ans=min(ans,int(sumn+(g-sump)/(mx+1) +1));
        }
        return;
    }
    func(n+1,g,mx,num,sump+v[n].first*100*(n+1)+v[n].second,sumn+v[n].first,v,d);
    func(n+1,g,100*(n+1),v[n].first,sump,sumn,v,d);
}

int main() {

    ll d,g;cin>>d>>g;
    vector<pair<int,int>> vec(d);

    rep(i,d) {
        pair<int,int> p;
        cin>>p.first>>p.second;
        vec[i]=p;
    }

    func(0,g,0,0,0,0,vec,d);

    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int main()
{
	int n=gi(),i,t=0,x=0,y=0,T,X,Y;
	while (n--) {
		T=gi(),X=gi(),Y=gi();
		if (abs(x-X)+abs(y-Y)>T-t||(abs(x-X)%2+abs(y-Y)%2+abs(t-T)%2)%2==1)
			return puts("No"),0;
		t=T,x=X,y=Y;
	}
	puts("Yes");
	return 0;
}


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

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

    int count = 0;
    string src;
    cin >> src;
    string input;
    while (true) {
        cin >> input;

        if (input == "END_OF_TEXT")
            break;
        transform(input.begin(), input.end(), input.begin(), ::tolower);
        if (input == src)
            count++;

        // cout << input << ", " << count << endl;
    }
    cout << count << endl;
}


Measured memory_bytes: 3244
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef pair<long long, int> P;
int main(void){
    int n;
    long long k;
    vector<int> a, f;
    priority_queue<P> q;
    cin >> n >> k;
    a.assign(n, 0);
    f.assign(n, 0);

    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> f[i];
    }
    sort(a.begin(), a.end());
    sort(f.begin(), f.end(), greater<int>());

    long long ok = 1e18, ng = -1;
    while(ng + 1 < ok){
        long long mid = (ok + ng) / 2;
        long long res = 0;
        for(int i=0;i<n;i++){
            long long v = mid / f[i];
            if(a[i] > v){
                res += a[i] - v;
            }
        }
        if(res <= k)ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


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

const ll mod = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);

    ll ans = 0;
    rep(i, n-1) {
        for(int j = i+1; j < n; j++) {
            if(a.at(i) > a.at(j)) ans++;
        }
    }

    int ansi = 0;
    sort(a.begin(), a.end());
    rep(i,n) {
        int dup = 1;
        while(i < n-1 && a.at(i) == a.at(i+1)) {
            dup++; i++;
        }
        ansi += dup * (n-i-1);
    }
    
    ans *= k;
    ans %= mod;
    ll ansn = ((ll)k * (k-1))/2;
    ansn %= mod;
    ansn *= ansi;
    ansn %= mod;
    ans += ansn;
    ans %= mod;
    cout << ans << endl;

    return 0;
}

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



int main(){
    ll n;cin>>n;
    string s;cin>>s;
    char c[100010];
    int ok=0;
    rep(i,0,4){
        ok=1;
        if(i==0){c[0]='S',c[1]='S';}
        else if(i==1){c[0]='S',c[1]='W';}
        else if(i==2){c[0]='W',c[1]='S';}
        else if(i==3){c[0]='W',c[1]='W';}
        rep(j,1,n-1){
            if(s[j]=='o'){
                if(c[j]=='S'&&c[j-1]=='S')c[j+1]='S';
                else if(c[j]=='W'&&c[j-1]=='S')c[j+1]='W';
                else if(c[j]=='S'&&c[j-1]=='W')c[j+1]='W';
                else if(c[j]=='W'&&c[j-1]=='W')c[j+1]='S';
            }
            else{
                if(c[j]=='S'&&c[j-1]=='S')c[j+1]='W';
                else if(c[j]=='W'&&c[j-1]=='S')c[j+1]='S';
                else if(c[j]=='S'&&c[j-1]=='W')c[j+1]='S';
                else if(c[j]=='W'&&c[j-1]=='W')c[j+1]='W';
            }
        }
        if(s[n-1]=='o'&&c[n-1]=='S'&&c[n-2]!=c[0])ok=0;
        else if(s[n-1]=='o'&&c[n-1]=='W'&&c[n-2]==c[0])ok=0;
        else if(s[n-1]=='x'&&c[n-1]=='S'&&c[n-2]==c[0])ok=0;
        else if(s[n-1]=='x'&&c[n-1]=='W'&&c[n-2]!=c[0])ok=0;
        if(s[0]=='o'&&c[0]=='S'&&c[n-1]!=c[1])ok=0;
        else if(s[0]=='o'&&c[0]=='W'&&c[n-1]==c[1])ok=0;
        else if(s[0]=='x'&&c[0]=='S'&&c[n-1]==c[1])ok=0;
        else if(s[0]=='x'&&c[0]=='W'&&c[n-1]!=c[1])ok=0;
        if(ok){
            rep(i,0,n)cout<<c[i];
            cout<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}
    









Measured memory_bytes: 640
#include <map>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s; int c = 0; map<int, int> m1, m2; vector<pair<int, int> > p;
int main() {
	while(s = "", getline(cin, s)) {
	    if(s == "") c++;
	    else {
	        int t = 0;
	        for(int i = 0; i < s.size(); i++) {
	            if(s[i] == ',') break;
	            else t = t * 10 + s[i] - 48;
	        }
	        if(c == 0) m1[t]++;
	        else m2[t]++;
	    }
	}
	for(map<int, int>::iterator i = m1.begin(); i != m1.end(); i++) {
	    int t = (*i).first;
	    if(m2[t]) p.push_back(make_pair(t, m1[t] + m2[t]));
	}
	sort(p.begin(), p.end());
	for(int i = 0; i < p.size(); i++) {
	    cout << p[i].first << ' ' << p[i].second << endl;
	}
}

Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int x = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int w = stdIn.nextInt();
        //int n = stdIn.nextInt();
        //int k = stdIn.nextInt();
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean heisei = true;
        
        
        if(105 % x == 0 && x != 1){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        
        //System.out.println();
        //System.out.print();
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N;
vector<int>v[100001];
bool used[100001];
bool ans=false;
int dfs(int x){
    used[x]=true;
    int count=0;
    REP(i,v[x].size()){
        if(used[v[x][i]]==false){
           int k=dfs(v[x][i]);
	   count+=k;
        }
    }
    if(count>=2){
       ans=true;
       count =0;
    }
    return 1-count;
}

int main(){
    cin>>N;
    int root=0;
    REP(i,100001){
        used[i]=false;
    }
    REP(i,N-1){
        int a,b;
        cin>>a;
        cin>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    if(N==2){
       cout<<"Second"<<endl;
       return 0;
    }
    REP(i,N){
        if(v[i].size()>1){
           root=i;
           break;
        }
    }
    
    int btk=1-dfs(root);
    if(btk==0){
       cout<<"First"<<endl;
       return 0;
    }
    if(ans==false){
       cout<<"Second"<<endl;
    }else{
       cout<<"First"<<endl;
    }
    return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}

signed main(){
    int a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;
    if(k<=a){
        cout<<k<<endl;
        return 0;
    }
    sum+=a;
    k-=a;
    if(k<=b){
        cout<<sum<<endl;
        return 0;
    }
    k-=b;
    cout<<sum-k<<endl;
    return 0;
}

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

using namespace std;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;

//global
int h;

// func
int del(VVI &table) {
    int score = 0;
    for (int i = 0; i < h; i++) {
        for (int start = 0; start < 3; start++) {
            int diff = 0;
            for (int end = start; end < 4; end++) {
                if (table[i][start] != table[i][end + 1]) {
                    break;
                } 
                diff++;
            }
            if (diff >= 2) {
                score += (diff + 1) * table[i][start];
                for (int j = 0; j <= diff; j++) {
                    table[i][start + j] = 0;
                }
            }
            start += diff;
        }
    }
    return score;
}

void drop(VVI &table) {
    VVI new_table(h, VI(5, 0));
    for (int j = 0; j < 5; j++) {
        int index = h - 1;
        for (int i = h - 1; i >= 0; i--) {
            if (table[i][j] != 0) {
                new_table[index][j] = table[i][j];
                index--;
            }
        }
    }
    table = new_table;
    return;
}

int main(void) {
    while(true) {
        cin >> h;
        if (h == 0) {
            break;
        }
        VVI table(h, VI(5));
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < 5; j++) {
                cin >> table[i][j];
            }
        }
        int score = 0;
        while(true) {
            //delete and score
            int new_score = del(table);
            if (new_score == 0) {
                break;
            } else {
                score += new_score;
            }
            //drop
            drop(table);
        }
        cout << score << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef                 long long ll;
typedef                 unsigned long long ull;
#define mkp             make_pair
#define pii             pair<int,int>
#define piii            pair<pii,int>
#define vi              vector<int>
#define PI              acos(-1)
#define all(v)          v.begin(),v.end()
#define mmset(a,val)    memset(a,val,sizeof(a))
#define sc(a)           scanf("%d",&a)
#define sc2(a,b)        scanf("%d%d",&a,&b)
#define sc3(a,b,c)      scanf("%d%d%d",&a,&b,&c)
#define sc4(a,b,c,d)    scanf("%d%d%d%d",&a,&b,&c,&d)
#define sc5(a,b,c,d,e)  scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)
#define scll(a)         scanf("%I64d",&a)
#define scll2(a,b)      scanf("%I64d%I64d",&a,&b)
#define scll3(a,b,c)    scanf("%lld%lld%lld",&a,&b,&c)
#define scll4(a,b,c,d)  scanf("%I64d%I64d%I64d%I64d",&a,&b,&c,&d)
#define Pr(a)           printf("%d\n",a)
#define Prll(a)         printf("%I64d\n",a)
#define pb(a)           push_back(a)
#define SZ              size()
#define tcs(t)          for(int tc=1;tc<=t;tc++)
#define INF             0x3f3f3f3f
#define hash_val        347
#define popcount        __builtin_popcount
#define MOD             1000000007
#define MX              2005
//int fx[]={-1,-1,0,1,1,1,0,-1};
//int fy[]={0,1,1, 1,0,-1,-1,-1};
int Set(int n,int pos){return n=n|(1<<pos);}
int reset(int n,int pos){return n=n& ~ (1<<pos);}
bool check(int n,int pos){return (bool) (n& (1<<pos));}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);};
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);};
int main()
{
             //       freopen("input.txt","r",stdin);
            //  freopen("output.txt","w",stdout);

        string s;
        cin>>s;
        int len=s.length(),cnt=1;
        for(int i=1;i<len;i++)
        {
            if(s[i]==s[i-1])
                cnt++;
            if(cnt==3)
            {
                printf("Yes\n");
                return 0;
            }
            if(s[i]!=s[i-1])
            {
                cnt=1;
            }
        }
        printf("No\n");


}


Measured memory_bytes: 256
from decimal import Decimal, ROUND_UP
 
l = [int(input()) for _ in range(5)]
if len([x%10 for x in l if x%10 > 0]) > 0:
    min_remainder = 10 - min([x%10 for x in l if x%10 > 0])
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]) - min_remainder)
else:
    print(sum([int(Decimal(x).quantize(Decimal("1E1"), rounding=ROUND_UP)) for x in l]))

Measured memory_bytes: 5024
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 1000000007;
int T[MAXN],A[MAXN];
int N;
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
void Solve() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) read(T[i]);
    for(int i = 1 ; i <= N ; ++i) read(A[i]);
    int ans = 1;
    for(int i = 1 ; i <= N ; ++i) {
	if(T[i] != T[i - 1] || A[i] != A[i + 1]) {
	    int a = -1,b = -1;
	    if(T[i] != T[i - 1]) a = T[i];
	    if(A[i] != A[i + 1]) b = A[i];
	    if(a != -1 && b != -1) {
		if(a != b) {puts("0");return;}
	    }
	    if(b > T[i]) {puts("0");return;}
	    if(a > A[i]) {puts("0");return;}
	}
	else {
	    ans = mul(ans,min(A[i],T[i]));
	}
    }
    out(ans);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    if (N % 2 == 1) {
        puts("No");
        return 0;
    }

    string a, b;
    a = S.substr(0, N / 2);
    b = S.substr(N / 2, N);

    if (a == b) {
        puts("Yes");
    } else {
        puts("No");
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
int mod=1e9+7;
#define input_from_file  freopen("input.txt", "r", stdin);
vector<vector<ll>> dp;
vector<vector<ll>> vec;

ll dfs(ll parent,ll color,ll vertex){
  if(dp[vertex][color]!=-1) return dp[vertex][color];
  dp[vertex][color]=1;
  for(auto x:vec[vertex]){
    if(x!=parent){
      if(color==0) 
        dp[vertex][0]*=(dfs(vertex,0,x)+dfs(vertex,1,x));
      else if(color==1){
        dp[vertex][1]*=dfs(vertex,0,x);
      }
      dp[vertex][color]=dp[vertex][color]%mod;
    }
  }
  return dp[vertex][color]%mod;
}

int main()
{
  //------------ SEE BELOW ARTICLE---------------
 // https://codeforces.com/blog/entry/64250?#comment-484569
  // input_from_file;
  ll n,u,v;cin>>n;
  dp.resize(n+1,vector<ll> (2,-1));
  vec.resize(n+1);
  for(int i=0;i<n-1;i++){
    cin>>u>>v;
    vec[u].pb(v);vec[v].pb(u);
  }
  // cout<<dfs(vec,parent,color);
  cout<<(dfs(-1,0,1)+dfs(-1,1,1))%mod;
  return 0;
}


Measured memory_bytes: 19584
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 55556
#define MOD 1000000007

typedef long long int lli;

//　素数判定
int isPrime(int x) {
	int ok = 1;
	for ( int i = 2; i < x; i++ ) {
		if ( x % i ) continue;
		ok = 0; break;
	}
	return ok;
}

int main(void) {
	int n;
	scanf("%d", &n);

	int ans[56];
	int cnt = 0;
	for (int i = 11; i < MAX; i += 5) {
		if( isPrime(i) ) ans[cnt++] = i;
		if (cnt == n) break;
	}

	rep(i, 0, n) printf("%d ", ans[i]);
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  rep(i,N){
    int a;
    cin >> a;
    A[i] = a;
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int sum=0;
  
  rep(i,N){
    if(i%2 == 0) sum += A[i];
    else sum -= A[i];
  }
  
  cout << sum << endl;
}


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

signed main(){
	int N, K, i;
	char *S = (char *)malloc(sizeof(char) * 101);
	scanf("%s", S);
	for(N = 0; S[N] != '\0'; N++){}
	scanf("%lld", &K);
	for(i = 0; i < N; i++){
		if(S[i] != '1'){
			break;
		}
	}
	if(K - 1 < i){
		printf("1\n");
	}
	else{
		printf("%c\n", S[i]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      string a;
      string b;
      cin >> a >> b;
      int x;
      int y;
      cin >> x >> y;
      string g;
      cin >> g;
      if(a == g)
      {cout << x-1 << " " << y << endl;}
      else{cout << x << " " << y-1 << endl;}
    }

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

using namespace std;

using vi = vector<int>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

int main() {
  IN(N); IN(M);

  vector<bool> red(N, false);
  vi ball(N, 1);
  red[0] = true;
  REP(i, M) {
    IN(x); IN(y);
    if (red[x-1])
      red[y-1] = true;
    --ball[x-1];
    ++ball[y-1];
    if (ball[x-1] == 0 && red[x-1])
      red[x-1] = false;
  }
  int ans = 0;
  REP(i, N)
    if (red[i])
      ++ans;
  OUT(ans);

  return 0;
}


Measured memory_bytes: 640